59 lines
1.6 KiB
TypeScript
59 lines
1.6 KiB
TypeScript
|
//TODO: maybe in a seperate path (e.g. /i/[id]) so that static is still there
|
||
|
//TODO: ^ going with this
|
||
|
//TODO: basically a fg, bg, font picker (text-entry? link to typical builtin fonts?)
|
||
|
//TODO: also making/editing presets
|
||
|
//TODO: might be easiest to refresh on submit
|
||
|
|
||
|
import { useState } from "preact/hooks";
|
||
|
import { Preset, Message, Database, Conversation } from "types";
|
||
|
import InputMsg from "components/InputMsg.tsx";
|
||
|
|
||
|
//TODO: oh also creating convos
|
||
|
//TODO: oh also updating convos' metadata
|
||
|
//TODO: a sort of commit like thing? reactive config, then you have to actually submit
|
||
|
//TODO: much harder than just refreshing but much nicer
|
||
|
//TODO: probably in the main index (much minimalism waow)
|
||
|
|
||
|
export default function AddMsg({
|
||
|
// preset_list,
|
||
|
preset,
|
||
|
onsubmit,
|
||
|
conv,
|
||
|
db,
|
||
|
}: {
|
||
|
// preset_list: string[];
|
||
|
// ehhh the order should stay consistent enough
|
||
|
preset: string;
|
||
|
onsubmit: (_: Message) => void;
|
||
|
conv: Conversation;
|
||
|
db: Database;
|
||
|
}) {
|
||
|
const [content, setContent] = useState("");
|
||
|
console.log(content);
|
||
|
const msg = {
|
||
|
content,
|
||
|
preset,
|
||
|
};
|
||
|
|
||
|
return (
|
||
|
<InputMsg
|
||
|
msg={msg}
|
||
|
db={db}
|
||
|
onSubmit={() => {
|
||
|
onsubmit(msg);
|
||
|
setContent("");
|
||
|
}}
|
||
|
conversation={conv}
|
||
|
onInput={e => setContent(e.target.value)}
|
||
|
/>
|
||
|
);
|
||
|
}
|
||
|
// type Message = {
|
||
|
// content: string;
|
||
|
// preset?: string | undefined;
|
||
|
// fg?: string | undefined;
|
||
|
// bg?: string | undefined;
|
||
|
// font?: string | undefined;
|
||
|
// sender?: string | undefined;
|
||
|
// }
|