Skip to content

Commit

Permalink
Refactor en.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
ArendPeter committed Dec 22, 2024
1 parent a114de7 commit 90fc2fc
Show file tree
Hide file tree
Showing 6 changed files with 508 additions and 490 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ export default () => {

whichColumns = whichColumns.map(c => ({...c, name: c.name == 'blank'? 'blank' : `${c.name}⭐`}))

return <Widget title={t(`results.column_distribution_title`)}>
<Typography variant='h6'>{t(`results.column_distribution_num_avg`, {count: Math.round(100*totalColumns / b.length)/100})}</Typography>
return <Widget title={t(`results_ext.column_distribution_title`)}>
<Typography variant='h6'>{t(`results_ext.column_distribution_num_avg`, {count: Math.round(100*totalColumns / b.length)/100})}</Typography>
<Divider/>
<Typography variant='h6'>{t(`results.column_distribution_num_title`)}</Typography>
<Typography variant='h6'>{t(`results_ext.column_distribution_num_title`)}</Typography>
<ResultsBarChart data={numColumns} xKey='count' percentage={true} sortFunc={false}/>
<Divider/>
{(race.voting_method == 'STAR' || race.voting_method == 'STAR_PR') && <>
<Typography variant='h6'>{t('results.column_distribution_which_title')}</Typography>
<Typography variant='h6'>{t('results_ext.column_distribution_which_title')}</Typography>
<ResultsBarChart data={whichColumns} xKey='count' percentage={true} sortFunc={false} percentDenominator={b.length}/>
</>}
</Widget>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ export default ({candidates=[], ranked=false} : {candidates?: Candidate[], ranke
if(m.leftVotes < m.rightVotes) losses++;
})

return <Widget title={t('results.head_to_head_title')}>
return <Widget title={t('results_ext.head_to_head_title')}>
<Select
value={refCandidateId}
label={t('results.candidateSelector')}
label={t('results_ext.candidate_selector')}
onChange={(e) => setRefCandidateId(e.target.value as string)}
>
{candidates.map((c, i) => <MenuItem value={c.candidate_id}>{c.candidate_name}</MenuItem>)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ export default () => {
})
})

return <Widget title={t(`results.name_recognition_title`)}>
<Typography variant='h6'>{t(`results.name_recognition_sub_title`)}</Typography>
return <Widget title={t(`results_ext.name_recognition_title`)}>
<Typography variant='h6'>{t(`results_ext.name_recognition_sub_title`)}</Typography>
<ResultsBarChart data={Object.values(numActive)} xKey='count' percentage={true} percentDenominator={b.length}/>
<Typography>{t(`results.name_recognition_blank_warning`)}</Typography>
<Typography>{t(`results_ext.name_recognition_blank_warning`)}</Typography>
</Widget>
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ export default () => {
)
})

return <Widget title={t(`results.score_range_title`)}>
<Typography variant='h6'>{t(`results.score_range_sub_title`)}</Typography>
return <Widget title={t(`results_ext.score_range_title`)}>
<Typography variant='h6'>{t(`results_ext.score_range_sub_title`)}</Typography>
<ResultsBarChart data={numAtDiff.reverse()} xKey='count' percentage={true} sortFunc={false}/>
<Typography sx={{'textAlign': 'left'}}>{t(`results.score_range_warning`)}</Typography>
<Typography sx={{'textAlign': 'left'}}>{t(`results_ext.score_range_warning`)}</Typography>
</Widget>
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,19 @@ export default ({topScore, frontRunners, ranked=false, candidates=undefined} : {
data.forEach(c => c.score = Math.round(100*c.score / totalTopScored)/100);
data.sort((a,b) => (ranked? 1 : -1)*(a.score-b.score));

return <Widget title={t('results.voter_profile_title')}>
return <Widget title={t('results_ext.voter_profile_title')}>
{/*<Typography>Average ballot for voters who gave</Typography>*/}
<Select
value={refCandidateId}
label={t('results.candidateSelector')}
label={t('results_ext.candidateSelector')}
onChange={(e) => setRefCandidateId(e.target.value as string)}
>
{candidates.map((c, i) => <MenuItem key={i} value={c.candidate_id}>{c.candidate_name}</MenuItem>)}
</Select>
<Divider variant='middle' sx={{width: '100%', m:3}}/>
<Typography variant='h6'>{t('results.voter_profile_count', {count: totalTopScored, name: refCandidateName})}</Typography>
<Typography variant='h6'>{t('results_ext.voter_profile_count', {count: totalTopScored, name: refCandidateName})}</Typography>
<Divider variant='middle' sx={{width: '100%', m:3}}/>
<Typography variant='h6'>{t('results.voter_profile_preferred_frontrunner', {name: refCandidateName})}</Typography>
<Typography variant='h6'>{t('results_ext.voter_profile_preferred_frontrunner', {name: refCandidateName})}</Typography>
{totalTopScored == 0 ? 'n/a' : <HeadToHeadChart
leftName={frontRunners[0].candidate_name}
rightName={frontRunners[1].candidate_name}
Expand All @@ -103,7 +103,7 @@ export default ({topScore, frontRunners, ranked=false, candidates=undefined} : {
}}
/>}
<Divider variant='middle' sx={{width: '100%', m:3}}/>
<Typography variant='h6'>{t(`results.voter_profile_average_${ranked? 'ranks' : 'scores'}`, {name: refCandidateName})}</Typography>
<Typography variant='h6'>{t(`results_ext.voter_profile_average_${ranked? 'ranks' : 'scores'}`, {name: refCandidateName})}</Typography>
{totalTopScored == 0 ? 'n/a' : <ResultsBarChart data={data} xKey='score' percentage={false} sortFunc={false}/>}
</Widget>
}
Loading

0 comments on commit 90fc2fc

Please sign in to comment.