mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-22 15:25:46 +00:00
refactor(playback): co-locate floating-player-bar + fs-idle-fade hooks (and orphaned playback tests) with their features
This commit is contained in:
@@ -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
-1
@@ -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
-1
@@ -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
|
||||
+3
-3
@@ -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' });
|
||||
+2
-2
@@ -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(() => {
|
||||
Reference in New Issue
Block a user