import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { FaArrowUpLong } from "react-icons/fa6"; import { useTranslation } from "react-i18next"; import { useState } from "react"; import type { StartingRequest } from "@/types/chat"; type ChatStartingStateProps = { onSendMessage: (message: string) => void; }; export function ChatStartingState({ onSendMessage }: ChatStartingStateProps) { const { t } = useTranslation(["views/chat"]); const [input, setInput] = useState(""); const defaultRequests: StartingRequest[] = [ { label: t("starting_requests.show_recent_events"), prompt: t("starting_requests_prompts.show_recent_events"), }, { label: t("starting_requests.show_camera_status"), prompt: t("starting_requests_prompts.show_camera_status"), }, ]; const handleRequestClick = (prompt: string) => { onSendMessage(prompt); }; const handleSubmit = () => { const text = input.trim(); if (!text) return; onSendMessage(text); setInput(""); }; const handleKeyDown = (e: React.KeyboardEvent) => { if (e.key === "Enter" && !e.shiftKey) { e.preventDefault(); handleSubmit(); } }; return (

{t("title")}

{t("subtitle")}

{t("suggested_requests")}

{defaultRequests.map((request, idx) => ( ))}
setInput(e.target.value)} onKeyDown={handleKeyDown} />
); }