Skip to content

Commit 0e46840

Browse files
fix(studio): landing own-app cards drop the package id and Writable badge; Recently viewed hides when it only repeats them (#35094)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} --> _Requested by **Yibo Wang** · [project thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBLW6dHPW6sSheA32XPKZzPV)_ Closes #35018 PR 2 of 2: card item 4, the Studio landing page. The other half (items 1–3, the permission page, the AI panel's 正在看 line and the field panel) is #35082, `Part of #35018`. Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:Studio 着陆页「自己的应用」卡片不再在应用名下显示包 ID(如 `com.qa.mtg`),也不再显示「可写」徽标;包 ID 改为卡片的悬停提示(和「已安装的应用」卡片一样)。「最近访问」在内容和上方卡片完全重复时不显示。 - 为什么改:卡片 #35018 第 4 项:自己的应用全都可写,徽标没有信息量;包 ID 是内部名;最近访问只重复上方卡片。 - 风险与回滚:只改着陆页显示,不改数据、接口、布局和功能(复制按钮、新建卡片、其他分区不变),不加文案键。回滚就是 revert 本 PR。 - 先看:`ui/packages/app-shell/src/views/studio-design/BuilderLanding.tsx`(`recentRepeatsCards` 判断和自己的应用卡片那一段)。 - 两分钟验证:中文 Studio 着陆页(`/studio`),建两个自己的应用:卡片只显示应用名和「复制」,鼠标悬停显示包 ID;把页面上每张应用卡片都打开一次再回来,「最近访问」不出现;再新建一个应用,「最近访问」重新出现。 - 需要你做的:无,席位落地。 ## What changes - **Own-app cards (自己的应用 / Your own apps).** `BuilderLanding`'s own-app card no longer draws the package id line under the name, and no longer draws the 可写 / "Writable" badge (`engine.studio.pkg.writable`). Every card in this section is writable by construction (`cards.filter((p) => p.writable)`), so the badge carried no information. The package id moves to the card row's hover `title`, the place the installed-app card already keeps it (`title={p.id}` there). The Duplicate button, the inline duplicate form and the create card are unchanged. - **最近访问 / Recently viewed.** The row is left out when its entries are exactly the apps the cards above already show (installed and own cards together, as a set, any order). It is drawn whenever it adds something: an app no card shows (for example a kernel package the cards hide), or a card it does not repeat. Each entry shows the app name only; the package id is on the entry's hover `title`, as on the cards (folded in at the seat's request, triage 6967733592). - No locale key is added, removed or changed. `engine.studio.pkg.writable` stays: `PackageSwitcher` and `PageShell` still read it. - The 可写 / read-only signal elsewhere on the page: the installed-app cards carry no read-only badge on main either (their section heading and hint say it), so there was no informative badge left to keep on this page. ## Why Card #35018 item 4, measured on main in this PR's before leg (below): each own-app card read `会议纪要 com.qa.mtg 可写 复制`, and with every app visited the 最近访问 row repeated the three cards above it. ## Tests <details><summary>Pins (in the landing's existing BuilderLanding.recentPackages-11863.test.tsx, two new card-named describes)</summary> - `an own-app card shows the app, not its package (objectstack#35018)`: the card's text holds the name and not the package id, and has no `Writable` text; no `Writable` anywhere on the page. Second case: the package id is reachable as the card's hover title (`getByTitle('com.acme.crm')` inside the card). - `a Recently viewed entry shows the app, not its package (objectstack#35018)`: the entry shows `Acme CRM`, not `com.acme.crm`, and `getByTitle('com.acme.crm')` inside the row returns that entry's link. - `"Recently viewed" is left out when it only repeats the cards (objectstack#35018)`: one recent visit to the only app ⇒ no row (the name appears once); every card visited, installed included, in another order ⇒ no row. CONTROL: a recent app no card shows (a kernel package) keeps the row; CONTROL: a card the row does not repeat keeps the row. - Fixture triage in the same file: six existing cases had one recent entry equal to the page's only cards. Each now lists one more app the row does not repeat, so it keeps testing what it tested (label, loading, deleted entry, slot fill, stored entry). `the package cards stay beside the recent row` keeps its assertion with a second card. `BuilderLanding.accessibleNames-12510` needed only a comment update (the own card's name no longer has an api name after it). </details> <details><summary>Ablations (scripts/ablation-replace.mjs at b43cf93; each restored, blob 11b989d == HEAD, git diff HEAD empty)</summary> - Package id line put back on the own card: `names no package id and carries no Writable badge` 1 failed / 17 passed. - Writable badge put back on the own card: the same case, 1 failed / 17 passed. - `title={p.id}` removed from the own card row: `keeps the package id reachable` 1 failed / 17 passed. - Fold (at a49e040, restored to blob a49e040): the recent entry's id line put back ⇒ the new recent-entry pin 1 failed / 18 passed; `title={item.name}` removed ⇒ 1 failed / 18 passed. - `&& !recentRepeatsCards` removed from the row's condition: the two hide cases failed, both CONTROLs passed (2 failed / 16 passed). </details> <details><summary>Suites (local, under os-verify-lock, at f961349)</summary> - `pnpm --dir ui exec vitest run packages/app-shell/src/views/studio-design/BuilderLanding`: Test Files 12 passed (12), Tests 89 passed (89); after the fold (a49e040): 12 files / 90 tests passed. - `pnpm --filter @object-ui/app-shell run type-check` (src and `tsconfig.test.json`): exit 0. - `npx eslint` on the three edited files from `ui/packages/app-shell`: exit 0. </details> ## Acceptance notes - **Live reading** (zh-CN, 1280×800, a fresh showcase backend per leg, console served from src by vite). Two self-built apps created over HTTP: `com.qa.mtg` 会议纪要 and `com.qa.tix` 工单跟踪. Before = `BuilderLanding.tsx` at the merge base, vite restarted with `--force`, served code checked with `curl`. After = branch head, checked the same way. - Before: own cards read `会议纪要com.qa.mtg可写 复制` / `工单跟踪com.qa.tix可写 复制`, 2 可写 badges on the page. With all three cards visited, 最近访问 listed 工单跟踪, 会议纪要, ObjectStack Showcase: the three cards again. - After: own cards read `会议纪要 复制` / `工单跟踪 复制`, 0 可写 on the page, hover title `com.qa.mtg`. With all three cards visited: no 最近访问 row. CONTROL: after a third app (客户回访) was created, the row came back, since it no longer repeats every card. - **Reading of 「完全重复」.** This PR hides the row when its entries and the cards are the same set of apps. It keeps the row when there are more cards than recent entries, because the row then says which of many apps were last open. If the maintainer means the stricter reading (hide whenever every recent entry already has a card), the row would show almost only for kernel packages: a one-line change in `recentRepeatsCards`, but close to removing the row. - Folded in (seat and triage 6967733592): each 最近访问 entry no longer draws its package id in mono under the name; the id is the entry's hover title. Live: `after-4-recent-no-id.png` (CONTROL case with a third app) reads 工单跟踪 / 会议纪要 / ObjectStack Showcase with no visible id; hover titles com.qa.tix / com.qa.mtg / com.example.showcase. ## Verification - Gates derived by `node scripts/pm/dispatch-gates.mjs --commands` at f961349 (38), all exit 0 locally. `--ran` with exit codes: `38 derived, 38 run, 0 NOT-MEASURED, 0 UNRUN` (a derived zero, all 38 recorded an exit code). `pnpm check:changeset-fixed`: exit 0. - `node scripts/pm/overlap-check.mjs --branch=claude/issue-35018-studio-landing-c` before each push: VERDICT clean exit 0. Against #35082: no shared file (this PR touches no i18n file), and a merge of the two heads is clean. - The CI lanes (Test UI, Type Check UI, repo-wide scans) are CI's. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01WGufzfrh8TiPJf1i2kMSoa <!-- signed: repo:objectstack#3 · os-support-ai · session_01WGufzfrh8TiPJf1i2kMSoa --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 936d335 commit 0e46840

4 files changed

Lines changed: 153 additions & 16 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
---
4+
5+
fix(studio): the Studio landing's own-app cards and 最近访问 entries show the app, not its package id, and 最近访问 is left out when it only repeats the cards
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
Two changes on the Studio landing page (`/studio`):
11+
12+
- **自己的应用 / Your own apps cards.** A card shows the app's name only. The package id line under the name (for example `app.nb57`) is gone, and so is the 可写 / "Writable" badge: every app in this section is writable, so the badge said nothing. The package id is still on the card's hover title, the way an installed app's card already carries it.
13+
- **最近访问 / Recently viewed.** The row is left out when its entries are exactly the apps the cards above already show, for example one recent visit to the only app on the page. It is drawn whenever it adds something: an app no card shows, or a card it does not repeat. Each entry shows the app's name only; its package id line is gone and the id is on the entry's hover title, as on the cards.
14+
15+
No layout or feature change: the cards, the Duplicate button, the create card and the other sections are as before. No locale keys change.

‎ui/packages/app-shell/src/views/studio-design/BuilderLanding.accessibleNames-12510.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ describe('Studio home cards carry their visible label as their name (objectui#12
9494
const recent = await screen.findByTestId('studio-landing-recent');
9595
expect(within(recent).getByRole('link', { name: /HotCRM/ })).toHaveAttribute('href', '/studio/app.objectstack.hotcrm');
9696

97-
// The writable card: its label leads the name; the api name follows it.
97+
// The writable card: named by its label (its id is only its hover title, objectstack#35018).
9898
expect(screen.getByRole('button', { name: /^Acme CRM\b/ })).toBeInTheDocument();
9999
// The installed (read-only) card: its label, and its Customize button named for it.
100100
expect(screen.getByRole('button', { name: 'HotCRM' })).toBeInTheDocument();

‎ui/packages/app-shell/src/views/studio-design/BuilderLanding.recentPackages-11863.test.tsx‎

Lines changed: 118 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,11 @@ describe('Studio landing → recent packages (objectui#11863)', () => {
156156
it('a package renamed since the visit shows its new name: the label is read on the render, never stored', async () => {
157157
// The visit happened while the package was called something else; the
158158
// stored entry carries no text from that moment to go stale.
159-
packages.list = [{ id: 'com.acme.crm', name: 'Acme Sales', writable: true, namespace: 'acme' }];
159+
// A second app the row does not repeat keeps it drawn (objectstack#35018).
160+
packages.list = [
161+
{ id: 'com.acme.crm', name: 'Acme Sales', writable: true, namespace: 'acme' },
162+
{ id: 'com.acme.hr', name: 'Acme HR', writable: true, namespace: 'acmehr' },
163+
];
160164
renderLanding([visit('com.acme.crm')]);
161165

162166
await screen.findByText('Recently viewed');
@@ -193,7 +197,10 @@ describe('Studio landing → recent packages (objectui#11863)', () => {
193197
packages.gate = new Promise<void>((resolve) => {
194198
release = resolve;
195199
});
196-
packages.list = [{ id: 'com.acme.crm', name: 'Acme CRM', writable: true, namespace: 'acme' }];
200+
packages.list = [
201+
{ id: 'com.acme.crm', name: 'Acme CRM', writable: true, namespace: 'acme' },
202+
{ id: 'com.acme.hr', name: 'Acme HR', writable: true, namespace: 'acmehr' },
203+
];
197204
renderLanding([visit('com.acme.crm')]);
198205

199206
expect(screen.getByText('Loading…')).toBeInTheDocument();
@@ -219,7 +226,10 @@ describe('Studio landing → recent packages (objectui#11863)', () => {
219226
});
220227

221228
it('the package cards stay beside the recent row', async () => {
222-
packages.list = [{ id: 'com.acme.crm', name: 'Acme CRM', writable: true, namespace: 'acme' }];
229+
packages.list = [
230+
{ id: 'com.acme.crm', name: 'Acme CRM', writable: true, namespace: 'acme' },
231+
{ id: 'com.acme.hr', name: 'Acme HR', writable: true, namespace: 'acmehr' },
232+
];
223233
renderLanding([visit('com.acme.crm')]);
224234

225235
await screen.findByText('Recently viewed');
@@ -231,7 +241,10 @@ describe('Studio landing → recent packages (objectui#11863)', () => {
231241

232242
describe('Studio landing → a deleted package leaves "Recently viewed" (objectstack#32615)', () => {
233243
it('a package the list no longer has is not listed; CONTROL — a live one beside it is', async () => {
234-
packages.list = [{ id: 'com.acme.crm', name: 'Acme CRM', writable: true, namespace: 'acme' }];
244+
packages.list = [
245+
{ id: 'com.acme.crm', name: 'Acme CRM', writable: true, namespace: 'acme' },
246+
{ id: 'com.acme.hr', name: 'Acme HR', writable: true, namespace: 'acmehr' },
247+
];
235248
renderLanding([visit('com.acme.gone'), visit('com.acme.crm')]);
236249

237250
await screen.findByText('Recently viewed');
@@ -240,7 +253,8 @@ describe('Studio landing → a deleted package leaves "Recently viewed" (objects
240253
});
241254

242255
it('the gone entry does not take a slot of the row: the next live packages fill it', async () => {
243-
packages.list = ['a', 'b', 'c'].map((x) => ({
256+
// A fourth app, never visited, keeps the row from repeating the cards (objectstack#35018).
257+
packages.list = ['a', 'b', 'c', 'd'].map((x) => ({
244258
id: `com.acme.${x}`,
245259
name: `Pkg ${x.toUpperCase()}`,
246260
writable: true,
@@ -277,11 +291,109 @@ describe('Studio landing → a deleted package leaves "Recently viewed" (objects
277291
});
278292

279293
it('the stored entry is kept: filtered on the render, never dropped from the store here', async () => {
280-
packages.list = [{ id: 'com.acme.crm', name: 'Acme CRM', writable: true, namespace: 'acme' }];
294+
packages.list = [
295+
{ id: 'com.acme.crm', name: 'Acme CRM', writable: true, namespace: 'acme' },
296+
{ id: 'com.acme.hr', name: 'Acme HR', writable: true, namespace: 'acmehr' },
297+
];
281298
renderLanding([visit('com.acme.gone'), visit('com.acme.crm')]);
282299

283300
await screen.findByText('Recently viewed');
284301
const stored = JSON.parse(localStorage.getItem(STORAGE_KEY) ?? '[]') as Array<{ id: string }>;
285302
expect(stored.map((e) => e.id)).toEqual(['package:com.acme.gone', 'package:com.acme.crm']);
286303
});
287304
});
305+
306+
/** The own-app section's card for `id`. */
307+
const ownCard = (id: string) => {
308+
const card = screen.getByTestId('studio-landing-own').querySelector(`[data-package-id="${id}"]`);
309+
if (!(card instanceof HTMLElement)) throw new Error(`no own-app card for ${id}`);
310+
return card;
311+
};
312+
313+
describe('Studio landing → an own-app card shows the app, not its package (objectstack#35018)', () => {
314+
it('names no package id and carries no Writable badge on its face', async () => {
315+
packages.list = [
316+
{ id: 'com.acme.crm', name: 'Acme CRM', writable: true, namespace: 'acme' },
317+
{ id: 'com.example.showcase', name: 'Showcase', writable: false, namespace: 'showcase' },
318+
];
319+
renderLanding([]);
320+
321+
await screen.findByText('Acme CRM');
322+
const card = ownCard('com.acme.crm');
323+
expect(within(card).getByText('Acme CRM')).toBeInTheDocument();
324+
expect(card.textContent).not.toContain('com.acme.crm');
325+
expect(within(card).queryByText('Writable')).not.toBeInTheDocument();
326+
// Nowhere on the page: an installed app's card carries no such badge either.
327+
expect(screen.queryByText('Writable')).not.toBeInTheDocument();
328+
});
329+
330+
it('keeps the package id reachable, as the card’s hover title', async () => {
331+
packages.list = [{ id: 'com.acme.crm', name: 'Acme CRM', writable: true, namespace: 'acme' }];
332+
renderLanding([]);
333+
334+
await screen.findByText('Acme CRM');
335+
expect(within(ownCard('com.acme.crm')).getByTitle('com.acme.crm')).toBeInTheDocument();
336+
});
337+
});
338+
339+
describe('Studio landing → a "Recently viewed" entry shows the app, not its package (objectstack#35018)', () => {
340+
it('shows the name and not the id; the id is the entry’s hover title', async () => {
341+
packages.list = [
342+
{ id: 'com.acme.crm', name: 'Acme CRM', writable: true, namespace: 'acme' },
343+
{ id: 'com.acme.hr', name: 'Acme HR', writable: true, namespace: 'acmehr' },
344+
];
345+
renderLanding([visit('com.acme.crm')]);
346+
347+
await screen.findByText('Recently viewed');
348+
const [link] = recentLinks();
349+
expect(within(link).getByText('Acme CRM')).toBeInTheDocument();
350+
expect(link.textContent).not.toContain('com.acme.crm');
351+
expect(within(recentSection()).getByTitle('com.acme.crm')).toBe(link);
352+
});
353+
});
354+
355+
describe('Studio landing → "Recently viewed" is left out when it only repeats the cards (objectstack#35018)', () => {
356+
it('one recent visit to the only app: no row', async () => {
357+
packages.list = [{ id: 'com.acme.crm', name: 'Acme CRM', writable: true, namespace: 'acme' }];
358+
renderLanding([visit('com.acme.crm')]);
359+
360+
await screen.findByText('Acme CRM');
361+
expect(screen.queryByTestId('studio-landing-recent')).not.toBeInTheDocument();
362+
expect(screen.queryByText('Recently viewed')).not.toBeInTheDocument();
363+
expect(screen.getAllByText('Acme CRM')).toHaveLength(1);
364+
});
365+
366+
it('every card visited, in any order, installed apps included: no row', async () => {
367+
packages.list = [
368+
{ id: 'com.acme.crm', name: 'Acme CRM', writable: true, namespace: 'acme' },
369+
{ id: 'com.example.showcase', name: 'Showcase', writable: false, namespace: 'showcase' },
370+
];
371+
renderLanding([visit('com.example.showcase'), visit('com.acme.crm')]);
372+
373+
await screen.findByText('Acme CRM');
374+
expect(screen.queryByTestId('studio-landing-recent')).not.toBeInTheDocument();
375+
});
376+
377+
it('CONTROL — a recent app no card shows keeps the row', async () => {
378+
packages.list = [{ id: 'com.acme.crm', name: 'Acme CRM', writable: true, namespace: 'acme' }];
379+
packages.hidden = ['com.objectstack.platform'];
380+
renderLanding([visit('com.acme.crm'), visit('com.objectstack.platform')]);
381+
382+
await screen.findByText('Recently viewed');
383+
expect(recentLinks().map((a) => a.getAttribute('href'))).toEqual([
384+
'/studio/com.acme.crm',
385+
'/studio/com.objectstack.platform',
386+
]);
387+
});
388+
389+
it('CONTROL — a card the row does not repeat keeps the row', async () => {
390+
packages.list = [
391+
{ id: 'com.acme.crm', name: 'Acme CRM', writable: true, namespace: 'acme' },
392+
{ id: 'com.acme.hr', name: 'Acme HR', writable: true, namespace: 'acmehr' },
393+
];
394+
renderLanding([visit('com.acme.crm')]);
395+
396+
await screen.findByText('Recently viewed');
397+
expect(recentLinks().map((a) => a.getAttribute('href'))).toEqual(['/studio/com.acme.crm']);
398+
});
399+
});

‎ui/packages/app-shell/src/views/studio-design/BuilderLanding.tsx‎

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,15 @@ export function BuilderLanding(): React.ReactElement {
182182
const writable = cards.filter((p) => p.writable);
183183
const readonly = cards.filter((p) => !p.writable);
184184

185+
// objectstack#35018 — "Recently viewed" is drawn only when it adds something
186+
// to the cards above it. When its entries are exactly the apps those cards
187+
// already show (one recent visit to the only app, say), the row repeats the
188+
// page and is left out; any entry the cards do not show, or any card it does
189+
// not repeat, keeps the whole row.
190+
const cardIds = new Set(cards.map((p) => p.id));
191+
const recentRepeatsCards =
192+
recentPackages.length === cardIds.size && recentPackages.every((item) => cardIds.has(item.name));
193+
185194
// ADR-0146 D3 — each read-only BASE's card carries "n customized, m switched
186195
// off", the server's counts (`GET /packages/:id/customizations`), one read
187196
// per card drawn. A pair (`<base>.custom`) draws no line and is never sent:
@@ -542,7 +551,10 @@ export function BuilderLanding(): React.ReactElement {
542551
<div data-testid="studio-landing-own" className="mb-6 grid grid-cols-1 gap-2.5 sm:grid-cols-2 lg:grid-cols-3">
543552
{writable.map((p) => (
544553
<div key={p.id} data-package-id={p.id} className="rounded-lg border bg-background">
545-
<div className="flex items-center gap-2.5 px-3 py-2.5">
554+
{/* objectstack#35018 — the app's id is not on the card's face, only
555+
* in its hover title, as on an installed app's card. Every app in
556+
* this section is writable, so the card carries no badge saying so. */}
557+
<div title={p.id} className="flex items-center gap-2.5 px-3 py-2.5">
546558
<button
547559
type="button"
548560
onClick={() => open(p.id)}
@@ -553,12 +565,8 @@ export function BuilderLanding(): React.ReactElement {
553565
</span>
554566
<span className="min-w-0 flex-1">
555567
<span className="block truncate text-[13px] font-medium">{p.name}</span>
556-
<span className="block truncate font-mono text-[10px] text-muted-foreground">{p.id}</span>
557568
</span>
558569
</button>
559-
<span className="rounded bg-emerald-400/15 px-1.5 py-0.5 text-[10px] text-emerald-600 dark:text-emerald-300">
560-
{t('engine.studio.pkg.writable', locale)}
561-
</span>
562570
{/* ADR-0070 D4 — Duplicate clones a writable base: the copy is a new
563571
* writable package holding the base's sys_metadata rows. It is
564572
* offered here, on writable bases only; a read-only package's card
@@ -642,19 +650,21 @@ export function BuilderLanding(): React.ReactElement {
642650

643651
{/* objectui#11863 — the packages last opened here. objectstack#34715
644652
* orders the page by the errand: installed apps first, the author's own
645-
* apps next, then the other entries, this one among them. */}
646-
{recentPackages.length > 0 && (
653+
* apps next, then the other entries, this one among them.
654+
* objectstack#35018 — left out when it only repeats those cards. */}
655+
{recentPackages.length > 0 && !recentRepeatsCards && (
647656
<>
648657
<h2 className={headingClass}>{t('engine.home.recent', locale)}</h2>
649658
<div data-testid="studio-landing-recent" className="mb-6 grid grid-cols-1 gap-2.5 sm:grid-cols-2 lg:grid-cols-3">
650659
{recentPackages.map((item) => (
651-
<Link key={item.id} to={item.href} className={entryCardClass}>
660+
// objectstack#35018 — the app's id is only the entry's hover
661+
// title, as on the cards above; its face shows the name.
662+
<Link key={item.id} to={item.href} title={item.name} className={entryCardClass}>
652663
<span className={entryIconClass}>
653664
<Clock className="h-4 w-4" />
654665
</span>
655666
<span className="min-w-0 flex-1">
656667
<span className="block truncate text-[13px] font-medium">{recentLabel(item)}</span>
657-
<span className="block truncate font-mono text-[10px] text-muted-foreground">{item.name}</span>
658668
</span>
659669
</Link>
660670
))}

0 commit comments

Comments
 (0)