Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BL-823_fe_i_want_export_raw-data #25

Open
wants to merge 103 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
b0011b4
init button scafolding
publiminal Aug 30, 2022
16b0f36
added test raw data fileg
publiminal Aug 30, 2022
42a7cab
addedd Downloadbutton as component
publiminal Aug 30, 2022
fd4bfb6
added main download functionality . POC succeded
publiminal Aug 31, 2022
86c35b6
added ~axios-progress-bar and js-file-download libs
publiminal Aug 31, 2022
243cd8d
added styling and vars cleanup
publiminal Aug 31, 2022
8d18a69
added default info button if no received in props
publiminal Sep 2, 2022
b60cbd2
updated styles to be overwritten out of component
publiminal Sep 3, 2022
c4bc8b7
BL-821 added visualization download functionality
Austin-T-Johnson Aug 24, 2022
7ec0b8f
added missing semicolons. Thanks linter !
publiminal Sep 7, 2022
de1de7a
removed unsused raw .csv file. For local testing purposes use .zip fi…
publiminal Sep 7, 2022
5897b9c
initial replacement of files in DataVisualizations
mack-gallagher Aug 17, 2022
470ecb2
rethink folder structure
mack-gallagher Aug 17, 2022
cfec9e3
begin routing
mack-gallagher Aug 17, 2022
62a16de
basic routing between HeatMap components
mack-gallagher Aug 17, 2022
1ca5a62
clarify ViewSelect
mack-gallagher Aug 17, 2022
2c93444
fix nested routing
mack-gallagher Aug 17, 2022
d156bf7
skeleton layout
mack-gallagher Aug 17, 2022
9662d81
drop-down menu to select office
mack-gallagher Aug 17, 2022
2b3b1c2
fix bug where office heatmap view would be shown within single office…
mack-gallagher Aug 17, 2022
54d2b27
change drop-down to be ant design style
mack-gallagher Aug 18, 2022
60e9f47
continue Ant Design makeover
mack-gallagher Aug 18, 2022
e954b54
update single office citizenship heatmap display to display office name
mack-gallagher Aug 18, 2022
989ab62
LAST COMMIT BEFORE INSTALLING CORS TO TEST LOCALLY IN CASE THAT'S A P…
mack-gallagher Aug 18, 2022
6aa6358
preliminary state management and form validation
mack-gallagher Aug 20, 2022
6fda4a2
final commit before testing Plotly
mack-gallagher Aug 22, 2022
a248cf2
final commit before checking out main
mack-gallagher Aug 23, 2022
6f12b21
add chloropleth
mack-gallagher Aug 23, 2022
3ae59e1
checking out main
mack-gallagher Aug 23, 2022
5f4982d
add message explaining seemingly unnecessary switch statements in viz…
mack-gallagher Aug 23, 2022
d58f113
change 'heatmaps' route to 'graphs'
mack-gallagher Aug 25, 2022
0775acf
fix office heat map display to render data from 'API' correctly
mack-gallagher Aug 25, 2022
5707382
start on new Tables components
mack-gallagher Aug 25, 2022
9262ee1
remove Tables directory
mack-gallagher Aug 25, 2022
bd44459
introduce first code for year limits slider
mack-gallagher Aug 28, 2022
cb75133
fix alignment of year limits slider [ still buggy and unwired ]
mack-gallagher Aug 28, 2022
f9179ee
move massive view-dependent API data filtering function, up from Year…
mack-gallagher Aug 28, 2022
cf3d9f3
final commit before starting draft PR [?]
mack-gallagher Aug 28, 2022
fca019c
clean up styling and make year limits slider reflect text entry
mack-gallagher Aug 29, 2022
8b09d3c
final commit before another attempt to push to remote repo
mack-gallagher Aug 29, 2022
3a09597
import internal test data, external mock test data server now obsolete
mack-gallagher Aug 29, 2022
8eeb6ba
remove all code relating to old Table display
mack-gallagher Aug 29, 2022
e9eaa82
remove unused navbar items
mack-gallagher Aug 29, 2022
017bdd2
simplify layout drastically, remove unused AdvancedApiFilter directories
mack-gallagher Aug 29, 2022
2b17cd7
initial Ant Design header with routing to Landing and Graphs pages
mack-gallagher Aug 29, 2022
93f1c7b
final commit before attempted merge with eric's branch
mack-gallagher Aug 29, 2022
71e5b59
created world scope drop down llist for all citizenship maps
Epeng1994 Aug 29, 2022
f48fe77
update style of header to match footer
mack-gallagher Aug 29, 2022
25c12a6
added titles to x&y axis, adjusted colorscale on citizenship map
Epeng1994 Aug 29, 2022
343cccd
truncate decimals from 'API' data
mack-gallagher Aug 29, 2022
96480b4
reinstate Layout directory
mack-gallagher Aug 29, 2022
7f872e8
removed some extraneous imports
Epeng1994 Aug 30, 2022
370da7a
test fast-forwarding [?]
mack-gallagher Aug 30, 2022
4a2bcaf
add .gitignore changes before rebase
mack-gallagher Aug 30, 2022
1fad171
condensed time-seriesAll APIDATA function, modified time-series all c…
Epeng1994 Aug 30, 2022
9a36175
add filled-in middle to year limits select slider
mack-gallagher Aug 30, 2022
5d76429
preliminary graying out of all colors to match Landing page
mack-gallagher Aug 30, 2022
50f53ef
clean up styling of year limits slider
mack-gallagher Aug 30, 2022
8a93da3
adjusted filter function
Epeng1994 Aug 30, 2022
fb56fc3
comments on api filter
Epeng1994 Aug 30, 2022
f714da2
condensed, updated officeHeatMapAll
Epeng1994 Aug 30, 2022
0ae0a6b
remove old console.log()s
mack-gallagher Aug 30, 2022
402e89b
change 'Office Heat Map' button to say 'Offices Heat Map'
mack-gallagher Aug 30, 2022
5b601d4
briefen interval by which Year Limits Select form text input fields c…
mack-gallagher Aug 31, 2022
6b05c0e
condensed citizhenshipMapAll filter
Epeng1994 Aug 31, 2022
5d6b0db
condensed timeSeriesSingleOffice filter and component
Epeng1994 Aug 31, 2022
1ab035a
condensed singleCitizenshipmap filter and component
Epeng1994 Aug 31, 2022
97e9abf
removed more unused variables, adjusted currentYear for initial state
Epeng1994 Aug 31, 2022
417f8b0
fix background color of single-office citizenship map
mack-gallagher Aug 31, 2022
622b4a5
remove .prettierignore from .gitignore
mack-gallagher Aug 31, 2022
18bbacd
remove unnecessary color variables that were destructured in Citizens…
mack-gallagher Aug 31, 2022
bfbf96e
fix outstanding warnings from linter
mack-gallagher Aug 31, 2022
b0d0671
fix slider elements to respond properly to horizontal scroll
mack-gallagher Sep 1, 2022
f0bc6f2
replace repetitive JSX in Footer.jsx with a .map()
mack-gallagher Sep 1, 2022
e7ab5ac
remove extraneous '/' in HRF site links
mack-gallagher Sep 1, 2022
8e73686
add all-office time series display as default for base '/graphs' rout…
mack-gallagher Sep 1, 2022
6395f30
add mock query params to mock-axios calls to demo eventual API function
mack-gallagher Sep 1, 2022
97123c5
add comments explaining production API calls
mack-gallagher Sep 1, 2022
8fb1795
repurposed rowdata in graphs from hasProperty to useState,useEffect
Epeng1994 Sep 1, 2022
92d6ad6
rough draft of landing page
Austin-T-Johnson Aug 30, 2022
fb31677
adds link to external page via read more button
Austin-T-Johnson Aug 30, 2022
c8fc0f4
adds iPhone SE mobile styling
Austin-T-Johnson Aug 30, 2022
131bd55
adds ant d button component to landing page, changes styling in footer
Austin-T-Johnson Aug 31, 2022
adf3e5c
adds media queries
Austin-T-Johnson Sep 1, 2022
ee8e5d5
fixes mobile-large media query
Austin-T-Johnson Sep 1, 2022
a8ca7a4
fixes mobile-large media query
Austin-T-Johnson Sep 1, 2022
71766ae
removes unwanted commented out code
Austin-T-Johnson Sep 1, 2022
a4dc95e
rough draft of landing page
Austin-T-Johnson Aug 30, 2022
4ec9ab3
adds link to external page via read more button
Austin-T-Johnson Aug 30, 2022
265a038
adds iPhone SE mobile styling
Austin-T-Johnson Aug 30, 2022
a7553dd
adds ant d button component to landing page, changes styling in footer
Austin-T-Johnson Aug 31, 2022
98afa82
adds media queries
Austin-T-Johnson Sep 1, 2022
2ac3360
fixes mobile-large media query
Austin-T-Johnson Sep 1, 2022
2f9691a
fixes mobile-large media query
Austin-T-Johnson Sep 1, 2022
47f1d7f
add meta tags in index
sim-taa Sep 2, 2022
2a5836d
adds xml sitemap for SEO purposes.
sim-taa Sep 2, 2022
28b81c7
rebasing fixing conflicts
publiminal Sep 7, 2022
d996351
rebasing fixing conflicts
publiminal Sep 7, 2022
27bb032
added styling and vars cleanup
publiminal Aug 31, 2022
5ee400f
added default info button if no received in props
publiminal Sep 2, 2022
d5cbebf
rebasing fixing conflicts
publiminal Sep 7, 2022
68df0f3
added missing semicolons. Thanks linter !
publiminal Sep 7, 2022
e9a75b5
rebasing with latest PR
publiminal Sep 7, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@
"@reduxjs/toolkit": "^1.8.2",
"antd": "^4.18.4",
"axios": "^0.21.1",
"axios-progress-bar": "^1.2.0",
"craco-less": "^1.20.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.26.1",
"js-file-download": "^0.4.12",
"plotly.js": "^1.54.6",
"react": "^16.13.1",
"react-dom": "^16.13.1",
Expand Down
313,836 changes: 313,836 additions & 0 deletions public/test-raw-data.csv

Large diffs are not rendered by default.

Binary file added public/test-raw-data.zip
Binary file not shown.
19 changes: 17 additions & 2 deletions src/components/Layout/Footer.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
import { Button, Space, Typography, Layout, Image } from 'antd';
import React from 'react';
import { Button, Space, Typography, Layout, Image } from 'antd';
import Logo from '../../styles/Images/WhiteLogo.png';
import { DownloadButton } from '../common/DownloadButton'
import '../../styles/styles.css'

const { Text } = Typography;
function FooterContent() {

const downloadBtnInfo = {
BTN_TXT:'Download all data',
MSG_LOADING:'Downloading all data...',
DOWNLOAD_TXT:'downloading CSV file',
MSG_DOWNLOAD_FINISHED:'Downloading finished',
STYLING:{background: '#404C4A', color:'#FFFFFF' , borderColor:'#8D8D99'}
}

return (
<div>
<div className='download-btn-container'>
<DownloadButton className='download-btn' downloadBtnInfo={downloadBtnInfo} />
</div>
{/*logo*/}
<div>
<Image width={100} src={Logo} preview={false} alt="HRF logo white" />
Expand Down Expand Up @@ -32,7 +47,7 @@ function FooterContent() {
function SubFooter() {
const { Footer } = Layout;
return (
<Footer style={{ backgroundColor: '#403737' }}>
<Footer style={{ backgroundColor: '#404C4A' }}>
<Space direction="horizontal">
<Button
type="text"
Expand Down
59 changes: 59 additions & 0 deletions src/components/common/DownloadButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import React, { useState } from 'react'
import { Button, message} from 'antd';
import { DownloadOutlined } from '@ant-design/icons';
import Axios from 'axios';
import { loadProgressBar } from 'axios-progress-bar'
import fileDownload from 'js-file-download';
import '../../styles/nprogress.css'
import 'antd/dist/antd.css';

const CSV_FILENAME = 'USCIS_Asylum_Data.zip';
const DEFAULT_DOWNLOAD_URL= 'http://localhost:3000/test-raw-data.zip';

const defaultInfo = {
BTN_TXT:'Download Report .csv',
MSG_LOADING:'Downloading data...',
DOWNLOAD_TXT:'downloading CSV file',
MSG_DOWNLOAD_FINISHED:'Downloading finished',
STYLING:{background: '#FD8960', color:'#FFFFFF' , borderColor:'#8D8D99'}
}

function DownloadButton(props){
const info = props.downloadBtnInfo || defaultInfo;
const { BTN_TXT, MSG_LOADING, DOWNLOAD_TXT, MSG_DOWNLOAD_FINISHED, STYLING } = info;
const [txt, setTxt] = useState(BTN_TXT);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job using a hook to update the button text. Very dynamic!

const url = process.env.REACT_APP_DOWNLOAD_RAW_CSV_DATA_URL || DEFAULT_DOWNLOAD_URL;
const STYLE = STYLING || defaultInfo.STYLING

loadProgressBar({showSpinner:false})

const downloadCsv = () => {
setTxt(DOWNLOAD_TXT);
message.loading(MSG_LOADING, 0);

Axios.get(url, {
responseType: 'blob'
}).then(res => {
message.destroy()
message.success(MSG_DOWNLOAD_FINISHED);
setTxt(BTN_TXT);
fileDownload(res.data, CSV_FILENAME);
});

}


return(
<Button
icon={<DownloadOutlined />}
type="ghost"
size="large"
onClick={() => downloadCsv()}
style={STYLE}
>{txt}
</Button>
)

}

export {DownloadButton};
73 changes: 73 additions & 0 deletions src/styles/nprogress.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/* Make clicks pass-through */
#nprogress {
pointer-events: none;
}

#nprogress .bar {
background: #29d;

position: fixed;
z-index: 1031;
top: 0;
left: 0;

width: 100%;
height: 5px;
}

/* Fancy blur effect */
#nprogress .peg {
display: block;
position: absolute;
right: 0px;
width: 100px;
height: 100%;
box-shadow: 0 0 10px #29d, 0 0 5px #29d;
opacity: 1.0;

-webkit-transform: rotate(3deg) translate(0px, -4px);
-ms-transform: rotate(3deg) translate(0px, -4px);
transform: rotate(3deg) translate(0px, -4px);
}

/* Remove these to get rid of the spinner */
#nprogress .spinner {
display: block;
position: fixed;
z-index: 1031;
top: 15px;
right: 15px;
}

#nprogress .spinner-icon {
width: 18px;
height: 18px;
box-sizing: border-box;

border: solid 2px transparent;
border-top-color: #29d;
border-left-color: #29d;
border-radius: 50%;

-webkit-animation: nprogress-spinner 400ms linear infinite;
animation: nprogress-spinner 400ms linear infinite;
}

.nprogress-custom-parent {
overflow: hidden;
position: relative;
}

.nprogress-custom-parent #nprogress .spinner,
.nprogress-custom-parent #nprogress .bar {
position: absolute;
}

@-webkit-keyframes nprogress-spinner {
0% { -webkit-transform: rotate(0deg); }
100% { -webkit-transform: rotate(360deg); }
}
@keyframes nprogress-spinner {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
10 changes: 9 additions & 1 deletion src/styles/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,12 @@ p {
p {
color: var(--primary-color-champagne)
}
*/
*/

.download-btn-container{
position: absolute;
top: 0;
right:0;
padding: 1rem;

}
22 changes: 22 additions & 0 deletions src/utils/saveVisualizations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
export const saveSvg = () => {
let getSvg = document.querySelector('.main-svg');
getSvg.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
let svgData = getSvg.outerHTML;
let svgBlob = new Blob([svgData], { type: 'image/svg+xml;charset=utf-8' });
let svgUrl = URL.createObjectURL(svgBlob);
let downloadLink = document.createElement('a');
downloadLink.href = svgUrl;
downloadLink.download = 'asylum-data';
document.body.appendChild(downloadLink);
downloadLink.click();
document.body.removeChild(downloadLink);
};

export const savePng = () => {
let ele = document
.querySelector('.svg-container')
.getElementsByClassName('modebar');
for (let i = 0; i < ele.length; i++) {
ele[i].getElementsByClassName('modebar-btn')[0].click();
}
};