// Copyright (c) 2025 Bytedance Ltd. and/or its affiliates // SPDX-License-Identifier: MIT import { useTranslations } from "next-intl"; import { useState } from "react"; import { Check, FileText, Newspaper, Users, GraduationCap } from "lucide-react"; import { Button } from "~/components/ui/button"; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger, } from "~/components/ui/dialog"; import { setReportStyle, useSettingsStore } from "~/core/store"; import { cn } from "~/lib/utils"; import { Tooltip } from "./tooltip"; const REPORT_STYLES = [ { value: "academic" as const, labelKey: "academic", descriptionKey: "academicDesc", icon: GraduationCap, }, { value: "popular_science" as const, labelKey: "popularScience", descriptionKey: "popularScienceDesc", icon: FileText, }, { value: "news" as const, labelKey: "news", descriptionKey: "newsDesc", icon: Newspaper, }, { value: "social_media" as const, labelKey: "socialMedia", descriptionKey: "socialMediaDesc", icon: Users, }, ]; export function ReportStyleDialog() { const t = useTranslations("settings.reportStyle"); const [open, setOpen] = useState(false); const currentStyle = useSettingsStore((state) => state.general.reportStyle); const handleStyleChange = ( style: "academic" | "popular_science" | "news" | "social_media", ) => { setReportStyle(style); setOpen(false); }; const currentStyleConfig = REPORT_STYLES.find((style) => style.value === currentStyle) || REPORT_STYLES[0]!; const CurrentIcon = currentStyleConfig.icon; return (

{t("writingStyle")}: {t(currentStyleConfig.labelKey)}

{t("chooseDesc")}

} >
{t("chooseTitle")} {t("chooseDesc")}
{REPORT_STYLES.map((style) => { const Icon = style.icon; const isSelected = currentStyle === style.value; return ( ); })}
); }