Skip to content

Commit

Permalink
prep-125 totals filter
Browse files Browse the repository at this point in the history
Totals now change with date filters.
  • Loading branch information
MikeYalter committed Jul 30, 2018
1 parent 531cc26 commit 78dfa41
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/components/landingPage/styles/style-landingPage.scss
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
}

.content {
min-height: 608px;
min-height: 400px;
width: 100%;
display: flex;
align-items: center;
Expand Down
6 changes: 5 additions & 1 deletion app/components/publisherPage/components/checksSection.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export default class ChecksSection extends React.Component {
coverage: is.object.isRequired,
memberId: is.string.isRequired,
loadingChecks: is.bool.isRequired,
setTotals: is.func.isRequired,
totals: is.object.isRequired
}


Expand Down Expand Up @@ -165,6 +167,7 @@ export default class ChecksSection extends React.Component {
keySig: this.generateKey(prevState.contentFilter, filterName, prevState.titleFilter),
filterError: !r.message.Coverage.length
}))
this.props.setTotals(r.message.totals)
})
.catch( e => {
console.error(e)
Expand All @@ -178,7 +181,7 @@ export default class ChecksSection extends React.Component {
.then( r => r.json())
.then( r => {
clearTimeout(this.loadingTimeout)

this.props.setTotals(r.message.totals)
this.setState( prevState => {
const newState = {dateChecksData: r.message.Coverage}

Expand Down Expand Up @@ -213,6 +216,7 @@ export default class ChecksSection extends React.Component {

} else {
clearTimeout(this.loadingTimeout)
this.props.setTotals(this.props.totals)
this.setState( prevState => ({
dateChecksData: undefined,
loadingFilter: false,
Expand Down
13 changes: 10 additions & 3 deletions app/components/publisherPage/publisherPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export default class PublisherPage extends React.Component {

state = {
totals: {},
allTotals:{},
coverage: {},
loadingChecks: true,
publisherName:""
Expand All @@ -51,13 +52,17 @@ export default class PublisherPage extends React.Component {
componentDidMount () {
fetch(`${deployConfig.apiBaseUrl}?op=participation-summary&memberid=${this.props.match.params.memberId}`)
.then( r => r.json())
.then( r => this.setState({totals: r.message.totals, coverage: r.message.Coverage, loadingChecks: false}))
.then( r => this.setState({allTotals: r.message.totals, coverage: r.message.Coverage, loadingChecks: false}))
.catch( e =>{
console.error(e)
this.setState({loadingChecks: false})
})
}

reloadTotals = (filterTotals) => {
this.setState( prevState => prevState.totals === filterTotals ? null : {totals: filterTotals})
}


render() {
const totals = this.state.totals
Expand Down Expand Up @@ -112,8 +117,10 @@ export default class PublisherPage extends React.Component {
coverage={this.state.coverage}
memberId={this.props.match.params.memberId}
tutorialOverlay={this.state.tutorialOverlay}
loadingChecks={this.state.loadingChecks}/>

loadingChecks={this.state.loadingChecks}
totals={this.state.allTotals}
setTotals={this.reloadTotals}/>

</div>

</div>
Expand Down

0 comments on commit 78dfa41

Please sign in to comment.