From 4ca16be4a46255c5aba6d35a4310b2f34cb7186a Mon Sep 17 00:00:00 2001 From: Marco Pedone Date: Tue, 11 Nov 2025 15:54:04 +0100 Subject: [PATCH] feat: update sorting options and default values in RicercaProvider; refine filter logic in RicercaFilters --- apps/infoalloggi/TODO | 3 +-- apps/infoalloggi/src/pages/annunci.tsx | 6 +++--- apps/infoalloggi/src/providers/RicercaProvider.tsx | 12 +++++++----- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/apps/infoalloggi/TODO b/apps/infoalloggi/TODO index af839d2..da7d80c 100644 --- a/apps/infoalloggi/TODO +++ b/apps/infoalloggi/TODO @@ -1,6 +1,5 @@ TODOS: - -- Modale admin conferma mostrare scorciatoia a doc lavoro o simile per facilitare la verifica e sezione per override pack in base a doc presentati +- Modale Admin conferma, selettore per fast modifica di permanenza - Post modale conferma, mostrare se transitorio , modale con informativa tipo:" il saldo del servizio e il periodo di permanenza veranno adeguati alle condizioni stabilite insieme al locatore nel momento della trattativa e alla documentazione presentata come giustificazione di transitorietà" (modificato) diff --git a/apps/infoalloggi/src/pages/annunci.tsx b/apps/infoalloggi/src/pages/annunci.tsx index eb76684..e8a4db7 100644 --- a/apps/infoalloggi/src/pages/annunci.tsx +++ b/apps/infoalloggi/src/pages/annunci.tsx @@ -238,7 +238,7 @@ const RicercaFilters = () => { { - await setSort(""); + await setSort("Recenti"); }} label={t.ordina_per} onValueChange={async (value: SortTypes) => { @@ -451,12 +451,12 @@ export const SelectFilter = ({ - {value !== "" && ( + {value !== defaultValue && ( diff --git a/apps/infoalloggi/src/providers/RicercaProvider.tsx b/apps/infoalloggi/src/providers/RicercaProvider.tsx index aa84368..c66d061 100644 --- a/apps/infoalloggi/src/providers/RicercaProvider.tsx +++ b/apps/infoalloggi/src/providers/RicercaProvider.tsx @@ -50,7 +50,7 @@ type RicercaContextType = { isLoading: boolean; }; -const sortOptions = ["Recenti", "Prezzo", "Consegna", "Mq", ""] as const; +const sortOptions = ["Recenti", "Prezzo", "Consegna", "Mq"] as const; //sort as string union export type SortTypes = (typeof sortOptions)[number]; @@ -96,7 +96,7 @@ export const RicercaProvider: FC<{ const [sort, setSort] = useQueryState( "sort", parseAsStringLiteral(sortOptions) - .withDefault("") + .withDefault("Recenti") .withOptions({ startTransition }), ); @@ -152,15 +152,17 @@ export const RicercaProvider: FC<{ await setTipo(""); await setComune(""); await setConsegna(null); - await setSort(""); + await setSort("Recenti"); await setPage(0); }; const nFiltri = - [tipo, comune, sort].reduce( + [tipo, comune].reduce( (count, item) => (item !== "" ? count + 1 : count), 0, - ) + (consegna !== null ? 1 : 0); + ) + + (consegna !== null ? 1 : 0) + + (sort !== "Recenti" ? 1 : 0); return (