From 09caf8f3646945f58c3213d3a86973dbff034ffd Mon Sep 17 00:00:00 2001 From: Sucukdeluxe Date: Fri, 21 Aug 2026 00:02:24 +0200 Subject: [PATCH] fix(downloads): keep layout reset in header menu --- .../views/downloads/DownloadsTable.tsx | 5 ++-- .../views/downloads/DownloadsView.tsx | 2 +- src/renderer/views/downloads/downloads.css | 15 ------------ tests/downloads-view.test.tsx | 23 ++++--------------- 4 files changed, 7 insertions(+), 38 deletions(-) diff --git a/src/renderer/views/downloads/DownloadsTable.tsx b/src/renderer/views/downloads/DownloadsTable.tsx index 3374a47..030d9c1 100644 --- a/src/renderer/views/downloads/DownloadsTable.tsx +++ b/src/renderer/views/downloads/DownloadsTable.tsx @@ -512,7 +512,6 @@ export interface DownloadsTableHeaderProps { actions: DownloadsTableActions; columnOrder: readonly string[]; gridTemplate: string; - onResetColumnLayout?: () => void; sortColumn: DownloadSortColumn; sortDirection: "asc" | "desc"; selectedCount: number; @@ -534,7 +533,7 @@ function moveColumnWithPointerActions(column: string, direction: -1 | 1, element actions.onColumnPointerUp(column, pointerEvent(clientX)); } -export function DownloadsTableHeader({ actions, columnOrder, gridTemplate, onResetColumnLayout, sortColumn, sortDirection, selectedCount, visibleIds }: DownloadsTableHeaderProps): ReactElement { +export function DownloadsTableHeader({ actions, columnOrder, gridTemplate, sortColumn, sortDirection, selectedCount, visibleIds }: DownloadsTableHeaderProps): ReactElement { const allSelected = visibleIds.length > 0 && selectedCount === visibleIds.length; const mixedSelection = selectedCount > 0 && selectedCount < visibleIds.length; return ( @@ -575,7 +574,7 @@ export function DownloadsTableHeader({ actions, columnOrder, gridTemplate, onRes ); })} - Aktion{onResetColumnLayout ? : null} + Aktion ); } diff --git a/src/renderer/views/downloads/DownloadsView.tsx b/src/renderer/views/downloads/DownloadsView.tsx index a5ebd92..eee5eff 100644 --- a/src/renderer/views/downloads/DownloadsView.tsx +++ b/src/renderer/views/downloads/DownloadsView.tsx @@ -149,7 +149,7 @@ export function DownloadsContent({ actions, model }: { actions: DownloadsViewAct return (
- +
diff --git a/src/renderer/views/downloads/downloads.css b/src/renderer/views/downloads/downloads.css index 942045b..a845908 100644 --- a/src/renderer/views/downloads/downloads.css +++ b/src/renderer/views/downloads/downloads.css @@ -527,21 +527,6 @@ padding: 0; } -.downloads-header-action-cell { - flex-direction: column; - gap: 1px; - line-height: 11px; -} - -.downloads-header-action-cell .downloads-column-reset-button { - width: 20px; - height: 20px; - min-height: 20px; - border-radius: 4px; - font-size: 15px; - line-height: 1; -} - .downloads-collapse-button { box-sizing: border-box; flex: 0 0 30px; diff --git a/tests/downloads-view.test.tsx b/tests/downloads-view.test.tsx index dccac29..82b567f 100644 --- a/tests/downloads-view.test.tsx +++ b/tests/downloads-view.test.tsx @@ -95,28 +95,13 @@ describe("Downloadtabellen-Spalten", () => { expect(header.props.style.gridTemplateColumns).toBe(expected); }); - it("exposes a header action that delegates resetting the column layout", () => { - const reset = vi.fn(); - const actions = createActions({ onResetColumnLayout: reset }); + it("keeps the column layout reset out of the table action header", () => { + const actions = createActions(); const model = withRuntime(createInput()); const content = renderToStaticMarkup(); - const header = DownloadsTableHeader({ - actions, - columnOrder: model.columnOrder, - gridTemplate: model.gridTemplate, - onResetColumnLayout: actions.onResetColumnLayout, - selectedCount: 0, - sortColumn: "name", - sortDirection: "asc", - visibleIds: model.visibleRowIds - }); - const button = findElement(header, (element) => element.type === "button" && element.props["aria-label"] === "Spaltenlayout zurücksetzen"); - button.props.onClick(); - - expect(content).toContain('aria-label="Spaltenlayout zurücksetzen"'); - expect(button.props.title).toBe("Spaltenlayout zurücksetzen"); - expect(reset).toHaveBeenCalledTimes(1); + expect(content).not.toContain('aria-label="Spaltenlayout zurücksetzen"'); + expect(content).toMatch(/class="downloads-action-cell" role="columnheader">Aktion<\/span>/); }); it("never interpolates download grid tracks while column contents move", () => {