From 95d5eba02607e30e502cb7eec6fa2c0dcea855dc Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Thu, 5 Feb 2026 17:22:05 -0600 Subject: [PATCH] feat(immersive): add window controls dropdown to player bar Replace the non-functional '...' button with a dropdown menu containing Fullscreen, Maximize/Restore, Minimize, and Exit Immersive options. Menu uses the same glassmorphism style as the player bar for visual consistency. --- .../immersive/ImmersivePlayer.svelte | 6 + .../immersive/PlayerControlsCompact.svelte | 162 ++++++++++++++++-- 2 files changed, 158 insertions(+), 10 deletions(-) diff --git a/src/lib/components/immersive/ImmersivePlayer.svelte b/src/lib/components/immersive/ImmersivePlayer.svelte index 52d54d78a..c57f8b6fd 100644 --- a/src/lib/components/immersive/ImmersivePlayer.svelte +++ b/src/lib/components/immersive/ImmersivePlayer.svelte @@ -517,6 +517,12 @@ {isInfinitePlay} {onToggleInfinitePlay} {onVolumeChange} + {isFullscreen} + {isMaximized} + onClose={handleExitImmersive} + onMinimize={minimizeWindow} + onToggleFullscreen={toggleFullscreen} + onToggleMaximize={toggleMaximize} /> {/if} diff --git a/src/lib/components/immersive/PlayerControlsCompact.svelte b/src/lib/components/immersive/PlayerControlsCompact.svelte index 59d710c64..165a53103 100644 --- a/src/lib/components/immersive/PlayerControlsCompact.svelte +++ b/src/lib/components/immersive/PlayerControlsCompact.svelte @@ -10,8 +10,15 @@ Volume2, VolumeX, MoreHorizontal, - Infinity + Infinity, + Maximize, + Minimize2, + Minus, + X, + MonitorUp, + Copy } from 'lucide-svelte'; + import { t } from '$lib/i18n'; interface Props { visible?: boolean; @@ -32,7 +39,13 @@ onToggleFavorite: () => void; onToggleInfinitePlay?: () => void; onVolumeChange: (volume: number) => void; - onContextMenu?: () => void; + // Window controls + isFullscreen?: boolean; + isMaximized?: boolean; + onClose?: () => void; + onMinimize?: () => void; + onToggleFullscreen?: () => void; + onToggleMaximize?: () => void; } let { @@ -54,7 +67,12 @@ onToggleFavorite, onToggleInfinitePlay, onVolumeChange, - onContextMenu + isFullscreen = false, + isMaximized = false, + onClose, + onMinimize, + onToggleFullscreen, + onToggleMaximize }: Props = $props(); let progressRef: HTMLDivElement | null = $state(null); @@ -133,6 +151,35 @@ }; } }); + + // Window controls dropdown + let menuOpen = $state(false); + let menuBtnRef: HTMLButtonElement | undefined = $state(undefined); + let menuRef: HTMLDivElement | undefined = $state(undefined); + + function toggleMenu() { + menuOpen = !menuOpen; + } + + function handleMenuAction(action: () => void) { + action(); + menuOpen = false; + } + + $effect(() => { + if (menuOpen) { + const handleClickOutside = (e: MouseEvent) => { + if ( + menuBtnRef && !menuBtnRef.contains(e.target as Node) && + menuRef && !menuRef.contains(e.target as Node) + ) { + menuOpen = false; + } + }; + document.addEventListener('mousedown', handleClickOutside); + return () => document.removeEventListener('mousedown', handleClickOutside); + } + });
@@ -245,13 +292,55 @@
- + @@ -464,6 +553,59 @@ transition: width 100ms linear; } + /* Window Controls Menu */ + .menu-anchor { + position: relative; + } + + .window-menu { + position: absolute; + bottom: calc(100% + 8px); + right: 0; + background: rgba(0, 0, 0, 0.5); + backdrop-filter: blur(40px); + -webkit-backdrop-filter: blur(40px); + border: 1px solid rgba(255, 255, 255, 0.18); + border-radius: 12px; + padding: 6px; + min-width: 200px; + box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4); + z-index: 50; + animation: menuFadeIn 150ms ease-out; + } + + @keyframes menuFadeIn { + from { opacity: 0; transform: translateY(4px); } + to { opacity: 1; transform: translateY(0); } + } + + .menu-item { + display: flex; + align-items: center; + gap: 10px; + width: 100%; + padding: 8px 12px; + background: none; + border: none; + border-radius: 8px; + color: rgba(255, 255, 255, 0.8); + font-size: 13px; + cursor: pointer; + transition: background 150ms ease, color 150ms ease; + white-space: nowrap; + } + + .menu-item:hover { + background: rgba(255, 255, 255, 0.12); + color: white; + } + + .menu-divider { + height: 1px; + background: rgba(255, 255, 255, 0.1); + margin: 4px 8px; + } + /* Responsive */ @media (max-width: 800px) { .player-bar {