import { ArrowRight } from "lucide-react"; import { type ReactNode, useEffect, useState } from "react"; import { App, Button, Image, Tag } from "antd"; import { useNavigate } from "react-router-dom"; import { Trans, useTranslation } from "react-i18next"; import { fetchPrompts, type Prompt } from "@/services/api/prompts"; import { navigationTools } from "@/constant/navigation-tools"; import i18n from "@/i18n"; import { cn } from "@/lib/utils"; function Highlighter({ action, color, children }: { action: "highlight" | "underline"; color: string; children?: ReactNode }) { return ( {action === "highlight" ? ( ) : ( )} {children} ); } export default function IndexPage() { const { message } = App.useApp(); const { t } = useTranslation(); const navigate = useNavigate(); const [primaryTool] = navigationTools; const [promptShowcase, setPromptShowcase] = useState([]); const [previewIndex, setPreviewIndex] = useState(0); const [previewOpen, setPreviewOpen] = useState(false); useEffect(() => { void fetchPrompts({ pageSize: 12 }) .then((data) => setPromptShowcase(data.items)) .catch((error) => message.error(error instanceof Error ? error.message : i18n.t("home.promptError"))); }, [message]); return (

{t("meta.title")}

, content: }} />

{t("home.showcaseTitle")}

{t("home.showcaseDescription")}

{promptShowcase.map((item, index) => ( ))}
{promptShowcase.map((item) => ( {item.title} ))}
); }