From 7892f995e56081a9482cff5cccddddc57d031642 Mon Sep 17 00:00:00 2001 From: amrit Date: Fri, 12 Jun 2026 14:43:39 +0545 Subject: [PATCH] feat(our-work): add our work page with table, form and link preview feat(our-work): add our work page with table, form and link preview --- app/Root/config/routes.ts | 17 +- app/components/EmbedPreview/index.tsx | 54 +++ app/components/EmbedPreview/styles.module.css | 13 + app/components/StatusCell/index.tsx | 23 ++ app/index.css | 17 + app/utils/common.ts | 24 ++ app/views/OurWorks/WorksForm/index.tsx | 327 ++++++++++++++++++ .../OurWorks/WorksList/WorksFilter/index.tsx | 67 ++++ app/views/OurWorks/WorksList/index.tsx | 194 +++++++++++ app/views/OurWorks/index.tsx | 9 - app/views/OurWorks/query.ts | 98 ++++++ app/views/Users/UserForm/index.tsx | 2 +- .../Users/UsersList/UserListFilters/index.tsx | 17 +- app/views/Users/UsersList/index.tsx | 32 +- app/views/Users/UsersList/styles.module.css | 16 - 15 files changed, 852 insertions(+), 58 deletions(-) create mode 100644 app/components/EmbedPreview/index.tsx create mode 100644 app/components/EmbedPreview/styles.module.css create mode 100644 app/components/StatusCell/index.tsx create mode 100644 app/views/OurWorks/WorksForm/index.tsx create mode 100644 app/views/OurWorks/WorksList/WorksFilter/index.tsx create mode 100644 app/views/OurWorks/WorksList/index.tsx delete mode 100644 app/views/OurWorks/index.tsx create mode 100644 app/views/OurWorks/query.ts delete mode 100644 app/views/Users/UsersList/styles.module.css diff --git a/app/Root/config/routes.ts b/app/Root/config/routes.ts index 7e42768..cac5c3d 100644 --- a/app/Root/config/routes.ts +++ b/app/Root/config/routes.ts @@ -81,9 +81,22 @@ const editUser: RouteConfig = { const ourWorks: RouteConfig = { index: true, path: '/our-works', - load: () => import('#views/OurWorks'), + load: () => import('#views/OurWorks/WorksList'), visibility: 'is-authenticated', }; + +const createWorks: RouteConfig = { + path: '/our-works/new', + load: () => import('#views/OurWorks/WorksForm'), + visibility: 'is-authenticated', +}; + +const editWorks: RouteConfig = { + path: '/our-works/:id/edit', + load: () => import('#views/OurWorks/WorksForm'), + visibility: 'is-authenticated', +}; + const preparedness: RouteConfig = { index: true, path: '/preparedness', @@ -128,6 +141,8 @@ const routes = { createUser, editUser, ourWorks, + createWorks, + editWorks, preparedness, dataAndReports, documents, diff --git a/app/components/EmbedPreview/index.tsx b/app/components/EmbedPreview/index.tsx new file mode 100644 index 0000000..6a6ad82 --- /dev/null +++ b/app/components/EmbedPreview/index.tsx @@ -0,0 +1,54 @@ +import { useMemo } from 'react'; +import { Container } from '@ifrc-go/ui'; +import { + _cs, + isDefined, + isNotDefined, +} from '@togglecorp/fujs'; + +import useDebouncedValue from '#hooks/useDebouncedValue'; +import { getSafeUrl } from '#utils/common'; + +import styles from './styles.module.css'; + +export interface Props { + className?: string; + url: string | undefined | null; + title?: string; + placeholder?: string; +} + +function EmbedPreview({ + className, + url, + title = 'Embed Preview', + placeholder = 'Enter a valid embed link to see a live preview', +}: Props) { + const debouncedUrl = useDebouncedValue(url, 500); + const previewUrl = useMemo(() => getSafeUrl(debouncedUrl), [debouncedUrl]); + + return ( + + {isDefined(previewUrl) && ( +