Skip to content

Add Trash UI for restoring and purging soft-deleted snips#23

Merged
StuartMeeks merged 2 commits into
masterfrom
feat/trash-ui
May 30, 2026
Merged

Add Trash UI for restoring and purging soft-deleted snips#23
StuartMeeks merged 2 commits into
masterfrom
feat/trash-ui

Conversation

@StuartMeeks

Copy link
Copy Markdown
Owner

What

Implements the Trash UI carried-over item from TODO.md. Soft-deleted snips (IsTrash) previously vanished from every view with no way to recover or permanently remove them — soft-delete was effectively a one-way trapdoor. This adds the missing recovery surface.

Changes

  • New TrashViewModel (Core) — a cross-CLI list of trashed snips, reusing SnipCardViewModel for visual consistency. Exposes Snips, HasSnips, IsEmpty.
  • ShellViewModel gains:
    • OpenTrash() — builds and shows the trash view from the in-memory document (mirrors OpenSettings).
    • RestoreSnipCommand — clears IsTrash, returning the snip to its CLI.
    • DeleteForeverCommand — permanently removes the snip after a confirmation dialog.
    • SaveAndRefreshTrashAsync — a lighter refresh that persists and rebuilds the trash list in place, keeping the user on the Trash view. Trash actions never add/remove a CLI, so the switcher and tag list are left to refresh lazily on the next CLI selection (they already read from the updated document).
  • App (WinUI): a "Trash" entry in the pane footer (above Settings), a TrashContentTemplate with per-snip Restore / Delete-permanently actions, and a TrashViewModel case in ShellContentTemplateSelector.
  • CHANGELOG entry under [Unreleased].

Notes

  • Restore is always safe: when a CLI is deleted, its trashed snips are removed with it (existing DeleteCurrentCliAsync behaviour), so a trashed snip always still has a live parent CLI.
  • Danger-styling the "Delete permanently" button is intentionally left to the batched final UI polish pass captured on chore/todo, alongside the existing Delete-CLI danger-styling note.

Tests

  • 3 new Core tests (OpenTrash lists only trashed snips; Restore clears the flag, saves, and drops it from the view; Delete-permanently only removes when confirmed).
  • Full suite green: 123 passing.
  • WinUI head compiles clean on the Windows build agent (0 warnings, 0 errors).

🤖 Generated with Claude Code

StuartMeeks and others added 2 commits May 30, 2026 07:20
Soft-deleted snips (IsTrash) previously vanished from every view with no
way to recover or permanently remove them. Add a "Trash" pane-footer entry
that lists trashed snips across all CLIs, each with Restore (clears the
trash flag, returning the snip to its CLI) and Delete permanently (removes
it from the store after confirmation).

Trash actions don't add or remove a CLI, so they persist and rebuild the
Trash list in place via SaveAndRefreshTrashAsync rather than the full
SaveAndRefreshAsync — keeping the user on the Trash view. The CLI switcher
and tag list refresh lazily on next CLI selection, which already reads the
updated document.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
SaveAndRefreshTrashAsync persisted the document and rebuilt the Trash list
but left the pane tag list for the currently-selected CLI stale: a restore
could surface a tag no visible snip had, and a purge could orphan one, with
the stale list staying on screen until the user switched CLIs and back.
Rebuild the tags in place (suppressing the content swap a tag change would
trigger) so the pane stays accurate while the user remains on the Trash view.

Found by codex review.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@StuartMeeks StuartMeeks merged commit f44f306 into master May 30, 2026
4 checks passed
@StuartMeeks StuartMeeks deleted the feat/trash-ui branch May 30, 2026 07:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant