Skip to content

AI-powered virtual executive team — a single coherent executive persona backed by 8 specialist agents (FastAPI + Next.js).

fix(ui): count done optional rows and make adding the team optional (#631)

Rufusf211b9696198
diff --git a/packages/ui/scripts/firstRun.test.mjs b/packages/ui/scripts/firstRun.test.mjs
index 58d72753..370b6f34 100644
--- a/packages/ui/scripts/firstRun.test.mjs
+++ b/packages/ui/scripts/firstRun.test.mjs
@@ -60,6 +60,22 @@ test("the two mailboxes are separate rows read from separate checks", () => {
assert.equal(items.find((i) => i.id === "own_mailbox").done, false);
});
+test("an optional row counts once done, and inviting the team is optional", () => {
+ const items = gettingStartedItems({
+ ...base,
+ hasAsked: true,
+ checks: [check("gmail", "ok"), check("your_gmail", "ok")],
+ team: true,
+ teamSize: 1,
+ });
+ const team = items.find((i) => i.id === "team");
+ assert.equal(team.done, false);
+ assert.equal(team.optional, true);
+ assert.match(team.detail, /^Optional\./);
+ assert.deepEqual(checklistProgress(items), { done: 4, total: 4 });
+ assert.equal(checklistComplete(items), true);
+});
+
test("while the checks are loading, nothing is marked done", () => {
const items = gettingStartedItems({ ...base, checks: null });
assert.equal(items.find((i) => i.id === "exec_mailbox").done, false);
diff --git a/packages/ui/src/lib/firstRun.ts b/packages/ui/src/lib/firstRun.ts
index 7bf62fc0..148ff37c 100644
--- a/packages/ui/src/lib/firstRun.ts
+++ b/packages/ui/src/lib/firstRun.ts
@@ -209,9 +209,9 @@ export function gettingStartedItems(input: ChecklistInput): ChecklistItem[] {
detail:
input.teamSize > 1
? `${input.teamSize} people on the People page`
- : "Who the Executive works with, and who reports to whom.",
+ : "Optional. Who the Executive works with, and who reports to whom.",
done: input.teamSize > 1,
- optional: false,
+ optional: true,
href: FIRST_RUN_LINKS.people,
action: "Add",
});
@@ -221,8 +221,8 @@ export function gettingStartedItems(input: ChecklistInput): ChecklistItem[] {
/** "2 of 5" for the heading; optional rows count once done. */
export function checklistProgress(items: readonly ChecklistItem[]): { done: number; total: number } {
- const required = items.filter((i) => !i.optional);
- return { done: required.filter((i) => i.done).length, total: required.length };
+ const counted = items.filter((i) => !i.optional || i.done);
+ return { done: counted.filter((i) => i.done).length, total: counted.length };
}
/** The checklist leaves Home once every required row is done. */