Refactor code structure for improved readability and maintainability
This commit is contained in:
parent
5c3a13bea9
commit
39074b58e4
3 changed files with 52 additions and 23 deletions
BIN
apps/infoalloggi/public/og.jpg
Normal file
BIN
apps/infoalloggi/public/og.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 79 KiB |
|
|
@ -1,5 +1,6 @@
|
|||
import { ArrowRight, Telescope } from "lucide-react";
|
||||
import type { NextPage } from "next";
|
||||
import Head from "next/head";
|
||||
import Link from "next/link";
|
||||
import { AccordionComp } from "~/components/accordionComp";
|
||||
import { CodiceBox } from "~/components/codiceRicerca";
|
||||
|
|
@ -7,36 +8,58 @@ import { PricingChoice } from "~/components/prezzi";
|
|||
import { HeroSvg, LogoSvg } from "~/components/svgs";
|
||||
import { Button } from "~/components/ui/button";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "~/components/ui/card";
|
||||
import { env } from "~/env.mjs";
|
||||
import type { LangDict } from "~/i18n/locales";
|
||||
import { useTranslation } from "~/providers/I18nProvider";
|
||||
|
||||
const Home: NextPage = () => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const description =
|
||||
"Infoalloggi.it - Trova il tuo alloggio ideale in modo semplice e veloce. Annunci di case, appartamenti e stanze in affitto per studenti, lavoratori e famiglie. Scopri ora gli annunci!";
|
||||
return (
|
||||
<div className="mx-5 mt-0 mb-12 sm:mt-[2rem]">
|
||||
<main className="mx-auto mb-4 max-w-7xl space-y-5 lg:mb-20">
|
||||
<div className="flex flex-col items-center justify-center lg:flex-row lg:justify-around">
|
||||
<div className="xs:mt-5 -mt-2 flex h-[19rem] max-w-full items-center justify-center min-[22rem]:h-[23rem] min-[25rem]:h-[26rem]">
|
||||
<div className="flex scale-50 items-center justify-center drop-shadow-xl min-[20rem]:scale-[0.6] min-[22rem]:scale-[0.7] min-[25rem]:scale-[0.8] sm:scale-100 md:max-h-96">
|
||||
<HeroSvg />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<TrovaCasaCTA testi={t} />
|
||||
</div>
|
||||
</main>
|
||||
<div className="w-full space-y-10 md:space-y-20">
|
||||
<FrequentSearches />
|
||||
|
||||
<AccordionComp
|
||||
className="mb-4 max-w-4xl py-4 md:py-8"
|
||||
texts={t.index.accordion_minifaq}
|
||||
<main>
|
||||
<Head>
|
||||
<meta content={description} property="description" />
|
||||
<meta content={env.NEXT_PUBLIC_BASE_URL} property="og:url" />
|
||||
<meta content="website" property="og:type" />
|
||||
<meta content="Infoalloggi.it" property="og:title" />
|
||||
<meta content={description} property="og:description" />
|
||||
<meta
|
||||
content={`${env.NEXT_PUBLIC_BASE_URL}/og.jpg`}
|
||||
property="og:image"
|
||||
/>
|
||||
<meta content="1200" property="og:image:width" />
|
||||
<meta content="630" property="og:image:height" />
|
||||
<meta
|
||||
content={`${env.NEXT_PUBLIC_BASE_URL}/Infoalloggi.png`}
|
||||
property="og:logo"
|
||||
/>
|
||||
<meta content="Infoalloggi.it" property="og:site_name" />
|
||||
</Head>
|
||||
<div className="mx-5 mt-0 mb-12 sm:mt-[2rem]">
|
||||
<main className="mx-auto mb-4 max-w-7xl space-y-5 lg:mb-20">
|
||||
<div className="flex flex-col items-center justify-center lg:flex-row lg:justify-around">
|
||||
<div className="xs:mt-5 -mt-2 flex h-[19rem] max-w-full items-center justify-center min-[22rem]:h-[23rem] min-[25rem]:h-[26rem]">
|
||||
<div className="flex scale-50 items-center justify-center drop-shadow-xl min-[20rem]:scale-[0.6] min-[22rem]:scale-[0.7] min-[25rem]:scale-[0.8] sm:scale-100 md:max-h-96">
|
||||
<HeroSvg />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<PricingChoice />
|
||||
<TrovaCasaCTA testi={t} />
|
||||
</div>
|
||||
</main>
|
||||
<div className="w-full space-y-10 md:space-y-20">
|
||||
<FrequentSearches />
|
||||
|
||||
<AccordionComp
|
||||
className="mb-4 max-w-4xl py-4 md:py-8"
|
||||
texts={t.index.accordion_minifaq}
|
||||
/>
|
||||
|
||||
<PricingChoice />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -94,17 +94,23 @@ export const getAnnunciMetaByCod = async ({ cod }: { cod: string }) => {
|
|||
try {
|
||||
const annuncio = await db
|
||||
.selectFrom("annunci")
|
||||
.select(["titolo_it", "desc_it", "og_url"])
|
||||
.select(["titolo_it", "desc_it", "og_url", "url_immagini"])
|
||||
.where("annunci.web", "=", true)
|
||||
.where("codice", "=", cod)
|
||||
.executeTakeFirst();
|
||||
if (!annuncio) {
|
||||
return null;
|
||||
}
|
||||
const ogImage =
|
||||
annuncio.url_immagini &&
|
||||
annuncio.url_immagini.length > 0 &&
|
||||
annuncio.url_immagini[0]
|
||||
? annuncio.url_immagini[0]
|
||||
: annuncio.og_url || "";
|
||||
|
||||
return {
|
||||
description: annuncio.desc_it || "",
|
||||
ogImage: annuncio.og_url || "",
|
||||
ogImage,
|
||||
ogUrl: `${env.NEXT_PUBLIC_BASE_URL}/annuncio/${cod}`,
|
||||
title: annuncio.titolo_it || "",
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue