closeCollectionModal picked document.querySelector(".fixed.inset-0") —
the FIRST overlay in DOM order, which is the sitewide #confirm-modal
that the header renders (hidden, display:none, but present). The real
create/edit modal stayed open: every Close and Cancel click on the
collection modals did nothing. Caught by the knob-matrix spec — the
pencil-glyph case clicked Close and the Edit modal persisted.
The buttons now pass $el and the overlay OWNING the button is closed
(closest(".fixed.inset-0")), falling back to #modal-container's child
for non-Alpine callers. Both the collection create/edit modal and the
restore-system modal take the argument.
40 lines
1.7 KiB
Templ
40 lines
1.7 KiB
Templ
package templates
|
|
|
|
templ RestoreSystemCollectionModal() {
|
|
<div x-data="collections" class="fixed inset-0 z-50 flex items-center justify-center p-4" style="background-color: var(--surface-overlay);">
|
|
<div class="card p-6 w-full max-w-md" style="box-shadow: var(--shadow-pop);">
|
|
<div class="flex justify-between items-center mb-6">
|
|
<div class="flex items-center gap-3">
|
|
<span class="grid place-items-center h-10 w-10 rounded-xl shrink-0" style="background-color: var(--accent-muted); color: var(--accent);">
|
|
@Icon("refresh", "h-5 w-5")
|
|
</span>
|
|
<h2 class="text-xl font-bold" style="color: var(--text-primary)">Restore System Collection</h2>
|
|
</div>
|
|
<button type="button" @click="closeCollectionModal($el)" class="icon-btn" aria-label="Close">
|
|
@Icon("close", "h-5 w-5")
|
|
</button>
|
|
</div>
|
|
<div class="mb-4">
|
|
<p class="mb-4" style="color: var(--text-secondary)">Select a system collection to restore:</p>
|
|
<form
|
|
hx-post="/api/dashboard/restore-system-collection"
|
|
hx-redirect="/collections"
|
|
>
|
|
<select name="collection_name" class="input">
|
|
<option value="">Select collection...</option>
|
|
<option value="Continue Reading">Continue Reading</option>
|
|
<option value="Recently Added">Recently Added</option>
|
|
<option value="Recently Read">Recently Read</option>
|
|
<option value="Not Started">Not Started</option>
|
|
<option value="Continue Series">Continue Series</option>
|
|
</select>
|
|
<div class="flex justify-end space-x-3 mt-6">
|
|
<button type="button" @click="closeCollectionModal($el)" class="btn btn-secondary">Cancel</button>
|
|
<button type="submit" class="btn btn-primary">Restore</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
}
|