Skip to content

Commit 2e5bb54

Browse files
committed
Add archive announcement
1 parent 77b1e12 commit 2e5bb54

7 files changed

Lines changed: 196 additions & 18 deletions

File tree

package-lock.json

Lines changed: 95 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"graphiql": "^0.14.2",
1515
"react": "^16.14.0",
1616
"react-app-polyfill": "^1.0.6",
17+
"react-cookie": "^4.1.1",
1718
"react-dom": "^16.14.0",
1819
"react-icons": "^4.2.0",
1920
"react-router-dom": "^5.2.0",
@@ -65,5 +66,5 @@
6566
"pre-commit": "lint-staged"
6667
}
6768
},
68-
"proxy": "http://localhost:5000"
69+
"proxy": "http://127.0.0.1:5000"
6970
}

server/requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ flask-restx == 0.5.1
77
graphene == 2.1.9
88
flask-accepts == 0.18.4
99
marshmallow == 3.14.0
10-
boto3 == 1.18.13
10+
boto3 == 1.18.13
11+
werkzeug==2.1.2

src/AboutModal.jsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
import React, { Component } from 'react';
2-
import { getTheme, mergeStyleSets, FontWeights, Modal } from '@fluentui/react';
2+
import {
3+
getTheme,
4+
mergeStyleSets,
5+
FontWeights,
6+
Modal,
7+
MessageBar,
8+
MessageBarType
9+
} from '@fluentui/react';
310
import { IconButton } from '@fluentui/react/lib/Button';
11+
import { ArchiveAnnouncement } from './ArchiveModal';
412

513
const theme = getTheme();
614
const cancelIcon = { iconName: 'Cancel' };
@@ -75,6 +83,9 @@ export default class AboutModal extends Component {
7583
/>
7684
</div>
7785
<div className={contentStyles.body}>
86+
<MessageBar messageBarType={MessageBarType.warning}>
87+
<ArchiveAnnouncement />
88+
</MessageBar>
7889
<p>
7990
Case Explorer is a web application and set of APIs for exploring
8091
data scraped from the{' '}

src/ArchiveModal.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.archive-modal .ms-Dialog-main {
2+
max-width: 500px;
3+
}

src/ArchiveModal.jsx

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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+
}

src/index.jsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import apiName from './ApiName';
1818
import { useEffect } from 'react';
1919
import SwaggerUI from 'swagger-ui-react';
2020
import 'swagger-ui-react/swagger-ui.css';
21+
import ArchiveModal from './ArchiveModal';
22+
import { CookiesProvider } from 'react-cookie';
2123

2224
export const version = '0.2';
2325

@@ -143,6 +145,7 @@ const App = props => {
143145
} else {
144146
return (
145147
<>
148+
<ArchiveModal />
146149
<Router>
147150
<Header title={title} version={version} />
148151
<div className="navbar">
@@ -175,5 +178,10 @@ const App = props => {
175178

176179
if (document.getElementById('root')) {
177180
initializeIcons();
178-
ReactDOM.render(<App />, document.getElementById('root'));
181+
ReactDOM.render(
182+
<CookiesProvider>
183+
<App />
184+
</CookiesProvider>,
185+
document.getElementById('root')
186+
);
179187
}

0 commit comments

Comments
 (0)