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

Update component library #1139

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"jest-watch-typeahead": "0.3.0",
"jwt-decode": "^2.2.0",
"lodash": "^4.17.15",
"material-table": "1.67.1",
"material-table": "1.69.0",
"mini-css-extract-plugin": "0.5.0",
"normalizr": "^3.3.0",
"optimize-css-assets-webpack-plugin": "5.0.1",
Expand Down
7 changes: 3 additions & 4 deletions app/src/App.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// TODO remove: import { ReactComponent as Logo } from '@hackoregon/component-library/assets/civic-logo-animated.svg';
// To remove the error: pseudo class ":first-child" is potentially unsafe
import * as React from 'react';
import PropTypes from 'prop-types';
import { Global, css } from '@emotion/core'; // eslint-disable-line no-unused-vars
import { connect } from 'react-redux';
import logo from './assets/icons/oae-logo-custom.svg';
import Logo from '@hackoregon/component-library/assets/civic-logo-animated.svg';
// import styles from '@hackoregon/component-library/assets/global.styles.css';
import Routes from './Pages/routes';
import FlashMessage from './components/FlashMessage/FlashMessage';
import styles from './assets/styles/global.styles';
Expand Down Expand Up @@ -39,7 +38,7 @@ class App extends React.Component {
<div css={style}>
<Global styles={styles} />
<FlashMessage />
{isLoading ? <img src={logo} alt="Logo" /> : <Routes />}
{isLoading ? <img src={Logo} alt="Logo" /> : <Routes />}
</div>
);
}
Expand Down
1 change: 1 addition & 0 deletions app/src/Pages/Home/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class HomePage extends React.Component {
}

render() {
console.log(this.props);
return <Home {...this.props} />;
}
}
Expand Down
1 change: 1 addition & 0 deletions app/src/components/Visualizations/ContributionTypePie.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { jsx } from '@emotion/core';
import PropTypes from 'prop-types';
import { PieChart } from '@hackoregon/component-library';
// import PieChart from '@hackoregon/component-library/dist/PieChart/PieChart';
import OpenElectionsVictoryTheme from './OpenElectionsVictoryTheme';

function ContributionTypePie({ data, count }) {
Expand Down
41 changes: 29 additions & 12 deletions app/src/state/ducks/publicData.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ export function getExternalPublicData() {
dispatch(actionCreators.getExternalPublicData.request());
try {
const response = await api.getExternalContributionGeoData();
console.log({ response });
dispatch(actionCreators.getExternalPublicData.success(response));
} catch (error) {
dispatch(actionCreators.getExternalPublicData.failure(error));
Expand Down Expand Up @@ -808,13 +809,17 @@ export const aggregatedDonationSize = createSelector(

export const aggregatedDonationSizeByCandidate = createSelector(
donationSizeByDonationRangeByCandidate,
candidateDonations =>
fromPairs(
candidateDonations => {
if (Object.keys(candidateDonations).length < 1) {
return [];
}
return fromPairs(
Object.entries(candidateDonations).map(entry => [
entry[0],
aggregateDonationsBySize(entry[1]),
])
)
);
}
);

// Done: count of and sum of donations for each contributor type
Expand Down Expand Up @@ -866,13 +871,17 @@ export const aggregatedContributorTypes = createSelector(

export const aggregatedContributorTypesByCandidate = createSelector(
sortedDonationsByCandidate,
candidateDonations =>
fromPairs(
candidateDonations => {
if (Object.keys(candidateDonations).length < 1) {
return [];
}
return fromPairs(
Object.entries(candidateDonations).map(entry => [
entry[0],
aggregateDonationsByContributorType(entry[1]),
])
)
);
}
);

// Done: count of and sum of donations for each contribution type
Expand Down Expand Up @@ -918,13 +927,17 @@ export const aggregatedContributionTypes = createSelector(

export const aggregatedContributionTypesByCandidate = createSelector(
sortedDonationsByCandidate,
candidateDonations =>
fromPairs(
candidateDonations => {
if (Object.keys(candidateDonations).length < 1) {
return [];
}
return fromPairs(
Object.entries(candidateDonations).map(entry => [
entry[0],
aggregateDonationsByContributionType(entry[1]),
])
)
);
}
);

// Done: count and sum of donations for each region
Expand Down Expand Up @@ -975,13 +988,17 @@ export const aggregatedContributionsByRegion = createSelector(

export const aggregatedContributionsByRegionByCandidate = createSelector(
sortedDonationsByCandidate,
candidateDonations =>
fromPairs(
candidateDonations => {
if (Object.keys(candidateDonations).length < 1) {
return [];
}
return fromPairs(
Object.entries(candidateDonations).map(entry => [
entry[0],
aggregateDonationsByRegion(entry[1]),
])
)
);
}
);

// Done: create a table that matches this format
Expand Down
Loading