Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/design-mode-name.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@object-ui/app-shell': patch
'@object-ui/i18n': patch
---

fix(console): the app menu's door into the design mode and the mode's bar read 「设计模式」 / "Design mode" again (renamed back from 「设计布局」 / "Design layout"), as do the strings that name the mode. The 「编辑应用」 / 「在 Studio 中查看」 row is unchanged.

Clause-②: no
Metadata-protocol: none
2 changes: 1 addition & 1 deletion content/docs/ui/actions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ ObjectSchema.create({
built-in the scope does not have and a built-in in `more`. `os validate`, `os build` and `os lint` also
refuse a name that is no action of the object, or one the scope does not place.
- An administrator sets the same arms in the running app: the app name at the top of
the sidebar, then 「Design layout」 in its menu, then 「Header buttons」 at the end of the
the sidebar, then 「Design mode」 in its menu, then 「Header buttons」 at the end of the
page header. Only the arm changed is saved. For
an installed object it is saved as this environment's customization, the
`object_extension` of the base's paired `.custom` package, whose arm replaces the
Expand Down
2 changes: 1 addition & 1 deletion ui/packages/app-shell/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ words "Open {app} in Studio" (ADR-0146 D5) instead of the pencil.
From 768 px up, where no top bar is drawn, the sidebar's app menu carries the
same entry on the same target and posture (`useAppStudioEntry`): "Edit app"
behind a pencil, or "View in Studio" behind an eye for a read-only package.
Beside it, "Design layout" turns on the shell's design mode, which edits the
Beside it, "Design mode" turns on the shell's design mode, which edits the
app's layout (its menu, header pins and page arrangement) in place; the mode's
bar carries the same name.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export function AppNoAccessEmptyState({ app, setupPath, reason = 'no-navigation'
defaultValue: '{{app}} has nothing in its menu yet',
})}
description={t('empty.appMenuEmptyDescription', {
defaultValue: 'Create objects for this app in App Studio and they join its menu, or add entries in Design layout.',
defaultValue: 'Create objects for this app in App Studio and they join its menu, or add entries in Design mode.',
})}
action={
<Button asChild variant="outline">
Expand Down
2 changes: 1 addition & 1 deletion ui/packages/app-shell/src/layout/ConsoleLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ export function ConsoleLayout({
const { apps: metadataApps } = useMetadata();
const appBasePath = `/apps/${appAddressSegment(metadataApps, activeApp) ?? activeAppName}`;
// objectstack#36362 — the app's design mode, held here so it stays on from
// page to page of the app; never on a phone, which has no 「Design layout」.
// page to page of the app; never on a phone, which has no 「Design mode」.
const designMode = useDesignModeController({ appName: activeAppName, appBasePath, enabled: !phone });
// objectstack#36907 — a Studio dashboard list's 「New」 arrives with the
// mode asked to enter and the 「Add menu item」 picker on its dashboards;
Expand Down
4 changes: 2 additions & 2 deletions ui/packages/app-shell/src/layout/DesignModeBar.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.

/**
* The design mode's bar (objectstack#36362): 「Design layout」 at its left
* The design mode's bar (objectstack#36362): 「Design mode」 at its left
* (objectstack#36758: the word its door in the app menu reads),
* 「Cancel」 and 「Save」 at its right, and nothing else (no app name, no
* explanation, no way to Studio). `ConsoleLayout` draws it in the app shell's
Expand All @@ -15,7 +15,7 @@ import type { DesignModeValue } from './designMode.js';

export function DesignModeBar({ mode }: { mode: DesignModeValue }) {
const { t } = useObjectTranslation();
const title = t('designMode.title', { defaultValue: 'Design layout' });
const title = t('designMode.title', { defaultValue: 'Design mode' });
return (
<div
role="region"
Expand Down
10 changes: 5 additions & 5 deletions ui/packages/app-shell/src/layout/SidebarAppMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* as before.
*
* objectstack#36758 — the design mode edits the app's layout only (its menu,
* header pins and page arrangement), so its door reads 「Design layout」, the
* header pins and page arrangement), so its door reads 「Design mode」, the
* word its bar shows. 「Edit app」 beside it opens this app's package in
* Studio: the app switcher's Studio row, on its target and posture
* (`useAppStudioEntry`), so the two cannot disagree. An installed
Expand Down Expand Up @@ -63,7 +63,7 @@ import { postureHasOrgWall, useTenancyPosture } from '../hooks/useTenancyPosture
export const APP_MENU_SEARCH_FROM = 8;

/**
* What 「Design layout」 does for this viewer, or `null` where it is not
* What 「Design mode」 does for this viewer, or `null` where it is not
* drawn: it turns the shell's design mode on for the app on screen, in place.
*
* Drawn on the page header's button's condition, unchanged: a workspace admin
Expand Down Expand Up @@ -91,15 +91,15 @@ function useEnterDesignMode(apps: Parameters<typeof matchAppBySegment>[0], activ
return designMode.enter;
}

/** 「Design layout」: the door into the design mode, named as its bar is. */
/** 「Design mode」: the door into the design mode, named as its bar is. */
function DesignLayoutItem({ onEnter }: { onEnter: () => void }) {
const { t } = useObjectTranslation();
return (
<DropdownMenuItem onSelect={onEnter} className="flex items-center gap-2.5 py-2" data-testid="sidebar-app-menu-design-layout">
<span className="flex size-[22px] shrink-0 items-center justify-center text-muted-foreground" aria-hidden>
<PencilRuler className="size-4" />
</span>
<span className="flex-1 truncate">{t('topbar.designLayout', { defaultValue: 'Design layout' })}</span>
<span className="flex-1 truncate">{t('topbar.designLayout', { defaultValue: 'Design mode' })}</span>
</DropdownMenuItem>
);
}
Expand Down Expand Up @@ -291,7 +291,7 @@ export function SidebarAppMenu({ activeAppName, onAppChange }: SidebarAppMenuPro
* neutral 「Documentation」 head where an app's name is, since the portal is
* in no app. It opens the same app list as the app menu, under 「Your apps」,
* with no row checked, and 「Add app」 for the viewers who may build. The
* app-scoped rows (「Design layout」, 「Edit app」) are not drawn: there is no
* app-scoped rows (「Design mode」, 「Edit app」) are not drawn: there is no
* app here for them to act on. Choosing an app opens it.
*/
export function SidebarDocsPortalMenu({ onAppChange }: { onAppChange: (segment: string) => void }) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ describe('the menu under the design mode (objectstack#36363)', () => {
expect(order()).toEqual(['home', ['sales', ['accounts', 'leads']], ['insights', []]]);

fireEvent.click(screen.getByText('switch to hr'));
expect(confirmSpy).toHaveBeenCalledWith('Leave Design layout? Your unsaved changes will be lost.');
expect(confirmSpy).toHaveBeenCalledWith('Leave Design mode? Your unsaved changes will be lost.');
expect(switchedTo).toEqual([]);
expect(screen.getByTestId('design-mode-bar')).toBeInTheDocument();
expect(order()).toEqual(['home', ['sales', ['accounts', 'leads']], ['insights', []]]);
Expand Down Expand Up @@ -1471,7 +1471,7 @@ describe("the arrival from a Studio dashboard list's New (objectstack#36907)", (
);
fireEvent.click(screen.getByText('arrive again'));
await flush();
expect(toastError).toHaveBeenCalledWith('Save or cancel your dashboard or report changes before designing the layout.');
expect(toastError).toHaveBeenCalledWith('Save or cancel your dashboard or report changes before entering Design mode.');
expect(screen.queryByTestId('design-mode-bar')).toBeNull();
expect(screen.queryByTestId('design-menu-picker')).toBeNull();
expect(here()).toEqual({ at: '/apps/crm', state: null });
Expand All @@ -1481,7 +1481,7 @@ describe("the arrival from a Studio dashboard list's New (objectstack#36907)", (
it('the same refusal when the editor opens in the very commit the arrival lands in', async () => {
arrive({ editorOpen: true });
await flush();
expect(toastError).toHaveBeenCalledWith('Save or cancel your dashboard or report changes before designing the layout.');
expect(toastError).toHaveBeenCalledWith('Save or cancel your dashboard or report changes before entering Design mode.');
expect(screen.queryByTestId('design-mode-bar')).toBeNull();
expect(here()).toEqual({ at: '/apps/crm', state: null });
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
* package list, and the shell's real design-mode controller.
*
* objectstack#36758 — the design mode edits the layout only, so its door reads
* 「Design layout」 (zh 「设计布局」), the bar's own word; 「Edit app」 beside
* 「Design mode」 (zh 「设计模式」), the bar's own word; 「Edit app」 beside
* it opens this app's package in Studio on the app switcher's target and
* posture, and reads 「View in App Studio」 (zh 「在应用搭建中查看」) for an
* installed (read-only) package. Real subject added: the built-in en and
* zh-Hans packs, for the words.
*
* objectstack#36692 — while a dashboard's or a report's own editor is open,
* 「Design layout」 stays drawn and choosing it refuses with the prompt to
* 「Design mode」 stays drawn and choosing it refuses with the prompt to
* save or cancel those changes first; the mode stays off. `sonner`'s toast is
* spied.
*
Expand Down Expand Up @@ -354,14 +354,14 @@ describe('「Add app」 offers 「New blank app」 whatever the catalog serves,
renderMenu('crm');
expect(menu().queryByTestId('sidebar-app-menu-add')).toBeNull();
expect(screen.queryByTestId('add-app-choices')).toBeNull();
// 「Design layout」 and 「Edit app」 read the package list, which has not
// 「Design mode」 and 「Edit app」 read the package list, which has not
// answered on this first frame, so nothing else asks for the separator.
expect(menu().queryByRole('separator')).toBeNull();
expect(screen.getByTestId('sidebar-app-menu').querySelector('hr')).toBeNull();
});
});

describe('「Design layout」 in the app menu enters the design mode (objectstack#36485, objectstack#36758)', () => {
describe('「Design mode」 in the app menu enters the design mode (objectstack#36485, objectstack#36758)', () => {
/** The shell's hold on the mode, as `ConsoleLayout` keeps it, and whether it is on. */
function Shell({ children }: { children: ReactNode }) {
const mode = useDesignModeController({ appName: 'crm', appBasePath: '/apps/crm', enabled: true });
Expand Down Expand Up @@ -392,7 +392,7 @@ describe('「Design layout」 in the app menu enters the design mode (objectstac
await mountMenu();
const item = editApp();
expect(item).not.toBeNull();
expect(item).toHaveTextContent('Design layout');
expect(item).toHaveTextContent('Design mode');
expect(item!.querySelector('svg.lucide-pencil-ruler')).not.toBeNull();
const lastRow = menu().getByTestId('sidebar-app-menu-row-setup');
const add = menu().getByTestId('sidebar-app-menu-add');
Expand Down Expand Up @@ -535,9 +535,9 @@ describe('the words: the door and the bar share one name (objectstack#36758)', (
const EN = builtInLocales.en as unknown as Pack;
const ZH = builtInLocales['zh-Hans'] as unknown as Pack;

it('zh-Hans: 「设计布局」 for the door and the bar, 「编辑应用」 and 「在应用搭建中查看」 for Studio', () => {
expect(ZH.topbar.designLayout).toBe('设计布局');
expect(ZH.designMode.title).toBe('设计布局');
it('zh-Hans: 「设计模式」 for the door and the bar, 「编辑应用」 and 「在应用搭建中查看」 for Studio', () => {
expect(ZH.topbar.designLayout).toBe('设计模式');
expect(ZH.designMode.title).toBe('设计模式');
expect(ZH.topbar.editApp).toBe('编辑应用');
expect(ZH.topbar.viewInStudio).toBe('在应用搭建中查看');
});
Expand All @@ -547,11 +547,11 @@ describe('the words: the door and the bar share one name (objectstack#36758)', (
expect(pack.topbar.designLayout, locale).toBe(pack.designMode.title);
expect(pack.topbar.designLayout, locale).not.toBe(pack.topbar.editApp);
}
expect(EN.designMode.title).toBe('Design layout');
expect(EN.designMode.title).toBe('Design mode');
});
});

describe('「Design layout」 refuses while a dashboard or report editor is open (objectstack#36692)', () => {
describe('「Design mode」 refuses while a dashboard or report editor is open (objectstack#36692)', () => {
/** The shell's hold on the mode, and a page whose own editor can be opened and closed. */
function Shell({ children }: { children: ReactNode }) {
const mode = useDesignModeController({ appName: 'crm', appBasePath: '/apps/crm', enabled: true });
Expand Down Expand Up @@ -599,7 +599,7 @@ describe('「Design layout」 refuses while a dashboard or report editor is open
await act(async () => fireEvent.click(designLayout()!));
expect(screen.getByTestId('mode')).toHaveTextContent('off');
expect(toastError).toHaveBeenCalledTimes(1);
expect(toastError).toHaveBeenCalledWith('Save or cancel your dashboard or report changes before designing the layout.');
expect(toastError).toHaveBeenCalledWith('Save or cancel your dashboard or report changes before entering Design mode.');
});

it('control: the editor closed, choosing it enters the mode and says nothing', async () => {
Expand Down Expand Up @@ -662,7 +662,7 @@ describe('the docs portal\'s head names no app and only switches apps (objectsta
for (const id of ['sidebar-app-menu-design-layout', 'sidebar-app-menu-edit-app', 'sidebar-app-menu-view-in-studio']) {
expect(portalMenu().queryByTestId(id), id).toBeNull();
}
for (const text of ['Design layout', 'Edit app', 'View in App Studio']) expect(portalMenu().queryByText(text)).toBeNull();
for (const text of ['Design mode', 'Edit app', 'View in App Studio']) expect(portalMenu().queryByText(text)).toBeNull();
});

it('control: a member gets the list and no 「Add app」', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* collapsed.
* - The edge is drawn only while the sidebar is hidden, never on a phone.
* - objectstack#36485 — the float carries the app-name menu, and its
* 「Design layout」 enters the design mode from there too.
* 「Design mode」 enters the design mode from there too.
*
* The test DOM computes no Tailwind and no layout, so widths are read as the
* class that sets them; the rendered widths are measured in a browser on the
Expand Down Expand Up @@ -692,7 +692,7 @@ function reloadDocked(width: number) {
return reload(width);
}

describe('the float carries the app menu, and its 「Design layout」 enters the design mode (objectstack#36485, objectstack#36758)', () => {
describe('the float carries the app menu, and its 「Design mode」 enters the design mode (objectstack#36485, objectstack#36758)', () => {
/** The shell's hold on the mode, as `ConsoleLayout` keeps it, and whether it is on. */
function Shell({ children }: { children: React.ReactNode }) {
const mode = useDesignModeController({ appName: 'crm', appBasePath: '/apps/crm', enabled: true });
Expand All @@ -709,7 +709,7 @@ describe('the float carries the app menu, and its 「Design layout」 enters the
vi.unstubAllGlobals();
});

it('collapsed at 1024 px, pressed open from the left edge: the app menu offers 「Design layout」 to an admin who may author, and it turns the mode on', async () => {
it('collapsed at 1024 px, pressed open from the left edge: the app menu offers 「Design mode」 to an admin who may author, and it turns the mode on', async () => {
workspaceAdmin = true;
vi.stubGlobal(
'fetch',
Expand Down Expand Up @@ -750,7 +750,7 @@ describe('the float carries the app menu, and its 「Design layout」 enters the
const menuTrigger = within(panel()).getByTestId('sidebar-app-menu-trigger');
fireEvent.pointerDown(menuTrigger, { button: 0, ctrlKey: false, pointerType: 'mouse' });
const item = await screen.findByTestId('sidebar-app-menu-design-layout');
expect(item).toHaveTextContent('Design layout');
expect(item).toHaveTextContent('Design mode');
expect(screen.getByTestId('mode')).toHaveTextContent('off');
await act(async () => fireEvent.click(item));
expect(screen.getByTestId('mode')).toHaveTextContent('on');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* The shell's design mode (objectstack#36362): the mode and its bar, and the
* extension point other surfaces stage their changes through.
*
* - The bar holds 「Design layout」, 「Cancel」 and 「Save」 and nothing else;
* - The bar holds 「Design mode」, 「Cancel」 and 「Save」 and nothing else;
* 「Save」 is off while nothing is staged.
* - 「Save」 commits every staged change in the order first staged, then
* leaves the mode; a failed commit stops there, keeps it and every later
Expand Down Expand Up @@ -103,13 +103,13 @@ afterEach(() => {
});

describe('the bar (objectstack#36362)', () => {
it('holds 「Design layout」, 「Cancel」 and 「Save」, and nothing else', () => {
it('holds 「Design mode」, 「Cancel」 and 「Save」, and nothing else', () => {
render(<Shell><EnterButton /></Shell>);
expect(bar()).toBeNull();
fireEvent.click(screen.getByText('enter'));

const region = screen.getByRole('region', { name: 'Design layout' });
expect(region).toHaveTextContent(/^Design layoutCancelSave$/);
const region = screen.getByRole('region', { name: 'Design mode' });
expect(region).toHaveTextContent(/^Design modeCancelSave$/);
expect(within(region).getAllByRole('button').map((b) => b.textContent)).toEqual(['Cancel', 'Save']);
expect(within(region).queryAllByRole('link')).toEqual([]);
});
Expand Down Expand Up @@ -266,7 +266,7 @@ describe('leaving with something staged (objectstack#36362)', () => {
inApp.click();
expect(confirmSpy).not.toHaveBeenCalled();
home.click();
expect(confirmSpy).toHaveBeenCalledWith('Leave Design layout? Your unsaved changes will be lost.');
expect(confirmSpy).toHaveBeenCalledWith('Leave Design mode? Your unsaved changes will be lost.');
} finally {
window.removeEventListener('click', stop);
inApp.remove();
Expand Down Expand Up @@ -391,7 +391,7 @@ describe('an editor of its own holds the mode out (objectstack#36692)', () => {
);
}

const PROMPT = 'Save or cancel your dashboard or report changes before designing the layout.';
const PROMPT = 'Save or cancel your dashboard or report changes before entering Design mode.';

it('while an editor is open, entering refuses with the prompt and the mode stays off', () => {
render(<Shell><Door /><Editor name="dashboard" /></Shell>);
Expand Down
Loading
Loading