Skip to content
Merged
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
17 changes: 17 additions & 0 deletions .changeset/37207-desktop-start-page-wording.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
'@object-ui/console': patch
'@object-ui/app-shell': patch
'@object-ui/i18n': patch
---

fix(console): on a desktop the Studio refusal's way home and the AI-unreachable sentence name the app start page

Clause-②: yes (widening) — one new published language-pack key, console.ai.unavailableErrorDesktop, in all eleven packs
Metadata-protocol: none

From 768 px up the platform home page is retired, and the way home opens an app's start page. Two desktop texts still named a home page:

- A caller without Studio access who opens `/studio` sees a refusal with a 「Back to home」 button. On a desktop it now reads 「Back to app start page」 (zh: 返回应用起始页), the app pill's row label, as the console's other way-home buttons do.
- When the AI service cannot be reached, the `/ai` screen's sentence ended 「…try again, or head back home.」 while its button already read 「Back to app start page」. On a desktop the sentence now ends 「…try again, or go back to the app start page.」, in every language.

A phone, whose Home is still its app list, keeps 「Back to home」 and 「…or head back home.」. No targets change. The new sentence is the language-pack key `console.ai.unavailableErrorDesktop`, added in all eleven packs; no key is removed or renamed, and no props or exports change.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
* The `/studio` entry gate used to send a non-holder home with no word of why,
* so a missing capability read exactly like a broken link. It now says, at the
* URL that was opened, that Studio access is needed (`console.studio.accessRequired`),
* with a way home that reuses the app refusal screen's label
* (`empty.appAccessDeniedHome`). `StudioRoute.test.tsx` pins the decision and
* with a way home that reuses the app refusal screen's label on a phone
* (`empty.appAccessDeniedHome`) and the app pill's row label from 768 px up
* (`layout.appSwitcher.backToHome`). `StudioRoute.test.tsx` pins the decision and
* where the way home leads; this file pins the LANGUAGE.
*
* ## Why every pack, and why the expected text is read from the pack
Expand Down Expand Up @@ -93,8 +94,12 @@ const LANGUAGES = Object.keys(builtInLocales) as Language[];

/** The refusal's sentence, as one pack writes it. */
const sentenceIn = (lang: Language) => builtInLocales[lang].console.studio.accessRequired;
/** The refusal's way home, as one pack writes it (the app refusal screen's label). */
const wayHomeIn = (lang: Language) => builtInLocales[lang].empty.appAccessDeniedHome;
/**
* The refusal's way home, as one pack writes it. jsdom's window is 1024 px, a
* desktop, where home is an app's start page: the app pill's row label. A
* phone keeps the app refusal screen's label; `StudioRoute.test.tsx` pins that.
*/
const wayHomeIn = (lang: Language) => builtInLocales[lang].layout.appSwitcher.backToHome;

function LocationProbe() {
const { pathname } = useLocation();
Expand Down
32 changes: 31 additions & 1 deletion ui/apps/console/src/components/StudioRoute.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,10 @@ const pathname = () => screen.getByTestId('pathname').textContent;
* file's pin.
*/
const NOTICE = 'You need Studio access to open Studio. An administrator can grant it with a permission set in Setup → Permission Set Assignment.';
const WAY_HOME = 'Back to home';
/** jsdom's window is 1024 px wide: a desktop, whose way home opens an app's start page. */
const WAY_HOME = 'Back to app start page';
/** A phone's way home, to its app list. */
const PHONE_WAY_HOME = 'Back to home';

/**
* The refusal, said at the URL that was opened: the sentence is on screen, the
Expand Down Expand Up @@ -467,3 +470,30 @@ describe('/studio/* — the states that are not an answer', () => {
expect(screen.queryByText(NOTICE)).not.toBeInTheDocument();
});
});

describe('/studio refused: the way home names where it goes, by viewport', () => {
const desktopWidth = window.innerWidth;
function atWidth(px: number) {
Object.defineProperty(window, 'innerWidth', { configurable: true, writable: true, value: px });
}
afterEach(() => atWidth(desktopWidth));

it('on a desktop, where home is an app\'s start page, it reads as the app pill\'s row does', async () => {
atWidth(1280);
renderStudioDeepLink('/studio/hotcrm/data');

expect(await screen.findByText(NOTICE)).toBeInTheDocument();
expect(screen.getByRole('link', { name: WAY_HOME })).toBeInTheDocument();
expect(screen.queryByRole('link', { name: PHONE_WAY_HOME })).not.toBeInTheDocument();
});

it('CONTROL — on a phone, whose Home is still its app list, it keeps 「Back to home」', async () => {
atWidth(375);
renderStudioDeepLink('/studio/hotcrm/data');

expect(await screen.findByText(NOTICE)).toBeInTheDocument();
expect(screen.getByRole('link', { name: PHONE_WAY_HOME })).toBeInTheDocument();
expect(screen.queryByRole('link', { name: WAY_HOME })).not.toBeInTheDocument();
expect(designSurface).not.toHaveBeenCalled();
});
});
12 changes: 10 additions & 2 deletions ui/apps/console/src/components/StudioRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import {
studioMetadataAreaPath,
studioPackagePath,
useHomePath,
usePhoneViewport,
useRecentItems,
useStudioEntryPermissions,
} from '@object-ui/app-shell';
Expand Down Expand Up @@ -91,10 +92,13 @@ const StudioEntryRedirect = lazy(() =>
* (`empty.appAccessDenied`): said in place, as the permanent decision it is, so
* no Retry; and the URL stays, so the caller can send it to an administrator
* and reload once access is granted. No header frames this screen, so the way
* home is its own button, as there, and it reuses that screen's label.
* home is its own button, as there, and it reuses that screen's labels.
*/
function StudioAccessRequired({ home }: { home: string }) {
const { t } = useObjectTranslation();
// A phone's Home is its app list; from 768 px up `home` opens an app's start
// page, so the button says so, as the shell's other way-home buttons do.
const phone = usePhoneViewport();
return (
<div className="flex h-screen items-center justify-center p-4">
<Empty data-testid="studio-access-required">
Expand All @@ -108,7 +112,11 @@ function StudioAccessRequired({ home }: { home: string }) {
</EmptyTitle>
<div className="mt-4">
<Button asChild>
<Link to={home}>{t('empty.appAccessDeniedHome', { defaultValue: 'Back to home' })}</Link>
<Link to={home}>
{phone
? t('empty.appAccessDeniedHome', { defaultValue: 'Back to home' })
: t('layout.appSwitcher.backToHome', { defaultValue: 'Back to app start page' })}
</Link>
</Button>
</div>
</Empty>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import userEvent from '@testing-library/user-event';
import { MemoryRouter, Routes, Route } from 'react-router-dom';
import { MetadataCtx, type MetadataContextValue } from '@object-ui/react';
import { RequireAiSurface } from '../ConsoleShell';
import { AiUnavailable } from '../ai/AiUnavailable';
import { useAiSurfaceEnabled } from '../../hooks/useAiSurface';

// The guard gates purely on the AI-surface signal (the agent catalog); that
Expand Down Expand Up @@ -216,3 +217,37 @@ describe('the no-assistant screen\'s way home names where it goes, by viewport (
expect(home).not.toHaveTextContent('«layout.appSwitcher.backToHome»');
});
});

describe('the unreachable-service sentence names where its way home goes, by viewport', () => {
// `AiChatPage` draws this shape when the agent catalog fails to load: the
// sentence points at the button below it, so it names the same place.
const echo = (key: string) => `«${key}»`;
function renderUnreachable() {
return render(
<MemoryRouter>
<AiUnavailable hasError onRetry={() => {}} onHome={() => {}} t={echo} />
</MemoryRouter>,
);
}

beforeEach(() => {
viewer.phone = false;
});

it('on a desktop, where the button opens an app\'s start page, the sentence says so', () => {
renderUnreachable();
const screenEl = screen.getByTestId('ai-unavailable');
expect(screenEl).toHaveTextContent('«console.ai.unavailableErrorDesktop»');
expect(screenEl).not.toHaveTextContent('«console.ai.unavailableError»');
expect(screen.getByTestId('ai-unavailable-home')).toHaveTextContent('«layout.appSwitcher.backToHome»');
});

it('CONTROL — on a phone, whose Home is still its app list, it keeps 「head back home」', () => {
viewer.phone = true;
renderUnreachable();
const screenEl = screen.getByTestId('ai-unavailable');
expect(screenEl).toHaveTextContent('«console.ai.unavailableError»');
expect(screenEl).not.toHaveTextContent('«console.ai.unavailableErrorDesktop»');
expect(screen.getByTestId('ai-unavailable-home')).toHaveTextContent('«console.ai.unavailableHome»');
});
});
14 changes: 10 additions & 4 deletions ui/packages/app-shell/src/console/ai/AiUnavailable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export function AiUnavailable({
// The way home names where it goes: a phone's Home is its app list; from
// 768 px up the home page is retired (objectstack#36732) and `onHome` opens
// an app's start page, named in the app pill's words (objectstack#37163).
// The error sentence that points at that button says the same on each side.
const phone = usePhoneViewport();
return (
<div className="flex flex-1 items-center justify-center p-6" data-testid="ai-unavailable">
Expand All @@ -59,10 +60,15 @@ export function AiUnavailable({
</EmptyTitle>
<EmptyDescription>
{hasError
? t('console.ai.unavailableError', {
defaultValue:
"Couldn't reach the AI service. It may be temporarily offline — try again, or head back home.",
})
? phone
? t('console.ai.unavailableError', {
defaultValue:
"Couldn't reach the AI service. It may be temporarily offline — try again, or head back home.",
})
: t('console.ai.unavailableErrorDesktop', {
defaultValue:
"Couldn't reach the AI service. It may be temporarily offline — try again, or go back to the app start page.",
})
: t('console.ai.unavailableDescription', {
defaultValue:
"This deployment doesn't have an AI assistant enabled. Everything else works as usual.",
Expand Down
1 change: 1 addition & 0 deletions ui/packages/i18n/src/locales/ar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2785,6 +2785,7 @@ const ar = {
unavailableTitle: "مساعد الذكاء الاصطناعي غير متاح",
unavailableDescription: "لم يتم تمكين مساعد الذكاء الاصطناعي في هذا النشر. وكل شيء آخر يعمل كالمعتاد.",
unavailableError: "تعذّر الوصول إلى خدمة الذكاء الاصطناعي. قد تكون غير متصلة مؤقتًا — أعد المحاولة أو عد إلى الرئيسية.",
unavailableErrorDesktop: "تعذّر الوصول إلى خدمة الذكاء الاصطناعي. قد تكون غير متصلة مؤقتًا — أعد المحاولة أو عد إلى صفحة بدء التطبيق.",
unavailableRetry: "إعادة المحاولة",
unavailableHome: "العودة إلى الرئيسية",
dock: {
Expand Down
1 change: 1 addition & 0 deletions ui/packages/i18n/src/locales/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2505,6 +2505,7 @@ const de = {
unavailableTitle: "KI-Assistent nicht verfügbar",
unavailableDescription: "In dieser Bereitstellung ist kein KI-Assistent aktiviert. Alles andere funktioniert wie gewohnt.",
unavailableError: "Der KI-Dienst war nicht erreichbar. Er ist möglicherweise vorübergehend offline — versuchen Sie es erneut, oder kehren Sie zur Startseite zurück.",
unavailableErrorDesktop: "Der KI-Dienst war nicht erreichbar. Er ist möglicherweise vorübergehend offline — versuchen Sie es erneut, oder kehren Sie zur Startseite der App zurück.",
unavailableRetry: "Erneut versuchen",
unavailableHome: "Zurück zur Startseite",
dock: {
Expand Down
1 change: 1 addition & 0 deletions ui/packages/i18n/src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3372,6 +3372,7 @@ const en = {
unavailableTitle: 'AI assistant unavailable',
unavailableDescription: "This deployment doesn't have an AI assistant enabled. Everything else works as usual.",
unavailableError: "Couldn't reach the AI service. It may be temporarily offline — try again, or head back home.",
unavailableErrorDesktop: "Couldn't reach the AI service. It may be temporarily offline — try again, or go back to the app start page.",
unavailableRetry: 'Try again',
unavailableHome: 'Back to home',
dock: {
Expand Down
1 change: 1 addition & 0 deletions ui/packages/i18n/src/locales/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2577,6 +2577,7 @@ const es = {
unavailableTitle: "Asistente de IA no disponible",
unavailableDescription: "Esta implementación no tiene habilitado un asistente de IA. Todo lo demás funciona con normalidad.",
unavailableError: "No se pudo contactar con el servicio de IA. Puede estar temporalmente sin conexión — reinténtelo o vuelva al inicio.",
unavailableErrorDesktop: "No se pudo contactar con el servicio de IA. Puede estar temporalmente sin conexión — reinténtelo o vuelva a la página inicial de la app.",
unavailableRetry: "Reintentar",
unavailableHome: "Volver al inicio",
dock: {
Expand Down
1 change: 1 addition & 0 deletions ui/packages/i18n/src/locales/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2573,6 +2573,7 @@ const fr = {
unavailableTitle: "Assistant IA non disponible",
unavailableDescription: "Cette instance n'a pas d'assistant IA activé. Tout le reste fonctionne normalement.",
unavailableError: "Impossible de joindre le service IA. Il est peut-être temporairement hors ligne — réessayez, ou retournez à l'accueil.",
unavailableErrorDesktop: "Impossible de joindre le service IA. Il est peut-être temporairement hors ligne — réessayez, ou retournez à la page de démarrage de l'app.",
unavailableRetry: "Réessayer",
unavailableHome: "Retour à l'accueil",
dock: {
Expand Down
1 change: 1 addition & 0 deletions ui/packages/i18n/src/locales/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2507,6 +2507,7 @@ const ja = {
unavailableTitle: "AI アシスタントを利用できません",
unavailableDescription: "このデプロイでは AI アシスタントが有効になっていません。それ以外の機能は通常どおり動作します。",
unavailableError: "AI サービスに接続できませんでした。一時的にオフラインの可能性があります — 再試行するか、ホームに戻ってください。",
unavailableErrorDesktop: "AI サービスに接続できませんでした。一時的にオフラインの可能性があります — 再試行するか、アプリのスタートページに戻ってください。",
unavailableRetry: "再試行",
unavailableHome: "ホームに戻る",
dock: {
Expand Down
1 change: 1 addition & 0 deletions ui/packages/i18n/src/locales/ko.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2505,6 +2505,7 @@ const ko = {
unavailableTitle: "AI 어시스턴트를 사용할 수 없습니다",
unavailableDescription: "이 배포에는 AI 어시스턴트가 활성화되어 있지 않습니다. 나머지 기능은 정상적으로 작동합니다.",
unavailableError: "AI 서비스에 연결할 수 없습니다. 일시적으로 오프라인일 수 있습니다 — 다시 시도하거나 홈으로 돌아가세요.",
unavailableErrorDesktop: "AI 서비스에 연결할 수 없습니다. 일시적으로 오프라인일 수 있습니다 — 다시 시도하거나 앱 시작 페이지로 돌아가세요.",
unavailableRetry: "다시 시도",
unavailableHome: "홈으로 돌아가기",
dock: {
Expand Down
1 change: 1 addition & 0 deletions ui/packages/i18n/src/locales/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2572,6 +2572,7 @@ const pt = {
unavailableTitle: "Assistente de IA indisponível",
unavailableDescription: "Esta implantação não tem um assistente de IA habilitado. Todo o resto funciona normalmente.",
unavailableError: "Não foi possível acessar o serviço de IA. Ele pode estar temporariamente off-line — tente novamente ou volte ao início.",
unavailableErrorDesktop: "Não foi possível acessar o serviço de IA. Ele pode estar temporariamente off-line — tente novamente ou volte à página inicial do app.",
unavailableRetry: "Tentar novamente",
unavailableHome: "Voltar ao início",
dock: {
Expand Down
1 change: 1 addition & 0 deletions ui/packages/i18n/src/locales/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2651,6 +2651,7 @@ const ru = {
unavailableTitle: "Ассистент ИИ недоступен",
unavailableDescription: "В этой среде ассистент ИИ не включён. Всё остальное работает как обычно.",
unavailableError: "Не удалось связаться с сервисом ИИ. Возможно, он временно недоступен — повторите попытку или вернитесь на главную.",
unavailableErrorDesktop: "Не удалось связаться с сервисом ИИ. Возможно, он временно недоступен — повторите попытку или вернитесь на стартовую страницу приложения.",
unavailableRetry: "Повторить",
unavailableHome: "На главную",
dock: {
Expand Down
1 change: 1 addition & 0 deletions ui/packages/i18n/src/locales/zh-Hans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2863,6 +2863,7 @@ const zh = {
unavailableTitle: 'AI 助手不可用',
unavailableDescription: '当前部署未启用 AI 助手。其他功能一切正常。',
unavailableError: '无法连接 AI 服务。它可能暂时离线 — 请重试,或返回首页。',
unavailableErrorDesktop: '无法连接 AI 服务。它可能暂时离线 — 请重试,或返回应用起始页。',
unavailableRetry: '重试',
unavailableHome: '返回首页',
dock: {
Expand Down
1 change: 1 addition & 0 deletions ui/packages/i18n/src/locales/zh-Hant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2863,6 +2863,7 @@ const zhHant = {
unavailableTitle: 'AI 助手不可用',
unavailableDescription: '當前部署未啟用 AI 助手。其他功能一切正常。',
unavailableError: '無法連線 AI 服務。它可能暫時離線 — 請重試,或返回首頁。',
unavailableErrorDesktop: '無法連線 AI 服務。它可能暫時離線 — 請重試,或返回應用起始頁。',
unavailableRetry: '重試',
unavailableHome: '返回首頁',
dock: {
Expand Down
Loading