Add maximize/restore/minimize buttons and QualityBadge placement

Window controls:
- Maximize button shows restore icon when maximized
- Add minimize button
- Button order: Fullscreen | Maximize/Restore | Minimize | Exit | Close

QualityBadge placement:
- Coverflow: below album name
- Split views (Lyrics/TrackInfo/Suggestions/Queue): below album name
- Added album name display in split view

Layout improvements:
- Panel section max-height 80vh
- Lyrics scrollbar only visible on hover
- Content vertically centered with artwork
This commit is contained in:
vicrodh committed 2026-02-01 07:44:18 -06:00
1 parent 730ce323c4
commit 2c389408d0
5 files changed
+323 -14

No files matched your search

@@ -1,5 +1,5 @@
<script lang="ts">
import { Disc3, LayoutGrid, Mic2, ListMusic, Music2, Info, Radio, Maximize, Minimize, ChevronDown, X, Square } from 'lucide-svelte';
import { Disc3, LayoutGrid, Mic2, ListMusic, Music2, Info, Radio, Maximize, Minimize, ChevronDown, X, Square, Copy, Minus } from 'lucide-svelte';
import { t } from '$lib/i18n';
import { getCurrentWindow } from '@tauri-apps/api/window';
@@ -18,8 +18,10 @@
hasTrackInfo?: boolean;
hasSuggestions?: boolean;
isFullscreen?: boolean;
isMaximized?: boolean;
onToggleFullscreen?: () => void;
onToggleMaximize?: () => void;
onMinimize?: () => void;
}
let {
@@ -34,8 +36,10 @@
hasTrackInfo = true,
hasSuggestions = true,
isFullscreen = false,
isMaximized = false,
onToggleFullscreen,
onToggleMaximize
onToggleMaximize,
onMinimize
}: Props = $props();
// Expandable window controls state
@@ -144,9 +148,20 @@
<button
class="window-btn"
onclick={onToggleMaximize}
title="Maximize Window"
title={isMaximized ? 'Restore Window' : 'Maximize Window'}
>
<Square size={14} />
{#if isMaximized}
<Copy size={14} />
{:else}
<Square size={14} />
{/if}
</button>
<button
class="window-btn"
onclick={onMinimize}
title="Minimize"
>
<Minus size={16} />
</button>
<button
class="window-btn"
@@ -334,7 +349,7 @@
}
.window-controls.expanded .expanded-buttons {
max-width: 160px;
max-width: 200px;
opacity: 1;
margin-right: 4px;
}
@@ -11,6 +11,7 @@
import QueuePanel from './panels/QueuePanel.svelte';
import CoverflowPanel from './panels/CoverflowPanel.svelte';
import LyricsFocusPanel from './panels/LyricsFocusPanel.svelte';
import QualityBadge from '$lib/components/QualityBadge.svelte';
interface LyricsLine {
text: string;
@@ -119,6 +120,7 @@
let showUI = $state(true);
let hideTimeout: ReturnType<typeof setTimeout> | null = null;
let isFullscreen = $state(false);
let isMaximized = $state(false);
const hasLyrics = $derived(lyricsLines.length > 0 || lyricsLoading);
const AUTO_HIDE_DELAY = 4000;
@@ -131,10 +133,11 @@
isFullscreen = !currentFullscreen;
}
// Check fullscreen state on open
async function checkFullscreenState() {
// Check fullscreen and maximized state on open
async function checkWindowState() {
const window = getCurrentWindow();
isFullscreen = await window.isFullscreen();
isMaximized = await window.isMaximized();
}
// Exit immersive and fullscreen
@@ -150,14 +153,21 @@
// Toggle maximize (not fullscreen)
async function toggleMaximize() {
const window = getCurrentWindow();
const maximized = await window.isMaximized();
if (maximized) {
if (isMaximized) {
await window.unmaximize();
isMaximized = false;
} else {
await window.maximize();
isMaximized = true;
}
}
// Minimize window
async function minimizeWindow() {
const window = getCurrentWindow();
await window.minimize();
}
// Auto-hide UI after inactivity
function resetHideTimer() {
showUI = true;
@@ -238,7 +248,7 @@
$effect(() => {
if (isOpen) {
resetHideTimer();
checkFullscreenState();
checkWindowState();
document.addEventListener('keydown', handleKeydown);
return () => {
@@ -280,8 +290,10 @@
hasTrackInfo={enableCredits}
hasSuggestions={enableSuggestions}
{isFullscreen}
{isMaximized}
onToggleFullscreen={toggleFullscreen}
onToggleMaximize={toggleMaximize}
onMinimize={minimizeWindow}
/>
<!-- Content based on display mode -->
@@ -293,6 +305,9 @@
{artist}
{album}
{isPlaying}
{quality}
{bitDepth}
{samplingRate}
/>
{:else if displayMode === 'lyrics-focus'}
<!-- Lyrics Focus: Single line, large, centered -->
@@ -323,6 +338,12 @@
<div class="split-track-info">
<h2 class="split-track-title">{trackTitle}</h2>
<p class="split-track-artist">{artist}</p>
{#if album}
<p class="split-track-album">{album}</p>
{/if}
<div class="split-quality-badge">
<QualityBadge {quality} {bitDepth} {samplingRate} />
</div>
</div>
</div>
@@ -448,20 +469,36 @@
.split-track-artist {
font-size: clamp(14px, 1.8vw, 16px);
color: var(--alpha-70, rgba(255, 255, 255, 0.7));
margin: 0;
margin: 0 0 4px 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.split-track-album {
font-size: clamp(12px, 1.5vw, 14px);
color: var(--alpha-50, rgba(255, 255, 255, 0.5));
margin: 0 0 12px 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.split-quality-badge {
display: flex;
justify-content: center;
margin-top: 8px;
}
.panel-section {
flex: 1;
min-width: 0;
min-height: 0;
max-width: 560px;
height: 100%;
max-height: 80vh;
display: flex;
flex-direction: column;
align-self: center;
}
/* Focus mode panels (queue) */
@@ -1,10 +1,15 @@
<script lang="ts">
import QualityBadge from '$lib/components/QualityBadge.svelte';
interface Props {
artwork: string;
trackTitle: string;
artist: string;
album?: string;
isPlaying?: boolean;
quality?: string;
bitDepth?: number;
samplingRate?: number;
}
let {
@@ -12,7 +17,10 @@
trackTitle,
artist,
album,
isPlaying = false
isPlaying = false,
quality,
bitDepth,
samplingRate
}: Props = $props();
</script>
@@ -40,6 +48,9 @@
{#if album}
<p class="track-album">{album}</p>
{/if}
<div class="quality-badge-wrapper">
<QualityBadge {quality} {bitDepth} {samplingRate} />
</div>
</div>
</div>
@@ -158,6 +169,10 @@
font-style: italic;
}
.quality-badge-wrapper {
margin-top: 12px;
}
/* Responsive */
@media (max-width: 768px) {
.coverflow-panel {
@@ -68,7 +68,8 @@
.lyrics-container {
flex: 1;
min-height: 0;
overflow: hidden;
overflow-y: auto;
overflow-x: hidden;
mask-image: linear-gradient(
to bottom,
transparent 0%,
@@ -85,6 +86,40 @@
);
}
/* Hide scrollbar by default, show on hover */
.lyrics-container::-webkit-scrollbar {
width: 6px;
opacity: 0;
}
.lyrics-container::-webkit-scrollbar-track {
background: transparent;
}
.lyrics-container::-webkit-scrollbar-thumb {
background: transparent;
border-radius: 3px;
transition: background 200ms ease;
}
.lyrics-container:hover::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.3);
}
.lyrics-container:hover::-webkit-scrollbar-thumb:hover {
background: rgba(255, 255, 255, 0.5);
}
/* Firefox */
.lyrics-container {
scrollbar-width: thin;
scrollbar-color: transparent transparent;
}
.lyrics-container:hover {
scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}
.lyrics-container :global(.lyrics-lines) {
--text-primary: var(--alpha-95, rgba(255, 255, 255, 0.95));
--text-secondary: var(--alpha-50, rgba(255, 255, 255, 0.5));