From 41cd848391226aabdf370d50bdf4119851c85d66 Mon Sep 17 00:00:00 2001 From: Halvor Thallaug Fagerli Date: Tue, 10 Nov 2026 18:05:22 +0100 Subject: [PATCH 1/5] fix: Partial control of input Min + max has been set for yearFrom and yearTo inputs, but only works for the arrows! Needs further work... --- frontend/src/components/Toolbar/Toolbar.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontend/src/components/Toolbar/Toolbar.tsx b/frontend/src/components/Toolbar/Toolbar.tsx index 29d9caa..7619b23 100644 --- a/frontend/src/components/Toolbar/Toolbar.tsx +++ b/frontend/src/components/Toolbar/Toolbar.tsx @@ -274,6 +274,8 @@ function FilterPanel({ filters, onApply, onClose }: FilterPanelProps) { type="number" inputMode="numeric" placeholder="Year" + min="1970" + max="2026" value={draft.yearFrom ?? ""} onChange={(event: ChangeEvent) => setDraft((d) => ({ @@ -290,6 +292,8 @@ function FilterPanel({ filters, onApply, onClose }: FilterPanelProps) { type="number" inputMode="numeric" placeholder="Year" + min={draft.yearFrom?.valueOf() ?? 1970} + max="2026" value={draft.yearTo ?? ""} onChange={(event: ChangeEvent) => setDraft((d) => ({ From 1a914a1a6606fb13ad1f13d61bc10cee211dc83b Mon Sep 17 00:00:00 2001 From: Halvor Thallaug Fagerli Date: Wed, 11 Nov 2026 20:13:59 +0100 Subject: [PATCH 2/5] feat: Added YEAR_OPTIONS Added array with options for years for the "Year" Select objects in Toolbar.tsx --- frontend/src/constants/filterOptions.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/frontend/src/constants/filterOptions.ts b/frontend/src/constants/filterOptions.ts index e876034..e1a968a 100644 --- a/frontend/src/constants/filterOptions.ts +++ b/frontend/src/constants/filterOptions.ts @@ -74,6 +74,17 @@ export const ESRB_OPTIONS = [ "Rating Pending", ] as const; +export const YEAR_OPTIONS = [ + 1984, 1985, 1986, 1987, 1988, 1989, + 1990, 1991, 1992, 1993, 1994, + 1995, 1996, 1997, 1998, 1999, + 2000, 2001, 2002, 2003, 2004, + 2005, 2006, 2007, 2008, 2009, + 2010, 2011, 2012, 2013, 2014, + 2015, 2016, 2017, 2018, 2019, + 2020, // Games imported are only up to 2020 +] as const; + export const SORT_FIELD_OPTIONS = [ { value: "NAME", label: "Name" }, { value: "RELEASE_DATE", label: "Release date" }, From 43888f8cf8643e147b58558e6c8f4db6a8e57ac3 Mon Sep 17 00:00:00 2001 From: Halvor Thallaug Fagerli Date: Wed, 11 Nov 2026 20:18:40 +0100 Subject: [PATCH 3/5] feat: Changed yearFrom and yearTo to Select objects `yearFrom` and `yearTo` are now changeable via Select object rather than being input objects. `yearTo` only displays valid years (after `yearFrom`). Known bug: when changing `yearFrom` to a year ealier than `yearTo` and applying filter, `yearTo` changes to `Year`, but gives result "No games match these filters." --- frontend/src/components/Toolbar/Toolbar.tsx | 40 ++++++++++++--------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/frontend/src/components/Toolbar/Toolbar.tsx b/frontend/src/components/Toolbar/Toolbar.tsx index 7619b23..9f10ee8 100644 --- a/frontend/src/components/Toolbar/Toolbar.tsx +++ b/frontend/src/components/Toolbar/Toolbar.tsx @@ -14,6 +14,7 @@ import { PLATFORM_OPTIONS, SORT_FIELD_OPTIONS, TAG_OPTIONS, + YEAR_OPTIONS, } from "../../constants/filterOptions"; import type { GameFilters, SortField, SortState } from "../../types/gameQuery"; import { EMPTY_FILTERS, hasActiveFilters } from "../../types/gameQuery"; @@ -270,38 +271,45 @@ function FilterPanel({ filters, onApply, onClose }: FilterPanelProps) { Released from - ) => + onChange={(event: ChangeEvent) => setDraft((d) => ({ ...d, yearFrom: event.target.value ? Number(event.target.value) : null, })) } - /> + > + + {YEAR_OPTIONS.map((year) => ( + + ))} + Released to - ) => + onChange={(event: ChangeEvent) => setDraft((d) => ({ ...d, yearTo: event.target.value ? Number(event.target.value) : null, })) } - /> + > + + {YEAR_OPTIONS.filter(year => { + if (draft.yearFrom == null) return ; + else if (year >= draft.yearFrom) return ; + }).map(filterYear => ( + + ))} + From 250c3c9ba8e5148e896dc9a58a337d1b84a4793a Mon Sep 17 00:00:00 2001 From: Halvor Thallaug Fagerli Date: Sun, 15 Nov 2026 14:07:37 +0100 Subject: [PATCH 4/5] fix: Changes yearTo = null if yearFrom is newer year Fixes problems with #60 and #81 and eliminates problems when setting release year filters #60 #81 --- frontend/src/components/Toolbar/Toolbar.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/Toolbar/Toolbar.tsx b/frontend/src/components/Toolbar/Toolbar.tsx index 9f10ee8..85af415 100644 --- a/frontend/src/components/Toolbar/Toolbar.tsx +++ b/frontend/src/components/Toolbar/Toolbar.tsx @@ -286,6 +286,7 @@ function FilterPanel({ filters, onApply, onClose }: FilterPanelProps) { {year} ))} + @@ -293,17 +294,20 @@ function FilterPanel({ filters, onApply, onClose }: FilterPanelProps) { Released to ) => + onChange={(event: ChangeEvent) => { setDraft((d) => ({ ...d, yearTo: event.target.value ? Number(event.target.value) : null, })) - } + console.log(event.target.value); + }} > {YEAR_OPTIONS.filter(year => { if (draft.yearFrom == null) return ; else if (year >= draft.yearFrom) return ; + // If someone changes yearFrom to a later year than yearTo + else if (Number(draft.yearTo) < draft.yearFrom) draft.yearTo = null; }).map(filterYear => (