generated from BloomTech-Labs/labs-spa-starter
-
Notifications
You must be signed in to change notification settings - Fork 3
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
publiminal
wants to merge
103
commits into
main
Choose a base branch
from
BL-823_fe_i_want_export_raw-data
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 9 commits
Commits
Show all changes
103 commits
Select commit
Hold shift + click to select a range
b0011b4
init button scafolding
publiminal 16b0f36
added test raw data fileg
publiminal 42a7cab
addedd Downloadbutton as component
publiminal fd4bfb6
added main download functionality . POC succeded
publiminal 86c35b6
added ~axios-progress-bar and js-file-download libs
publiminal 243cd8d
added styling and vars cleanup
publiminal 8d18a69
added default info button if no received in props
publiminal b60cbd2
updated styles to be overwritten out of component
publiminal c4bc8b7
BL-821 added visualization download functionality
Austin-T-Johnson 7ec0b8f
added missing semicolons. Thanks linter !
publiminal de1de7a
removed unsused raw .csv file. For local testing purposes use .zip fi…
publiminal 5897b9c
initial replacement of files in DataVisualizations
mack-gallagher 470ecb2
rethink folder structure
mack-gallagher cfec9e3
begin routing
mack-gallagher 62a16de
basic routing between HeatMap components
mack-gallagher 1ca5a62
clarify ViewSelect
mack-gallagher 2c93444
fix nested routing
mack-gallagher d156bf7
skeleton layout
mack-gallagher 9662d81
drop-down menu to select office
mack-gallagher 2b3b1c2
fix bug where office heatmap view would be shown within single office…
mack-gallagher 54d2b27
change drop-down to be ant design style
mack-gallagher 60e9f47
continue Ant Design makeover
mack-gallagher e954b54
update single office citizenship heatmap display to display office name
mack-gallagher 989ab62
LAST COMMIT BEFORE INSTALLING CORS TO TEST LOCALLY IN CASE THAT'S A P…
mack-gallagher 6aa6358
preliminary state management and form validation
mack-gallagher 6fda4a2
final commit before testing Plotly
mack-gallagher a248cf2
final commit before checking out main
mack-gallagher 6f12b21
add chloropleth
mack-gallagher 3ae59e1
checking out main
mack-gallagher 5f4982d
add message explaining seemingly unnecessary switch statements in viz…
mack-gallagher d58f113
change 'heatmaps' route to 'graphs'
mack-gallagher 0775acf
fix office heat map display to render data from 'API' correctly
mack-gallagher 5707382
start on new Tables components
mack-gallagher 9262ee1
remove Tables directory
mack-gallagher bd44459
introduce first code for year limits slider
mack-gallagher cb75133
fix alignment of year limits slider [ still buggy and unwired ]
mack-gallagher f9179ee
move massive view-dependent API data filtering function, up from Year…
mack-gallagher cf3d9f3
final commit before starting draft PR [?]
mack-gallagher fca019c
clean up styling and make year limits slider reflect text entry
mack-gallagher 8b09d3c
final commit before another attempt to push to remote repo
mack-gallagher 3a09597
import internal test data, external mock test data server now obsolete
mack-gallagher 8eeb6ba
remove all code relating to old Table display
mack-gallagher e9eaa82
remove unused navbar items
mack-gallagher 017bdd2
simplify layout drastically, remove unused AdvancedApiFilter directories
mack-gallagher 2b17cd7
initial Ant Design header with routing to Landing and Graphs pages
mack-gallagher 93f1c7b
final commit before attempted merge with eric's branch
mack-gallagher 71e5b59
created world scope drop down llist for all citizenship maps
Epeng1994 f48fe77
update style of header to match footer
mack-gallagher 25c12a6
added titles to x&y axis, adjusted colorscale on citizenship map
Epeng1994 343cccd
truncate decimals from 'API' data
mack-gallagher 96480b4
reinstate Layout directory
mack-gallagher 7f872e8
removed some extraneous imports
Epeng1994 370da7a
test fast-forwarding [?]
mack-gallagher 4a2bcaf
add .gitignore changes before rebase
mack-gallagher 1fad171
condensed time-seriesAll APIDATA function, modified time-series all c…
Epeng1994 9a36175
add filled-in middle to year limits select slider
mack-gallagher 5d76429
preliminary graying out of all colors to match Landing page
mack-gallagher 50f53ef
clean up styling of year limits slider
mack-gallagher 8a93da3
adjusted filter function
Epeng1994 fb56fc3
comments on api filter
Epeng1994 f714da2
condensed, updated officeHeatMapAll
Epeng1994 0ae0a6b
remove old console.log()s
mack-gallagher 402e89b
change 'Office Heat Map' button to say 'Offices Heat Map'
mack-gallagher 5b601d4
briefen interval by which Year Limits Select form text input fields c…
mack-gallagher 6b05c0e
condensed citizhenshipMapAll filter
Epeng1994 5d6b0db
condensed timeSeriesSingleOffice filter and component
Epeng1994 1ab035a
condensed singleCitizenshipmap filter and component
Epeng1994 97e9abf
removed more unused variables, adjusted currentYear for initial state
Epeng1994 417f8b0
fix background color of single-office citizenship map
mack-gallagher 622b4a5
remove .prettierignore from .gitignore
mack-gallagher 18bbacd
remove unnecessary color variables that were destructured in Citizens…
mack-gallagher bfbf96e
fix outstanding warnings from linter
mack-gallagher b0d0671
fix slider elements to respond properly to horizontal scroll
mack-gallagher f0bc6f2
replace repetitive JSX in Footer.jsx with a .map()
mack-gallagher e7ab5ac
remove extraneous '/' in HRF site links
mack-gallagher 8e73686
add all-office time series display as default for base '/graphs' rout…
mack-gallagher 6395f30
add mock query params to mock-axios calls to demo eventual API function
mack-gallagher 97123c5
add comments explaining production API calls
mack-gallagher 8fb1795
repurposed rowdata in graphs from hasProperty to useState,useEffect
Epeng1994 92d6ad6
rough draft of landing page
Austin-T-Johnson fb31677
adds link to external page via read more button
Austin-T-Johnson c8fc0f4
adds iPhone SE mobile styling
Austin-T-Johnson 131bd55
adds ant d button component to landing page, changes styling in footer
Austin-T-Johnson adf3e5c
adds media queries
Austin-T-Johnson ee8e5d5
fixes mobile-large media query
Austin-T-Johnson a8ca7a4
fixes mobile-large media query
Austin-T-Johnson 71766ae
removes unwanted commented out code
Austin-T-Johnson a4dc95e
rough draft of landing page
Austin-T-Johnson 4ec9ab3
adds link to external page via read more button
Austin-T-Johnson 265a038
adds iPhone SE mobile styling
Austin-T-Johnson a7553dd
adds ant d button component to landing page, changes styling in footer
Austin-T-Johnson 98afa82
adds media queries
Austin-T-Johnson 2ac3360
fixes mobile-large media query
Austin-T-Johnson 2f9691a
fixes mobile-large media query
Austin-T-Johnson 47f1d7f
add meta tags in index
sim-taa 2a5836d
adds xml sitemap for SEO purposes.
sim-taa 28b81c7
rebasing fixing conflicts
publiminal d996351
rebasing fixing conflicts
publiminal 27bb032
added styling and vars cleanup
publiminal 5ee400f
added default info button if no received in props
publiminal d5cbebf
rebasing fixing conflicts
publiminal 68df0f3
added missing semicolons. Thanks linter !
publiminal e9a75b5
rebasing with latest PR
publiminal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
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}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
}; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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!