translate the rest of puzzle storm - closes #8014

prod-hotfix
Thibault Duplessis 2021-01-27 22:16:20 +01:00
parent e708462b73
commit 0c3f48921a
5 changed files with 65 additions and 24 deletions

View File

@ -38,8 +38,8 @@ object storm {
high map { h =>
frag(
div(cls := "storm-play-scores")(
span("Puzzle storm highscores"),
a(href := routes.Storm.dashboard())("View best runs »")
span(trans.storm.puzzleStormHighscores()),
a(href := routes.Storm.dashboard())(trans.storm.viewBestRuns(), " »")
),
div(cls := "storm-dashboard__high__periods")(
renderHigh(h)
@ -76,7 +76,7 @@ object storm {
)(
main(cls := "storm-dashboard page-small")(
div(cls := "storm-dashboard__high box box-pad")(
h1("Puzzle Storm highscores"),
h1(trans.storm.puzzleStormHighscores()),
div(cls := "storm-dashboard__high__periods highlight-alltime")(
renderHigh(high)
)
@ -86,14 +86,14 @@ object storm {
table(cls := "slist slist-pad")(
thead(
tr(
th("Best run of day"),
th("Score"),
th("Moves"),
th("Accuracy"),
th("Combo"),
th("Time"),
th("Highest solved"),
th("Runs")
th(trans.storm.bestRunOfDay()),
th(trans.storm.score()),
th(trans.storm.moves()),
th(trans.storm.accuracy()),
th(trans.storm.combo()),
th(trans.storm.time()),
th(trans.storm.highestSolved()),
th(trans.storm.runs())
)
),
tbody(
@ -126,7 +126,19 @@ object storm {
t.newMonthlyHighscore,
t.newAllTimeHighscore,
t.previousHighscoreWasX,
t.playAgain
t.playAgain,
t.score,
t.moves,
t.accuracy,
t.combo,
t.time,
t.timePerMove,
t.highestSolved,
t.puzzlesPlayed,
t.newRun,
t.endRun,
t.puzzleStormHighscores,
t.viewBestRuns
).map(_.key)
}
}

View File

@ -1982,6 +1982,20 @@ val `newAllTimeHighscore` = new I18nKey("storm:newAllTimeHighscore")
val `previousHighscoreWasX` = new I18nKey("storm:previousHighscoreWasX")
val `playAgain` = new I18nKey("storm:playAgain")
val `highscoreX` = new I18nKey("storm:highscoreX")
val `score` = new I18nKey("storm:score")
val `moves` = new I18nKey("storm:moves")
val `accuracy` = new I18nKey("storm:accuracy")
val `combo` = new I18nKey("storm:combo")
val `time` = new I18nKey("storm:time")
val `timePerMove` = new I18nKey("storm:timePerMove")
val `highestSolved` = new I18nKey("storm:highestSolved")
val `puzzlesPlayed` = new I18nKey("storm:puzzlesPlayed")
val `newRun` = new I18nKey("storm:newRun")
val `endRun` = new I18nKey("storm:endRun")
val `puzzleStormHighscores` = new I18nKey("storm:puzzleStormHighscores")
val `viewBestRuns` = new I18nKey("storm:viewBestRuns")
val `bestRunOfDay` = new I18nKey("storm:bestRunOfDay")
val `runs` = new I18nKey("storm:runs")
val `xRuns` = new I18nKey("storm:xRuns")
val `playedNbRunsOfPuzzleStorm` = new I18nKey("storm:playedNbRunsOfPuzzleStorm")
}

View File

@ -17,4 +17,18 @@
<item quantity="other">Played %1$s runs of %2$s</item>
</plurals>
<string name="highscoreX">Highscore: %s</string>
<string name="score">Score</string>
<string name="moves">Moves</string>
<string name="accuracy">Accuracy</string>
<string name="combo">Combo</string>
<string name="time">Time</string>
<string name="timePerMove">Time per move</string>
<string name="highestSolved">Highest solved</string>
<string name="puzzlesPlayed">Puzzles played</string>
<string name="newRun">New run (hotkey: Space)</string>
<string name="endRun">End run (hotkey: Enter)</string>
<string name="puzzleStormHighscores">Puzzle storm highscores</string>
<string name="viewBestRuns">View best runs</string>
<string name="bestRunOfDay">Best run of day</string>
<string name="runs">Runs</string>
</resources>

View File

@ -24,12 +24,13 @@ const renderSummary = (ctrl: StormCtrl): VNode[] => {
const run = ctrl.runStats();
const high = ctrl.vm.run.response?.newHigh;
const accuracy = 100 * (run.moves - run.errors) / run.moves;
const noarg = ctrl.trans.noarg;
return [
...(high ? [
h('div.storm--end__high.storm--end__high-daily.bar-glider',
h('div.storm--end__high__content', [
h('div.storm--end__high__text', [
h('strong', ctrl.trans(newHighI18n[high.key])),
h('strong', noarg(newHighI18n[high.key])),
high.prev ? h('span', ctrl.trans('previousHighscoreWasX', high.prev)) : null
])
])
@ -38,33 +39,33 @@ const renderSummary = (ctrl: StormCtrl): VNode[] => {
h('span.storm--end__score__number', {
hook: onInsert(el => numberSpread(el, run.score, Math.round(run.score * 50), 0)(run.score))
}, '0'),
h('p', ctrl.trans('puzzlesSolved'))
h('p', noarg('puzzlesSolved'))
]),
h('div.storm--end__stats.box.box-pad', [
h('table.slist', [
h('tbody', [
h('tr', [
h('th', 'Moves played'),
h('th', noarg('moves')),
h('td', h('number', run.moves))
]),
h('tr', [
h('th', 'Accuracy'),
h('th', noarg('accuracy')),
h('td', [h('number', Number(accuracy).toFixed(1)), '%'])
]),
h('tr', [
h('th', 'Best combo'),
h('th', noarg('combo')),
h('td', h('number', ctrl.vm.comboBest))
]),
h('tr', [
h('th', 'Total time'),
h('th', noarg('time')),
h('td', [h('number', Math.round(run.time)), 's'])
]),
h('tr', [
h('th', 'Time per move'),
h('th', noarg('timePerMove')),
h('td', [h('number', Number(run.time / run.moves).toFixed(2)), 's'])
]),
h('tr', [
h('th', 'Highest solved'),
h('th', noarg('highestSolved')),
h('td', h('number', run.highest))
])
])
@ -72,13 +73,13 @@ const renderSummary = (ctrl: StormCtrl): VNode[] => {
]),
h('a.storm-play-again.button', {
attrs: ctrl.vm.run.endAt! < getNow() - 900 ? { href: '/storm' } : {}
}, ctrl.trans('playAgain'))
}, noarg('playAgain'))
];
}
const renderHistory = (ctrl: StormCtrl): VNode =>
h('div.storm--end__history.box.box-pad', [
h('h2', 'Puzzles played'),
h('h2', ctrl.trans('puzzlesPlayed')),
h('div.storm--end__history__rounds',
ctrl.vm.history.map(round =>
h('div.storm--end__history__round', [

View File

@ -48,13 +48,13 @@ const renderControls = (ctrl: StormCtrl): VNode =>
attrs: {
href: '/storm',
'data-icon': 'B',
title: 'New run (hotkey: Space)'
title: ctrl.trans('newRun')
}
}),
h('a.storm__control__end.button.button-empty', {
attrs: {
'data-icon': 'b',
title: 'End run (hotkey: Enter)',
title: ctrl.trans('endRun'),
},
hook: onInsert(el => el.addEventListener('click', ctrl.end))
})