From 0ba65eb2aa4b5b5a0dbe4e845d8819efaa59f2eb Mon Sep 17 00:00:00 2001 From: Marco Pedone Date: Tue, 12 May 2026 18:43:00 +0200 Subject: [PATCH] revamp gruida, come funziona e accordion faqs nel sito --- .../src/components/accordionComp.tsx | 6 +- .../src/components/how-it-works.tsx | 303 ++++++++---------- apps/infoalloggi/src/i18n/en.ts | 7 +- apps/infoalloggi/src/i18n/it.ts | 7 +- apps/infoalloggi/src/pages/annunci.tsx | 6 +- apps/infoalloggi/src/pages/guida.tsx | 133 ++------ apps/infoalloggi/src/pages/index.tsx | 7 +- apps/infoalloggi/src/pages/prezzi.tsx | 6 +- apps/infoalloggi/src/pages/proprietari.tsx | 14 +- 9 files changed, 194 insertions(+), 295 deletions(-) diff --git a/apps/infoalloggi/src/components/accordionComp.tsx b/apps/infoalloggi/src/components/accordionComp.tsx index d7155f0..c2ef7da 100644 --- a/apps/infoalloggi/src/components/accordionComp.tsx +++ b/apps/infoalloggi/src/components/accordionComp.tsx @@ -40,7 +40,7 @@ export const AccordionComp = forwardRef( ref={ref} > ( > {texts.map((text, index) => ( key={`ac-item-${index}`} value={`item-${index}`} > - + {text.title} diff --git a/apps/infoalloggi/src/components/how-it-works.tsx b/apps/infoalloggi/src/components/how-it-works.tsx index ef0f947..b49c8b7 100644 --- a/apps/infoalloggi/src/components/how-it-works.tsx +++ b/apps/infoalloggi/src/components/how-it-works.tsx @@ -1,176 +1,119 @@ "use client"; import { domAnimation, LazyMotion, m } from "framer-motion"; +import { ArrowRight } from "lucide-react"; +import Link from "next/link"; import type React from "react"; +import { Button } from "~/components/ui/button"; import { cn } from "~/lib/utils"; +import { useTranslation } from "~/providers/I18nProvider"; -interface CardProps { - number: string; - title: string; - description: string; - colorTheme?: "orange" | "blue" | "purple"; - className?: string; - rotate?: string; - colors?: { - bg: string; - text: string; - border: string; - }; -} - -const Card = ({ - number, - title, - description, - colorTheme = "blue", - className, - colors: customColors, -}: CardProps) => { - const defaultBgColors = { - orange: "bg-orange-50 dark:bg-orange-500/10", - blue: "bg-blue-50 dark:bg-blue-500/10", - purple: "bg-purple-50 dark:bg-purple-500/10", - }; - const defaultTextColors = { - orange: "text-orange-500 dark:text-orange-400", - blue: "text-blue-600 dark:text-blue-400", - purple: "text-purple-600 dark:text-purple-400", - }; - const defaultBorderColors = { - orange: "border-orange-100 dark:border-orange-500/20", - blue: "border-blue-100 dark:border-blue-500/20", - purple: "border-purple-100 dark:border-purple-500/20", - }; - - const bgColor = customColors?.bg || defaultBgColors[colorTheme]; - const textColor = customColors?.text || defaultTextColors[colorTheme]; - const borderColor = customColors?.border || defaultBorderColors[colorTheme]; - - return ( -
-
-
- {number} -

- {title} -

-

- {description} -

-
-
-
- ); +const divClassNames = { + orange: + "bg-orange-50 dark:bg-orange-500/10 border-orange-100 dark:border-orange-500/20", + blue: "bg-blue-50 dark:bg-blue-500/10 border-blue-100 dark:border-blue-500/20", + purple: + "bg-purple-50 dark:bg-purple-500/10 border-purple-100 dark:border-purple-500/20", + green: + "bg-green-50 dark:bg-green-500/10 border-green-100 dark:border-green-500/20", }; -export interface Step { +const txtClassNames = { + orange: "text-orange-500 dark:text-orange-400", + blue: "text-blue-600 dark:text-blue-400", + purple: "text-purple-600 dark:text-purple-400", + green: "text-green-600 dark:text-green-400", +}; + +interface Step { title: string; description: string; - colorTheme?: "orange" | "blue" | "purple"; - colors?: { - bg: string; + colorTheme: "orange" | "blue" | "purple" | "green"; + link?: { + href: string; text: string; - border: string; }; } -export interface StepPosition { - className?: string; -} - -export interface HowItWorksProps { - features?: Step[]; - className?: string; - stepPositions?: StepPosition[]; -} - -const DEFAULT_CARD_POSITIONS: StepPosition[] = [ +const F_ita: Step[] = [ { - className: "md:absolute md:top-0 md:left-[15%] lg:left-[10%]", + title: "Esplora gli annunci", + description: + "In base a località, tipologia, prezzo, data di disponibilità e molte altre caratteristiche.", + colorTheme: "orange", + link: { + href: "/annunci", + text: "Vai agli annunci", + }, }, { - className: "md:absolute md:top-[210px] md:right-[15%] lg:right-[10%]", + title: "Attiva il servizio", + description: + "Richiedi il servizio, ti invieremo un collegamento per completare la ricerca che abbiamo creato per te e acquistare il servizio.", + colorTheme: "blue", + link: { + href: "/contatti", + text: "Contattaci", + }, }, { - className: "md:absolute md:top-[450px] md:left-[15%] lg:left-[10%]", + title: "Visita le case", + description: + "Fissa appuntamenti direttamente con i proprietari per una visita. La trattativa è tra voi privati. Non c'è mediazione.", + colorTheme: "purple", }, { - className: "md:absolute md:top-[680px] md:right-[10%] lg:right-[10%]", - }, - { - className: "md:absolute md:top-[910px] md:left-[15%] lg:left-[10%]", + title: "Contratto di affitto", + description: + "Procederemo alla stesura del contratto di locazione in base agli accordi che hai trovato con il propritario.", + colorTheme: "green", }, ]; +const F_eng: Step[] = [ + { + title: "Explore Listings", + description: + "Search by location, type, price, availability date, and many other criteria.", + colorTheme: "orange", + link: { + href: "/annunci", + text: "Go to listings", + }, + }, + { + title: "Activate the Service", + description: + "Request the service; we’ll send you a link to complete the search we created for you and purchase the service.", + colorTheme: "blue", + }, + { + title: "Visit the Homes", + description: + "Schedule appointments directly with owners for viewings. The negotiation is private between you and the owner—no mediation.", + colorTheme: "purple", + }, + { + title: "Rental Agreement", + description: + "We’ll draft the lease contract based on the terms you’ve agreed upon with the owner.", + colorTheme: "green", + }, +]; +export default function HowItWorks({ className }: { className?: string }) { + const { locale } = useTranslation(); -export default function HowItWorks({ - features, - className, - stepPositions, -}: HowItWorksProps) { - const defaultFeatures: Step[] = [ - { - title: "Create Account", - description: - "Sign up in minutes. Enter your details and verify your email to get started.", - colorTheme: "orange", - }, - { - title: "Verify Identity", - description: - "Complete your profile verification to ensure secure transactions and compliance.", - colorTheme: "blue", - }, - { - title: "Select Plan", - description: - "Choose from a variety of investment plans tailored to your financial goals.", - colorTheme: "purple", - }, - { - title: "Analyze & Invest", - description: - "Review returns and make your first investment with confidence.", - colorTheme: "orange", - }, - { - title: "Track Growth", - description: - "Monitor your portfolio in real-time and watch your wealth grow over time.", - colorTheme: "blue", - }, - ]; - - const data = features && features.length > 0 ? features : defaultFeatures; - const positions = stepPositions || DEFAULT_CARD_POSITIONS; - - let height = 1130; - if (data.length === 1) height = 400; - else if (data.length === 2) height = 450; - else if (data.length === 3) height = 800; - else if (data.length === 4) height = 900; - else height = 1130; + const features: Step[] = locale === "it" ? F_ita : F_eng; return (
-
-
+
+
-
- {data.length > 1 && ( +
+ {features.length > 1 && ( stroke {(() => { - const pathD = data.reduce((acc, _, index) => { - if (index >= data.length - 1) return acc; + const pathD = features.reduce((acc, _, index) => { + if (index >= features.length - 1) return acc; if (index === 0) return "M 290 150 C 500 150, 550 270, 710 270"; // 1 -> 2 if (index === 1) @@ -238,19 +178,58 @@ export default function HowItWorks({ )} - {data.map((step, index) => { - const position = positions[index % positions.length]; - if (!position) return null; + {features.map((step, index) => { return ( - + style={ + { + "--offset": `${index === 0 ? 25 : index * 220}px`, + } as React.CSSProperties + } + > +
+
+ + {`0${index + 1}`} + +

+ {step.title} +

+

+ {step.description} +

+ {step.link && ( + + + + )} +
+
+
); })}
diff --git a/apps/infoalloggi/src/i18n/en.ts b/apps/infoalloggi/src/i18n/en.ts index dc378b7..69bf273 100644 --- a/apps/infoalloggi/src/i18n/en.ts +++ b/apps/infoalloggi/src/i18n/en.ts @@ -275,12 +275,7 @@ export const en: LangDict = { }, annulla: "Cancel", annunci: { - accordion_minifaq: [ - Faqs.cosa_significa_transitorio, - Faqs.posso_visitarli, - Faqs.posso_contattarvi, - Faqs.come_confermare, - ], + accordion_minifaq: [Faqs.cosa_significa_transitorio, Faqs.posso_visitarli], comune: "City", consegna: "From", budget: "Budget", diff --git a/apps/infoalloggi/src/i18n/it.ts b/apps/infoalloggi/src/i18n/it.ts index 45a9749..010bc90 100644 --- a/apps/infoalloggi/src/i18n/it.ts +++ b/apps/infoalloggi/src/i18n/it.ts @@ -280,12 +280,7 @@ export const it: LangDict = { }, annulla: "Annulla", annunci: { - accordion_minifaq: [ - Faqs.cosa_significa_transitorio, - Faqs.posso_visitarli, - Faqs.posso_contattarvi, - Faqs.come_confermare, - ], + accordion_minifaq: [Faqs.cosa_significa_transitorio, Faqs.posso_visitarli], comune: "Comune", consegna: "Disponibile da", budget: "Budget", diff --git a/apps/infoalloggi/src/pages/annunci.tsx b/apps/infoalloggi/src/pages/annunci.tsx index 49f9b29..3bd79be 100644 --- a/apps/infoalloggi/src/pages/annunci.tsx +++ b/apps/infoalloggi/src/pages/annunci.tsx @@ -81,12 +81,12 @@ const Annunci = ({ options }: AnnunciPageProps) => { {t.annunci.titolo} - + ); diff --git a/apps/infoalloggi/src/pages/guida.tsx b/apps/infoalloggi/src/pages/guida.tsx index fe3231a..446da55 100644 --- a/apps/infoalloggi/src/pages/guida.tsx +++ b/apps/infoalloggi/src/pages/guida.tsx @@ -8,7 +8,6 @@ import { AccordionTrigger, } from "~/components/ui/accordion"; import { Badge } from "~/components/ui/badge"; -import { Button } from "~/components/ui/button"; import { useTranslation } from "~/providers/I18nProvider"; /** @@ -16,49 +15,6 @@ import { useTranslation } from "~/providers/I18nProvider"; */ const Guida: NextPage = () => { const { t } = useTranslation(); - //todo translation - const features = [ - { - title: "Esplora gli annunci", - description: - "In base a località, tipologia, prezzo, data di disponibilità e molte altre caratteristiche.", - colors: { - bg: "bg-orange-50 dark:bg-orange-500/10", - text: "text-orange-500 dark:text-orange-400", - border: "border-orange-100 dark:border-orange-500/20", - }, - }, - { - title: "Attiva il servizio", - description: - "Richiedi il servizio, ti invieremo un collegamento per completare la ricerca che abbiamo creato per te e acquistare il servizio.", - colors: { - bg: "bg-blue-50 dark:bg-blue-500/10", - text: "text-blue-600 dark:text-blue-400", - border: "border-blue-100 dark:border-blue-500/20", - }, - }, - { - title: "Visita le case", - description: - "Fissa appuntamenti direttamente con i proprietari per una visita. La trattativa è tra voi privati. Non c'è mediazione.", - colors: { - bg: "bg-purple-50 dark:bg-purple-500/10", - text: "text-purple-600 dark:text-purple-400", - border: "border-purple-100 dark:border-purple-500/20", - }, - }, - { - title: "Contratto di affitto", - description: - "Procederemo alla stesura del contratto di locazione in base agli accordi che hai trovato con il propritario.", - colors: { - bg: "bg-green-50 dark:bg-green-500/10", - text: "text-green-500 dark:text-green-400", - border: "border-green-100 dark:border-green-500/20", - }, - }, - ]; return ( <> @@ -72,7 +28,7 @@ const Guida: NextPage = () => { {/* */} - + @@ -83,13 +39,6 @@ export default Guida; const FAQSection = () => { const { t } = useTranslation(); - const handleScroll = (id: string) => { - document.getElementById(id)?.scrollIntoView({ - behavior: "smooth", - }); - window.history.replaceState({}, "", `${window.location.pathname}#${id}`); - }; - if (!t.faq?.domande) { return null; // Ensure translations are loaded before rendering } @@ -102,58 +51,44 @@ const FAQSection = () => {

{t.faq.titolo}

-

+

{t.faq.descrizione}

-
-
- {t.faq.domande.map((item) => ( - - ))} -
-
- {t.faq.domande.map((item) => ( - -
-

{item.label}

-
- {item.qas.map((f, i) => ( - - i - }`} - value={i.toString()} - > - - {f.title} - - -

{f.description}

-
-
- ))} -
- - ))} -
+
+ {t.faq.domande.map((item) => ( + +
+

{item.label}

+
+ {item.qas.map((f, i) => ( + + i + }`} + value={i.toString()} + > + + {f.title} + + +

{f.description}

+
+
+ ))} +
+ + ))}
diff --git a/apps/infoalloggi/src/pages/index.tsx b/apps/infoalloggi/src/pages/index.tsx index ce1ea3c..20a0e0a 100644 --- a/apps/infoalloggi/src/pages/index.tsx +++ b/apps/infoalloggi/src/pages/index.tsx @@ -5,8 +5,8 @@ import Link from "next/link"; import { AccordionComp } from "~/components/accordionComp"; import { AnniversaryBanner } from "~/components/banners"; import { CodiceBox } from "~/components/codiceRicerca"; -import { ComeFunziona } from "~/components/expand_guida"; import { HeroSvg } from "~/components/hero-svg"; +import HowItWorks from "~/components/how-it-works"; import { LogoSvg } from "~/components/logo-svg"; import { PricingChoice } from "~/components/prezzi"; import { Button } from "~/components/ui/button"; @@ -56,10 +56,11 @@ const Home: NextPage = () => {
{/* */} -
+ {/*
-
+
*/} + { {/* */} @@ -122,7 +122,7 @@ const Prezzi: NextPage = () => {
{/* */} @@ -170,7 +170,7 @@ const Prezzi: NextPage = () => {
{/* */} diff --git a/apps/infoalloggi/src/pages/proprietari.tsx b/apps/infoalloggi/src/pages/proprietari.tsx index 09880a4..b106fe4 100644 --- a/apps/infoalloggi/src/pages/proprietari.tsx +++ b/apps/infoalloggi/src/pages/proprietari.tsx @@ -6,7 +6,6 @@ import Link from "next/link"; import { AccordionComp } from "~/components/accordionComp"; import { Badge } from "~/components/ui/badge"; import { Button } from "~/components/ui/button"; -import { Card, CardContent } from "~/components/ui/card"; import { useTranslation } from "~/providers/I18nProvider"; /** @@ -55,15 +54,10 @@ const Proprietari: NextPage = () => { />
- - - - - - +