3 Commits

Author SHA1 Message Date
Scott Idem
ad3b27b747 fix(badges): auto-save font sizes on adjustment
Font size changes now persist automatically (600ms debounce) without
requiring the user to find and click Lock Sizes in the collapsed Staff
section. reset_font_sizes_to_auto continues to handle its own save.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 19:37:31 -04:00
Scott Idem
15566efec1 revert(badges): remove _random workaround on badge create template ID
Per V3 convention, {obj_type}_id IS the random string — send
event_badge_template_id (not _random). The backend not saving it is
a backend bug, not a frontend concern.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 18:37:16 -04:00
Scott Idem
5e07f2822c fix(badges): send event_badge_template_id_random on badge create
The IDB stores the random string in event_badge_template_id (overwritten
by _process_generic_props). Sending this as event_badge_template_id
passed a string to an int(11) FK column — backend silently ignored it.
Using event_badge_template_id_random lets the V3 CRUD handler resolve
it to the correct integer FK.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 18:34:54 -04:00

View File

@@ -731,6 +731,34 @@ async function reset_font_sizes_to_auto() {
}
}
// --- Auto-save font sizes on change ---
// When a trusted user adjusts font sizes the change is saved automatically after a
// short debounce so they don't have to find and click "Lock Sizes" every time.
// WHY: the Lock Sizes button is in the Staff section (starts collapsed) and users
// routinely adjusted font sizes and then reloaded, losing their changes.
// reset_font_sizes_to_auto handles its own save, so we only auto-save when at
// least one size is non-null (i.e. the "reset to auto" path is excluded here).
let _font_auto_save_timer: ReturnType<typeof setTimeout> | null = null;
$effect(() => {
// Re-read the dirty+override signals inside the effect so Svelte tracks them.
const dirty = sizes_are_dirty;
const has_override = has_any_size_override;
if (!dirty || !has_override || !is_trusted || !$lq__event_badge_obj?.event_badge_id) {
return;
}
if (_font_auto_save_timer !== null) clearTimeout(_font_auto_save_timer);
_font_auto_save_timer = setTimeout(() => {
_font_auto_save_timer = null;
lock_font_sizes();
}, 600);
return () => {
if (_font_auto_save_timer !== null) {
clearTimeout(_font_auto_save_timer);
_font_auto_save_timer = null;
}
};
});
// TC modal ref for the lead scanning terms & conditions dialog
let tc_dialog_ref: HTMLDialogElement | undefined;