diff --git a/src/components/CreatePromptModal.tsx b/src/components/CreatePromptModal.tsx index 04a6a17..b512219 100644 --- a/src/components/CreatePromptModal.tsx +++ b/src/components/CreatePromptModal.tsx @@ -2,6 +2,8 @@ import { ActionIcon, Button, Modal, + Select, + SimpleGrid, Stack, Textarea, TextInput, @@ -13,31 +15,45 @@ import { IconPlaylistAdd, IconPlus } from "@tabler/icons-react"; import { useEffect, useState } from "react"; import { detaDB, generateKey, Prompt } from "../db"; import { usePrompts } from "../hooks/contexts"; +import { config } from "../utils/config"; -export function CreatePromptModal({ content }: { content?: string }) { +export function CreatePromptModal({ content, title: titleProp, open: openProp }: { content?: string, title?: string, open?: boolean }) { const [opened, { open, close }] = useDisclosure(false); const [submitting, setSubmitting] = useState(false); const { setPrompts } = usePrompts() + const [writingCharacter, setWritingCharacter] = useState(null); + const [writingTone, setWritingTone] = useState(null); + const [writingStyle, setWritingStyle] = useState(null); + const [writingFormat, setWritingFormat] = useState(null); + const [value, setValue] = useState(""); const [title, setTitle] = useState(""); useEffect(() => { setValue(content ?? ""); - }, [content]); + setTitle(titleProp ?? ""); + if (openProp) { + open() + } + }, [content, titleProp, openProp]); return ( <> - {content ? ( - - - - - - ) : ( - + {!openProp && ( + <> + {content ? ( + + + + + + ) : ( + + )} + )}
setTitle(event.currentTarget.value)} formNoValidate data-autofocus /> + + + +