Compare commits

...
Author SHA1 Message Date
shadowdaoandClaude Sonnet 5.5 55d1c34b1f Donate form: remove the form after a successful donation until page reload
Test and Release / test (push) Successful in 1m27s
Test and Release / release (push) Successful in 6s
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0185ukXhhC8xipsBR7e3o76i
2026-11-16 08:25:05 -08:00
shadowdaoandClaude Sonnet 5.5 565ee0a352 Donate form: show a clear thank-you panel after a successful donation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0185ukXhhC8xipsBR7e3o76i
2026-11-16 08:21:20 -08:00
2 changed files with 18 additions and 1 deletions

No files matched your search

+4
View File
@@ -53,3 +53,7 @@
.sg-donate .sg-progress [hidden]{display:none}
.sg-donate.sg-progress-only .sg-progress{margin-bottom:0}
@media (prefers-reduced-motion:reduce){.sg-donate .sg-progress-fill{transition:none}}
.sg-donate .sg-thanks{margin:.5rem 0 0;padding:1.1rem 1rem;border:1px solid rgba(26,127,55,.55);border-left-width:4px;border-radius:.4rem;text-align:center}
.sg-donate .sg-thanks:focus{outline:0}
.sg-donate .sg-thanks-title{margin:0;font-size:1.15em;font-weight:700;line-height:1.4;overflow-wrap:anywhere}
.sg-donate [hidden]{display:none!important}
+14 -1
View File
@@ -262,6 +262,18 @@
};
}
// Replace the form with a confirmation (keeps the progress bar). No way back until the page is reloaded,
// so the donor does not pay twice thinking it failed.
function showThanks(text) {
state.renderToken++;
Array.prototype.forEach.call(root.children, function (n) { if (n !== barBox) { n.hidden = true; } });
var panel = el('div', { 'class': 'sg-thanks', role: 'status', tabindex: '-1' }, [
el('p', { 'class': 'sg-thanks-title', text: text })
]);
root.appendChild(panel);
try { panel.focus(); panel.scrollIntoView({ block: 'nearest', behavior: 'smooth' }); } catch (e) { /* ignore */ }
}
function renderButtons() {
var token = ++state.renderToken;
buttons.textContent = '';
@@ -277,7 +289,8 @@
},
onApprove: function (data) {
return api('/orders/' + encodeURIComponent(data.orderID) + '/capture', { method: 'POST' }).then(function (r) {
say(r.status === 'completed' ? T.thanks : T.processing, 'sg-ok');
say('');
showThanks(r.status === 'completed' ? T.thanks : T.processing);
afterDonation();
});
},