Skip to content

Commit 9b3227f

Browse files
fix(console): first-run checklist counts like its progress, names Setup per language, folds to one line (#36013)
<!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuEwfVd7uXPuit61egsUgNQ6)_ repo:objectstack#1 · os-sales · session_01L6bhgWpxtdkmztBUeYCva3 Fixes #35417 Clause-②: yes (widening) — @object-ui/i18n adds console.firstRunChecklist.showDoneSplit; nothing removed Metadata-protocol: none ## 维护者速读 - 管理员在首页看到的「完成初始设置」卡片:已完成数与进度不再对不上,文案里的英文 Setup 换成各语言的「系统设置」叫法,只剩一两项时整张卡收成一行。 - 属于「控制台核心业务操作体验」专题,解决首页初始设置清单数字矛盾、中英混杂、少量剩余项仍占首屏的问题。 - 出错时只影响管理员首页这张清单的显示,不改任何设置、不写数据,可直接撤回。 - 无 ## What changes 1. **Done count matches the progress line.** The progress line counts the required rows alone (optional rows are kept out by the existing mail-optional ruling); the control that unfolds the done rows counted every done row, so a managed environment read "6 of 7 done" above "Show completed (8)". A new pure function `checklistDoneCount` in `firstRunChecklistLogic.ts` splits the done rows into required and optional. Once an optional row is done the control reads "Show completed (6 required · 2 optional)" (zh 「显示已完成的项(必做 6 · 可选 2)」); with none done it reads as before ("Show completed (6)"). New key `console.firstRunChecklist.showDoneSplit` in all eleven packs, translated. 2. **No English "Setup" in the checklist copy.** The three checklist strings that named Setup (`description`, `aiProvider.doneSettings`, `connectAssistant.todo`) now use the Setup app's own translated label from platform-objects' app translations: zh-Hans 系统设置, zh-Hant 系統設定, ja セットアップ, ko 설정, es Configuración, pt-BR Configuração, fr Configuration, ru Настройка (as «в разделе «Настройка»»), ar الإعداد. en and de keep "Setup", which is their label. No other "Setup" in the locale files is touched. 3. **One line when two rows or fewer are left.** Above the page (`top` placement), when `drawsOneLine` holds (1 or 2 drawn rows not done, optional included), the card draws one line: title, progress, each remaining row's title with a Set button, and the close button; no description, no done rows, no unfold control. It wraps (flex-wrap) at narrow widths. A localization row's Set opens the full card with that row's editor (`setEditing`), and the card folds back to the line when the editor closes (Cancel or a confirmed save). Every other row's Set opens the page its row already links to. The phone placement (`afterApps`) keeps its own fold, unchanged. No row, completion rule or write changes. The module docblock describes the one-line form. ## Tests <details><summary>Console checklist suites (3 files)</summary> `pnpm --dir ui exec vitest run` on `FirstRunChecklist.test.tsx`, `firstRunChecklistLogic.test.ts`, `firstRunChecklistProfile.test.ts`: Test Files 3 passed (3), Tests 109 passed (109), at d173c3c. New top-level describes in the shared harness `FirstRunChecklist.test.tsx`: - done control counts required and optional apart: managed, two optional done, "3 of 6 done" with "Show completed (3 required · 2 optional)" and the zh form; CONTROL self-hosted with no optional done keeps "Show completed (2)". - one-line form: one row left draws title, progress, the row and its Set, the close button, with no description, no toggle and no detail line; Set opens the full card with the editor and Cancel folds it back; two rows left with a link row (href kept, label Set) and close hides it; CONTROL three rows left draws the full card; CONTROL phone placement keeps its fold; zh label. - locale pin: every non-en/de pack's three strings carry its Setup label and no "Setup"; the pack roster is asserted complete; CONTROL en/de keep "Setup". Logic file: `checklistDoneCount` on the managed 6-of-7 + 2-optional case (progress 6/7, count 6 + 2) with a CONTROL; `drawsOneLine` at 1, 2, 3 and 0 rows left. </details> <details><summary>Ablations (committed fix first, restored by blob hash)</summary> - `drawsOneLine` body replaced by `return false;` (scripts/ablation-replace.mjs, anchor 1 to 0, blob 25f225b to 25e09c72b936): 4 failed, 96 passed; restored, blob equals HEAD, `git diff HEAD` empty. - the split branch condition `: doneCount.optional > 0` replaced by `: false`: 1 failed (the managed split pin), 73 passed; restored, blob equals HEAD. </details> <details><summary>Wider console and i18n runs</summary> - The six console App/FormPage suites that mount the checklist, plus all of `apps/console/src/pages/settings/`: Test Files 49 passed (49), Tests 483 passed (483). - `pnpm --filter @object-ui/i18n type-check` and `pnpm --dir ui exec vitest run packages/i18n/` (includes all-locales key parity): Test Files 105 passed (105), Tests 1957 passed, 13 skipped. - `pnpm --filter @object-ui/console type-check`: exit 0, 0 errors (the console tsconfig lists both edited test files). - eslint over the 4 console files and the 11 locale packs: 18 files, 0 errors, 0 warnings. </details> ## Acceptance notes - The one-line form's Set label is `console.firstRunChecklist.set` for every row, as the card asks ("项名 + 「设置」按钮"), so a link row such as Invite colleagues reads Set there and keeps its own action label in the full card. - The one-line form shows the Optional mark next to an optional row (for example mail), so a reader is not told an optional row is required. - The one-line state is derived, not stored: a Set on a localization row opens the full card only while its editor is open. - No before/after screenshot was taken. ## Verification Read first: `FirstRunChecklist.tsx` (the one-line branch before the full card, and the done toggle label), `firstRunChecklistLogic.ts` (`checklistDoneCount`, `drawsOneLine`), the zh-Hans pack's `firstRunChecklist` block. Two-minute check: run `pnpm --dir ui exec vitest run apps/console/src/pages/settings/__tests__/FirstRunChecklist.test.tsx`; expect all tests passed, including the "folds to one line" and "its own label" describes. <details><summary>Local gates at d173c3c</summary> `node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --ran`: 41 derived families accounted for, 41 run, 0 NOT-MEASURED (a derived zero, every one with exit 0). `pnpm --dir ui exec vitest run scripts/` was OOM-killed once beside a locked run and rerun under the verification lock with 2 workers: 172 files passed, 2 skipped. `pnpm --dir ui check:new-line-citations`: 0 new citations. `node scripts/pm/overlap-check.mjs`: clean against origin/main b113178 and 4 open PRs sharing the locale packs. CI families: not yet reported at open. </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L6bhgWpxtdkmztBUeYCva3 <!-- signed: repo:objectstack#1 · os-sales · session_01L6bhgWpxtdkmztBUeYCva3 --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 141a826 commit 9b3227f

16 files changed

Lines changed: 434 additions & 43 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
'@object-ui/console': patch
3+
'@object-ui/i18n': patch
4+
---
5+
6+
fix(console): the first-run checklist on Home counts its done rows the way its progress line does, names the Setup app in the reader's language, and folds to one line when two rows or fewer are left
7+
8+
Clause-②: yes (widening) — @object-ui/i18n adds console.firstRunChecklist.showDoneSplit; nothing removed
9+
Metadata-protocol: none
10+
11+
The progress line counts the required rows alone, while the control that unfolds the done rows counted every done row, optional ones included, so a managed environment could read "6 of 7 done" above "Show completed (8)". Once an optional row is done the control now names the two counts apart ("Show completed (6 required · 2 optional)"); with no optional row done it reads as before.
12+
13+
The checklist's description, the built-in AI row's done line and the Connect an AI assistant row's line named "Setup" in English in every language; they now use the Setup app's own label in each pack (for example 系统设置, 系統設定, セットアップ, Configuración). English and German keep "Setup", which is their label.
14+
15+
Above the page, once two rows or fewer are left to do, the card folds to one line: its title, its progress, each row left by its title and a Set button, and the close button. A language, timezone or currency row's Set opens the full card with that row's editor, and the card folds back once the editor closes; every other row's Set opens the page its row links to. The phone placement after the apps keeps its own fold. No row, completion rule or setting write changes.
16+
17+
New locale key: `console.firstRunChecklist.showDoneSplit`, in all eleven packs.

‎ui/apps/console/src/pages/settings/FirstRunChecklist.tsx‎

Lines changed: 133 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,18 @@
9595
* one control under them names how many are done and shows them (in their
9696
* place in the list) or folds them again, so the card keeps the first screen
9797
* for the work left (objectstack#32157). Unfolding is this mount's own state:
98-
* a fresh visit starts folded.
98+
* a fresh visit starts folded. The control counts the required rows and the
99+
* optional ones apart once an optional row is done, since the progress line
100+
* counts the required rows alone (`checklistDoneCount`).
101+
*
102+
* Above the page, once few rows are left to do (`drawsOneLine`: two or fewer,
103+
* optional ones included), the card folds to one line: its title, its
104+
* progress, each row left by its title and a Set button, and the close
105+
* button; no description, no done rows and no control to unfold them. The
106+
* line wraps on a narrow page rather than scroll. A localization row's Set
107+
* opens the full card with that row's editor, and the card folds back to the
108+
* line once the editor closes; every other row's Set opens the page its row
109+
* links to. A phone's card (`afterApps`) folds its own way, above.
99110
*
100111
* ## Hiding it
101112
*
@@ -150,8 +161,10 @@ import {
150161
LOCALIZATION_NAMESPACE,
151162
TIMEZONE_KEY,
152163
checklistCompletion,
164+
checklistDoneCount,
153165
deviceStorage,
154166
dismissRecordKey,
167+
drawsOneLine,
155168
hasInvitedColleagues,
156169
isOrganizationNamed,
157170
localizationRows,
@@ -460,6 +473,19 @@ function SettingsRowEditor({
460473
*/
461474
export type FirstRunChecklistPlacement = 'top' | 'afterApps';
462475

476+
/**
477+
* One row as the checklist draws it: the full row (`node`), and what the
478+
* one-line form draws of it, its title and where its Set goes (a page to open,
479+
* or the localization row to open for editing in the full card).
480+
*/
481+
interface ChecklistDrawnRow {
482+
id: string;
483+
done: boolean;
484+
title: string;
485+
set?: { to: string } | { edit: ChecklistSettingsRow['id'] };
486+
node: ReactNode;
487+
}
488+
463489
export function FirstRunChecklist({ placement = 'top' }: { placement?: FirstRunChecklistPlacement } = {}) {
464490
const { t, language } = useObjectTranslation();
465491
const { user, activeOrganization, getMembers, listInvitations, getAuthConfig } = useAuth();
@@ -607,11 +633,14 @@ export function FirstRunChecklist({ placement = 'top' }: { placement?: FirstRunC
607633
const localization = localizationRows(settings.localization.manifest, settings.localization.values, browser);
608634
const organizationNamed = isOrganizationNamed(activeOrganization?.name);
609635

610-
const rows: Array<{ id: string; done: boolean; node: ReactNode }> = [];
636+
const rows: ChecklistDrawnRow[] = [];
611637

638+
const organizationPath = `${setupPath}/sys_organization/record/${encodeURIComponent(orgId)}`;
612639
rows.push({
613640
id: 'organization_name',
614641
done: organizationNamed,
642+
title: t('console.firstRunChecklist.organizationName.title'),
643+
set: { to: organizationPath },
615644
node: (
616645
<ChecklistRow
617646
key="organization_name"
@@ -626,7 +655,7 @@ export function FirstRunChecklist({ placement = 'top' }: { placement?: FirstRunC
626655
}
627656
action={
628657
<RowLink
629-
to={`${setupPath}/sys_organization/record/${encodeURIComponent(orgId)}`}
658+
to={organizationPath}
630659
label={organizationNamed ? t('console.firstRunChecklist.change') : t('console.firstRunChecklist.organizationName.action')}
631660
testId="first-run-checklist-link-organization_name"
632661
/>
@@ -640,6 +669,8 @@ export function FirstRunChecklist({ placement = 'top' }: { placement?: FirstRunC
640669
rows.push({
641670
id: row.id,
642671
done: row.done,
672+
title: settingsRowTitle(row, t),
673+
set: { edit: row.id },
643674
node: (
644675
<ChecklistRow
645676
key={row.id}
@@ -701,6 +732,8 @@ export function FirstRunChecklist({ placement = 'top' }: { placement?: FirstRunC
701732
rows.push({
702733
id: 'mail',
703734
done,
735+
title: t('console.firstRunChecklist.mail.title'),
736+
set: { to: `${setupPath}/system/settings/mail` },
704737
node: (
705738
<ChecklistRow
706739
key="mail"
@@ -725,6 +758,8 @@ export function FirstRunChecklist({ placement = 'top' }: { placement?: FirstRunC
725758
rows.push({
726759
id: 'invite',
727760
done: colleagues,
761+
title: t('console.firstRunChecklist.invite.title'),
762+
set: { to: `${setupPath}/sys_user/view/all_users` },
728763
node: (
729764
<ChecklistRow
730765
key="invite"
@@ -751,6 +786,8 @@ export function FirstRunChecklist({ placement = 'top' }: { placement?: FirstRunC
751786
rows.push({
752787
id: 'ai_provider',
753788
done: ai.done,
789+
title: t('console.firstRunChecklist.aiProvider.title'),
790+
set: { to: `${setupPath}/system/settings/${AI_NAMESPACE}` },
754791
node: (
755792
<ChecklistRow
756793
key="ai_provider"
@@ -786,6 +823,8 @@ export function FirstRunChecklist({ placement = 'top' }: { placement?: FirstRunC
786823
rows.push({
787824
id: 'connect_assistant',
788825
done,
826+
title: t('console.firstRunChecklist.connectAssistant.title'),
827+
set: { to: assistantPath },
789828
node: (
790829
<ChecklistRow
791830
key="connect_assistant"
@@ -816,6 +855,7 @@ export function FirstRunChecklist({ placement = 'top' }: { placement?: FirstRunC
816855
rows.push({
817856
id: 'first_app',
818857
done,
858+
title: t('console.firstRunChecklist.firstApp.title'),
819859
node: (
820860
<ChecklistRow
821861
key="first_app"
@@ -834,6 +874,8 @@ export function FirstRunChecklist({ placement = 'top' }: { placement?: FirstRunC
834874
rows.push({
835875
id: 'first_record',
836876
done,
877+
title: t('console.firstRunChecklist.firstRecord.title'),
878+
set: firstOwn ? { to: `/apps/${appRouteSegment(firstOwn)}` } : undefined,
837879
node: (
838880
<ChecklistRow
839881
key="first_record"
@@ -861,7 +903,9 @@ export function FirstRunChecklist({ placement = 'top' }: { placement?: FirstRunC
861903
const drawn = rows.filter((row) => profileDrawsRow(profile, row.id, row.done));
862904
// Done rows are folded away, the optional ones included; only the required
863905
// ones decide whether the checklist is still drawn and what its progress says.
864-
const doneCount = drawn.filter((row) => row.done).length;
906+
// The control that unfolds them names the required and the optional apart,
907+
// so its count never reads larger than the progress line's.
908+
const doneCount = checklistDoneCount(drawn, optionalRow);
865909
const completion = checklistCompletion(drawn, optionalRow);
866910
if (completion.complete) return null;
867911

@@ -872,6 +916,86 @@ export function FirstRunChecklist({ placement = 'top' }: { placement?: FirstRunC
872916

873917
const progress = t('console.firstRunChecklist.progress', { done: completion.done, total: completion.total });
874918

919+
const dismissButton = (
920+
<button
921+
type="button"
922+
onClick={hide}
923+
aria-label={t('console.firstRunChecklist.dismiss')}
924+
title={t('console.firstRunChecklist.dismiss')}
925+
className="shrink-0 rounded-md p-1 text-muted-foreground hover:bg-accent hover:text-foreground"
926+
data-testid="first-run-checklist-dismiss"
927+
>
928+
<X className="h-4 w-4" />
929+
</button>
930+
);
931+
932+
// Above the page, with few rows left and none open for editing: one line,
933+
// each row left by its title and its Set. A localization row's Set opens the
934+
// full card with that row's editor; the others open their page.
935+
if (!foldable && editing === null && drawsOneLine(drawn)) {
936+
return (
937+
<div className="px-4 pt-4 sm:px-6 lg:px-8">
938+
<section
939+
className="mx-auto flex max-w-[1120px] flex-wrap items-center gap-x-4 gap-y-1.5 rounded-xl border border-border bg-card py-2 pl-4 pr-1.5"
940+
data-testid="first-run-checklist"
941+
data-one-line="true"
942+
aria-labelledby="first-run-checklist-title"
943+
>
944+
<p className="flex min-w-0 items-baseline gap-2">
945+
<span id="first-run-checklist-title" className="text-[13px] font-semibold tracking-tight">
946+
{t('console.firstRunChecklist.title')}
947+
</span>
948+
<span className="shrink-0 text-xs text-muted-foreground" data-testid="first-run-checklist-progress">
949+
{progress}
950+
</span>
951+
</p>
952+
<ul className="flex min-w-0 flex-1 flex-wrap items-center gap-x-4 gap-y-1.5">
953+
{drawn
954+
.filter((row) => !row.done)
955+
.map(({ id, title, set }) => (
956+
<li
957+
key={id}
958+
className="flex min-w-0 items-center gap-2"
959+
data-testid={`first-run-checklist-row-${id}`}
960+
data-done="false"
961+
data-optional={optionalRow(id) ? 'true' : undefined}
962+
>
963+
<Circle className="h-4 w-4 shrink-0 text-muted-foreground" aria-hidden />
964+
<span className="min-w-0 text-[13px]">{title}</span>
965+
{optionalRow(id) ? (
966+
<span
967+
className="shrink-0 rounded-full border border-border px-1.5 py-px text-[11px] text-muted-foreground"
968+
data-testid={`first-run-checklist-optional-${id}`}
969+
>
970+
{t('console.firstRunChecklist.optional')}
971+
</span>
972+
) : null}
973+
{set && 'edit' in set ? (
974+
<Button
975+
size="sm"
976+
variant="outline"
977+
className="h-7 shrink-0"
978+
onClick={() => setEditing(set.edit)}
979+
data-testid={`first-run-checklist-set-${id}`}
980+
>
981+
{t('console.firstRunChecklist.set')}
982+
</Button>
983+
) : set ? (
984+
<Button asChild size="sm" variant="outline" className="h-7 shrink-0">
985+
<Link to={set.to} data-testid={`first-run-checklist-link-${id}`}>
986+
{t('console.firstRunChecklist.set')}
987+
</Link>
988+
</Button>
989+
) : null}
990+
</li>
991+
))}
992+
</ul>
993+
{dismissButton}
994+
</section>
995+
</div>
996+
);
997+
}
998+
875999
if (foldable && !unfolded) {
8761000
return (
8771001
<section
@@ -938,22 +1062,13 @@ export function FirstRunChecklist({ placement = 'top' }: { placement?: FirstRunC
9381062
<ChevronUp className="h-4 w-4" aria-hidden />
9391063
</button>
9401064
) : null}
941-
<button
942-
type="button"
943-
onClick={hide}
944-
aria-label={t('console.firstRunChecklist.dismiss')}
945-
title={t('console.firstRunChecklist.dismiss')}
946-
className="rounded-md p-1 text-muted-foreground hover:bg-accent hover:text-foreground"
947-
data-testid="first-run-checklist-dismiss"
948-
>
949-
<X className="h-4 w-4" />
950-
</button>
1065+
{dismissButton}
9511066
</div>
9521067
</div>
9531068
<ol className="mt-2 divide-y divide-border" id="first-run-checklist-rows">
9541069
{drawn.filter((row) => showDone || !row.done).map((row) => row.node)}
9551070
</ol>
956-
{doneCount > 0 ? (
1071+
{doneCount.required + doneCount.optional > 0 ? (
9571072
<div className="border-t border-border py-2">
9581073
<button
9591074
type="button"
@@ -970,7 +1085,9 @@ export function FirstRunChecklist({ placement = 'top' }: { placement?: FirstRunC
9701085
)}
9711086
{showDone
9721087
? t('console.firstRunChecklist.hideDone')
973-
: t('console.firstRunChecklist.showDone', { done: doneCount })}
1088+
: doneCount.optional > 0
1089+
? t('console.firstRunChecklist.showDoneSplit', { required: doneCount.required, optional: doneCount.optional })
1090+
: t('console.firstRunChecklist.showDone', { done: doneCount.required })}
9741091
</button>
9751092
</div>
9761093
) : null}

0 commit comments

Comments
 (0)