feat(downloads): reset the saved column layout
Wire the download header reset action to cancel active column motion, restore the default order immediately, persist it through the serialized settings path, and confirm the result in the UI.
This commit is contained in:
@@ -4805,6 +4805,20 @@ export function App(): ReactElement {
|
||||
}), [actionBusy, columnOrder, downloadDisclosureRevision, downloadPackageSpeeds, downloadQueueTotalBytes, downloadRemaining, downloadsSortColumn, downloadsSortDescending, downloadsViewCore, editingName, editingPackageId, gridTemplate, liveDownloadSpeedBps, providerStats.length, scheduleCountdown, schedulePickerOpen, scheduleTimeInput, snapshot.canPause, snapshot.canStart, snapshot.canStop, snapshot.clipboardActive, snapshot.etaText, snapshot.reconnectSeconds, snapshot.session.items, snapshot.session.paused, snapshot.session.reconnectReason, snapshot.session.running, snapshot.settings.animatePackageDisclosure, snapshot.settings.scheduledStartEpochMs, snapshot.stats.totalDownloaded, snapshot.stats.totalPackages]);
|
||||
|
||||
const downloadsActions: DownloadsViewActions = {
|
||||
onResetColumnLayout: () => {
|
||||
if (columnDragSettleTimerRef.current !== null) {
|
||||
window.clearTimeout(columnDragSettleTimerRef.current);
|
||||
columnDragSettleTimerRef.current = null;
|
||||
}
|
||||
cancelColumnDragAnimations();
|
||||
if (columnDragSessionRef.current) {
|
||||
clearDownloadColumnDrag(columnDragSessionRef.current);
|
||||
columnDragSessionRef.current = null;
|
||||
}
|
||||
setColumnOrder(DEFAULT_COLUMN_ORDER);
|
||||
persistColumnOrder(DEFAULT_COLUMN_ORDER);
|
||||
showToast("Spaltenlayout zurückgesetzt", 1800);
|
||||
},
|
||||
onDisplayModeChange: setDownloadDisplayMode,
|
||||
onFilterChange: setDownloadFilter,
|
||||
onProviderFilterChange: setDownloadProviderFilter,
|
||||
|
||||
@@ -83,6 +83,16 @@ describe("desktop shell", () => {
|
||||
expect(pointerUp).toContain("snapshot.settings.animatePackageDisclosure");
|
||||
});
|
||||
|
||||
it("resets the download columns immediately and persists the default order", () => {
|
||||
const source = readFileSync(new URL("../src/renderer/App.tsx", import.meta.url), "utf8");
|
||||
const actions = source.slice(source.indexOf("const downloadsActions"), source.indexOf("const statisticsActions"));
|
||||
|
||||
expect(actions).toContain("onResetColumnLayout");
|
||||
expect(actions).toContain("setColumnOrder(DEFAULT_COLUMN_ORDER)");
|
||||
expect(actions).toContain("persistColumnOrder(DEFAULT_COLUMN_ORDER)");
|
||||
expect(actions).toContain('showToast("Spaltenlayout zurückgesetzt"');
|
||||
});
|
||||
|
||||
it("keeps application menus mounted for animated opening and closing", () => {
|
||||
const source = readFileSync(new URL("../src/renderer/App.tsx", import.meta.url), "utf8");
|
||||
const css = readFileSync(new URL("../src/renderer/styles.css", import.meta.url), "utf8");
|
||||
|
||||
Reference in New Issue
Block a user