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:
1 parent
69f4de6d1a
commit
9ae5aa2280
1 file changed
+131
-35
@@ -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,6 +518,18 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
<div class="checkbox-row">
|
||||||
|
<div class="form-group checkbox">
|
||||||
|
<label>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
bind:checked={isPublic}
|
||||||
|
disabled={loading}
|
||||||
|
/>
|
||||||
|
<span>Make playlist public</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
{#if mode === 'edit'}
|
{#if mode === 'edit'}
|
||||||
<div class="form-group checkbox">
|
<div class="form-group checkbox">
|
||||||
<label>
|
<label>
|
||||||
@@ -547,33 +548,33 @@
|
|||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="danger-zone">
|
|
||||||
<div class="danger-label">Danger Zone</div>
|
|
||||||
{#if showDeleteConfirm}
|
|
||||||
<div class="delete-confirm">
|
|
||||||
<span>Are you sure? This cannot be undone.</span>
|
|
||||||
<div class="delete-actions">
|
|
||||||
<button class="btn-cancel" onclick={() => showDeleteConfirm = false} disabled={loading}>
|
|
||||||
Cancel
|
|
||||||
</button>
|
|
||||||
<button class="btn-delete" onclick={handleDelete} disabled={loading}>
|
|
||||||
{loading ? 'Deleting...' : 'Delete'}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{:else}
|
|
||||||
<button class="btn-danger" onclick={() => showDeleteConfirm = true} disabled={loading}>
|
|
||||||
<Trash2 size={14} />
|
|
||||||
Delete Playlist
|
|
||||||
</button>
|
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
|
{#if mode === 'edit'}
|
||||||
|
<div class="footer-left">
|
||||||
|
{#if showDeleteConfirm}
|
||||||
|
<div class="delete-confirm-inline">
|
||||||
|
<span>Delete?</span>
|
||||||
|
<button class="btn-delete-sm" onclick={handleDelete} disabled={loading}>
|
||||||
|
Yes
|
||||||
|
</button>
|
||||||
|
<button class="btn-cancel-sm" onclick={() => showDeleteConfirm = false} disabled={loading}>
|
||||||
|
No
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
<button class="btn-danger-sm" onclick={() => showDeleteConfirm = true} disabled={loading}>
|
||||||
|
<Trash2 size={12} />
|
||||||
|
Delete
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
<div class="footer-right">
|
||||||
<button class="btn-secondary" onclick={onClose} disabled={loading}>
|
<button class="btn-secondary" onclick={onClose} disabled={loading}>
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</button>
|
||||||
@@ -593,6 +594,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@@ -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;
|
||||||
|
|||||||
Reference in new issue
Block a user