From 7a0548ac94c4998f5b1fcb2f17e798d3407b96c0 Mon Sep 17 00:00:00 2001 From: Antti Kettunen Date: Mon, 18 May 2026 21:11:45 +0300 Subject: [PATCH] refactor(import): normalize controls and classes - let the singles action buttons use the default size again - remove redundant type="button" props from import controls - switch import page conditional classes to clsx object notation - drop route-test assertions that pinned compact auto-import sizes --- webui/src/routes/import/-route.test.tsx | 7 -- .../routes/import/-ui/album-import-tab.tsx | 72 +++++++------------ .../src/routes/import/-ui/auto-import-tab.tsx | 45 +++++------- webui/src/routes/import/-ui/import-page.tsx | 38 +++++----- .../routes/import/-ui/singles-import-tab.tsx | 25 ++----- 5 files changed, 70 insertions(+), 117 deletions(-) diff --git a/webui/src/routes/import/-route.test.tsx b/webui/src/routes/import/-route.test.tsx index 7f9634fc..989aaacb 100644 --- a/webui/src/routes/import/-route.test.tsx +++ b/webui/src/routes/import/-route.test.tsx @@ -304,13 +304,6 @@ describe('import route', () => { expect(await screen.findByRole('button', { name: /^Needs Review\s*1$/ })).toBeInTheDocument(); expect(screen.getAllByText('Album A').length).toBeGreaterThan(0); expect(screen.getByText('Watching')).toHaveAttribute('data-tone', 'success'); - const compactFilterGroup = document.querySelector('#auto-import-results [data-size="sm"]'); - expect(compactFilterGroup).toBeInTheDocument(); - const intervalSelect = document.getElementById('auto-import-interval'); - if (!(intervalSelect instanceof HTMLElement)) { - throw new Error('auto-import interval select missing'); - } - expect(intervalSelect).toHaveAttribute('data-size', 'sm'); expect(getFetchUrls().some((url) => url.includes('/api/import/staging/groups'))).toBe(false); expect(getFetchUrls().some((url) => url.includes('/api/import/staging/suggestions'))).toBe( false, diff --git a/webui/src/routes/import/-ui/album-import-tab.tsx b/webui/src/routes/import/-ui/album-import-tab.tsx index d5ba7511..f74b79ae 100644 --- a/webui/src/routes/import/-ui/album-import-tab.tsx +++ b/webui/src/routes/import/-ui/album-import-tab.tsx @@ -1,10 +1,10 @@ import { useQuery } from '@tanstack/react-query'; import { type DragEvent, type KeyboardEvent, useState } from 'react'; +import clsx from 'clsx'; import { Button, TextInput } from '@/components/form/form'; import type { ImportAlbumResult } from '../-import.types'; -import styles from './import-page.module.css'; import { importStagingGroupsQueryOptions, @@ -20,6 +20,7 @@ import { IMPORT_PLACEHOLDER_IMAGE, } from '../-import.helpers'; import { useAlbumImportWorkflow } from '../-import.store'; +import styles from './import-page.module.css'; import { fallbackImage, getErrorMessage, @@ -235,10 +236,7 @@ function AlbumImportPanelContent({ viewModel }: { viewModel: AlbumImportViewMode return ( <> -
+
{albumResults === null && ( <> {groups.length > 0 && ( @@ -246,10 +244,9 @@ function AlbumImportPanelContent({ viewModel }: { viewModel: AlbumImportViewMode
Auto-Detected Albums
{groups.map((group, index) => ( - -
@@ -333,10 +329,7 @@ function AlbumImportPanelContent({ viewModel }: { viewModel: AlbumImportViewMode
-
+
{albumMatchLoading ? (
Matching files to tracklist...
) : albumMatchError ? ( @@ -344,7 +337,9 @@ function AlbumImportPanelContent({ viewModel }: { viewModel: AlbumImportViewMode ) : albumMatch?.album ? ( ) : ( -
Select an album to start matching files.
+
+ Select an album to start matching files. +
)}
@@ -359,7 +354,7 @@ function AlbumCard({ onSelect: (album: ImportAlbumResult) => void; }) { return ( - -
@@ -467,9 +452,10 @@ function AlbumMatchPanel({ viewModel }: { viewModel: AlbumImportViewModel }) { return (
{ if (tapSelectedChip !== null) onTapAssign(index, tapSelectedChip); }} @@ -488,18 +474,16 @@ function AlbumMatchPanel({ viewModel }: { viewModel: AlbumImportViewModel }) { > {trackInfo.displayTrackNumber} {trackInfo.name} - + {file ? ( <> {file.filename} = 0.7 ? '' : styles.low - }`} + className={clsx(styles.importPageMatchConfidence, { + [styles.low]: confidence < 0.7, + })} > {confidencePercent}% @@ -511,7 +495,6 @@ function AlbumMatchPanel({ viewModel }: { viewModel: AlbumImportViewModel }) { {file ? (
@@ -291,12 +286,7 @@ function SingleSearchPanel({ if (event.key === 'Enter') onRunSearch(fileKey, query); }} /> - @@ -311,7 +301,6 @@ function SingleSearchPanel({ searchState?.results.map((track, index) => (