refactor(playback): co-locate floating-player-bar + fs-idle-fade hooks (and orphaned playback tests) with their features

This commit is contained in:
Psychotoxical
2026-06-30 19:55:20 +02:00
parent f03a5f13e8
commit c2461c88d5
8 changed files with 9 additions and 9 deletions
@@ -12,7 +12,7 @@ import { useCachedUrl } from '@/ui/CachedImage';
import { useArtistFanart } from '@/cover/useArtistFanart';
import { backdropFromConfig } from '@/cover/artistBackdrop';
import { useThemeStore } from '@/store/themeStore';
import { useFsIdleFade } from '@/hooks/useFsIdleFade';
import { useFsIdleFade } from '@/features/fullscreenPlayer/hooks/useFsIdleFade';
import { useQueueTrackAt } from '@/features/queue';
import { WaveformSeek } from '@/features/waveform';
import { FsQueueModal } from '@/features/fullscreenPlayer/components/FsQueueModal';
@@ -30,7 +30,7 @@ import { PlayerSeekbarSection } from '@/features/playback/components/playerBar/P
import { PlayerPlaybackRate } from '@/features/playback/components/playerBar/PlayerPlaybackRate';
import { PlayerVolume } from '@/features/playback/components/playerBar/PlayerVolume';
import { PlayerOverflowMenu } from '@/features/playback/components/playerBar/PlayerOverflowMenu';
import { useFloatingPlayerBar } from '@/hooks/useFloatingPlayerBar';
import { useFloatingPlayerBar } from '@/features/playback/hooks/useFloatingPlayerBar';
import { useUtilityOverflowMenu } from '@/hooks/useUtilityOverflowMenu';
import {
usePlayerBarLayoutStore,
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { computeFloatingPlayerBarStyle } from './computeFloatingPlayerBarStyle';
import { computeFloatingPlayerBarStyle } from '@/features/playback/hooks/computeFloatingPlayerBarStyle';
describe('computeFloatingPlayerBarStyle', () => {
it('centers in the main column and shrink-wraps instead of stretching', () => {
@@ -1,5 +1,5 @@
import React, { useEffect, useState } from 'react';
import { computeFloatingPlayerBarStyle } from './computeFloatingPlayerBarStyle';
import { computeFloatingPlayerBarStyle } from '@/features/playback/hooks/computeFloatingPlayerBarStyle';
/** Computes the floating player-bar position based on the current sidebar +
* queue panel widths. Returns an inline-style object (left/right/width); only
@@ -1,10 +1,10 @@
import { renderHook } from '@testing-library/react';
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { useAuthStore } from '../store/authStore';
import { useAuthStore } from '@/store/authStore';
import { usePlayerStore } from '@/features/playback/store/playerStore';
import { usePlaybackServerId } from '@/features/playback/hooks/usePlaybackServerId';
vi.mock('../utils/server/switchActiveServer', () => ({
vi.mock('@/utils/server/switchActiveServer', () => ({
switchActiveServer: vi.fn(async () => true),
}));
@@ -49,7 +49,7 @@ describe('usePlaybackServerId', () => {
});
it('does not call switchActiveServer when browsed server changes', async () => {
const { switchActiveServer } = await import('../utils/server/switchActiveServer');
const { switchActiveServer } = await import('@/utils/server/switchActiveServer');
vi.mocked(switchActiveServer).mockClear();
const { rerender } = renderHook(() => usePlaybackServerId());
useAuthStore.setState({ activeServerId: 'b' });
@@ -13,7 +13,7 @@ vi.mock('@/lib/api/library', () => ({
TIMELINE_HISTORY_BOOTSTRAP_LIMIT: 50,
}));
vi.mock('../utils/queue/timelineBootstrapReady', () => ({
vi.mock('@/utils/queue/timelineBootstrapReady', () => ({
timelineBootstrapIndexReady: vi.fn(),
}));
@@ -23,7 +23,7 @@ vi.mock('@/features/playback/store/queueTrackResolver', async importOriginal =>
});
import { libraryGetRecentPlaySessions } from '@/lib/api/library';
import { timelineBootstrapIndexReady } from '../utils/queue/timelineBootstrapReady';
import { timelineBootstrapIndexReady } from '@/utils/queue/timelineBootstrapReady';
describe('ensureTimelineBootstrap', () => {
beforeEach(() => {