Skip to content

Commit

Permalink
Alterando texto no caso sem creches
Browse files Browse the repository at this point in the history
Como parte da issue prefeiturasp#21, ficou decidido que não bastava informar que existiam 0 creches e era necessário exibir um texto especial para este caso. Essa issue faz tal coisa.
  • Loading branch information
victorsenam committed Sep 18, 2018
1 parent ec9cc7f commit 8555b23
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/configs/Strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ export default {
},
results: {
total_wait_message: function (waitListTotal, groupName, numberOfSchools, address) {
if (!numberOfSchools) return `Não há creches perto de ${address}.`;
return `Há ${waitListTotal} crianças na fila do ${groupName} a serem distribuídas nas ${numberOfSchools} creches perto de ${address}.`;
},
title_wait_message: function (waitListTotal, numberOfSchools) {
if (!numberOfSchools) return `Não há creches próximas a este endereço.`;
return `Há ${waitListTotal} crianças na fila de espera destas ${numberOfSchools} creches`;
},
data_updated_at: function (updatedAt) {
Expand Down
14 changes: 11 additions & 3 deletions src/containers/Results/Results.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class Results extends React.Component {
render() {
const schoolsNearby = this.state.schoolsNearby ? this.state.schoolsNearby : false;
const numberOfSchools = this.state.schoolsNearby ? this.state.schoolsNearby.length : false;
const waitListTotal = this.state.waitListTotal ? this.state.waitListTotal : 0;
const waitListTotal = this.state.waitListTotal ? this.state.waitListTotal : false;
return (
<div>
<BackButton />
Expand All @@ -67,9 +67,17 @@ export class Results extends React.Component {
/>}
{this.state.waitListLoaded && <Banner
title={STRINGS.results.title_wait_message(waitListTotal, numberOfSchools)}
paragraphs={[STRINGS.results.total_wait_message(waitListTotal, this.state.groupName, numberOfSchools, this.state.geocodedAddress), STRINGS.results.data_updated_at(this.state.waitListUpdatedAt), STRINGS.results.see_list_below]}
paragraphs={[
STRINGS.results.total_wait_message(waitListTotal, this.state.groupName, numberOfSchools, this.state.geocodedAddress),
STRINGS.results.data_updated_at(this.state.waitListUpdatedAt),
numberOfSchools ? STRINGS.results.see_list_below : null,
]}
/>}
{this.state.waitListLoaded && <SchoolList schools={schoolsNearby} groupName={this.state.groupName} groupCode={this.state.groupCode} />}
{this.state.waitListLoaded && numberOfSchools ? <SchoolList
schools={schoolsNearby}
groupName={this.state.groupName}
groupCode={this.state.groupCode}
/> : null}
{this.state.waitListLoaded && <Banner
title={STRINGS.actions.can_do}
/>}
Expand Down

0 comments on commit 8555b23

Please sign in to comment.