From 5d5012c0f7d04daee57b5351a64515bcd212d192 Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Sun, 1 Mar 2026 21:00:07 -0500 Subject: [PATCH] feat(templates): add collection modals for create/edit/restore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add two new template components: 1. CollectionModal(collection CollectionData) - Reusable modal for both creating and editing collections - When collection.ID is empty: shows "Create Collection" form - When collection.ID is set: shows "Edit Collection" form with pre-filled data - Features: * Name and description fields * Icon picker with search input and emoji grid (grid populated dynamically by JavaScript) (supports typing emoji directly or searching by keywords) * Color selection buttons (blue/red/yellow/green/purple) * HTMX form submission (hx-post for create, hx-put for update) - HX-Redirect to /collections after successful submission 2. RestoreSystemCollectionModal() - Modal for restoring deleted system collections - Dropdown with options: Continue Reading, Recently Added, Recently Read, Not Started - HTMX form submission to /api/dashboard/restore-system-collection - HX-Redirect to /collections after restoration Both modals: - Use fixed inset-0 positioning with black/70 backdrop - Inherit theme from parent page (no html/head/body tags) - Include close button (✕) that calls closeCollectionModal() - Follow existing card styling conventions - Use CSS custom properties for theming (--bg-secondary, --text-primary, etc.) --- templates/collection_modal.templ | 151 ++++++++++++++++++ .../restore_system_collection_modal.templ | 31 ++++ 2 files changed, 182 insertions(+) create mode 100644 templates/collection_modal.templ create mode 100644 templates/restore_system_collection_modal.templ diff --git a/templates/collection_modal.templ b/templates/collection_modal.templ new file mode 100644 index 0000000..f52a3fb --- /dev/null +++ b/templates/collection_modal.templ @@ -0,0 +1,151 @@ +package templates + +templ CollectionModal(collection CollectionData) { +
+
+
+ if collection.ID != "" { +

Edit Collection

+ } else { +

Create Collection

+ } + +
+ if collection.ID != "" { +
+ +
+ + +
+
+ + +
+
+ + + + + + +
+ +
+
+
+ +
+ + + + + +
+ +
+
+ + +
+
+ } else { +
+
+ + +
+
+ + +
+
+ + + + + + +
+ +
+
+
+ +
+ + + + + +
+ +
+
+ + +
+
+ } +
+
+} diff --git a/templates/restore_system_collection_modal.templ b/templates/restore_system_collection_modal.templ new file mode 100644 index 0000000..97441b2 --- /dev/null +++ b/templates/restore_system_collection_modal.templ @@ -0,0 +1,31 @@ +package templates + +templ RestoreSystemCollectionModal() { +
+
+
+

Restore System Collection

+ +
+
+

Select a system collection to restore:

+
+ +
+ + +
+
+
+
+
+}