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 (