Change terminology. Sketch out Draft Function

This commit is contained in:
Yura Dupyn 2026-02-14 00:14:15 +01:00
parent 6a0f95812a
commit 0941756bf9
8 changed files with 172 additions and 55 deletions

49
src/ui/Function.tsx Normal file
View file

@ -0,0 +1,49 @@
import { createSignal } from "solid-js";
import { Digith } from "./Digith";
import { useProgram } from "./ProgramProvider";
export function NewFunctionDraftDigith(props: { draft: Digith.NewFunctionDraft }) {
const program = useProgram();
const [name, setName] = createSignal(props.draft.raw_name);
const [params, setParams] = createSignal(props.draft.raw_parameters);
const [body, setBody] = createSignal(props.draft.raw_body);
const handleCommit = () => {
// TODO: Add the new function to the draft
console.log(`Committing ${name()} to the Program...`);
};
// TODO: What about parsing errors?
return (
<article>
<header><strong>Fn Draft</strong></header>
<div>TODO: New Fn Draft under construction</div>
</article>
);
}
// TODO: What about renaming?
export function FunctionDigith(props: { function: Digith.Function }) {
const program = useProgram();
const [params, setParams] = createSignal(props.function.raw_parameters);
const [body, setBody] = createSignal(props.function.raw_body);
const handleCommit = () => {
// TODO: Update the old function with new code
console.log(`Committing ${props.function.name} to the Program...`);
};
return (
<article>
<header><strong>Fn</strong></header>
<div>TODO: Fn under construction</div>
</article>
);
}