feat(badges): goto() after print with per-device fallback toggle

Switch post-print navigation from window.location.href to goto() for
faster SvelteKit client-side transition back to Badge Search (no full
reload). A nav_to_badges() helper in print controls branches on
badges_loc.print_nav_use_goto (default true).

Badges Config page gains a "Local Device Settings" section with a
checkbox to disable goto() and fall back to hard reload — stored in
localStorage per browser, not synced to the event. Useful as an
on-site escape hatch without a code deploy.

Also fixes the Templates button on the config page: adds the standard
border border-surface-300-700 so it looks like a button.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Scott Idem
2026-06-08 20:28:33 -04:00
parent 55f3e3a5a4
commit cc04411d23
3 changed files with 58 additions and 7 deletions

View File

@@ -138,6 +138,10 @@ export interface BadgesLocState {
trusted_search_min_chars: number;
// Timestamp when the remote config was last mirrored locally
remote_cfg_last_synced_on: string | null;
// After-print navigation method. true (default) = SvelteKit goto() — faster, no full reload.
// false = window.location.href — full page reload, use as a fallback if goto causes issues.
// Per-device: stored in localStorage, not synced to the event config.
print_nav_use_goto: boolean;
}
export interface BadgesSessState {
@@ -203,7 +207,8 @@ export const badges_loc_defaults: BadgesLocState = {
auth_search_min_chars: 2,
trusted_search_result_limit: 150,
trusted_search_min_chars: 1,
remote_cfg_last_synced_on: null
remote_cfg_last_synced_on: null,
print_nav_use_goto: true
};
// In-memory badge state — resets on page load.