From f1c00a24e17edb7be4de01a57182110a5be49ccc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Peyronnet?= Date: Sat, 23 Mar 2024 17:32:33 +0100 Subject: [PATCH] Added the possibility to create manual generations --- app/i18n/locales/en/common.json | 9 ++- app/i18n/locales/fr/common.json | 9 ++- components/navbar.tsx | 121 +++++++++++++++++++++++++++++--- 3 files changed, 126 insertions(+), 13 deletions(-) diff --git a/app/i18n/locales/en/common.json b/app/i18n/locales/en/common.json index 5920d30d..01500492 100644 --- a/app/i18n/locales/en/common.json +++ b/app/i18n/locales/en/common.json @@ -250,5 +250,12 @@ "unavailable": "Unavailable", "motivation-letter": "Cover letter", "rephraser": "Rephraser", - "expand-input": "Expand input area" + "expand-input": "Expand input area", + "new-creation": "New creation", + "ai": "AI", + "ai-desc": "Use AI entirely to generate documents", + "manual": "Manual", + "manual-desc": "Write a document manually.", + "new-doc": "New document", + "doc-title": "Title" } diff --git a/app/i18n/locales/fr/common.json b/app/i18n/locales/fr/common.json index 697dd3cf..32ce0926 100644 --- a/app/i18n/locales/fr/common.json +++ b/app/i18n/locales/fr/common.json @@ -248,5 +248,12 @@ "unavailable": "Indisponible", "motivation-letter": "Lettre de motivation", "rephraser": "Reformulateur", - "expand-input": "Élargir la zone de saisie" + "expand-input": "Élargir la zone de saisie", + "new-creation": "Nouvelle création", + "ai": "IA", + "ai-desc": "Utiliser entièrement l'IA pour générer des documents.", + "manual": "Manuel", + "manual-desc": "Rédiger manuellement un document.", + "new-doc": "Nouveau document", + "doc-title": "Titre" } diff --git a/components/navbar.tsx b/components/navbar.tsx index 0ed6631c..f02e524e 100644 --- a/components/navbar.tsx +++ b/components/navbar.tsx @@ -3,12 +3,41 @@ import { useTranslation } from "@/app/i18n/client"; import Image from "next/image"; import { Button } from "./ui/button"; import Link from "next/link"; -import { Rocket, Settings, UserCircle2 } from "lucide-react"; +import { Lightbulb, Pen, Rocket, Settings, UserCircle2 } from "lucide-react"; import { useTheme } from "next-themes"; +import { + Dialog, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, + DialogTrigger, +} from "./ui/dialog"; +import Spotlight, { SpotlightCard } from "./spotlight"; +import { Input } from "./ui/input"; +import { Close } from "@radix-ui/react-dialog"; +import { addToHistory, getHistory } from "@/lib/history"; +import { useState } from "react"; +import { useRouter } from "next/navigation"; export default function NavBar(props: { lng: string }) { const { t } = useTranslation(props.lng, "common"); const { setTheme } = useTheme(); + const { push } = useRouter(); + const [title, setTitle] = useState(""); + const [manual, setManual] = useState(false); + + function createDoc() { + addToHistory({ + template: "manual", + content: "", + date: new Date(), + prompt: title, + }); + let generations = getHistory(); + push(`/${props.lng}/generations/edit?id=${generations.length - 1}`); + } return (