From 7a7f67d3e2cbce3ab13a2d6605268f1c7a6cecfa Mon Sep 17 00:00:00 2001 From: Iqbal Date: Fri, 30 Oct 2026 13:49:38 +0700 Subject: [PATCH] Approve a plan only once its kind, frequency and language are chosen The plan's title said the kind and frequency were not chosen yet while its fields showed Summary / per week and the Approve button was on, with no content language picked. A guessed kind or frequency now shows as not chosen in the fields too, and Approve waits until they and the language are set, saying what is missing. Co-Authored-By: Claude Opus 5.5 --- src/i18n.ts | 6 ++++++ src/pages/Instruction.tsx | 15 +++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/i18n.ts b/src/i18n.ts index f82a688..f7fe336 100644 --- a/src/i18n.ts +++ b/src/i18n.ts @@ -396,6 +396,9 @@ const en = { 'agent.languageSet': 'Content will be written in {language}.', 'ins.language': 'Content language', 'ins.languagePending': 'Not chosen yet', + 'ins.kindPending': 'Choose a kind', + 'ins.perPending': 'Choose how often', + 'ins.incomplete': 'Choose the kind, the frequency and the content language first.', 'agent.skipped': 'OK, I skipped “{part}”.', 'agent.removed': 'Removed {rule}.', 'agent.updated': 'Updated: {rule}.', @@ -899,6 +902,9 @@ const id: Record = { 'agent.languageSet': 'Konten akan ditulis dalam {language}.', 'ins.language': 'Bahasa konten', 'ins.languagePending': 'Belum dipilih', + 'ins.kindPending': 'Pilih jenis', + 'ins.perPending': 'Pilih frekuensi', + 'ins.incomplete': 'Pilih jenis, frekuensi, dan bahasa konten dulu.', 'agent.skipped': 'Oke, “{part}” saya lewati.', 'agent.removed': '{rule} dihapus.', 'agent.updated': 'Diperbarui: {rule}.', diff --git a/src/pages/Instruction.tsx b/src/pages/Instruction.tsx index 40986ae..aa6db6c 100644 --- a/src/pages/Instruction.tsx +++ b/src/pages/Instruction.tsx @@ -55,6 +55,8 @@ export function InstructionPage() { // The whole Brain is attached, so every ready document counts. const tooFewSources = choosable(docs.data).length < MIN_PRODUCTION_SOURCES && ready.some(i => needsTwoSources(i.rule)) const hasContent = agent.items.some(i => i.rule.type === 'content') + // A kind or frequency the agent only guessed, or no content language yet: the plan is not finished. + const incomplete = ready.some(i => i.rule.type === 'content' && (i.rule.kindGuessed || i.rule.perGuessed)) || (hasContent && !agent.language) // The agent's current turn: its question, or what it is waiting for. It stays live, so an edit in the plan updates it. const live = inLang(lang, () => saving ? { text: t('agent.approving'), options: [] as string[] } @@ -103,7 +105,8 @@ export function InstructionPage() { async function approve(state = agent, replyLang = lang) { const items = state.items.filter(i => canSchedule(i.rule)) - if (!items.length || tooFewSources) return + const unfinished = items.some(i => i.rule.type === 'content' && (i.rule.kindGuessed || i.rule.perGuessed)) + if (!items.length || tooFewSources || unfinished) return setSaving(true) const done: Outcome[] = [] const created = new Set() @@ -198,8 +201,9 @@ export function InstructionPage() { {t('ins.sourcesAll')} {t('ins.approveNote')} {tooFewSources && {t('ins.tooFewInBrain', { n: MIN_PRODUCTION_SOURCES })}} + {incomplete && {t('ins.incomplete')}} - @@ -301,12 +305,15 @@ function RuleCard({ rule, from, onChange, onRemove }: {
{rule.type === 'content' ? ( <> - onChange({ kind: e.target.value as ContentKind })}> + {rule.kindGuessed && } {KINDS.map(k => )} onChange({ count: Math.max(1, Number(e.target.value) || 1) })} /> - onChange({ per: e.target.value as ContentRule['per'] })}> + {rule.perGuessed && }