diff --git a/src/lib/components/Sidebar.svelte b/src/lib/components/Sidebar.svelte index a2f549240..a632ed2ba 100644 --- a/src/lib/components/Sidebar.svelte +++ b/src/lib/components/Sidebar.svelte @@ -1,6 +1,7 @@ @@ -977,18 +1001,97 @@ - - - handleViewChange('favorites')} - showLabel={isExpanded} - > - {#snippet icon()}{/snippet} - + + + {#if isExpanded} + handleViewChange('favorites')} + > + + + + {$t('nav.favorites')} + { e.stopPropagation(); favoritesExpanded = !favoritesExpanded; }} + title={favoritesExpanded ? 'Collapse' : 'Expand'} + > + + + + {#if favoritesExpanded} + + {#each favoritesTabOrder as tab} + handleViewChange(`favorites-${tab}`)} + > + + {#if tab === 'artists'} + + {:else if tab === 'albums'} + + {:else if tab === 'tracks'} + + {/if} + + {$t(`favorites.${tab}`)} + + {/each} + + {/if} + {:else} + + { + const rect = e.currentTarget.getBoundingClientRect(); + favoritesMenuPos = { x: rect.right + 8, y: rect.top }; + showFavoritesMenu = !showFavoritesMenu; + }} + title={$t('nav.favorites')} + > + + + + + {/if} + + {#if showFavoritesMenu && !isExpanded} + + { handleViewChange('favorites'); showFavoritesMenu = false; }}> + + {$t('favorites.title')} + + + {#each favoritesTabOrder as tab} + { handleViewChange(`favorites-${tab}`); showFavoritesMenu = false; }} + > + {#if tab === 'artists'} + + {:else if tab === 'albums'} + + {:else if tab === 'tracks'} + + {/if} + {$t(`favorites.${tab}`)} + + {/each} + + {/if} + {#if !isOffline} @@ -2123,4 +2226,102 @@ color: var(--text-muted); text-align: center; } + + /* Favorites Section */ + .favorites-section { + position: relative; + } + + .favorites-header { + position: relative; + padding-right: 28px; + } + + .favorites-chevron { + position: absolute; + right: 8px; + top: 50%; + transform: translateY(-50%); + display: flex; + align-items: center; + justify-content: center; + width: 18px; + height: 18px; + padding: 0; + background: transparent; + border: none; + border-radius: 4px; + cursor: pointer; + color: var(--text-muted); + transition: transform 150ms ease, color 150ms ease, background 150ms ease; + } + + .favorites-chevron:hover { + background: var(--bg-hover); + color: var(--text-primary); + } + + .favorites-chevron.expanded { + transform: translateY(-50%) rotate(90deg); + } + + .favorites-subitems { + display: flex; + flex-direction: column; + padding-left: 12px; + } + + .favorites-subitem { + padding: 6px 10px; + font-size: 12px; + } + + .favorites-subitem .icon-container { + width: 18px; + height: 18px; + } + + /* Favorites Popover (collapsed sidebar) */ + .favorites-popover { + position: fixed; + z-index: 9999; + background: var(--bg-secondary); + border: 1px solid var(--border-subtle); + border-radius: 8px; + box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); + padding: 6px; + min-width: 160px; + animation: fade-in 150ms ease; + } + + @keyframes fade-in { + from { opacity: 0; transform: translateY(-4px); } + to { opacity: 1; transform: translateY(0); } + } + + .popover-item { + display: flex; + align-items: center; + gap: 10px; + width: 100%; + padding: 8px 12px; + background: none; + border: none; + border-radius: 6px; + font-size: 13px; + color: var(--text-primary); + cursor: pointer; + text-align: left; + transition: background-color 150ms ease; + } + + .popover-item:hover { + background: var(--bg-hover); + } + + .popover-divider { + height: 1px; + background: var(--border-subtle); + margin: 6px 0; + }