Improve admin UX with confirmations and fix analytics edge cases - #6
Merged
Conversation
…cs dedupe, and polish Functional bugs: - FileForm: add missing `bind:this` on the file input. Without it the "Choose a file" button was a no-op (only the field label and drag-drop worked) and the remove button couldn't clear the native input, so a "removed" file was still uploaded on submit. - IdentityForm: the quick-links hint described the wrong field order (icon | label | url) and the wrong destination (:::links buttons). The field parses label | href | icon and feeds the share card and JSON-LD, not the on-page link buttons. Corrected the hint. - PasteForm: the character counter was bound to a derived prop, so it froze at the initial length while typing. Bind the textarea to local state (re-seeded on selection change via untrack) so it counts live. - analytics/beacon: the visitor-identity migration (UPDATE onto the visitors PK) could collide when the page's deferred track() write landed after the beacon, aborting the batch and dropping the fingerprint cookie. Switch to UPDATE OR IGNORE plus a purge of leftover rows, and stop the batch failure from failing the beacon. Adds a regression test. Polish: - Analytics: title-case device labels (Mobile/Desktop/Bot) to match the lists beside them. - Download page: stop printing the file size twice. - w.js: the contribution-graph wheel handler no longer traps page scroll at the pan's edges (releases the wheel when the pan can't move). - Consistent delete confirmation on link, paste, and file deletes. - Button: an `<a>` variant now drops its href and stops taking focus/clicks when busy or disabled. - imageKeysIn: match the `[\w.-]` key characters the renderer accepts so a manually-written key isn't GC'd out from under a live document. - Refresh two stale nav comments. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DwxzS8U3YVf6NyDqSaHsAE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR improves the admin interface with user confirmations for destructive actions and fixes several edge cases in analytics tracking and UI behavior.
Key Changes
Admin Delete Confirmations
confirmDeletesubmit functions across multiple formsAnalytics Tracking Fixes
track()write could land after beacon, creating duplicate visitor rowsPURGE_VISITORstatement to clean up rows that couldn't be migrated due to existing fingerprint identityUPDATE OR IGNOREto gracefully handle conflictsUI/UX Improvements
untrackto prevent unwanted resets during typingDocumentation & Validation
Notable Implementation Details
The analytics fix uses a three-statement batch: migrate old identity to fingerprint identity, purge any rows that couldn't migrate, then ensure home row exists. This handles the case where the fingerprint identity already has a row for the same (day, slug) pair, which would normally cause a primary key conflict.
The paste form body field uses Svelte's
untrackto prevent the derived initial value from resetting the body on every keystroke while still allowing it to seed when the selected paste changes.https://claude.ai/code/session_01DwxzS8U3YVf6NyDqSaHsAE