From 5fc218fd3a06a80c9cce36ae62913e80feb6efbf Mon Sep 17 00:00:00 2001 From: maxstue Date: Sat, 27 Jun 2026 19:59:28 +0200 Subject: [PATCH] fix(consumptions): keep selected month urls lowercase --- .../client/src/app/consumptions/month-nav.tsx | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/apps/client/src/app/consumptions/month-nav.tsx b/apps/client/src/app/consumptions/month-nav.tsx index 8cdef0e..f51a002 100644 --- a/apps/client/src/app/consumptions/month-nav.tsx +++ b/apps/client/src/app/consumptions/month-nav.tsx @@ -11,11 +11,10 @@ import { import { Popover, PopoverContent, PopoverTrigger } from '@kijk/ui/components/popover'; import { getRouteApi } from '@tanstack/react-router'; import { Check, ChevronsUpDown } from 'lucide-react'; -import { Suspense, useState } from 'react'; +import { useState } from 'react'; -import { Loader } from '@/shared/components/ui/loaders/loader'; import type { Months } from '@/shared/utils/months'; -import { monthsLocalized } from '@/shared/utils/months'; +import { formatMonth, monthSchema } from '@/shared/utils/months'; const Route = getRouteApi('/_protected/consumptions'); @@ -28,9 +27,9 @@ export function ConsumptionMonthNav({ className }: Props) { const navigate = Route.useNavigate(); const { month } = searchParameters; - const handleSelectMonth = (m: string) => { + const handleSelectMonth = (selectedMonth: Months) => { setOpen(false); - navigate({ search: (previous) => ({ ...previous, month: m as Months }) }); + navigate({ search: (previous) => ({ ...previous, month: selectedMonth }) }); }; return ( @@ -38,13 +37,13 @@ export function ConsumptionMonthNav({ className }: Props) { @@ -53,22 +52,26 @@ export function ConsumptionMonthNav({ className }: Props) { No Month found. - }> - - {monthsLocalized().map((m) => ( + + {monthSchema.options.map((m) => { + const label = formatMonth(m); + + return ( { - handleSelectMonth(y); + keywords={[label]} + value={m} + onSelect={() => { + handleSelectMonth(m); }} > - {m} + {label} - ))} - - + ); + })} +