Merge remote-tracking branch 'origin/main' into claim-ux-kept-link
# Conflicts: # internal/console/static/demo_claim.js # internal/console/templates/demo_claim.html
2 files changed,
+17
−2
internal/console/static/demo_claim.js+16 −1internal/console/templates/demo_claim.html+1 −1
CI cancelled — superseded by a newer push — run details
Intent
Attributed to this commit: 28.8 g CO₂e (3,588,011 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on claim-ux-kept-link, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.
diff --git a/internal/console/static/demo_claim.js b/internal/console/static/demo_claim.js| index 89599bd82..4c64f6951 100644 |
| --- a/internal/console/static/demo_claim.js |
| +++ b/internal/console/static/demo_claim.js |
| @@ -23,13 +23,28 @@ |
| claim.dataset.state = "missing"; |
| opening.hidden = false; |
| } |
| + // One guard for the page: two forms (the code and a different address) |
| + // must not both go inside the working window. |
| + let submitted = false; |
| + const working = []; |
| + addEventListener("pageshow", event => { |
| + if (!event.persisted) return; |
| + submitted = false; |
| + for (const [button, label] of working) { |
| + button.disabled = false; |
| + button.classList.remove("is-working"); |
| + button.removeAttribute("aria-busy"); |
| + button.textContent = label; |
| + } |
| + working.length = 0; |
| + }); |
| for (const form of document.querySelectorAll("#claim form")) { |
| - let submitted = false; |
| form.addEventListener("submit", async event => { |
| event.preventDefault(); |
| if (submitted) return; |
| submitted = true; |
| for (const button of form.querySelectorAll('button[type="submit"]')) { |
| + working.push([button, button.textContent]); |
| button.disabled = true; |
| button.classList.add("is-working"); |
| button.setAttribute("aria-busy", "true"); |
diff --git a/internal/console/templates/demo_claim.html b/internal/console/templates/demo_claim.html| index a387d1d34..ef0df559c 100644 |
| --- a/internal/console/templates/demo_claim.html |
| +++ b/internal/console/templates/demo_claim.html |
| @@ -145,7 +145,7 @@ |
| <span class="claim-life"><svg class="claim-clock" viewBox="0 0 16 16" aria-hidden="true"><circle cx="8" cy="8" r="6"/><path class="claim-hands" d="M8 4v4l3 2"/><path class="claim-tick" d="M4 8l3 3 5-6"/></svg><time class="claim-old" datetime="{{.EndTime}}" title="{{.EndTime}}">{{.TimeLeft}}</time><span class="claim-new">{{.Copy.done}}</span></span></div> |
| <span class="claim-burst" aria-hidden="true"><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i></span> |
| </div>{{end}} |
| -<h1 id="claim-heading">{{if eq .State "claimed"}}{{.Copy.completeHeading}}{{else if eq .State "stopping"}}{{.Copy.failureHeading}}{{else if .EmailPending}}{{.Copy.codeHeading}}{{else if and .Address (gt .Eligible 1)}}{{.Copy.accountsHeading}}{{else if eq .State "proof"}}{{.Copy.heading}}{{else}}{{.Copy.title}}{{end}}</h1> |
| +<h1 id="claim-heading">{{if eq .State "claimed"}}{{.Copy.completeHeading}}{{else if or (eq .State "stopping") (eq .State "aborted")}}{{.Copy.failureHeading}}{{else if .EmailPending}}{{.Copy.codeHeading}}{{else if and .Address (gt .Eligible 1)}}{{.Copy.accountsHeading}}{{else if eq .State "proof"}}{{.Copy.heading}}{{else}}{{.Copy.title}}{{end}}</h1> |
| {{if .Error}}<p role="alert">{{.Error}}</p><p><a href="/demo/claim">{{.Copy.back}}</a></p>{{end}} |
| {{if eq .State "no_accounts"}}<p>{{.Copy.identity}} <strong>{{.Address}}</strong></p><p>{{.Copy.noAccounts}}</p> |
| <fieldset class="claim-unavailable"><legend>{{.Copy.accountsLabel}}</legend>{{range .Accounts}}{{template "claim_card" .}}{{end}}</fieldset>{{end}} |