From c420fd2aa1bc64b5b204b940d6fe32b13faac20e Mon Sep 17 00:00:00 2001 From: Jakob Wennberg Date: Thu, 13 Aug 2026 15:17:03 +0200 Subject: [PATCH] refactor(transactions): drop the Q1-Q4 chips from the period filter (#1579) The quarter chips (#1545) appeared only once a rakenskapsar was chosen, pushed the filter row out of alignment, and on a brutet rakenskapsar they were fiscal-year quarters rather than momsdeklaration quarters, so they misled more than they scoped. The rakenskapsar filter itself (the user-requested half) stays; lib/transactions/period-filter.ts keeps its quarter helpers and tests since resolvePeriodBounds still serves the full-year bounds. Co-authored-by: Jakob Wennberg <311770904+jakobwennberg-oss@users.noreply.github.com> Co-authored-by: Claude Fable 5 --- app/(dashboard)/transactions/page.tsx | 74 +++++---------------------- messages/en.json | 1 - messages/sv.json | 1 - 3 files changed, 13 insertions(+), 63 deletions(-) diff --git a/app/(dashboard)/transactions/page.tsx b/app/(dashboard)/transactions/page.tsx index 3dd62ff3..ecc91c86 100644 --- a/app/(dashboard)/transactions/page.tsx +++ b/app/(dashboard)/transactions/page.tsx @@ -65,13 +65,7 @@ import type { TransactionCategory, CreateTransactionInput, Invoice, Customer, Su import type { SuggestedTemplate } from '@/lib/transactions/category-suggestions' import { isImportedTransaction } from '@/lib/transactions/origin' import { computeJeUnderlagStatus, type JeUnderlagStatus } from '@/lib/transactions/underlag-status' -import { - QUARTERS, - isWithinBounds, - quarterBounds, - resolvePeriodBounds, - type Quarter, -} from '@/lib/transactions/period-filter' +import { isWithinBounds, resolvePeriodBounds } from '@/lib/transactions/period-filter' import type { FiscalPeriod } from '@/types' function InlineDialogContentLoading() { @@ -451,40 +445,28 @@ export default function TransactionsPage() { } }, []) - // Period filter (rakenskapsar + optional quarter within it). Quarters - // follow the fiscal year, so a brutet rakenskapsar (July-June) gets - // Q1 = Jul-Sep. FyPicker owns the persistence under the page-local key; - // the quarter is session-only. + // Period filter (rakenskapsar). FyPicker owns the persistence under the + // page-local key. Quarter chips existed briefly (#1545) but were dropped: + // they crowded the filter row, and on a brutet rakenskapsar they were not + // momsdeklaration quarters, which made them misleading rather than useful. const [fyPeriodId, setFyPeriodId] = useState(null) const [fyPeriod, setFyPeriod] = useState(null) - const [fyQuarter, setFyQuarter] = useState(null) - const periodBounds = useMemo( - () => resolvePeriodBounds(fyPeriod, fyQuarter), - [fyPeriod, fyQuarter], - ) + const periodBounds = useMemo(() => resolvePeriodBounds(fyPeriod, null), [fyPeriod]) const handlePeriodChange = useCallback((periodId: string | null, period?: FiscalPeriod | null) => { setFyPeriodId(periodId) setFyPeriod(period ?? null) - setFyQuarter(null) // Batch selections may reference rows the new scope hides; every batch // action operates on "what you see", so drop them. setSelectedIds(new Set()) setSkvSelectedIds(new Set()) }, []) - const handleQuarterChange = useCallback((quarter: Quarter | null) => { - setFyQuarter(quarter) - setSelectedIds(new Set()) - setSkvSelectedIds(new Set()) - }, []) - // Footer "Visa alla" escape hatch: clears the period scope AND its // persisted value (FyPicker only writes storage from its own dropdown). const clearPeriodFilter = useCallback(() => { setFyPeriodId(null) setFyPeriod(null) - setFyQuarter(null) setSelectedIds(new Set()) setSkvSelectedIds(new Set()) if (companyId) { @@ -2926,49 +2908,19 @@ export default function TransactionsPage() { /> {/* Far-right context group, shared by both view modes: period scope - (rakenskapsar chip + quarter chips once a year is chosen) and the - account chooser (concept scene 10). Approved deviation from - convention 8's single chip: booking is period work, so the period - scope earns the second chip (user request 2026-08-12). */} + (rakenskapsar chip) and the account chooser (concept scene 10). + Approved deviation from convention 8's single chip: booking is + period work, so the period scope earns the second chip (user + request 2026-08-12). The Q1-Q4 chips that briefly rendered here + (#1545) were removed: they crowded the row into a second line, + and on a brutet rakenskapsar they were not momsdeklaration + quarters, so they misled more than they scoped. */}
- {fyPeriod && ( -
- {QUARTERS.map((quarter) => { - const bounds = quarterBounds(fyPeriod, quarter) - const active = fyQuarter === quarter - return ( - - ) - })} -
- )} {sourceItems.length > 1 && (