Files
AutoMetabuilder/frontend/autometabuilder/components/sections/PromptSection.tsx
johndoe6345789 22c9306347 Introduce AutoMetabuilder core components and workflow packages:
- Implement core components: CLI argument parsing, environment loading, GitHub service creation, and logging configuration.
- Add support for OpenAI client setup and model resolution.
- Develop SDLC context loader from GitHub and repository files.
- Implement workflow context and engine builders.
- Introduce major workflow packages: `game_tick_loop` and `contextual_iterative_loop`.
- Update localization files with new package descriptions and labels.
- Streamline web navigation by loading items from a dedicated JSON file.
2026-01-10 01:08:34 +00:00

39 lines
1.2 KiB
TypeScript

import { useEffect, useState } from "react";
type PromptSectionProps = {
content: string;
onSave: (content: string) => Promise<void>;
t: (key: string, fallback?: string) => string;
};
export default function PromptSection({ content, onSave, t }: PromptSectionProps) {
const [draft, setDraft] = useState(content);
const [message, setMessage] = useState("");
useEffect(() => {
setDraft(content);
}, [content]);
const handleSave = async () => {
await onSave(draft);
setMessage(t("ui.prompt.save", "Save Prompt"));
setTimeout(() => setMessage(""), 2000);
};
return (
<section className="section-card" id="prompt">
<div className="section-card__header">
<h2>{t("ui.prompt.title", "Prompt Builder")}</h2>
<p>{t("ui.prompt.subtitle", "Shape how the assistant thinks, speaks, and decides")}</p>
</div>
<textarea className="prompt-editor" value={draft} onChange={(event) => setDraft(event.target.value)} rows={12} />
<div className="workflow-actions">
<button className="primary" type="button" onClick={handleSave}>
{t("ui.prompt.save", "Save Prompt")}
</button>
<span className="workflow-message">{message}</span>
</div>
</section>
);
}