"use client"; import { useGetAbout } from "@/app/[name]/(Main)/about/hooks/useAboutData"; import { useGetProfile } from "@/app/[name]/(Profile)/profile/hooks/userProfileData"; import { glassSurfaceFlat } from "@/lib/styles/glassSurface"; import { Send2 } from "iconsax-react"; import Image from "next/image"; import { FormEvent, useState } from "react"; import { useTranslation } from "react-i18next"; import { AI_SUGGESTIONS } from "./suggestions"; type Message = { id: string; role: "user" | "assistant"; content: string; }; function getGreetingKey() { const hour = new Date().getHours(); if (hour >= 5 && hour < 12) return "morning"; if (hour >= 12 && hour < 14) return "noon"; if (hour >= 14 && hour < 17) return "afternoon"; return "evening"; } function AiPage() { const { t } = useTranslation("common", { keyPrefix: "AI" }); const { data: about } = useGetAbout(); const { data: profile, isSuccess } = useGetProfile(); const [input, setInput] = useState(""); const [messages, setMessages] = useState([]); const restaurant = about?.data; const brandName = restaurant?.name || t("BrandFallback"); const logoUrl = restaurant?.logo || "/assets/images/danak-logo.png"; const userName = isSuccess && profile?.data?.firstName ? profile.data.firstName : t("GuestName"); const sendMessage = (text: string) => { const content = text.trim(); if (!content) return; setMessages((prev) => [...prev, { id: `u-${Date.now()}`, role: "user", content }, { id: `a-${Date.now()}`, role: "assistant", content: t("MockReply") }]); setInput(""); }; const onSubmit = (e: FormEvent) => { e.preventDefault(); sendMessage(input); }; return (

{t("Heading")}

{messages.length > 0 ? (
    {messages.map((message) => (
  • {message.content}

  • ))}
) : (
{brandName}

{t(`Greeting.${getGreetingKey()}`, { name: userName })}

{AI_SUGGESTIONS.map(({ labelKey, icon: Icon }) => ( ))}
)}
setInput(e.target.value)} placeholder={t("InputPlaceholder")} autoComplete="off" className="h-full w-full bg-transparent text-[11px] outline-none placeholder:text-disabled-text" />
); } export default AiPage;