import { useMemo } from "react"
import { Link, useNavigate } from "react-router-dom"
import {
ArrowRight,
BarChart3,
CheckCircle2,
Clock3,
Command,
Globe2,
Layers3,
Moon,
ShieldCheck,
Sparkles,
Sun,
TimerReset,
Waypoints,
} from "lucide-react"
import { Button } from "../components/ui/button"
import { useTheme } from "../components/ThemeProvider"
import { useTranslation } from "../hooks/useTranslation"
import { cn } from "../lib/utils"
const formatNumber = (value: number, lang: "en" | "fa") =>
new Intl.NumberFormat(lang === "fa" ? "fa-IR" : "en-US").format(value)
export default function Landing() {
const navigate = useNavigate()
const { t, lang, setLanguage } = useTranslation()
const { theme, setTheme } = useTheme()
const isAuthenticated = typeof window !== "undefined" && !!localStorage.getItem("accessToken")
const isDarkMode =
theme === "dark" ||
(theme === "system" && document.documentElement.classList.contains("dark"))
const metrics = useMemo(
() => [
{
value: lang === "fa" ? "۹۸٪" : "98%",
label: t.landing.metrics.capture,
tone: "from-cyan-500/20 to-cyan-500/5 text-cyan-700 dark:text-cyan-200",
},
{
value: lang === "fa" ? "۴.۶×" : "4.6x",
label: t.landing.metrics.visibility,
tone: "from-emerald-500/20 to-emerald-500/5 text-emerald-700 dark:text-emerald-200",
},
{
value: lang === "fa" ? "< ۲m" : "< 2m",
label: t.landing.metrics.decision,
tone: "from-amber-500/20 to-amber-500/5 text-amber-700 dark:text-amber-200",
},
],
[lang, t.landing.metrics],
)
const capabilityCards = useMemo(
() => [
{
icon: TimerReset,
title: t.landing.capabilities.time.title,
description: t.landing.capabilities.time.description,
},
{
icon: BarChart3,
title: t.landing.capabilities.reports.title,
description: t.landing.capabilities.reports.description,
},
{
icon: ShieldCheck,
title: t.landing.capabilities.control.title,
description: t.landing.capabilities.control.description,
},
],
[t.landing.capabilities],
)
const workflow = useMemo(
() => [
t.landing.workflow.capture,
t.landing.workflow.structure,
t.landing.workflow.improve,
],
[t.landing.workflow],
)
const ctaTarget = isAuthenticated ? "/timesheet" : "/auth"
return (
{lang === "fa" ? "خانه" : "Home"}
{t.landing.nav.about}
{t.landing.eyebrow}
{t.landing.hero.titleTop}
{t.landing.hero.titleAccent}
{t.landing.hero.description}
{t.landing.actions.watchDemo}
{metrics.map((metric) => (
{metric.value}
{metric.label}
))}
{t.landing.trust.first}
{t.landing.trust.second}
{t.landing.trust.third}
{t.landing.demo.timerTag}
{t.landing.demo.timerTitle}
{lang === "fa" ? "۰۲:۴۶:۱۸" : "02:46:18"}
{t.landing.demo.timerText}
{t.landing.demo.panelLabel}
{t.landing.demo.panelTitle}
{lang === "fa" ? "زنده" : "Live"}
{t.landing.demo.runningCard}
{t.landing.demo.currentTask}
{t.landing.demo.currentTaskMeta}
{t.landing.demo.billableLabel}
{lang === "fa" ? "۹۵ دلار" : "$95"}
{t.landing.demo.reportCard}
{[34, 56, 48, 72, 65, 88, 76].map((height, index) => (
))}
{t.landing.demo.opsCard}
{[82, 63, 91].map((value, index) => (
{t.landing.demo.opsLabels[index]}
{formatNumber(value, lang)}%
))}
{t.landing.demo.logCard}
{t.landing.demo.logItems.map((item: { title: string; meta: string }, index: number) => (
))}
{t.landing.demo.outcomeTag}
{lang === "fa" ? "۳۶٪" : "36%"}
{t.landing.demo.outcomeText}
{capabilityCards.map(({ icon: Icon, title, description }, index) => (
))}
{t.landing.workflowTag}
{t.landing.workflowTitle}
{t.landing.workflowDescription}
{workflow.map((item, index) => (
{lang === "fa" ? `گام ${formatNumber(index + 1, lang)}` : `Step ${index + 1}`}
{item}
))}
{t.landing.finalCtaTag}
{t.landing.finalCtaTitle}
{t.landing.finalCtaDescription}
)
}