From 9f90c763b3ad23849edeb30e6e494634a57874b5 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 11:30:57 +0000 Subject: [PATCH 1/5] wip(studio): package overview page with Info and Pending tabs Claude-Session: https://claude.ai/code/session_01Utp6CbL6Nn3scsU8yvLyU4 Co-authored-by: Claude --- .../src/preview/DraftChangesPanel.tsx | 755 ++++++++++-------- .../views/studio-design/StudioBackToApp.tsx | 10 +- .../studio-design/StudioDesignSurface.tsx | 95 ++- .../views/studio-design/StudioPackageMenu.tsx | 13 +- .../StudioPackageOverviewPage.tsx | 288 +++++++ .../src/views/studio-design/packages-io.ts | 18 +- .../src/views/studio-design/studioAddress.ts | 29 + .../views/studio-design/studioAddressTable.ts | 16 + .../src/views/studio-design/studioMenuData.ts | 6 + .../views/studio-design/studioMenuModel.ts | 54 +- ui/packages/i18n/src/namespaces/studio/en.ts | 23 + ui/packages/i18n/src/namespaces/studio/zh.ts | 23 + 12 files changed, 939 insertions(+), 391 deletions(-) create mode 100644 ui/packages/app-shell/src/views/studio-design/StudioPackageOverviewPage.tsx diff --git a/ui/packages/app-shell/src/preview/DraftChangesPanel.tsx b/ui/packages/app-shell/src/preview/DraftChangesPanel.tsx index c5c177446e0..5a64aa4c683 100644 --- a/ui/packages/app-shell/src/preview/DraftChangesPanel.tsx +++ b/ui/packages/app-shell/src/preview/DraftChangesPanel.tsx @@ -1497,6 +1497,22 @@ export interface DraftChangesPanelProps { * ({@link customizationEnvironmentText}, objectstack#30119). */ customizationOf?: string; + /** + * objectstack#37454 (ADR-0084, amended 2026-11-26, 概览 Overview) — drawn in + * place, as the Pending tab of Studio's package overview, instead of as a + * sheet: the same list, checks, note and Publish all, with no overlay. + * `open` still says whether it is shown (it loads on each open), and + * `onOpenChange` is never called. Opening clears no toast: a page in place + * covers nothing, and a remount after a publish would clear the publish's + * own answer. + */ + embedded?: boolean; + /** + * Read the drafts again whenever this value changes while open. The sheet + * re-reads at each open; an embedded panel stays open, so its host passes + * what moves when the drafts do (a publish, a new pending count). + */ + reloadKey?: unknown; } export type DraftChangesPosture = 'review' | 'confirm'; @@ -1518,6 +1534,8 @@ export function DraftChangesPanel({ posture = 'review', renderEntryNote, customizationOf, + embedded = false, + reloadKey, }: DraftChangesPanelProps) { const { t, language } = useObjectTranslation(); const [entries, setEntries] = useState(null); @@ -1762,7 +1780,7 @@ export function DraftChangesPanel({ useEffect(() => { if (open) void load(); - }, [open, load]); + }, [open, load, reloadKey]); /** * Clear the toast stack when this panel opens (`add10d8f9`). @@ -1788,7 +1806,9 @@ export function DraftChangesPanel({ * a toast this panel's OWN publish raises is untouched. */ useEffect(() => { - if (open) toast.dismiss(); + if (open && !embedded) toast.dismiss(); + // Keyed on the open transition; `embedded` is fixed for a host's mount. + // eslint-disable-next-line react-hooks/exhaustive-deps }, [open]); const noChangeText = t('preview.changes.detailNone', { @@ -1810,6 +1830,382 @@ export function DraftChangesPanel({ byType.set(entry.type, bucket); } + const titleText = t('preview.changes.title', { defaultValue: 'Pending changes' }); + const descriptionText = t('preview.changes.description', { + defaultValue: 'What publishing will change. New items are added; updates overwrite the live version.', + }); + const headerNotes = ( + <> + {customizationOf ? ( +

+ {savedToCustomizationText(t, customizationOf)} +

+ ) : null} + {/* objectstack#30119 (ADR-0146 D2) — and where they live: this + * environment's database, as items of the pair (`packageId`, the + * pair the host reviews), moved only by `os package export`. */} + {customizationOf && packageId ? ( +

+ {customizationEnvironmentText(t, packageId)} +

+ ) : null} + + ); + const body = ( + <> + {posture === 'confirm' && entries && entries.length > 0 && !error ? ( + // objectui#12517 — what the publish carries, counted off the same + // per-type grouping the headings below read. +

+ {[ + t('preview.changes.summaryItems', { count: entries.length, defaultValue: '{{count}} items' }), + ...[...byType.entries()].map(([type, items]) => summaryTypeSegment(t, type, items.length)), + ].join(' · ')} +

+ ) : null} +
+ {error ? ( +

+ {t('preview.changes.loadFailed', { defaultValue: 'Could not load pending changes:' })}{' '} + {error} +

+ ) : entries === null ? ( +
+ + {t('preview.changes.loading', { defaultValue: 'Loading pending changes…' })} +
+ ) : entries.length === 0 ? ( +

+ {t('preview.changes.empty', { defaultValue: 'Nothing pending — every draft has been published.' })} +

+ ) : ( + [...byType.entries()].map(([type, items]) => ( +
+

+ {summaryTypeSegment(t, type, items.length)} +

+
    + {items.map((entry) => { + const key = entryKey(entry); + const isExpanded = expanded.has(key); + // objectui#11807 — the drill-in found nothing this publish + // changes: not an UPDATE, whatever the name list said. + const isUnchanged = unchanged.has(key); + // objectui#11862 — the row's label leads, in the console + // language, for a NEW row and an UPDATE row alike: the one + // `_drafts` serves, so this list never chooses between a + // published and a draft label. The name follows as + // secondary text, or is the row's text when there is no + // label. + const labelText = resolveI18nLabel(entry.label, language)?.trim() ?? ''; + const note = renderEntryNote?.(entry); + return ( +
  • + + {note ? ( +
    + {note} +
    + ) : null} + {isExpanded && ( +
    + markCompared(key, same)} + backfill={backfillControl} + /> +
    + )} +
  • + ); + })} +
+
+ )) + )} +
+ {checks.length > 0 && !error && ( +
+

+ + {t('preview.changes.flowChecksTitle', { + defaultValue: 'Before you publish — the publish check will report these', + })} +

+
    + {draftChecksByItem(checks).map(({ type, name, items }) => { + const entry = entries?.find((e) => e.type === type && e.name === name); + const heading = resolveI18nLabel(entry?.label, language)?.trim() || name; + return ( +
  • + {/* The flow by the label its row shows, opening its designer + where a host publishes the surface channel (Studio), plain + text elsewhere — the security block's rule, below. */} + {openSurface ? ( + + ) : ( + {heading} + )} +
      + {items.map((c, i) => ( +
    • + {c.message} +
    • + ))} +
    +
  • + ); + })} +
+
+ )} + {problems.length > 0 && !error && ( +
+

+ + {t('preview.changes.securityBlockTitle', { + count: problems.length, + defaultValue: 'Publishing will be refused — {{count}} item(s) need a decision first', + })} +

+
    + {problems.map((p) => ( +
  • + {/* `type/name`, the way the server's own publish refusal names + the item (`object/crmext_visit: …`) — and, unlike a bare + name, text that cannot collide with the same draft's row in + the list above. + + Clickable ONLY where a host publishes the surface channel, + i.e. inside Studio. This sheet is shared with the Home / + draft-preview bar, where the designer is not a reachable + destination at all: there `openSurface` is null and the + name stays the plain prose it has always been, because a + link that goes nowhere is worse than the sentence below + telling you where to go. */} + {openSurface ? ( + + ) : ( + + {p.type}/{p.name} + + )}{' '} + — {securityProblemText(t, p)} +
  • + ))} +
+

+ {t('preview.changes.securityBlockWhere', { + defaultValue: 'Fix it on the object under Settings → Who can see which records, then publish again.', + })} +

+
+ )} + {onPublish && (entries?.length ?? 0) > 0 && !error && ( +
+

+ {/* objectui#11591 — the note states what THIS scope's Publish + does. Only a package publishes as one atomic batch (`POST + /packages/:id/publish-drafts`); with no package there is no + batch door, so the caller promotes each draft by itself and a + draft that fails stays pending while the others go live. */} + {packageId + ? t('preview.changes.confirmNote', { + count: entries!.length, + defaultValue: + 'Publishing releases all {{count}} pending drafts of this package together: all of them go live, or none do.', + }) + : t('preview.changes.confirmNoteSeparate', { + count: entries!.length, + defaultValue: + 'Publishing releases the {{count}} pending drafts one at a time: a draft that fails stays pending while the others go live.', + })} +

+ {packageId && ( + // ADR-0146 D1 — the change note. Offered only where the footer + // publishes one package as a batch: only that door carries a + // `message` to every history row it writes. +
+ +