diff --git a/app/i18n/locales/en/common.json b/app/i18n/locales/en/common.json index a3b9f089..a607ebe1 100644 --- a/app/i18n/locales/en/common.json +++ b/app/i18n/locales/en/common.json @@ -85,5 +85,6 @@ "tones-enthusiastic": "Enthusiastic", "tones-informative": "Informative", "tones-funny": "Funny", - "table": "Table" + "table": "Table", + "format-desc": "A generation format is a mode in which Synapsy Write generates text." } diff --git a/app/i18n/locales/fr/common.json b/app/i18n/locales/fr/common.json index 10df7a7b..d0c90ee5 100644 --- a/app/i18n/locales/fr/common.json +++ b/app/i18n/locales/fr/common.json @@ -85,5 +85,6 @@ "tones-enthusiastic": "Enthousiaste", "tones-informative": "Informatif", "tones-funny": "Drôle", - "table": "Tableau" + "table": "Tableau", + "format-desc": "Un format de génération est une manière dont Synapsy Write va générer du texte." } diff --git a/components/format-dialog.tsx b/components/format-dialog.tsx new file mode 100644 index 00000000..95c05aee --- /dev/null +++ b/components/format-dialog.tsx @@ -0,0 +1,72 @@ +"use client"; +import { + Dialog, + DialogContent, + DialogDescription, + DialogHeader, + DialogTitle, + DialogTrigger, +} from "@/components/ui/dialog"; +import { useTranslation } from "@/app/i18n/client"; +import { Button } from "./ui/button"; +import { Input } from "./ui/input"; +import { ScrollArea } from "./ui/scroll-area"; +import formats from "@/lib/formats"; +import { useState } from "react"; +import { DialogClose } from "@radix-ui/react-dialog"; +export default function FormatDialog(props: { lng: string; setVal: Function }) { + const { t } = useTranslation(props.lng, "common"); + const [value, setValue] = useState(""); + + return ( + + + + + + + {t("select-format")} + {t("format-desc")} + +
+ setValue(v.target.value)} + placeholder={t("search-formats")} + /> + + {formats.map((category, i) => ( +
+

+ {t(category.category)} +

+
+ {category.options.map((format, j) => ( + <> + {t(format.text) + .toLowerCase() + .match(value.toLowerCase()) ? ( + + + + ) : ( + <> + )} + + ))} +
+
+ ))} +
+
+
+
+ ); +}