d39d69e52c43c5df47fed48f0f70473988bde93c

Author
TheEdgeOfRage <git@theedgeofrage.com>
Committer
TheEdgeOfRage <git@theedgeofrage.com>
Date

Message

Show last song's result on the final screen

The gameover screen previously replaced the per-song result on the last
round, so the player never saw how their final guess scored. Extract the
result content into a reusable resultBody partial and render it above the
final score when a result is present, so the end screen shows both.

Diff

 1diff --git a/web/static/style.css b/web/static/style.css
 2index 879f538357700c1eaa949d85235674f5544334bf..1fe709ea0fd0901c009710e2e993c897cec8743a 100644
 3--- a/web/static/style.css
 4+++ b/web/static/style.css
 5@@ -136,20 +136,16 @@ button:active { transform: translateY(1px); }
 6 .hinted { color: var(--orange); font-size: 0.85rem; }
 7 
 8 /* Game over */
 9-.gameover {
10+.final-sep { border: none; border-top: 1px solid var(--line); margin: 18px 0; }
11+.final-wrap {
12   display: flex;
13   flex-direction: column;
14   align-items: center;
15-  gap: 10px;
16-  padding: 20px 0;
17+  gap: 12px;
18   text-align: center;
19+  margin-top: 4px;
20 }
21-.final-score {
22-  font-size: 3.6rem;
23-  font-weight: 700;
24-  color: var(--accent);
25-  line-height: 1;
26-}
27+.final-score { font-size: 3.4rem; font-weight: 700; color: var(--accent); line-height: 1; }
28 .final-sub { color: var(--dim); margin: 0; }
29 
30 /* Round progress dots */
31diff --git a/web/templates/gameover.html b/web/templates/gameover.html
32index 202814264b79f4591523c586df1cbb385b76fc2c..683b8a7652999d61d40aadf9971620029939ef34 100644
33--- a/web/templates/gameover.html
34+++ b/web/templates/gameover.html
35@@ -1,5 +1,6 @@
36 {{define "gameover"}}
37-<div class="gameover">
38+{{if .Result}}{{template "resultBody" .}}<hr class="final-sep">{{end}}
39+<div class="final-wrap">
40   <div class="final-score">{{.Score}}</div>
41   <p class="final-sub">out of {{.MaxScore}} points</p>
42   <button hx-post="/restart" hx-target="#game" hx-swap="innerHTML">Play again</button>
43diff --git a/web/templates/result.html b/web/templates/result.html
44index 533d647b592f5828d99b3ab31af3a315b1000e7d..a58528f3be472e0cad8de820c51d0dcd9958c927 100644
45--- a/web/templates/result.html
46+++ b/web/templates/result.html
47@@ -1,6 +1,6 @@
48-{{define "result"}}
49+{{define "resultBody"}}
50 <div class="result">
51-  <div class="result-summary {{.ResultTone}}">{{.ResultMark}} {{.Result.ResultMsg}}</div>
52+  <div class="result-summary {{.ResultTone}}">{{if .ResultMark}}{{.ResultMark}} {{end}}{{.Result.ResultMsg}}</div>
53   <div class="field-rows">
54     {{range .Fields}}
55     <div class="frow">
56@@ -12,9 +12,9 @@
57   </div>
58   {{if .Result.Hinted}}<div class="hinted">Hint used · points halved</div>{{end}}
59 </div>
60-{{if .Done}}
61-<button hx-post="/restart" hx-target="#game" hx-swap="innerHTML">Play again</button>
62-{{else}}
63-<button hx-get="/next" hx-target="#game" hx-swap="innerHTML">Next song</button>
64 {{end}}
65+
66+{{define "result"}}
67+{{template "resultBody" .}}
68+<button hx-get="/next" hx-target="#game" hx-swap="innerHTML">Next song</button>
69 {{end}}