From ea3e3f1adfd3fbd665d5ffbaad8958173a58440d Mon Sep 17 00:00:00 2001 From: Psychotoxical <171614930+Psychotoxical@users.noreply.github.com> Date: Mon, 29 Jun 2026 22:55:35 +0200 Subject: [PATCH] refactor(deviceSync): co-locate device sync feature into features/deviceSync --- src/app/AppRoutes.tsx | 2 +- src/components/Sidebar.tsx | 2 +- .../deviceSync/components}/BrowserRow.tsx | 0 .../components}/DeviceSyncBrowserPanel.tsx | 8 ++--- .../components}/DeviceSyncDevicePanel.tsx | 6 ++-- .../components}/DeviceSyncHeader.tsx | 6 ++-- .../components}/DeviceSyncMigrationModal.tsx | 2 +- .../components}/DeviceSyncPreSyncModal.tsx | 4 +-- .../deviceSync}/hooks/useDeviceSyncBrowser.ts | 12 +++---- .../hooks/useDeviceSyncDeviceScan.ts | 4 +-- .../deviceSync}/hooks/useDeviceSyncDrives.ts | 2 +- .../hooks/useDeviceSyncJobEvents.ts | 10 +++--- .../hooks/useDeviceSyncSourceStatuses.ts | 6 ++-- src/features/deviceSync/index.ts | 10 ++++++ .../deviceSync}/pages/DeviceSync.tsx | 34 +++++++++---------- .../deviceSync}/store/deviceSyncJobStore.ts | 0 .../deviceSync}/store/deviceSyncStore.ts | 0 .../deviceSync/utils}/deviceSyncHelpers.ts | 2 +- .../utils}/deviceSyncLegacyTemplate.ts | 2 +- .../utils}/runDeviceSyncChooseFolder.ts | 4 +-- .../utils}/runDeviceSyncExecution.ts | 16 ++++----- .../utils}/runDeviceSyncMigration.ts | 12 +++---- src/utils/playback/fetchTracksForSource.ts | 2 +- 23 files changed, 78 insertions(+), 68 deletions(-) rename src/{components/deviceSync => features/deviceSync/components}/BrowserRow.tsx (100%) rename src/{components/deviceSync => features/deviceSync/components}/DeviceSyncBrowserPanel.tsx (95%) rename src/{components/deviceSync => features/deviceSync/components}/DeviceSyncDevicePanel.tsx (97%) rename src/{components/deviceSync => features/deviceSync/components}/DeviceSyncHeader.tsx (95%) rename src/{components/deviceSync => features/deviceSync/components}/DeviceSyncMigrationModal.tsx (99%) rename src/{components/deviceSync => features/deviceSync/components}/DeviceSyncPreSyncModal.tsx (96%) rename src/{ => features/deviceSync}/hooks/useDeviceSyncBrowser.ts (92%) rename src/{ => features/deviceSync}/hooks/useDeviceSyncDeviceScan.ts (93%) rename src/{ => features/deviceSync}/hooks/useDeviceSyncDrives.ts (94%) rename src/{ => features/deviceSync}/hooks/useDeviceSyncJobEvents.ts (88%) rename src/{ => features/deviceSync}/hooks/useDeviceSyncSourceStatuses.ts (90%) create mode 100644 src/features/deviceSync/index.ts rename src/{ => features/deviceSync}/pages/DeviceSync.tsx (88%) rename src/{ => features/deviceSync}/store/deviceSyncJobStore.ts (100%) rename src/{ => features/deviceSync}/store/deviceSyncStore.ts (100%) rename src/{utils/deviceSync => features/deviceSync/utils}/deviceSyncHelpers.ts (96%) rename src/{utils/deviceSync => features/deviceSync/utils}/deviceSyncLegacyTemplate.ts (97%) rename src/{utils/deviceSync => features/deviceSync/utils}/runDeviceSyncChooseFolder.ts (89%) rename src/{utils/deviceSync => features/deviceSync/utils}/runDeviceSyncExecution.ts (89%) rename src/{utils/deviceSync => features/deviceSync/utils}/runDeviceSyncMigration.ts (93%) diff --git a/src/app/AppRoutes.tsx b/src/app/AppRoutes.tsx index 0e97378b..776bcbcd 100644 --- a/src/app/AppRoutes.tsx +++ b/src/app/AppRoutes.tsx @@ -31,7 +31,7 @@ const Settings = lazy(() => import('../pages/Settings')); const Statistics = lazy(() => import('@/features/stats/pages/Statistics')); const Help = lazy(() => import('../pages/Help')); const WhatsNew = lazy(() => import('../pages/WhatsNew')); -const DeviceSync = lazy(() => import('../pages/DeviceSync')); +const DeviceSync = lazy(() => import('@/features/deviceSync/pages/DeviceSync')); const OfflineLibrary = lazy(() => import('../pages/OfflineLibrary')); const LabelAlbums = lazy(() => import('../pages/LabelAlbums')); const SearchBrowsePage = lazy(() => import('../pages/SearchBrowsePage')); diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx index 913eafed..f29e9029 100644 --- a/src/components/Sidebar.tsx +++ b/src/components/Sidebar.tsx @@ -3,7 +3,7 @@ import { createPortal } from 'react-dom'; import { usePlayerStore } from '../store/playerStore'; import { useOfflineJobStore } from '../store/offlineJobStore'; import { clearOfflinePinTasks } from '../utils/offline/offlinePinQueue'; -import { useDeviceSyncJobStore } from '../store/deviceSyncJobStore'; +import { useDeviceSyncJobStore } from '@/features/deviceSync'; import { useAuthStore } from '../store/authStore'; import { useSidebarStore } from '../store/sidebarStore'; import { useLocation } from 'react-router-dom'; diff --git a/src/components/deviceSync/BrowserRow.tsx b/src/features/deviceSync/components/BrowserRow.tsx similarity index 100% rename from src/components/deviceSync/BrowserRow.tsx rename to src/features/deviceSync/components/BrowserRow.tsx diff --git a/src/components/deviceSync/DeviceSyncBrowserPanel.tsx b/src/features/deviceSync/components/DeviceSyncBrowserPanel.tsx similarity index 95% rename from src/components/deviceSync/DeviceSyncBrowserPanel.tsx rename to src/features/deviceSync/components/DeviceSyncBrowserPanel.tsx index b1003b39..c5d15b2e 100644 --- a/src/components/deviceSync/DeviceSyncBrowserPanel.tsx +++ b/src/features/deviceSync/components/DeviceSyncBrowserPanel.tsx @@ -6,10 +6,10 @@ import { } from 'lucide-react'; import type { SubsonicAlbum, SubsonicArtist, SubsonicPlaylist, -} from '../../api/subsonicTypes'; -import type { DeviceSyncSource } from '../../store/deviceSyncStore'; -import type { SourceTab } from '../../utils/deviceSync/deviceSyncHelpers'; -import BrowserRow from './BrowserRow'; +} from '@/api/subsonicTypes'; +import type { DeviceSyncSource } from '@/features/deviceSync/store/deviceSyncStore'; +import type { SourceTab } from '@/features/deviceSync/utils/deviceSyncHelpers'; +import BrowserRow from '@/features/deviceSync/components/BrowserRow'; interface Props { activeTab: SourceTab; diff --git a/src/components/deviceSync/DeviceSyncDevicePanel.tsx b/src/features/deviceSync/components/DeviceSyncDevicePanel.tsx similarity index 97% rename from src/components/deviceSync/DeviceSyncDevicePanel.tsx rename to src/features/deviceSync/components/DeviceSyncDevicePanel.tsx index d61e3545..a609f9d5 100644 --- a/src/components/deviceSync/DeviceSyncDevicePanel.tsx +++ b/src/features/deviceSync/components/DeviceSyncDevicePanel.tsx @@ -5,9 +5,9 @@ import { AlertCircle, CheckCircle2, Clock, HardDriveUpload, Loader2, Trash2, Undo2, } from 'lucide-react'; -import { useDeviceSyncJobStore } from '../../store/deviceSyncJobStore'; -import type { DeviceSyncSource } from '../../store/deviceSyncStore'; -import type { SyncStatus } from '../../utils/deviceSync/deviceSyncHelpers'; +import { useDeviceSyncJobStore } from '@/features/deviceSync/store/deviceSyncJobStore'; +import type { DeviceSyncSource } from '@/features/deviceSync/store/deviceSyncStore'; +import type { SyncStatus } from '@/features/deviceSync/utils/deviceSyncHelpers'; interface Props { sources: DeviceSyncSource[]; diff --git a/src/components/deviceSync/DeviceSyncHeader.tsx b/src/features/deviceSync/components/DeviceSyncHeader.tsx similarity index 95% rename from src/components/deviceSync/DeviceSyncHeader.tsx rename to src/features/deviceSync/components/DeviceSyncHeader.tsx index ebb7531f..e5ff5a99 100644 --- a/src/components/deviceSync/DeviceSyncHeader.tsx +++ b/src/features/deviceSync/components/DeviceSyncHeader.tsx @@ -4,9 +4,9 @@ import { AlertCircle, FolderOpen, HardDriveUpload, RefreshCw, Usb, } from 'lucide-react'; import CustomSelect from '@/ui/CustomSelect'; -import type { RemovableDrive } from '../../utils/deviceSync/deviceSyncHelpers'; -import { formatBytes } from '../../utils/deviceSync/deviceSyncHelpers'; -import type { DeviceSyncSource } from '../../store/deviceSyncStore'; +import type { RemovableDrive } from '@/features/deviceSync/utils/deviceSyncHelpers'; +import { formatBytes } from '@/features/deviceSync/utils/deviceSyncHelpers'; +import type { DeviceSyncSource } from '@/features/deviceSync/store/deviceSyncStore'; interface Props { targetDir: string | null; diff --git a/src/components/deviceSync/DeviceSyncMigrationModal.tsx b/src/features/deviceSync/components/DeviceSyncMigrationModal.tsx similarity index 99% rename from src/components/deviceSync/DeviceSyncMigrationModal.tsx rename to src/features/deviceSync/components/DeviceSyncMigrationModal.tsx index 178310ad..c08c2881 100644 --- a/src/components/deviceSync/DeviceSyncMigrationModal.tsx +++ b/src/features/deviceSync/components/DeviceSyncMigrationModal.tsx @@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next'; import { AlertCircle, CheckCircle2, Loader2 } from 'lucide-react'; import type { MigrationPair, MigrationPhase, MigrationResult, -} from '../../utils/deviceSync/runDeviceSyncMigration'; +} from '@/features/deviceSync/utils/runDeviceSyncMigration'; interface Props { migrationPhase: MigrationPhase; diff --git a/src/components/deviceSync/DeviceSyncPreSyncModal.tsx b/src/features/deviceSync/components/DeviceSyncPreSyncModal.tsx similarity index 96% rename from src/components/deviceSync/DeviceSyncPreSyncModal.tsx rename to src/features/deviceSync/components/DeviceSyncPreSyncModal.tsx index 1f196b38..6ffd5fd0 100644 --- a/src/components/deviceSync/DeviceSyncPreSyncModal.tsx +++ b/src/features/deviceSync/components/DeviceSyncPreSyncModal.tsx @@ -1,8 +1,8 @@ import React from 'react'; import { useTranslation } from 'react-i18next'; import { AlertCircle, Loader2 } from 'lucide-react'; -import type { SyncDelta } from '../../utils/deviceSync/runDeviceSyncExecution'; -import { formatMb } from '../../utils/format/formatBytes'; +import type { SyncDelta } from '@/features/deviceSync/utils/runDeviceSyncExecution'; +import { formatMb } from '@/utils/format/formatBytes'; interface Props { preSyncOpen: boolean; diff --git a/src/hooks/useDeviceSyncBrowser.ts b/src/features/deviceSync/hooks/useDeviceSyncBrowser.ts similarity index 92% rename from src/hooks/useDeviceSyncBrowser.ts rename to src/features/deviceSync/hooks/useDeviceSyncBrowser.ts index 1c705409..ed7da0b8 100644 --- a/src/hooks/useDeviceSyncBrowser.ts +++ b/src/features/deviceSync/hooks/useDeviceSyncBrowser.ts @@ -1,12 +1,12 @@ import { useCallback, useEffect, useState } from 'react'; -import { getPlaylists } from '../api/subsonicPlaylists'; -import { getArtists, getArtist } from '../api/subsonicArtists'; -import { getAlbumList } from '../api/subsonicLibrary'; -import { search as searchSubsonic } from '../api/subsonicSearch'; +import { getPlaylists } from '@/api/subsonicPlaylists'; +import { getArtists, getArtist } from '@/api/subsonicArtists'; +import { getAlbumList } from '@/api/subsonicLibrary'; +import { search as searchSubsonic } from '@/api/subsonicSearch'; import type { SubsonicAlbum, SubsonicArtist, SubsonicPlaylist, -} from '../api/subsonicTypes'; -import type { SourceTab } from '../utils/deviceSync/deviceSyncHelpers'; +} from '@/api/subsonicTypes'; +import type { SourceTab } from '@/features/deviceSync/utils/deviceSyncHelpers'; export interface DeviceSyncBrowserResult { playlists: SubsonicPlaylist[]; diff --git a/src/hooks/useDeviceSyncDeviceScan.ts b/src/features/deviceSync/hooks/useDeviceSyncDeviceScan.ts similarity index 93% rename from src/hooks/useDeviceSyncDeviceScan.ts rename to src/features/deviceSync/hooks/useDeviceSyncDeviceScan.ts index bbe576e2..f575edf1 100644 --- a/src/hooks/useDeviceSyncDeviceScan.ts +++ b/src/features/deviceSync/hooks/useDeviceSyncDeviceScan.ts @@ -1,8 +1,8 @@ import { useCallback, useEffect, useRef } from 'react'; import { invoke } from '@tauri-apps/api/core'; import type { TFunction } from 'i18next'; -import { useDeviceSyncStore, type DeviceSyncSource } from '../store/deviceSyncStore'; -import { showToast } from '../utils/ui/toast'; +import { useDeviceSyncStore, type DeviceSyncSource } from '@/features/deviceSync/store/deviceSyncStore'; +import { showToast } from '@/utils/ui/toast'; export interface DeviceSyncDeviceScanResult { scanDevice: () => Promise; diff --git a/src/hooks/useDeviceSyncDrives.ts b/src/features/deviceSync/hooks/useDeviceSyncDrives.ts similarity index 94% rename from src/hooks/useDeviceSyncDrives.ts rename to src/features/deviceSync/hooks/useDeviceSyncDrives.ts index e801f8ce..4577368a 100644 --- a/src/hooks/useDeviceSyncDrives.ts +++ b/src/features/deviceSync/hooks/useDeviceSyncDrives.ts @@ -1,6 +1,6 @@ import { useCallback, useEffect, useMemo, useState } from 'react'; import { invoke } from '@tauri-apps/api/core'; -import type { RemovableDrive } from '../utils/deviceSync/deviceSyncHelpers'; +import type { RemovableDrive } from '@/features/deviceSync/utils/deviceSyncHelpers'; export interface DeviceSyncDrivesResult { drives: RemovableDrive[]; diff --git a/src/hooks/useDeviceSyncJobEvents.ts b/src/features/deviceSync/hooks/useDeviceSyncJobEvents.ts similarity index 88% rename from src/hooks/useDeviceSyncJobEvents.ts rename to src/features/deviceSync/hooks/useDeviceSyncJobEvents.ts index e2acace2..a0ce20f4 100644 --- a/src/hooks/useDeviceSyncJobEvents.ts +++ b/src/features/deviceSync/hooks/useDeviceSyncJobEvents.ts @@ -2,11 +2,11 @@ import { useEffect } from 'react'; import { invoke } from '@tauri-apps/api/core'; import { listen } from '@tauri-apps/api/event'; import type { TFunction } from 'i18next'; -import { useDeviceSyncJobStore } from '../store/deviceSyncJobStore'; -import { useDeviceSyncStore } from '../store/deviceSyncStore'; -import { showToast } from '../utils/ui/toast'; -import { trackToSyncInfo } from '../utils/deviceSync/deviceSyncHelpers'; -import { fetchTracksForSource } from '../utils/playback/fetchTracksForSource'; +import { useDeviceSyncJobStore } from '@/features/deviceSync/store/deviceSyncJobStore'; +import { useDeviceSyncStore } from '@/features/deviceSync/store/deviceSyncStore'; +import { showToast } from '@/utils/ui/toast'; +import { trackToSyncInfo } from '@/features/deviceSync/utils/deviceSyncHelpers'; +import { fetchTracksForSource } from '@/utils/playback/fetchTracksForSource'; export function useDeviceSyncJobEvents( t: TFunction, diff --git a/src/hooks/useDeviceSyncSourceStatuses.ts b/src/features/deviceSync/hooks/useDeviceSyncSourceStatuses.ts similarity index 90% rename from src/hooks/useDeviceSyncSourceStatuses.ts rename to src/features/deviceSync/hooks/useDeviceSyncSourceStatuses.ts index d4a1e83f..a27faade 100644 --- a/src/hooks/useDeviceSyncSourceStatuses.ts +++ b/src/features/deviceSync/hooks/useDeviceSyncSourceStatuses.ts @@ -1,8 +1,8 @@ import { useEffect, useMemo, useState } from 'react'; import { invoke } from '@tauri-apps/api/core'; -import { fetchTracksForSource } from '../utils/playback/fetchTracksForSource'; -import { trackToSyncInfo, type SyncStatus } from '../utils/deviceSync/deviceSyncHelpers'; -import type { DeviceSyncSource } from '../store/deviceSyncStore'; +import { fetchTracksForSource } from '@/utils/playback/fetchTracksForSource'; +import { trackToSyncInfo, type SyncStatus } from '@/features/deviceSync/utils/deviceSyncHelpers'; +import type { DeviceSyncSource } from '@/features/deviceSync/store/deviceSyncStore'; export interface DeviceSyncSourceStatusesResult { sourcePathsMap: Map; diff --git a/src/features/deviceSync/index.ts b/src/features/deviceSync/index.ts new file mode 100644 index 00000000..52d0c443 --- /dev/null +++ b/src/features/deviceSync/index.ts @@ -0,0 +1,10 @@ +/** + * Device Sync feature — copies/transcodes library tracks onto external devices + * (USB drives, players). The `DeviceSync` page is lazy-loaded by the router via + * its deep path, so it is intentionally not re-exported here. + * + * Note: `audioListenerSetup/eqDeviceSync` is NOT part of this feature — it is the + * audio-core EQ-per-output-device profile sync, kept in the audio core. + */ +export { useDeviceSyncJobStore } from './store/deviceSyncJobStore'; +export type { DeviceSyncSource } from './store/deviceSyncStore'; diff --git a/src/pages/DeviceSync.tsx b/src/features/deviceSync/pages/DeviceSync.tsx similarity index 88% rename from src/pages/DeviceSync.tsx rename to src/features/deviceSync/pages/DeviceSync.tsx index 3494e0b7..45b611e9 100644 --- a/src/pages/DeviceSync.tsx +++ b/src/features/deviceSync/pages/DeviceSync.tsx @@ -1,33 +1,33 @@ -import type { SubsonicSong } from '../api/subsonicTypes'; +import type { SubsonicSong } from '@/api/subsonicTypes'; import React, { useState, useCallback, useMemo } from 'react'; import { useTranslation } from 'react-i18next'; -import { useDeviceSyncStore, DeviceSyncSource } from '../store/deviceSyncStore'; -import { useDeviceSyncJobStore } from '../store/deviceSyncJobStore'; +import { useDeviceSyncStore, DeviceSyncSource } from '@/features/deviceSync/store/deviceSyncStore'; +import { useDeviceSyncJobStore } from '@/features/deviceSync/store/deviceSyncJobStore'; import { type SourceTab, -} from '../utils/deviceSync/deviceSyncHelpers'; -import { useDeviceSyncDrives } from '../hooks/useDeviceSyncDrives'; -import { useDeviceSyncSourceStatuses } from '../hooks/useDeviceSyncSourceStatuses'; -import { useDeviceSyncBrowser } from '../hooks/useDeviceSyncBrowser'; -import { useDeviceSyncDeviceScan } from '../hooks/useDeviceSyncDeviceScan'; -import { useDeviceSyncJobEvents } from '../hooks/useDeviceSyncJobEvents'; +} from '@/features/deviceSync/utils/deviceSyncHelpers'; +import { useDeviceSyncDrives } from '@/features/deviceSync/hooks/useDeviceSyncDrives'; +import { useDeviceSyncSourceStatuses } from '@/features/deviceSync/hooks/useDeviceSyncSourceStatuses'; +import { useDeviceSyncBrowser } from '@/features/deviceSync/hooks/useDeviceSyncBrowser'; +import { useDeviceSyncDeviceScan } from '@/features/deviceSync/hooks/useDeviceSyncDeviceScan'; +import { useDeviceSyncJobEvents } from '@/features/deviceSync/hooks/useDeviceSyncJobEvents'; import { runDeviceSyncMigrationPreview, runDeviceSyncMigrationExecute, type MigrationPhase, type MigrationPair, type MigrationResult, -} from '../utils/deviceSync/runDeviceSyncMigration'; +} from '@/features/deviceSync/utils/runDeviceSyncMigration'; import { runDeviceSyncSummaryPrompt, runDeviceSyncExecute, type SyncDelta, -} from '../utils/deviceSync/runDeviceSyncExecution'; -import { runDeviceSyncChooseFolder } from '../utils/deviceSync/runDeviceSyncChooseFolder'; -import DeviceSyncHeader from '../components/deviceSync/DeviceSyncHeader'; -import DeviceSyncPreSyncModal from '../components/deviceSync/DeviceSyncPreSyncModal'; -import DeviceSyncMigrationModal from '../components/deviceSync/DeviceSyncMigrationModal'; -import DeviceSyncBrowserPanel from '../components/deviceSync/DeviceSyncBrowserPanel'; -import DeviceSyncDevicePanel from '../components/deviceSync/DeviceSyncDevicePanel'; +} from '@/features/deviceSync/utils/runDeviceSyncExecution'; +import { runDeviceSyncChooseFolder } from '@/features/deviceSync/utils/runDeviceSyncChooseFolder'; +import DeviceSyncHeader from '@/features/deviceSync/components/DeviceSyncHeader'; +import DeviceSyncPreSyncModal from '@/features/deviceSync/components/DeviceSyncPreSyncModal'; +import DeviceSyncMigrationModal from '@/features/deviceSync/components/DeviceSyncMigrationModal'; +import DeviceSyncBrowserPanel from '@/features/deviceSync/components/DeviceSyncBrowserPanel'; +import DeviceSyncDevicePanel from '@/features/deviceSync/components/DeviceSyncDevicePanel'; // ─── component ─────────────────────────────────────────────────────────────── diff --git a/src/store/deviceSyncJobStore.ts b/src/features/deviceSync/store/deviceSyncJobStore.ts similarity index 100% rename from src/store/deviceSyncJobStore.ts rename to src/features/deviceSync/store/deviceSyncJobStore.ts diff --git a/src/store/deviceSyncStore.ts b/src/features/deviceSync/store/deviceSyncStore.ts similarity index 100% rename from src/store/deviceSyncStore.ts rename to src/features/deviceSync/store/deviceSyncStore.ts diff --git a/src/utils/deviceSync/deviceSyncHelpers.ts b/src/features/deviceSync/utils/deviceSyncHelpers.ts similarity index 96% rename from src/utils/deviceSync/deviceSyncHelpers.ts rename to src/features/deviceSync/utils/deviceSyncHelpers.ts index 02522719..fa43efa9 100644 --- a/src/utils/deviceSync/deviceSyncHelpers.ts +++ b/src/features/deviceSync/utils/deviceSyncHelpers.ts @@ -1,4 +1,4 @@ -import type { SubsonicSong } from '../../api/subsonicTypes'; +import type { SubsonicSong } from '@/api/subsonicTypes'; export type SourceTab = 'playlists' | 'albums' | 'artists'; diff --git a/src/utils/deviceSync/deviceSyncLegacyTemplate.ts b/src/features/deviceSync/utils/deviceSyncLegacyTemplate.ts similarity index 97% rename from src/utils/deviceSync/deviceSyncLegacyTemplate.ts rename to src/features/deviceSync/utils/deviceSyncLegacyTemplate.ts index 125ab9cb..23bfebf5 100644 --- a/src/utils/deviceSync/deviceSyncLegacyTemplate.ts +++ b/src/features/deviceSync/utils/deviceSyncLegacyTemplate.ts @@ -1,4 +1,4 @@ -import { IS_WINDOWS } from '../platform'; +import { IS_WINDOWS } from '@/utils/platform'; // Same sanitize rules the Rust side uses (`sanitize_path_component`): strip // Windows-illegal chars and control chars, trim leading/trailing dots + spaces. diff --git a/src/utils/deviceSync/runDeviceSyncChooseFolder.ts b/src/features/deviceSync/utils/runDeviceSyncChooseFolder.ts similarity index 89% rename from src/utils/deviceSync/runDeviceSyncChooseFolder.ts rename to src/features/deviceSync/utils/runDeviceSyncChooseFolder.ts index 33711a02..e6296774 100644 --- a/src/utils/deviceSync/runDeviceSyncChooseFolder.ts +++ b/src/features/deviceSync/utils/runDeviceSyncChooseFolder.ts @@ -1,8 +1,8 @@ import { invoke } from '@tauri-apps/api/core'; import { open as openDialog } from '@tauri-apps/plugin-dialog'; import type { TFunction } from 'i18next'; -import { useDeviceSyncStore, type DeviceSyncSource } from '../../store/deviceSyncStore'; -import { showToast } from '../ui/toast'; +import { useDeviceSyncStore, type DeviceSyncSource } from '@/features/deviceSync/store/deviceSyncStore'; +import { showToast } from '@/utils/ui/toast'; export interface RunDeviceSyncChooseFolderDeps { t: TFunction; diff --git a/src/utils/deviceSync/runDeviceSyncExecution.ts b/src/features/deviceSync/utils/runDeviceSyncExecution.ts similarity index 89% rename from src/utils/deviceSync/runDeviceSyncExecution.ts rename to src/features/deviceSync/utils/runDeviceSyncExecution.ts index bd02c629..6e8070e7 100644 --- a/src/utils/deviceSync/runDeviceSyncExecution.ts +++ b/src/features/deviceSync/utils/runDeviceSyncExecution.ts @@ -1,12 +1,12 @@ import type { TFunction } from 'i18next'; import { invoke } from '@tauri-apps/api/core'; -import { buildDownloadUrl } from '../../api/subsonicStreamUrl'; -import type { SubsonicSong } from '../../api/subsonicTypes'; -import { useDeviceSyncStore, type DeviceSyncSource } from '../../store/deviceSyncStore'; -import { useDeviceSyncJobStore } from '../../store/deviceSyncJobStore'; -import { showToast } from '../ui/toast'; -import { trackToSyncInfo, uuid } from './deviceSyncHelpers'; -import { fetchTracksForSource } from '../playback/fetchTracksForSource'; +import { buildDownloadUrl } from '@/api/subsonicStreamUrl'; +import type { SubsonicSong } from '@/api/subsonicTypes'; +import { useDeviceSyncStore, type DeviceSyncSource } from '@/features/deviceSync/store/deviceSyncStore'; +import { useDeviceSyncJobStore } from '@/features/deviceSync/store/deviceSyncJobStore'; +import { showToast } from '@/utils/ui/toast'; +import { trackToSyncInfo, uuid } from '@/features/deviceSync/utils/deviceSyncHelpers'; +import { fetchTracksForSource } from '@/utils/playback/fetchTracksForSource'; export interface SyncDelta { addBytes: number; @@ -37,7 +37,7 @@ export async function runDeviceSyncSummaryPrompt(deps: RunDeviceSyncSummaryDeps) setPreSyncOpen(true); try { - const { getClient } = await import('../../api/subsonicClient'); + const { getClient } = await import('@/api/subsonicClient'); const { baseUrl, params } = getClient(); const payload = await invoke('calculate_sync_payload', { sources, diff --git a/src/utils/deviceSync/runDeviceSyncMigration.ts b/src/features/deviceSync/utils/runDeviceSyncMigration.ts similarity index 93% rename from src/utils/deviceSync/runDeviceSyncMigration.ts rename to src/features/deviceSync/utils/runDeviceSyncMigration.ts index 866785cb..7d00b3b2 100644 --- a/src/utils/deviceSync/runDeviceSyncMigration.ts +++ b/src/features/deviceSync/utils/runDeviceSyncMigration.ts @@ -1,11 +1,11 @@ import type React from 'react'; import { invoke } from '@tauri-apps/api/core'; -import type { DeviceSyncSource } from '../../store/deviceSyncStore'; -import type { SubsonicSong } from '../../api/subsonicTypes'; -import { applyLegacyTemplate } from './deviceSyncLegacyTemplate'; -import { trackToSyncInfo } from './deviceSyncHelpers'; -import { fetchTracksForSource } from '../playback/fetchTracksForSource'; -import { IS_WINDOWS } from '../platform'; +import type { DeviceSyncSource } from '@/features/deviceSync/store/deviceSyncStore'; +import type { SubsonicSong } from '@/api/subsonicTypes'; +import { applyLegacyTemplate } from '@/features/deviceSync/utils/deviceSyncLegacyTemplate'; +import { trackToSyncInfo } from '@/features/deviceSync/utils/deviceSyncHelpers'; +import { fetchTracksForSource } from '@/utils/playback/fetchTracksForSource'; +import { IS_WINDOWS } from '@/utils/platform'; export type MigrationPhase = 'closed' | 'loading' | 'preview' | 'executing' | 'done' | 'nothing'; diff --git a/src/utils/playback/fetchTracksForSource.ts b/src/utils/playback/fetchTracksForSource.ts index 5c92a114..4033daff 100644 --- a/src/utils/playback/fetchTracksForSource.ts +++ b/src/utils/playback/fetchTracksForSource.ts @@ -1,5 +1,5 @@ import type { SubsonicSong } from '../../api/subsonicTypes'; -import type { DeviceSyncSource } from '../../store/deviceSyncStore'; +import type { DeviceSyncSource } from '@/features/deviceSync'; import { resolveAlbum, resolveArtist,