infoalloggi-monorepo/apps/infoalloggi/src/components/frequent_searches.tsx
Marco Pedone edaee780d6 refactor: remove unused annunci data fetching and components; update ricerca logic
- Deleted the `annunci.ts` file which contained the database fetching logic.
- Removed the `TestAppPage` component that relied on the deleted data fetching.
- Eliminated the `AnnunciList` component that was dependent on the removed data.
- Updated `annunci_map.tsx` to handle optional `selectComune` parameter.
- Refactored `annunci_tutorial.tsx` to use `buildRicercaUrl` for navigation.
- Adjusted `annuncio_card.tsx` for consistent styling and layout changes.
- Modified `codiceRicerca.tsx` to fix z-index issue.
- Enhanced `failed-loading.tsx` and `500Auth.tsx` for responsive design.
- Updated `annunci.tsx` to include loading state for map and annunci list.
- Refined filter handling in `Filters` component to use a single `setAllParams` method.
- Introduced `FrequentSearches` component for better user navigation.
- Updated `RicercaProvider` to streamline state management and URL building.
- Adjusted server-side logic in `annunci.controller.ts` to ensure valid data.
2026-01-20 18:38:17 +01:00

97 lines
2.4 KiB
TypeScript

import { ArrowRight } from "lucide-react";
import Link from "next/link";
import { useTranslation } from "~/providers/I18nProvider";
import { buildRicercaUrl } from "~/providers/RicercaProvider";
import { Button } from "./ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "./ui/card";
const it = {
title: "Ricerche frequenti",
transitorio: "Transitori",
stabili: "Stabili",
};
const en = {
title: "Frequent Searches",
transitorio: "Short-term",
stabili: "Stable",
};
export const FrequentSearches = () => {
const { locale } = useTranslation();
const t = locale === "en" ? en : it;
return (
<Card className="mx-auto mb-4 max-w-4xl gap-4 border-0 bg-secondary shadow-none">
<CardHeader>
<CardTitle className="text-center font-bold text-3xl sm:text-2xl">
{t.title}
</CardTitle>
</CardHeader>
<CardContent className="mx-auto flex max-w-fit flex-wrap items-center justify-center gap-4 px-2 sm:px-6">
<Link href={buildRicercaUrl({ tipo: "Transitorio" })}>
<Button
className="flex items-center gap-1 border-2 border-transitorio bg-transitorio text-lg text-white"
size="lg"
variant="flat"
>
{t.transitorio}
<ArrowRight />
</Button>
</Link>
<Link href={buildRicercaUrl({ tipo: "Stabile" })}>
<Button
className="flex items-center gap-1 border-2 border-stabile bg-stabile text-lg text-white"
size="lg"
variant="flat"
>
{t.stabili}
<ArrowRight />
</Button>
</Link>
<Link
href={buildRicercaUrl({
comune: "Bassano del Grappa",
})}
>
<Button
className="flex items-center gap-1 border-2 border-primary text-lg"
size="lg"
>
Bassano del Grappa
<ArrowRight />
</Button>
</Link>
<Link
href={buildRicercaUrl({
comune: "Bassano del Grappa",
tipo: "Transitorio",
})}
>
<Button
className="flex items-center gap-1 border-2 border-transitorio bg-transitorio text-lg text-white"
size="lg"
variant="flat"
>
{t.transitorio} Bassano
<ArrowRight />
</Button>
</Link>
<Link
href={buildRicercaUrl({
comune: "Marostica",
})}
>
<Button
className="flex items-center gap-1 border-2 border-primary text-lg"
size="lg"
>
Marostica
<ArrowRight />
</Button>
</Link>
</CardContent>
</Card>
);
};