import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'; import { Link, Outlet } from '@tanstack/react-router'; import clsx from 'clsx'; import { Button, Switch } from '@/components/form/form'; import { Show } from '@/components/primitives'; import { useReactPageShell } from '@/platform/shell/route-controllers'; import type { ImportOptionsPayload, ImportQueueEntry } from '../-import.types'; import { importOptionsQueryOptions, IMPORT_QUERY_KEY, saveImportOptions } from '../-import.api'; import { getQueueProgressPercent, getQueueStatusText, getStagingStatsText, } from '../-import.helpers'; import { useImportQueueWorkflow } from '../-import.store'; import styles from './import-page.module.css'; import { fallbackImage, RefreshIcon, useImportStaging } from './import-shared'; export function ImportPage() { useReactPageShell('import'); const { refreshStaging, scanning, scanProgress, stagingFiles, stagingPath, stagingQuery } = useImportStaging(); const isRefreshing = stagingQuery.isRefetching; const lastRefreshedAt = stagingQuery.dataUpdatedAt > 0 ? formatShortTime(stagingQuery.dataUpdatedAt) : null; // While a large staging folder is still scanning (#947), show progress instead of a count. const fileCountText = scanning ? scanProgress && scanProgress.total > 0 ? `Scanning ${scanProgress.scanned} of ${scanProgress.total} files…` : 'Scanning staging folder…' : getStagingStatsText(stagingFiles); return (
Import Music