diff --git a/app/components/AdditionalLinkList/index.tsx b/app/components/AdditionalLinkList/index.tsx
index 2e3f821..3ef20ac 100644
--- a/app/components/AdditionalLinkList/index.tsx
+++ b/app/components/AdditionalLinkList/index.tsx
@@ -16,13 +16,12 @@ import useFilterState from '#hooks/useFilterState';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const PUBLIC_LINKS_QUERY = gql`
query PublicLinks(
- $limit: Int = 10
- $offset: Int = 0
- $linkType: LinkTypeEnum
+ $pagination: OffsetPaginationInput,
+ $filters: LinkFilter
) {
publicLinks(
- pagination: { limit: $limit, offset: $offset }
- filters: { linkType: $linkType }
+ filters: $filters
+ pagination: $pagination
) {
totalCount
results {
@@ -54,9 +53,13 @@ function AdditionalLinkList({ linkType }: LinkListProps) {
const [{ data, fetching }] = usePublicLinksQuery({
variables: {
- linkType,
- limit,
- offset,
+ filters: {
+ linkType,
+ },
+ pagination: {
+ limit,
+ offset,
+ },
},
});
diff --git a/app/components/DocumentList/index.tsx b/app/components/DocumentList/index.tsx
index 5e990c7..86a6299 100644
--- a/app/components/DocumentList/index.tsx
+++ b/app/components/DocumentList/index.tsx
@@ -15,13 +15,12 @@ import {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const DOCUMENT_LIST_QUERY = gql`
query DocumentList(
- $reportType: ReportTypeEnum
- $limit: Int = 10
- $offset: Int = 0
+ $pagination: OffsetPaginationInput,
+ $filters: ReportFilter
) {
reports(
- filters: { reportType: $reportType }
- pagination: { limit: $limit, offset: $offset }
+ filters: $filters
+ pagination: $pagination
) {
totalCount
results {
@@ -55,7 +54,9 @@ function DocumentList(props: Props) {
const [{ data, fetching }] = useDocumentListQuery({
variables: {
- reportType,
+ filters: {
+ reportType,
+ },
},
});
diff --git a/app/components/GoMapContainer/index.tsx b/app/components/GoMapContainer/index.tsx
index c39268f..ff97680 100644
--- a/app/components/GoMapContainer/index.tsx
+++ b/app/components/GoMapContainer/index.tsx
@@ -26,12 +26,13 @@ import {
isDefined,
} from '@togglecorp/fujs';
import { MapContainer } from '@togglecorp/re-map';
+import FileSaver from 'file-saver';
+import { toPng } from 'html-to-image';
import Link from '#components/Link';
+import useAlert from '#hooks/useAlert';
import goLogo from '#resources/image/logo.png';
-// import FileSaver from 'file-saver';
-// import { toPng } from 'html-to-image';
import styles from './styles.module.css';
interface Props {
@@ -128,20 +129,20 @@ function GoMapContainer(props: Props) {
}
}, [presentationMode, onPresentationModeChange]);
- // const alert = useAlert();
- // const handleDownloadClick = useCallback(() => {
- // if (!containerRef?.current) {
- // alert.show(
- // "Failed to download map. Try again.",
- // { variant: 'danger' },
- // );
- // exitPrintMode();
- // return;
- // }
- // toPng(containerRef.current, { skipAutoScale: false })
- // .then((data) => FileSaver.saveAs(data, title))
- // .finally(exitPrintMode);
- // }, [exitPrintMode, title, alert]);
+ const alert = useAlert();
+ const handleDownloadClick = useCallback(() => {
+ if (!containerRef?.current) {
+ alert.show(
+ 'Failed to download map. Try again.',
+ { variant: 'danger' },
+ );
+ exitPrintMode();
+ return;
+ }
+ toPng(containerRef.current, { skipAutoScale: false })
+ .then((data) => FileSaver.saveAs(data, title))
+ .finally(exitPrintMode);
+ }, [exitPrintMode, title, alert]);
return (
diff --git a/app/views/Galleries/Photos/index.tsx b/app/views/Galleries/Photos/index.tsx
index 81d482e..d77dbba 100644
--- a/app/views/Galleries/Photos/index.tsx
+++ b/app/views/Galleries/Photos/index.tsx
@@ -10,6 +10,7 @@ import {
ListView,
Pager,
} from '@ifrc-go/ui';
+import { saveAs } from 'file-saver';
import { gql } from 'urql';
import { useGalleryQuery } from '#generated/types/graphql';
@@ -19,10 +20,13 @@ import styles from './styles.module.css';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const IMAGES_QUERY = gql`
- query Gallery($offset: Int, $limit: Int, $albumId: ID) {
+ query Gallery(
+ $pagination: OffsetPaginationInput,
+ $filters: GalleryImageFilter
+ ) {
galleryImages(
- pagination: { limit: $limit, offset: $offset }
- filters: { albumId: $albumId }
+ filters: $filters
+ pagination: $pagination
) {
totalCount
results {
@@ -56,6 +60,10 @@ function ImageComponent(props: ImageComponentProps) {
} = props;
const safeSrc = toSafeSrc(src);
+ const handleDownloadClick = () => {
+ saveAs(safeSrc, name);
+ };
+
return (
@@ -64,17 +72,16 @@ function ImageComponent(props: ImageComponentProps) {
className={styles.actionButton}
withPadding
>
-
-
-
-
-
+
+
+
void}) {
const [{ fetching: imageLoading, data: imageData }] = useGalleryQuery({
variables: {
- albumId,
- limit,
- offset,
+ filters: {
+ albumId,
+ },
+ pagination: {
+ limit,
+ offset,
+ },
},
+ pause: !albumId,
});
return (
{
@@ -203,6 +210,7 @@ function Galleries() {
)}
diff --git a/app/views/Home/ActiveOperation/index.tsx b/app/views/Home/ActiveOperation/index.tsx
index 27c5ae5..48a57af 100644
--- a/app/views/Home/ActiveOperation/index.tsx
+++ b/app/views/Home/ActiveOperation/index.tsx
@@ -303,7 +303,7 @@ function ActiveOperation() {
),
createEventColumn(
'operation',
- 'operation',
+ 'Operation',
(item) => item.name,
(item) => ({
href: `${goUrl}/emergencies/${item.event}/details`,
@@ -407,7 +407,7 @@ function ActiveOperation() {
onAdminZeroFillClick={handleCountryClick}
>
(undefined);
+
const [{ data: emergencyResponse, fetching }] = useExternalDashboardsQuery({
variables: {
- page: DashboardPage.EmergencyResponse,
- isActive: true,
+ filters: {
+ page: DashboardPage.EmergencyResponse,
+ isActive: true,
+ regions: [regionId ?? ''],
+ },
},
-
});
+
return (
-
-
- }
- title="Emergency Response Overview Dashboard"
- description="Real-time emergency alerts and early warning system monitoring across regions"
+
+ )}
+ />
+ }
+ title="Emergency Response Overview Dashboard"
+ description="Real-time emergency alerts and early warning system monitoring across regions"
+ />
+
{emergencyResponse?.externalDashboards.results.map((report) => (
))}
-
-
+
+
);
}
diff --git a/app/views/OurWork/ProjectMapping/index.tsx b/app/views/OurWork/ProjectMapping/index.tsx
index d49c78d..e434ffc 100644
--- a/app/views/OurWork/ProjectMapping/index.tsx
+++ b/app/views/OurWork/ProjectMapping/index.tsx
@@ -12,11 +12,12 @@ import {
} from '#generated/types/graphql';
function ProjectMapping() {
- // Todo: Region filter
const [{ data: projectMappingData, fetching }] = useExternalDashboardsQuery({
variables: {
- page: DashboardPage.ProjectMapping,
- isActive: true,
+ filters: {
+ page: DashboardPage.ProjectMapping,
+ isActive: true,
+ },
},
});
diff --git a/app/views/OurWork/index.tsx b/app/views/OurWork/index.tsx
index 3588e80..7a2e301 100644
--- a/app/views/OurWork/index.tsx
+++ b/app/views/OurWork/index.tsx
@@ -2,6 +2,8 @@ import { Outlet } from 'react-router';
import {
AlertLineIcon,
HeartAddLineIcon,
+ InspectIcon,
+ MapIcon,
ShieldUserLineIcon,
} from '@ifrc-go/icons';
import {
@@ -14,7 +16,6 @@ import { gql } from 'urql';
import KeyCard from '#components/KeyCard';
import NavigationTab from '#components/NavigationTab';
import Page from '#components/Page';
-import RegionSelectInput from '#components/RegionSelectInput';
// NOTE: There is limit of 20 dashboards for now, as we don't have more than that.
// We can add pagination if needed in the future
@@ -22,14 +23,12 @@ import RegionSelectInput from '#components/RegionSelectInput';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const EXTERNAL_DASHBOARDS_QUERY = gql`
query ExternalDashboards(
- $page: DashboardPage
- $isActive: Boolean = true
- $limit: Int = 20
- $offset: Int = 0
+ $pagination: OffsetPaginationInput,
+ $filters: ExternalDashboardFilter
) {
externalDashboards(
- filters: { page: $page, isActive: $isActive }
- pagination: { limit: $limit, offset: $offset }
+ filters: $filters
+ pagination: $pagination
) {
results {
title
@@ -98,14 +97,6 @@ function OurWork() {
{keyFigures}
)}
- actions={(
- // TODO: add region filter
- {}}
- />
- )}
>
- Emergency Response
+
+
+
+ Emergency Response
+
+
- Project Mapping
+
+
+
+ Project Mapping
+
+
diff --git a/app/views/Preparedness/DisasterResponse/index.tsx b/app/views/Preparedness/DisasterResponse/index.tsx
index 42f8266..3670668 100644
--- a/app/views/Preparedness/DisasterResponse/index.tsx
+++ b/app/views/Preparedness/DisasterResponse/index.tsx
@@ -1,47 +1,60 @@
+import { useState } from 'react';
import { AlertLineIcon } from '@ifrc-go/icons';
import {
Container,
+ InlineLayout,
ListView,
} from '@ifrc-go/ui';
import InfoCard from '#components/InfoCard';
import PowerBIEmbed from '#components/PowerBiEmbed';
+import RegionSelectInput from '#components/RegionSelectInput';
import {
DashboardPage,
useExternalDashboardsQuery,
} from '#generated/types/graphql';
function DisasterResponse() {
- // Todo: Region filter
+ const [regionId, setRegionId] = useState(undefined);
const [{ data: disasterResponse, fetching }] = useExternalDashboardsQuery({
variables: {
- page: DashboardPage.DisasterResponse,
- isActive: true,
+ filters: {
+ page: DashboardPage.DisasterResponse,
+ isActive: true,
+ regions: [regionId ?? ''],
+ },
},
-
});
return (
-
-
+ )}
+ />
+ }
+ title="Alerts Dashboard"
+ description="Real-time emergency alerts and early warning system monitoring across regions"
+ />
+
- }
- title="Alerts Dashboard"
- description="Real-time emergency alerts and early warning system monitoring across regions"
- />
{disasterResponse?.externalDashboards.results.map((report) => (
))}
-
-
+
+
);
}
export default DisasterResponse;
diff --git a/app/views/Preparedness/EmergencyAlert/index.tsx b/app/views/Preparedness/EmergencyAlert/index.tsx
index 559899c..b4c9cca 100644
--- a/app/views/Preparedness/EmergencyAlert/index.tsx
+++ b/app/views/Preparedness/EmergencyAlert/index.tsx
@@ -1,47 +1,62 @@
+import { useState } from 'react';
import { AlertLineIcon } from '@ifrc-go/icons';
import {
Container,
+ InlineLayout,
ListView,
} from '@ifrc-go/ui';
import InfoCard from '#components/InfoCard';
import PowerBIEmbed from '#components/PowerBiEmbed';
+import RegionSelectInput from '#components/RegionSelectInput';
import {
DashboardPage,
useExternalDashboardsQuery,
} from '#generated/types/graphql';
function EmergencyAlert() {
- // Todo: Region filter
+ const [regionId, setRegionId] = useState(undefined);
+
const [{ data: emergencyAlert, fetching }] = useExternalDashboardsQuery({
variables: {
- page: DashboardPage.EmergencyAlerts,
- isActive: true,
+ filters: {
+ page: DashboardPage.EmergencyAlerts,
+ isActive: true,
+ regions: [regionId ?? ''],
+ },
},
-
});
+
return (
-
-
+ )}
+ />
+ }
+ title="Alerts Dashboard"
+ description="Real-time emergency alerts and early warning system monitoring across regions"
+ />
+
- }
- title="Alerts Dashboard"
- description="Real-time emergency alerts and early warning system monitoring across regions"
- />
{emergencyAlert?.externalDashboards.results.map((report) => (
))}
-
-
+
+
);
}
export default EmergencyAlert;
diff --git a/app/views/Preparedness/index.tsx b/app/views/Preparedness/index.tsx
index 2071406..d68b70b 100644
--- a/app/views/Preparedness/index.tsx
+++ b/app/views/Preparedness/index.tsx
@@ -1,4 +1,10 @@
import { Outlet } from 'react-router';
+import {
+ AlertLineIcon,
+ AnalyzingIcon,
+ EmergencyResponseUnitIcon,
+ InspectIcon,
+} from '@ifrc-go/icons';
import {
ListView,
NavigationTabList,
@@ -24,23 +30,50 @@ function Preparedness() {
- Emergency Alert
+
+
+
+ Emergency Alert
+
+
- Disaster Response
- {' '}
+
+
+
+ Disaster Response
+
+
- PMER
+
+
+
+ PMER
+
+
- Risk Analysis
+
+
+
+ Risk Analysis
+
+
diff --git a/app/views/TeamList/Members/index.tsx b/app/views/TeamList/Members/index.tsx
index c2e0ee8..105ebba 100644
--- a/app/views/TeamList/Members/index.tsx
+++ b/app/views/TeamList/Members/index.tsx
@@ -12,6 +12,10 @@ import {
createElementColumn,
createStringColumn,
} from '@ifrc-go/ui/utils';
+import {
+ decodeDate,
+ formatDateToString,
+} from '@togglecorp/fujs';
import { gql } from 'urql';
import ExportButton from '#components/ExportButton';
@@ -28,12 +32,9 @@ import useGraphQLToCSV from '#hooks/useGraphqlToCsv';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const TEAM_MEMBERS_QUERY = gql`
query TeamMembers(
- $offset: Int
- $limit: Int
- $search: String
- $woredas: [ID!]
+ $pagination: OffsetPaginationInput,
+ $filters: TeamMemberFilter
$teamId: ID!
- $regions: [ID!]
) {
team(id: $teamId) {
id
@@ -41,13 +42,8 @@ const TEAM_MEMBERS_QUERY = gql`
description
}
teamMembers(
- pagination: { limit: $limit, offset: $offset }
- filters: {
- search: $search
- woredas: $woredas
- teamId: $teamId
- regions: $regions
- }
+ filters: $filters
+ pagination: $pagination
) {
totalCount
results {
@@ -72,18 +68,10 @@ const TEAM_MEMBERS_QUERY = gql`
const TEAM_MEMBERS_EXPORT_QUERY = gql`
query TeamMembersExport(
- $search: String
- $woredas: [ID!]
- $teamId: ID!
- $regions: [ID!]
+ $filters: TeamMemberFilter
) {
teamMembers(
- filters: {
- search: $search
- woredas: $woredas
- teamId: $teamId
- regions: $regions
- }
+ filters: $filters
) {
results {
id
@@ -146,9 +134,13 @@ function Members() {
const [{ fetching, data }] = useTeamMembersQuery({
variables: {
teamId: id!,
- offset,
- limit,
- search: filter.searchText,
+ filters: {
+ search: filter.searchText,
+ },
+ pagination: {
+ offset,
+ limit,
+ },
},
pause: !id,
});
@@ -163,18 +155,22 @@ function Members() {
filename: `team-${data?.team.id ? data?.team.name.toLowerCase() : id}-members.csv`,
transform: (responseData) => (
responseData.teamMembers.results ?? []
- ).map((member) => ({
- ID: member.id,
- Name: member.name,
- Email: member.email,
- Gender: member.sex,
- 'Phone Number': member.phoneNumber,
- Position: member.position,
- Training: member.training,
- 'Field of Study': member.fieldOfStudy,
- 'Created At': member.createdAt,
- 'Updated At': member.updatedAt,
- })),
+ ).map((member) => {
+ const createdAt = member.createdAt ? formatDateToString(decodeDate(member.createdAt as string), 'yyyy-dd-MM') : '';
+ const updatedAt = member.updatedAt ? formatDateToString(decodeDate(member.createdAt as string), 'yyyy-dd-MM') : '';
+ return {
+ ID: member.id,
+ Name: member.name,
+ Email: member.email,
+ Gender: member.sex,
+ 'Phone Number': member.phoneNumber,
+ Position: member.position,
+ Training: member.training,
+ 'Field of Study': member.fieldOfStudy,
+ 'Created At': createdAt,
+ 'Updated At': updatedAt,
+ };
+ }),
});
const handleExport = () => {
@@ -248,6 +244,7 @@ function Members() {
>
=20.10'}
+ html-to-image@1.11.13:
+ resolution: {integrity: sha512-cuOPoI7WApyhBElTTb9oqsawRvZ0rHhaHwghRLlTuffoD1B2aDemlCruLeZrUIIdvG7gs9xeELEPm6PhuASqrg==}
+
htmlparser2@10.1.0:
resolution: {integrity: sha512-VTZkM9GWRAtEpveh7MSF6SjjrpNVNNVJfFup7xTY3UpFtm67foy9HDVXneLtFVt4pMz5kZtgNcvCniNFb1hlEQ==}
@@ -8919,6 +8925,8 @@ snapshots:
html-tags@5.1.0: {}
+ html-to-image@1.11.13: {}
+
htmlparser2@10.1.0:
dependencies:
domelementtype: 2.3.0