From 80c3f883affae03346e987bcc0a0bd01d12ea7be Mon Sep 17 00:00:00 2001 From: crssstha Date: Thu, 2 Jul 2026 11:32:49 +0545 Subject: [PATCH 1/2] feat(home): added operational dashboard --- app/Root/hooks/useRouting.tsx | 37 +++++++++ app/views/Home/index.tsx | 138 +++++++++++++++++----------------- app/views/OurWork/index.tsx | 1 + 3 files changed, 106 insertions(+), 70 deletions(-) create mode 100644 app/Root/hooks/useRouting.tsx diff --git a/app/Root/hooks/useRouting.tsx b/app/Root/hooks/useRouting.tsx new file mode 100644 index 0000000..29b67d8 --- /dev/null +++ b/app/Root/hooks/useRouting.tsx @@ -0,0 +1,37 @@ +import { + generatePath, + useNavigate, +} from 'react-router'; + +import routes from '#root/config/routes'; + +export type RoutesMap = typeof routes; + +type ExtractPath = T extends { path: infer P } + ? (P extends string ? P : '') + : ''; + +type PathParams

= P extends `${string}:${string}` + ? [params: Record] + : [params?: Record | undefined]; + +function useRouting() { + const navigate = useNavigate(); + + return ( + route: K, + ...args: PathParams> + ) => { + const routeConfig = routes[route] as { path?: string }; + const pathTemplate = routeConfig.path ?? ''; + + const normalizedTemplate = pathTemplate.startsWith('/') + ? pathTemplate + : `/${pathTemplate}`; + + const absolutePath = generatePath(normalizedTemplate, args[0] ?? {}); + navigate(absolutePath); + }; +} + +export default useRouting; diff --git a/app/views/Home/index.tsx b/app/views/Home/index.tsx index f832b55..a4dd24f 100644 --- a/app/views/Home/index.tsx +++ b/app/views/Home/index.tsx @@ -13,10 +13,46 @@ import { import InfoCard from '#components/InfoCard'; import KeyCard from '#components/KeyCard'; import Page from '#components/Page'; +import { + DashboardPage, + useExternalDashboardsQuery, +} from '#generated/types/graphql'; +import type { RouteKeys } from '#root/config/routes'; +import useRouting from '#root/hooks/useRouting'; import ActiveOperation from '#views/Home/ActiveOperation'; +const DASHBOARD_PAGE_TO_ROUTE_KEY: Record = { + [DashboardPage.CapacityResources]: 'capacityAndResources', + [DashboardPage.DisasterResponse]: 'disasterResponse', + [DashboardPage.EmergencyAlerts]: 'emergencyAlert', + [DashboardPage.EmergencyResponse]: 'emergencyResponse', + [DashboardPage.Home]: 'home', + [DashboardPage.Operations]: 'home', + [DashboardPage.ProjectMapping]: 'projectMapping', +}; + function Home() { - // TODO: Fetch real data for key figures and operations + const routeTo = useRouting(); + + const [{ data, fetching }] = useExternalDashboardsQuery({ + variables: { + filters: { + isActive: true, + showOnHome: true, + }, + pagination: { + limit: 6, + }, + }, + }); + + const operationDashboards = data?.externalDashboards.results ?? []; + + const handleViewClick = (page: DashboardPage) => { + const routeKey = DASHBOARD_PAGE_TO_ROUTE_KEY[page]; + routeTo(routeKey); + }; + const keyFigures = ( - } - title="Operational Dashboards" - description="Real-time emergency alerts and early warning system monitoring across regions" - /> - - - - - - - - + + + } + title="Operational Dashboards" + description="Real-time emergency alerts and early warning system monitoring across regions" + /> + + {operationDashboards.map((res) => ( + handleViewClick(res.page)} + /> + ))} + + + ); diff --git a/app/views/OurWork/index.tsx b/app/views/OurWork/index.tsx index 7a2e301..8ff8ca0 100644 --- a/app/views/OurWork/index.tsx +++ b/app/views/OurWork/index.tsx @@ -41,6 +41,7 @@ const EXTERNAL_DASHBOARDS_QUERY = gql` page regionId showOnHome + pageDisplay url } pageInfo { From 3eac40aa38a7764ba3b1ea7aa29ed432604f5a13 Mon Sep 17 00:00:00 2001 From: crssstha Date: Thu, 2 Jul 2026 12:18:49 +0545 Subject: [PATCH 2/2] fix(report): overflow issue, search in capticity and other minor issue --- app/Root/config/routes.ts | 2 +- app/views/CapacityAndResources/index.tsx | 4 +++- app/views/DataAndReport/AIsummary/index.tsx | 16 ++++++------- .../DataAndReport/AIsummary/styles.module.css | 4 ++++ .../DataAndReport/ReportDetail/index.tsx | 8 ++++--- app/views/Preparedness/Pmer/index.tsx | 23 +++++++++++++++++++ app/views/Preparedness/Pmer/styles.module.css | 14 +++++++++++ app/views/TeamList/Members/index.tsx | 3 ++- backend | 2 +- 9 files changed, 61 insertions(+), 15 deletions(-) create mode 100644 app/views/Preparedness/Pmer/index.tsx create mode 100644 app/views/Preparedness/Pmer/styles.module.css diff --git a/app/Root/config/routes.ts b/app/Root/config/routes.ts index 3b22f61..26397d4 100644 --- a/app/Root/config/routes.ts +++ b/app/Root/config/routes.ts @@ -33,7 +33,7 @@ const preparedness: RouteConfig = { }, { path: 'pmer', - load: () => import('#views/Preparedness/DisasterResponse'), + load: () => import('#views/Preparedness/Pmer'), visibility: 'is-anything', }, { diff --git a/app/views/CapacityAndResources/index.tsx b/app/views/CapacityAndResources/index.tsx index 9a5eca0..64c5a78 100644 --- a/app/views/CapacityAndResources/index.tsx +++ b/app/views/CapacityAndResources/index.tsx @@ -78,7 +78,9 @@ function CapacityAndResourcesList() { filters: { regions: regionId ? [regionId] : null, isActive: true, - search: filter.searchText, + title: { + iContains: filter.searchText, + }, }, pagination: { limit, diff --git a/app/views/DataAndReport/AIsummary/index.tsx b/app/views/DataAndReport/AIsummary/index.tsx index e33ab89..0b3e3cc 100644 --- a/app/views/DataAndReport/AIsummary/index.tsx +++ b/app/views/DataAndReport/AIsummary/index.tsx @@ -1,6 +1,6 @@ import { StarLineIcon } from '@ifrc-go/icons'; import { - BlockLoading, + Container, Description, Heading, InlineView, @@ -30,16 +30,16 @@ function AIsummary(props: AISummaryProps) { > AI Summary - {loading ? ( - - ) : ( + {summary} - ) } + ); } diff --git a/app/views/DataAndReport/AIsummary/styles.module.css b/app/views/DataAndReport/AIsummary/styles.module.css index 634fa2a..9f13084 100644 --- a/app/views/DataAndReport/AIsummary/styles.module.css +++ b/app/views/DataAndReport/AIsummary/styles.module.css @@ -5,4 +5,8 @@ white-space: pre-line; color: var(--go-ui-color-white); + .summary-container { + flex-grow: 1; + min-height: 0; + } } \ No newline at end of file diff --git a/app/views/DataAndReport/ReportDetail/index.tsx b/app/views/DataAndReport/ReportDetail/index.tsx index e4fe497..4498e83 100644 --- a/app/views/DataAndReport/ReportDetail/index.tsx +++ b/app/views/DataAndReport/ReportDetail/index.tsx @@ -98,8 +98,9 @@ function ReportDetail() { const aiSummary = summaryData?.reportSummaries.results .map((summary) => summary.text) .join('\n \n'); + const publishedDate = new Date(reportData?.publishedAt); - const encodedPublishedDate = encodeDate(publishedDate); + const encodedPublishedDate = reportData?.publishedAt ? encodeDate(publishedDate) : '-'; return ( @@ -172,7 +174,7 @@ function ReportDetail() { /> ) } - {isDefined(aiSummary) && ( + {aiSummary && (

+ + + Under Construction + + + The PMER dashboard is currently being built. Please check back later. + +
+ ); +} + +export default Pmer; diff --git a/app/views/Preparedness/Pmer/styles.module.css b/app/views/Preparedness/Pmer/styles.module.css new file mode 100644 index 0000000..17144a0 --- /dev/null +++ b/app/views/Preparedness/Pmer/styles.module.css @@ -0,0 +1,14 @@ +.pmer { + display: flex; + align-items: center; + flex-direction: column; + justify-content: center; + gap: var(--go-ui-spacing-sm); + min-height: 60vh; + text-align: center; + + .icon { + color: var(--go-ui-color-text-light); + font-size: 2.5rem; + } +} diff --git a/app/views/TeamList/Members/index.tsx b/app/views/TeamList/Members/index.tsx index 9433724..af736f7 100644 --- a/app/views/TeamList/Members/index.tsx +++ b/app/views/TeamList/Members/index.tsx @@ -133,9 +133,10 @@ function Members() { const [{ fetching, data }] = useTeamMembersQuery({ variables: { - teamId: id!, + teamId: id ?? '', filters: { search: filter.searchText, + teamId: id, }, pagination: { offset, diff --git a/backend b/backend index e85bd4e..62f92ee 160000 --- a/backend +++ b/backend @@ -1 +1 @@ -Subproject commit e85bd4e1e55c708aabce1dca3d0d8cf4dcfbd0f7 +Subproject commit 62f92ee515fb2ca80c0c3f661a092ba68c9a9f7d