refactor(PlaylistModal): improve layout and move danger zone to footer

- Move delete button to footer (left-aligned, compact style)
- Make modal 50px wider (490px)
- Remove "(optional)" from Folder label
- Put "Make playlist public" and "Hide from sidebar" inline
- Add compact delete confirmation in footer
This commit is contained in:
vicrodh committed 2026-01-25 00:28:31 -06:00
1 parent 69f4de6d1a
commit 9ae5aa2280
1 file changed
+158 -62
+158 -62
View File
@@ -499,22 +499,11 @@
></textarea> ></textarea>
</div> </div>
<div class="form-group checkbox">
<label>
<input
type="checkbox"
bind:checked={isPublic}
disabled={loading}
/>
<span>Make playlist public</span>
</label>
</div>
{#if folders.length > 0} {#if folders.length > 0}
<div class="form-group"> <div class="form-group">
<label for="folder-select"> <label for="folder-select">
<Folder size={14} style="display: inline; vertical-align: middle; margin-right: 4px;" /> <Folder size={14} style="display: inline; vertical-align: middle; margin-right: 4px;" />
Folder (optional) Folder
</label> </label>
<select <select
id="folder-select" id="folder-select"
@@ -529,67 +518,80 @@
</div> </div>
{/if} {/if}
{#if mode === 'edit'} <div class="checkbox-row">
<div class="form-group checkbox"> <div class="form-group checkbox">
<label> <label>
<input <input
type="checkbox" type="checkbox"
bind:checked={hidden} bind:checked={isPublic}
disabled={loading} disabled={loading}
/> />
<span class="hidden-label"> <span>Make playlist public</span>
{#if hidden}
<EyeOff size={14} />
{:else}
<Eye size={14} />
{/if}
Hide from sidebar
</span>
</label> </label>
</div> </div>
<div class="danger-zone"> {#if mode === 'edit'}
<div class="danger-label">Danger Zone</div> <div class="form-group checkbox">
{#if showDeleteConfirm} <label>
<div class="delete-confirm"> <input
<span>Are you sure? This cannot be undone.</span> type="checkbox"
<div class="delete-actions"> bind:checked={hidden}
<button class="btn-cancel" onclick={() => showDeleteConfirm = false} disabled={loading}> disabled={loading}
Cancel />
</button> <span class="hidden-label">
<button class="btn-delete" onclick={handleDelete} disabled={loading}> {#if hidden}
{loading ? 'Deleting...' : 'Delete'} <EyeOff size={14} />
</button> {:else}
</div> <Eye size={14} />
</div> {/if}
{:else} Hide from sidebar
<button class="btn-danger" onclick={() => showDeleteConfirm = true} disabled={loading}> </span>
<Trash2 size={14} /> </label>
Delete Playlist </div>
</button> {/if}
{/if} </div>
</div>
{/if}
{/if} {/if}
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button class="btn-secondary" onclick={onClose} disabled={loading}> {#if mode === 'edit'}
Cancel <div class="footer-left">
</button> {#if showDeleteConfirm}
<button class="btn-primary" onclick={handleSubmit} disabled={loading}> <div class="delete-confirm-inline">
{#if loading} <span>Delete?</span>
Saving... <button class="btn-delete-sm" onclick={handleDelete} disabled={loading}>
{:else if mode === 'create'} Yes
Create </button>
{:else if mode === 'edit'} <button class="btn-cancel-sm" onclick={() => showDeleteConfirm = false} disabled={loading}>
Save No
{:else if selectedPlaylistId === CREATE_NEW_PLAYLIST} </button>
Create & Add </div>
{:else} {:else}
Add <button class="btn-danger-sm" onclick={() => showDeleteConfirm = true} disabled={loading}>
{/if} <Trash2 size={12} />
</button> Delete
</button>
{/if}
</div>
{/if}
<div class="footer-right">
<button class="btn-secondary" onclick={onClose} disabled={loading}>
Cancel
</button>
<button class="btn-primary" onclick={handleSubmit} disabled={loading}>
{#if loading}
Saving...
{:else if mode === 'create'}
Create
{:else if mode === 'edit'}
Save
{:else if selectedPlaylistId === CREATE_NEW_PLAYLIST}
Create & Add
{:else}
Add
{/if}
</button>
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -608,7 +610,7 @@
.modal { .modal {
width: 100%; width: 100%;
max-width: 440px; max-width: 490px;
max-height: 90vh; max-height: 90vh;
overflow: hidden; overflow: hidden;
display: flex; display: flex;
@@ -741,14 +743,38 @@
color: var(--text-primary); color: var(--text-primary);
} }
.checkbox-row {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 8px;
}
.checkbox-row .form-group {
margin-bottom: 0;
}
.modal-footer { .modal-footer {
display: flex; display: flex;
justify-content: flex-end; justify-content: space-between;
align-items: center;
gap: 12px; gap: 12px;
padding: 16px 24px; padding: 16px 24px;
border-top: 1px solid var(--bg-tertiary); border-top: 1px solid var(--bg-tertiary);
} }
.footer-left {
display: flex;
align-items: center;
}
.footer-right {
display: flex;
align-items: center;
gap: 12px;
margin-left: auto;
}
.btn-secondary, .btn-secondary,
.btn-primary { .btn-primary {
padding: 10px 20px; padding: 10px 20px;
@@ -791,6 +817,76 @@
gap: 6px; gap: 6px;
} }
/* Compact footer delete button */
.btn-danger-sm {
display: flex;
align-items: center;
gap: 6px;
padding: 8px 14px;
background: rgba(239, 68, 68, 0.1);
border: 1px solid rgba(239, 68, 68, 0.3);
border-radius: 8px;
font-size: 13px;
color: #ef4444;
cursor: pointer;
transition: all 150ms ease;
}
.btn-danger-sm:hover:not(:disabled) {
background: rgba(239, 68, 68, 0.2);
border-color: rgba(239, 68, 68, 0.5);
}
.btn-danger-sm:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.delete-confirm-inline {
display: flex;
align-items: center;
gap: 8px;
}
.delete-confirm-inline span {
font-size: 13px;
color: #ef4444;
}
.btn-delete-sm,
.btn-cancel-sm {
padding: 8px 12px;
border-radius: 6px;
font-size: 13px;
cursor: pointer;
transition: all 150ms ease;
border: none;
}
.btn-cancel-sm {
background: var(--bg-tertiary);
color: var(--text-primary);
}
.btn-cancel-sm:hover:not(:disabled) {
background: var(--bg-hover);
}
.btn-delete-sm {
background: #ef4444;
color: white;
}
.btn-delete-sm:hover:not(:disabled) {
background: #dc2626;
}
.btn-delete-sm:disabled,
.btn-cancel-sm:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.danger-zone { .danger-zone {
margin-top: 24px; margin-top: 24px;
padding-top: 20px; padding-top: 20px;