|
| 1 | +import * as React from 'react'; |
| 2 | +import { Dialog, DialogType, DialogFooter } from '@fluentui/react/lib/Dialog'; |
| 3 | +import { PrimaryButton, DefaultButton } from '@fluentui/react/lib/Button'; |
| 4 | +import { useBoolean } from '@fluentui/react-hooks'; |
| 5 | +import { useCookies } from 'react-cookie'; |
| 6 | +import './ArchiveModal.css'; |
| 7 | + |
| 8 | +const modelProps = { |
| 9 | + className: 'archive-modal', |
| 10 | + isBlocking: false, |
| 11 | + styles: { main: { maxWidth: 800 } } |
| 12 | +}; |
| 13 | +const dialogContentProps = { |
| 14 | + type: DialogType.largeHeader, |
| 15 | + title: 'Case Explorer will be shutting down soon', |
| 16 | + styles: { |
| 17 | + content: { |
| 18 | + p: { margin: '0px 0px 24px', lineHeight: '1.5em' }, |
| 19 | + a: { outline: 'none' } |
| 20 | + } |
| 21 | + } |
| 22 | +}; |
| 23 | + |
| 24 | +export function ArchiveAnnouncement() { |
| 25 | + return ( |
| 26 | + <> |
| 27 | + <p> |
| 28 | + At the end of February 2023, Case Explorer will be shutting down until |
| 29 | + we are able to secure funding for our ongoing database hosting costs. |
| 30 | + You will still be able to download{' '} |
| 31 | + <a target="_blank" href="https://exports.mdcaseexplorer.com/"> |
| 32 | + exports of the database |
| 33 | + </a> |
| 34 | + . |
| 35 | + </p> |
| 36 | + <p> |
| 37 | + Please note that the database does not contain any cases newer than May |
| 38 | + 2022 due to the MD Judiciary's implementation of anti-scraping |
| 39 | + technologies. |
| 40 | + </p> |
| 41 | + </> |
| 42 | + ); |
| 43 | +} |
| 44 | + |
| 45 | +export default function ArchiveModal() { |
| 46 | + const [hideDialog, { toggle: toggleHideDialog }] = useBoolean(false); |
| 47 | + const [cookies, setCookie] = useCookies(['archive']); |
| 48 | + |
| 49 | + const closeDialog = () => { |
| 50 | + setCookie('archive', 'true', { |
| 51 | + expires: new Date(new Date().getTime() + 24 * 60 * 60 * 1000) |
| 52 | + }); |
| 53 | + toggleHideDialog(); |
| 54 | + }; |
| 55 | + |
| 56 | + return ( |
| 57 | + <> |
| 58 | + {cookies.archive === undefined && ( |
| 59 | + <Dialog |
| 60 | + hidden={hideDialog} |
| 61 | + dialogContentProps={dialogContentProps} |
| 62 | + modalProps={modelProps} |
| 63 | + onDismiss={closeDialog} |
| 64 | + > |
| 65 | + <ArchiveAnnouncement /> |
| 66 | + <DialogFooter> |
| 67 | + <PrimaryButton onClick={closeDialog} text="OK" /> |
| 68 | + </DialogFooter> |
| 69 | + </Dialog> |
| 70 | + )} |
| 71 | + </> |
| 72 | + ); |
| 73 | +} |
0 commit comments