fix(ui): improve sidebar toggle button position and tooltips
- Move toggle button to sidebar edge (50% vertical, half inside/out) - Add glass effect: rgba(255,255,255,0.08) + backdrop blur + border - Use single chevron icons instead of double - Hover: scale 1.1 + increased opacity - Add left padding (22px) to main content for button clearance - Fix playlist tooltips: show name + track count when sidebar is collapsed
This commit is contained in:
1 parent
63fc930f91
commit
a7f0310682
2 files changed
+30
-14
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { tick } from 'svelte';
|
import { tick } from 'svelte';
|
||||||
import { Search, Home, HardDrive, Plus, RefreshCw, ChevronDown, ChevronUp, Heart, ListMusic, Import, Settings, MoreHorizontal, ArrowUpDown, ChevronRight, ChevronsLeft, ChevronsRight } from 'lucide-svelte';
|
import { Search, Home, HardDrive, Plus, RefreshCw, ChevronDown, ChevronUp, Heart, ListMusic, Import, Settings, MoreHorizontal, ArrowUpDown, ChevronRight, ChevronLeft } from 'lucide-svelte';
|
||||||
import { invoke } from '@tauri-apps/api/core';
|
import { invoke } from '@tauri-apps/api/core';
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import NavigationItem from './NavigationItem.svelte';
|
import NavigationItem from './NavigationItem.svelte';
|
||||||
@@ -170,7 +170,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get basic tooltip (no state mutation during render)
|
// Get basic tooltip (no state mutation during render)
|
||||||
function getPlaylistTooltip(playlist: Playlist): string {
|
function getPlaylistTooltip(playlist: Playlist, sidebarExpanded: boolean): string {
|
||||||
|
// When sidebar is collapsed, show playlist name + track count
|
||||||
|
if (!sidebarExpanded) {
|
||||||
|
const totalCount = getTotalTrackCount(playlist);
|
||||||
|
const trackText = totalCount === 1 ? 'track' : 'tracks';
|
||||||
|
return `${playlist.name}\n${totalCount} ${trackText}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// When sidebar is expanded, use the rich tooltip with artists
|
||||||
const cached = playlistTooltipCache.get(playlist.id);
|
const cached = playlistTooltipCache.get(playlist.id);
|
||||||
if (cached) return cached;
|
if (cached) return cached;
|
||||||
|
|
||||||
@@ -687,7 +695,7 @@
|
|||||||
{#each visiblePlaylists as playlist (playlist.id)}
|
{#each visiblePlaylists as playlist (playlist.id)}
|
||||||
<NavigationItem
|
<NavigationItem
|
||||||
label={playlist.name}
|
label={playlist.name}
|
||||||
tooltip={getPlaylistTooltip(playlist)}
|
tooltip={getPlaylistTooltip(playlist, isExpanded)}
|
||||||
active={activeView === 'playlist' && selectedPlaylistId === playlist.id}
|
active={activeView === 'playlist' && selectedPlaylistId === playlist.id}
|
||||||
onclick={() => handlePlaylistClick(playlist)}
|
onclick={() => handlePlaylistClick(playlist)}
|
||||||
onHover={() => loadPlaylistTooltip(playlist)}
|
onHover={() => loadPlaylistTooltip(playlist)}
|
||||||
@@ -736,16 +744,16 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Toggle Button -->
|
<!-- Toggle Button (Edge position) -->
|
||||||
<button
|
<button
|
||||||
class="toggle-btn"
|
class="toggle-btn"
|
||||||
onclick={onToggle}
|
onclick={onToggle}
|
||||||
title={isExpanded ? $t('actions.collapse') : $t('actions.expand')}
|
title={isExpanded ? $t('actions.collapse') : $t('actions.expand')}
|
||||||
>
|
>
|
||||||
{#if isExpanded}
|
{#if isExpanded}
|
||||||
<ChevronsLeft size={16} />
|
<ChevronLeft size={16} />
|
||||||
{:else}
|
{:else}
|
||||||
<ChevronsRight size={16} />
|
<ChevronRight size={16} />
|
||||||
{/if}
|
{/if}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
@@ -952,24 +960,31 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.toggle-btn {
|
.toggle-btn {
|
||||||
|
position: absolute;
|
||||||
|
right: -16px;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
width: 100%;
|
width: 32px;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
padding: 0 12px;
|
padding: 0;
|
||||||
background: none;
|
background: rgba(255, 255, 255, 0.08);
|
||||||
border: none;
|
backdrop-filter: blur(12px);
|
||||||
|
-webkit-backdrop-filter: blur(12px);
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||||
|
border-radius: 50%;
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: color 150ms ease, background-color 150ms ease;
|
transition: transform 150ms ease, background-color 150ms ease, color 150ms ease;
|
||||||
border-radius: 0;
|
z-index: 10;
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.toggle-btn:hover {
|
.toggle-btn:hover {
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
background-color: var(--bg-hover);
|
background: rgba(255, 255, 255, 0.12);
|
||||||
|
transform: translateY(-50%) scale(1.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-section {
|
.user-section {
|
||||||
|
|||||||
@@ -2728,6 +2728,7 @@
|
|||||||
min-width: 0;
|
min-width: 0;
|
||||||
height: calc(100vh - 136px); /* 104px NowPlayingBar + 32px TitleBar */
|
height: calc(100vh - 136px); /* 104px NowPlayingBar + 32px TitleBar */
|
||||||
overflow: hidden; /* Views handle their own scrolling */
|
overflow: hidden; /* Views handle their own scrolling */
|
||||||
|
padding-left: 22px; /* Space for sidebar toggle button (16px overlap + 6px margin) */
|
||||||
padding-right: 8px; /* Gap between scrollbar and window edge */
|
padding-right: 8px; /* Gap between scrollbar and window edge */
|
||||||
background-color: var(--bg-primary, #0f0f0f);
|
background-color: var(--bg-primary, #0f0f0f);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user