diff --git a/client/scripts/feature-pairs.json b/client/scripts/feature-pairs.json index 07c7d4401..2eb12b804 100644 --- a/client/scripts/feature-pairs.json +++ b/client/scripts/feature-pairs.json @@ -661,6 +661,22 @@ "desktop": ["src/components/Roadtrip/RoadtripStayModal.tsx"], "mobile": ["src/mobile/screens/trip/roadtrip/MRtStaySheet.tsx"] }, + { + "feature": "Settings / Demo account locks", + "hooks": ["src/components/Demo/useDemoLock.ts"], + "desktop": [ + "src/components/Settings/AccountTab.tsx", + "src/components/Settings/DisplaySettingsTab.tsx", + "src/components/Settings/IntegrationsTab.tsx", + "src/components/Settings/ai/AiConnectionSection.tsx" + ], + "mobile": [ + "src/mobile/screens/settings/MAiConnectionSection.tsx", + "src/mobile/screens/settings/MSettingsAccount.tsx", + "src/mobile/screens/settings/MSettingsGeneral.tsx", + "src/mobile/screens/settings/MSettingsMcp.tsx" + ] + }, { "feature": "Settings / Account", "hooks": ["src/components/Settings/useAccountSettings.ts"], diff --git a/client/scripts/theme-baseline.json b/client/scripts/theme-baseline.json index 641c00f88..3060f905a 100644 --- a/client/scripts/theme-baseline.json +++ b/client/scripts/theme-baseline.json @@ -206,7 +206,7 @@ "mobile/screens/settings/MSetPickerSheet.tsx": 2, "mobile/screens/settings/MSettings.tsx": 2, "mobile/screens/settings/MSettingsAbout.tsx": 5, - "mobile/screens/settings/MSettingsAccount.tsx": 21, + "mobile/screens/settings/MSettingsAccount.tsx": 20, "mobile/screens/settings/MSettingsAppearance.tsx": 12, "mobile/screens/settings/MSettingsMap.tsx": 5, "mobile/screens/settings/MSettingsMcp.tsx": 30, diff --git a/client/src/components/Demo/DemoLock.test.tsx b/client/src/components/Demo/DemoLock.test.tsx new file mode 100644 index 000000000..212a3056d --- /dev/null +++ b/client/src/components/Demo/DemoLock.test.tsx @@ -0,0 +1,48 @@ +import { describe, expect, it } from 'vitest'; +import { render, screen } from '../../../tests/helpers/render'; +import DemoLock from './DemoLock'; + +describe('DemoLock', () => { + it('FE-COMP-DEMOLOCK-001: unlocked, the section is the section and nothing more', () => { + const { container } = render( + + + + ); + expect(screen.getByRole('button', { name: 'Create key' })).toBeEnabled(); + expect(screen.queryByRole('note')).not.toBeInTheDocument(); + expect(container.querySelector('[data-demo-lock]')).toBeNull(); + }); + + it('FE-COMP-DEMOLOCK-002: locked, the section stays visible but out of reach, under the badge and the reason', () => { + const { container } = render( + + + + ); + const note = screen.getByRole('note'); + expect(note).toHaveTextContent('Demo mode'); + expect(note).toHaveTextContent('API keys cannot be created in the demo.'); + expect(screen.queryByRole('button', { name: 'Create key' })).not.toBeInTheDocument(); + const veiled = container.querySelector('[data-demo-lock] > [inert]'); + expect(veiled).toHaveAttribute('aria-hidden', 'true'); + expect(veiled).toContainElement(screen.getByRole('button', { hidden: true, name: 'Create key' })); + expect(note.getAttribute('style')).toContain('repeating-linear-gradient'); + expect(note.getAttribute('style')).toContain('var(--text-primary)'); + }); + + it('FE-COMP-DEMOLOCK-003: a single row puts the note in its middle, a section at its top', () => { + const { rerender } = render( + + row + + ); + expect(screen.getByRole('note').className).toContain('items-center'); + rerender( + + section + + ); + expect(screen.getByRole('note').className).toContain('items-start'); + }); +}); diff --git a/client/src/components/Demo/DemoLock.tsx b/client/src/components/Demo/DemoLock.tsx new file mode 100644 index 000000000..fedf21f12 --- /dev/null +++ b/client/src/components/Demo/DemoLock.tsx @@ -0,0 +1,57 @@ +import { Lock } from 'lucide-react'; +import type { ReactNode } from 'react'; +import { useTranslation } from '../../i18n'; +import { fs } from '../shared/DialogShell'; + +interface DemoLockProps { + /** From useDemoAccountLock: false renders the children untouched. */ + locked: boolean; + /** One line saying what the demo does not allow here. */ + reason: string; + children: ReactNode; + /** `row` for a single settings row: the note sits in the middle instead of at the top. */ + size?: 'section' | 'row'; + className?: string; +} + +/** Thin diagonal stripes in the theme's own ink, so they read in light and dark alike. */ +const STRIPES = + 'repeating-linear-gradient(135deg, color-mix(in srgb, var(--text-primary) 8%, transparent) 0 9px, transparent 9px 18px)'; + +/** + * A section the shared demo account may look at but not change: dimmed, + * out of reach for pointer and keyboard, under a striped veil that carries a + * small "Demo mode" badge and the reason. Used on the desktop settings and on + * the phone screens alike. + */ +export default function DemoLock({ locked, reason, children, size = 'section', className = '' }: DemoLockProps) { + const { t } = useTranslation(); + if (!locked) return <>{children}; + return ( +
+ +
+
+ + + {t('demo.lock.badge')} + + + {reason} + +
+
+
+ ); +} diff --git a/client/src/components/Demo/useDemoLock.test.ts b/client/src/components/Demo/useDemoLock.test.ts new file mode 100644 index 000000000..b760f7eb4 --- /dev/null +++ b/client/src/components/Demo/useDemoLock.test.ts @@ -0,0 +1,35 @@ +import { renderHook } from '@testing-library/react'; +import { beforeEach, describe, expect, it } from 'vitest'; +import { buildUser } from '../../../tests/helpers/factories'; +import { resetAllStores, seedStore } from '../../../tests/helpers/store'; +import { useAuthStore } from '../../store/authStore'; +import { useDemoAccountLock } from './useDemoLock'; + +beforeEach(() => resetAllStores()); + +describe('useDemoAccountLock', () => { + it('FE-HOOK-DEMOLOCK-001: locks the demo account on a demo instance', () => { + seedStore(useAuthStore, { demoMode: true, user: buildUser({ email: 'demo@trek.app' }) }); + expect(renderHook(() => useDemoAccountLock()).result.current).toBe(true); + }); + + it('FE-HOOK-DEMOLOCK-002: knows the address the demo account had before the rename', () => { + seedStore(useAuthStore, { demoMode: true, user: buildUser({ email: 'demo@nomad.app' }) }); + expect(renderHook(() => useDemoAccountLock()).result.current).toBe(true); + }); + + it('FE-HOOK-DEMOLOCK-003: leaves the admin of a demo instance alone', () => { + seedStore(useAuthStore, { demoMode: true, user: buildUser({ email: 'admin@trek.app', role: 'admin' }) }); + expect(renderHook(() => useDemoAccountLock()).result.current).toBe(false); + }); + + it('FE-HOOK-DEMOLOCK-004: leaves the demo address alone on an instance that is not a demo', () => { + seedStore(useAuthStore, { demoMode: false, user: buildUser({ email: 'demo@trek.app' }) }); + expect(renderHook(() => useDemoAccountLock()).result.current).toBe(false); + }); + + it('FE-HOOK-DEMOLOCK-005: is off while nobody is signed in', () => { + seedStore(useAuthStore, { demoMode: true, user: null }); + expect(renderHook(() => useDemoAccountLock()).result.current).toBe(false); + }); +}); diff --git a/client/src/components/Demo/useDemoLock.ts b/client/src/components/Demo/useDemoLock.ts new file mode 100644 index 000000000..ce2583bf3 --- /dev/null +++ b/client/src/components/Demo/useDemoLock.ts @@ -0,0 +1,16 @@ +import { isDemoAccountEmail } from '@trek/shared'; +import { useAuthStore } from '../../store/authStore'; + +/** + * Whether the account signed in here is the shared demo account of a demo + * instance. Every visitor signs in as that one account, so its Account tab, + * API keys, MCP configuration, own AI connection and language sit under a + * DemoLock; the server refuses the same writes (`demo-write.ts`). The admin + * of a demo instance, and every account of a real one, see the sections as + * they are. + */ +export function useDemoAccountLock(): boolean { + const demoMode = useAuthStore((s) => s.demoMode); + const email = useAuthStore((s) => s.user?.email); + return demoMode && isDemoAccountEmail(email); +} diff --git a/client/src/components/Settings/AccountTab.test.tsx b/client/src/components/Settings/AccountTab.test.tsx index 8bd5d180a..d079124d6 100644 --- a/client/src/components/Settings/AccountTab.test.tsx +++ b/client/src/components/Settings/AccountTab.test.tsx @@ -395,10 +395,20 @@ describe('AccountTab – MFA', () => { expect(screen.getByText(/requires two-factor authentication/i)).toBeInTheDocument(); }); - it('FE-COMP-ACCOUNT-036: MFA section shows demoBlocked message in demo mode', () => { - seedStore(useAuthStore, { demoMode: true }); + it('FE-COMP-ACCOUNT-036: the shared demo account sees the whole tab under the demo lock', () => { + seedStore(useAuthStore, { demoMode: true, user: buildUser({ email: 'demo@trek.app', mfa_enabled: false }) }); + const { container } = render(); + expect(screen.getByRole('note')).toHaveTextContent('The shared demo account cannot be changed.'); + expect(container.querySelector('[data-demo-lock] [inert]')).toContainElement( + screen.getByRole('button', { hidden: true, name: /Set up authenticator/ }), + ); + }); + + it('FE-COMP-ACCOUNT-036b: the admin of a demo instance keeps the tab unlocked, 2FA included', () => { + seedStore(useAuthStore, { demoMode: true, user: buildUser({ email: 'admin@trek.app', role: 'admin', mfa_enabled: false }) }); render(); - expect(screen.getByText('Not available in demo mode')).toBeInTheDocument(); + expect(screen.queryByRole('note')).not.toBeInTheDocument(); + expect(screen.getByRole('button', { name: /Set up authenticator/ })).toBeInTheDocument(); }); }); diff --git a/client/src/components/Settings/AccountTab.tsx b/client/src/components/Settings/AccountTab.tsx index 83c40103c..0089d8050 100644 --- a/client/src/components/Settings/AccountTab.tsx +++ b/client/src/components/Settings/AccountTab.tsx @@ -12,6 +12,8 @@ import { SETTINGS_BUTTON, SETTINGS_BUTTON_DANGER, SETTINGS_BUTTON_PRIMARY, SettingRow, SettingRows, SettingsHint, StatusPill, } from './settingsKit' import { stripTrailingSlashes, useAccountSettings } from './useAccountSettings' +import DemoLock from '../Demo/DemoLock' +import { useDemoAccountLock } from '../Demo/useDemoLock' /** The small turning ring a button shows while its request is on the way. */ const SPINNER = 'h-3.5 w-3.5 flex-none animate-spin rounded-full border-2 border-current border-t-transparent' @@ -22,6 +24,7 @@ const EYEBROW = 'm-0 font-geist font-bold uppercase tracking-[.08em] text-conten export default function AccountTab(): React.ReactElement { const { t } = useTranslation() const blockedLabelId = useId() + const demoLocked = useDemoAccountLock() const { user, demoMode, @@ -71,6 +74,8 @@ export default function AccountTab(): React.ReactElement { return ( <> + {/* The shared demo account: everything here is shown, nothing can be changed. */} +
{/* Who is signed in: the picture with its two actions, the role and the SSO link. */}
@@ -221,10 +226,7 @@ export default function AccountTab(): React.ReactElement {
)} {t('settings.mfa.description')} - {demoMode ? ( -

{t('settings.mfa.demoBlocked')}

- ) : ( - <> + <> )} - - )} +
{/* Passkeys */} +
{/* Delete Account Blocked */} { expect(await screen.findByText('Save failed')).toBeInTheDocument(); }); }); + +describe('DisplaySettingsTab – the demo account', () => { + it('FE-COMP-DISPLAY-DEMO-001: the shared demo account sees English under the demo lock', () => { + seedStore(useAuthStore, { user: buildUser({ email: 'demo@trek.app' }), isAuthenticated: true, demoMode: true }); + seedStore(useSettingsStore, { settings: buildSettings({ language: 'en' }), isLoaded: true }); + render(); + expect(screen.getByRole('note')).toHaveTextContent('The demo always runs in English.'); + }); + + it('FE-COMP-DISPLAY-DEMO-002: any other account of a demo instance picks its language freely', () => { + seedStore(useAuthStore, { user: buildUser({ email: 'admin@trek.app' }), isAuthenticated: true, demoMode: true }); + render(); + expect(screen.queryByRole('note')).not.toBeInTheDocument(); + }); +}); diff --git a/client/src/components/Settings/DisplaySettingsTab.tsx b/client/src/components/Settings/DisplaySettingsTab.tsx index aea8f97bf..8a97f0d9e 100644 --- a/client/src/components/Settings/DisplaySettingsTab.tsx +++ b/client/src/components/Settings/DisplaySettingsTab.tsx @@ -18,6 +18,8 @@ import { DEFAULT_START_PAGE, DEFAULT_START_TRIP_TAB } from '../../utils/startDes import type { DistanceUnit } from '../../types' import { DEFAULT_WEEK_START } from '@trek/shared' import { weekStartOptions } from '../../utils/calendarWeek' +import DemoLock from '../Demo/DemoLock' +import { useDemoAccountLock } from '../Demo/useDemoLock' /** A select on the right of a row: wide enough for a currency or a weekday, never wider than the row. */ const SELECT_BOX = 'w-[260px] max-w-full' @@ -25,6 +27,7 @@ const SELECT_BOX = 'w-[260px] max-w-full' export default function DisplaySettingsTab(): React.ReactElement { const { settings, save } = useSettingSaver() const { t, locale } = useTranslation() + const demoLocked = useDemoAccountLock() const [tempUnit, setTempUnit] = useState(settings.temperature_unit || DEFAULT_SETTINGS.temperature_unit) const [distanceUnit, setDistanceUnit] = useState(settings.distance_unit || DEFAULT_SETTINGS.distance_unit) const [langOpen, setLangOpen] = useState(false) @@ -123,7 +126,9 @@ export default function DisplaySettingsTab(): React.ReactElement { } /> - {/* Language: every option at a glance on a wide window, a compact list on a narrow one */} + {/* Language: every option at a glance on a wide window, a compact list on a narrow one. + The shared demo account always runs in English. */} +
+ {/* Place names (#1799): searches can answer in another language than the app. */} {/* Immich, Synology Photos and AirTrail all connect to a server the reader @@ -42,9 +45,15 @@ export default function IntegrationsTab(): React.ReactElement { {S.llmEnabled && S.ownParsing && !managed && } {/* Above MCP on purpose: an API key needs no addon, and someone looking for one should not have to read past a section about AI assistants. */} - + + + {/* TREK inside Claude rides on the MCP server, so it follows that addon. */} - {S.mcpEnabled && } + {S.mcpEnabled && ( + + + + )} diff --git a/client/src/components/Settings/ai/AiConnectionSection.test.tsx b/client/src/components/Settings/ai/AiConnectionSection.test.tsx index 7784da8b5..22e829ae8 100644 --- a/client/src/components/Settings/ai/AiConnectionSection.test.tsx +++ b/client/src/components/Settings/ai/AiConnectionSection.test.tsx @@ -140,4 +140,13 @@ describe('AiConnectionSection', () => { const { container } = render(); await waitFor(() => expect(container).toBeEmptyDOMElement()); }); + + it('FE-COMP-AI-CONNECTION-008: the shared demo account sees its own connection locked, and no admin hint', async () => { + seedStore(useAuthStore, { user: buildUser({ email: 'demo@trek.app' }), isAuthenticated: true, demoMode: true }); + repo.status.mockResolvedValue(status({ canConnectOwn: false })); + render(); + expect(await screen.findByRole('note')).toHaveTextContent('Your own AI connection cannot be added in the demo.'); + expect(screen.queryByText('Your admin sets this up.')).not.toBeInTheDocument(); + expect(screen.getByRole('button', { hidden: true, name: 'Connect your own provider' })).toBeDisabled(); + }); }); diff --git a/client/src/components/Settings/ai/AiConnectionSection.tsx b/client/src/components/Settings/ai/AiConnectionSection.tsx index c346a684b..290c416c4 100644 --- a/client/src/components/Settings/ai/AiConnectionSection.tsx +++ b/client/src/components/Settings/ai/AiConnectionSection.tsx @@ -3,6 +3,8 @@ import { Loader2, LogOut, MessageCircle, Sparkles, Unplug } from 'lucide-react'; import React from 'react'; import { useTranslation } from '../../../i18n'; import { useAssistantCostEstimates, useAssistantMapFollow } from '../../Assistant/useAssistantMapFollow'; +import DemoLock from '../../Demo/DemoLock'; +import { useDemoAccountLock } from '../../Demo/useDemoLock'; import ConfirmDialog from '../../shared/ConfirmDialog'; import CustomSelect from '../../shared/CustomSelect'; import { fs } from '../../shared/DialogShell'; @@ -202,6 +204,25 @@ function AssistantBehaviour() { ); } +/** Where the shared demo account would connect a provider of its own: shown, and locked. */ +function LockedOwnConnection() { + const { t } = useTranslation(); + return ( + + + + {t('assistant.errorAction.connectOwn')} + + } + /> + + + ); +} + /** The connect panel, opened on purpose or because nothing is connected yet. */ function ConnectPanel({ S }: { S: AiConnections }) { const { t } = useTranslation(); @@ -254,6 +275,7 @@ export default function AiConnectionSection({ }): React.ReactElement | null { const { t } = useTranslation(); const S = useAiConnections(); + const demoLocked = useDemoAccountLock(); const text = aiSectionText(assistant, parsing); if (S.view === 'hidden') return null; const own = S.own; @@ -277,7 +299,8 @@ export default function AiConnectionSection({ {S.view === 'own' && own && } {S.view === 'instance' && } {assistant && (S.view === 'own' || S.view === 'instance') && } - {S.view === 'adminOnly' && {t('assistant.setup.adminOnly')}} + {S.view === 'adminOnly' && !demoLocked && {t('assistant.setup.adminOnly')}} + {demoLocked && S.view !== 'loading' && } {S.panel && } diff --git a/client/src/mobile/screens/settings/MAiConnectionSection.test.tsx b/client/src/mobile/screens/settings/MAiConnectionSection.test.tsx index 8e48e575d..e9a1e0281 100644 --- a/client/src/mobile/screens/settings/MAiConnectionSection.test.tsx +++ b/client/src/mobile/screens/settings/MAiConnectionSection.test.tsx @@ -2,8 +2,11 @@ import userEvent from '@testing-library/user-event'; import type { AiConnectionView, AiStatusResponse } from '@trek/shared'; import { beforeEach, describe, expect, it, vi } from 'vitest'; +import { buildUser } from '../../../../tests/helpers/factories'; import { render, screen, waitFor } from '../../../../tests/helpers/render'; +import { seedStore } from '../../../../tests/helpers/store'; import { useAssistantStore } from '../../../store/assistantStore'; +import { useAuthStore } from '../../../store/authStore'; const repo = vi.hoisted(() => ({ status: vi.fn(), @@ -83,4 +86,20 @@ describe('MAiConnectionSection', () => { expect(await screen.findByText('What would you like to chat with?')).toBeInTheDocument(); expect(screen.getByRole('button', { name: /Paste an API key/ })).toBeInTheDocument(); }); + + it('FE-MOB-AI-DEMO-001: the shared demo account sees the place for its own connection locked', async () => { + seedStore(useAuthStore, { user: buildUser({ email: 'demo@trek.app' }), isAuthenticated: true, demoMode: true }); + repo.status.mockResolvedValue(status({ canConnectOwn: false })); + render(); + expect(await screen.findByRole('note')).toHaveTextContent('Your own AI connection cannot be added in the demo.'); + expect(screen.queryByText('Your admin sets this up.')).not.toBeInTheDocument(); + }); + + it('FE-MOB-AI-DEMO-002: any other account keeps the admin hint', async () => { + seedStore(useAuthStore, { user: buildUser({ email: 'admin@trek.app' }), isAuthenticated: true, demoMode: true }); + repo.status.mockResolvedValue(status({ canConnectOwn: false })); + render(); + expect(await screen.findByText('Your admin sets this up.')).toBeInTheDocument(); + expect(screen.queryByRole('note')).not.toBeInTheDocument(); + }); }); diff --git a/client/src/mobile/screens/settings/MAiConnectionSection.tsx b/client/src/mobile/screens/settings/MAiConnectionSection.tsx index 7d946452c..0e4475cbd 100644 --- a/client/src/mobile/screens/settings/MAiConnectionSection.tsx +++ b/client/src/mobile/screens/settings/MAiConnectionSection.tsx @@ -2,6 +2,8 @@ import type { AiConnectionView } from '@trek/shared'; import { ChevronDown, Loader2, LogOut, MessageCircle, Sparkles, Unplug } from 'lucide-react'; import React, { useState } from 'react'; import { useAssistantCostEstimates, useAssistantMapFollow } from '../../../components/Assistant/useAssistantMapFollow'; +import DemoLock from '../../../components/Demo/DemoLock'; +import { useDemoAccountLock } from '../../../components/Demo/useDemoLock'; import AiConnectPanel from '../../../components/Settings/ai/AiConnectPanel'; import { aiSectionText, CONNECTION_STATUS } from '../../../components/Settings/ai/aiConnectModel'; import { useAiConnections } from '../../../components/Settings/ai/useAiConnections'; @@ -117,6 +119,30 @@ function MInstanceConnection({ S }: { S: AiConnections }) { ); } +/** + * Under the connection: the hint that only the admin connects one, or, for the + * shared demo account, the locked place where its own would go. + */ +function MOwnConnectionNote({ view }: { view: AiConnections['view'] }) { + const { t } = useTranslation(); + const demoLocked = useDemoAccountLock(); + if (view === 'loading') return null; + if (!demoLocked) return view === 'adminOnly' ? {t('assistant.setup.adminOnly')} : null; + return ( + + + {t('assistant.errorAction.connectOwn')} + + } + /> + + ); +} + /** Whether the trip map follows the assistant, the phone's row for the shared switch. */ function MAssistantBehaviour() { const { t } = useTranslation(); @@ -180,7 +206,7 @@ export default function MAiConnectionSection({ {S.view === 'own' && S.own && } {S.view === 'instance' && } {assistant && (S.view === 'own' || S.view === 'instance') && } - {S.view === 'adminOnly' && {t('assistant.setup.adminOnly')}} + {S.panel && (
+ {/* The shared demo account: everything here is shown, nothing can be changed. */} + {/* ── Profile ─────────────────────────────────────────────── */}
@@ -185,10 +190,7 @@ export default function MSettingsAccount() { )}

{t('settings.mfa.description')}

- {demoMode ? ( -

{t('settings.mfa.demoBlocked')}

- ) : ( - <> + <>

{user?.mfa_enabled ? t('settings.mfa.enabled') : t('settings.mfa.disabled')}

@@ -287,11 +289,11 @@ export default function MSettingsAccount() {
)} - - )} + + {t('settings.currency')} setCurrencyOpen(true)} /> - {t('settings.language')} - setLangOpen(true)} /> + {/* The shared demo account always runs in English. */} + + {t('settings.language')} + setLangOpen(true)} /> + {t('settings.temperature')} void }) { return ( @@ -37,6 +39,7 @@ function CodeBlock({ children }: { children: string }) { */ export default function MSettingsMcp() { const { t, locale } = useTranslation() + const demoLocked = useDemoAccountLock() const { activeMcpTab: activeTab, setActiveMcpTab: setActiveTab, @@ -119,6 +122,7 @@ export default function MSettingsMcp() { ) return ( + {t('settings.mcp.endpoint')}
@@ -518,5 +522,6 @@ export default function MSettingsMcp() { onConfirm={() => tokenDeleteId !== null && deleteToken(tokenDeleteId)} /> + ) } diff --git a/client/tests/unit/mobile/settings/MSettingsAccount.test.tsx b/client/tests/unit/mobile/settings/MSettingsAccount.test.tsx index 815ea6253..1a662082f 100644 --- a/client/tests/unit/mobile/settings/MSettingsAccount.test.tsx +++ b/client/tests/unit/mobile/settings/MSettingsAccount.test.tsx @@ -385,12 +385,13 @@ describe('MSettingsAccount – MFA', () => { await screen.findByText('JBSWY3DPEHPK3PXP'); } - it('FE-MOB-SETACC-023: demo mode replaces the controls with the demo notice', () => { - seedStore(useAuthStore, { demoMode: true }); + it('FE-MOB-SETACC-023: the shared demo account sees the controls under the demo lock', () => { + seedStore(useAuthStore, { demoMode: true, user: buildUser({ email: 'demo@trek.app', mfa_enabled: false }) }); renderAccount(); - expect(screen.getByText('Not available in demo mode')).toBeInTheDocument(); + expect(screen.getByRole('note')).toHaveTextContent('The shared demo account cannot be changed.'); expect(screen.queryByRole('button', { name: 'Set up authenticator' })).not.toBeInTheDocument(); + expect(screen.getByRole('button', { hidden: true, name: 'Set up authenticator' })).toBeInTheDocument(); }); it('FE-MOB-SETACC-024: the ?mfa=required entry shows the policy banner', () => { diff --git a/shared/src/i18n/ar/settings.ts b/shared/src/i18n/ar/settings.ts index e1e1fe5c1..66cb495ea 100644 --- a/shared/src/i18n/ar/settings.ts +++ b/shared/src/i18n/ar/settings.ts @@ -302,7 +302,6 @@ const settings: TranslationStrings = { 'settings.mfa.disable': 'تعطيل 2FA', 'settings.mfa.toastEnabled': 'تم تفعيل المصادقة الثنائية', 'settings.mfa.toastDisabled': 'تم تعطيل المصادقة الثنائية', - 'settings.mfa.demoBlocked': 'غير متاح في الوضع التجريبي', 'settings.tabs.offline': 'دون اتصال', 'settings.notificationPreferences.email': 'البريد الإلكتروني', 'settings.notificationPreferences.webhook': 'Webhook', diff --git a/shared/src/i18n/az/settings.ts b/shared/src/i18n/az/settings.ts index 749f7c46f..d5aaae786 100644 --- a/shared/src/i18n/az/settings.ts +++ b/shared/src/i18n/az/settings.ts @@ -396,7 +396,6 @@ const settings: TranslationStrings = { 'settings.mfa.disable': '2FA-nı deaktiv et', 'settings.mfa.toastEnabled': 'İki mərhələli autentifikasiya aktivləşdirildi', 'settings.mfa.toastDisabled': 'İki mərhələli autentifikasiya deaktiv edildi', - 'settings.mfa.demoBlocked': 'Demo rejimində əlçatan deyil', 'settings.currency': 'Göstərilən valyuta', 'settings.currencyHint': diff --git a/shared/src/i18n/br/settings.ts b/shared/src/i18n/br/settings.ts index 60dbb71f0..b39fde35b 100644 --- a/shared/src/i18n/br/settings.ts +++ b/shared/src/i18n/br/settings.ts @@ -209,7 +209,6 @@ const settings: TranslationStrings = { 'settings.mfa.disable': 'Desativar 2FA', 'settings.mfa.toastEnabled': 'Autenticação em duas etapas ativada', 'settings.mfa.toastDisabled': 'Autenticação em duas etapas desativada', - 'settings.mfa.demoBlocked': 'Indisponível no modo demonstração', 'settings.mcp.title': 'Configuração MCP', 'settings.mcp.endpoint': 'Endpoint MCP', 'settings.mcp.clientConfig': 'Configuração do cliente', diff --git a/shared/src/i18n/ca/settings.ts b/shared/src/i18n/ca/settings.ts index bf6f4f2cc..60d80e2f2 100644 --- a/shared/src/i18n/ca/settings.ts +++ b/shared/src/i18n/ca/settings.ts @@ -259,7 +259,6 @@ const settings: TranslationStrings = { 'settings.mfa.disable': 'Desactiva el 2FA', 'settings.mfa.toastEnabled': 'Autenticació de dos factors activada', 'settings.mfa.toastDisabled': 'Autenticació de dos factors desactivada', - 'settings.mfa.demoBlocked': 'No disponible en mode de demostració', 'settings.toast.mapSaved': 'Configuració del mapa desada', 'settings.toast.keysSaved': 'Claus API desades', 'settings.toast.displaySaved': 'Configuració de visualització desada', diff --git a/shared/src/i18n/cs/settings.ts b/shared/src/i18n/cs/settings.ts index 5b0fb94f0..06d17d602 100644 --- a/shared/src/i18n/cs/settings.ts +++ b/shared/src/i18n/cs/settings.ts @@ -289,7 +289,6 @@ const settings: TranslationStrings = { 'settings.mfa.disable': 'Vypnout 2FA', 'settings.mfa.toastEnabled': 'Dvoufaktorové ověření bylo zapnuto', 'settings.mfa.toastDisabled': 'Dvoufaktorové ověření bylo vypnuto', - 'settings.mfa.demoBlocked': 'Není k dispozici v demo režimu', 'settings.bookingLabels': 'Popisky tras rezervací', 'settings.bookingLabelsHint': 'Zobrazuje názvy stanic / letišť na mapě. Pokud je vypnuto, zobrazí se pouze ikona.', 'settings.mustChangePassword': 'Před pokračováním musíte změnit heslo.', diff --git a/shared/src/i18n/de/settings.ts b/shared/src/i18n/de/settings.ts index da08b1e55..574bc2028 100644 --- a/shared/src/i18n/de/settings.ts +++ b/shared/src/i18n/de/settings.ts @@ -299,7 +299,6 @@ const settings: TranslationStrings = { 'settings.mfa.disable': '2FA deaktivieren', 'settings.mfa.toastEnabled': 'Zwei-Faktor-Authentifizierung aktiviert', 'settings.mfa.toastDisabled': 'Zwei-Faktor-Authentifizierung deaktiviert', - 'settings.mfa.demoBlocked': 'In der Demo nicht verfügbar', 'settings.notifyVersionAvailable': 'Neue Version verfügbar', 'settings.notifyReplicaFailure': 'Speicher-Replik-Fehler', 'settings.notifyPaddleRegionRequested': 'Paddel-Region angefragt', diff --git a/shared/src/i18n/en/settings.ts b/shared/src/i18n/en/settings.ts index 5cad3bf96..124612a4a 100644 --- a/shared/src/i18n/en/settings.ts +++ b/shared/src/i18n/en/settings.ts @@ -356,7 +356,6 @@ const settings: TranslationStrings = { 'settings.mfa.disable': 'Disable 2FA', 'settings.mfa.toastEnabled': 'Two-factor authentication enabled', 'settings.mfa.toastDisabled': 'Two-factor authentication disabled', - 'settings.mfa.demoBlocked': 'Not available in demo mode', 'settings.currency': 'Display currency', 'settings.currencyHint': 'Amounts in Costs are shown converted to this currency for display only; the original amounts are unchanged.', diff --git a/shared/src/i18n/es/settings.ts b/shared/src/i18n/es/settings.ts index 334b56b45..0f48cb609 100644 --- a/shared/src/i18n/es/settings.ts +++ b/shared/src/i18n/es/settings.ts @@ -277,7 +277,6 @@ const settings: TranslationStrings = { 'settings.mfa.disable': 'Desactivar 2FA', 'settings.mfa.toastEnabled': 'Autenticación de dos factores activada', 'settings.mfa.toastDisabled': 'Autenticación de dos factores desactivada', - 'settings.mfa.demoBlocked': 'No disponible en modo demo', 'settings.toast.mapSaved': 'Ajustes del mapa guardados', 'settings.toast.keysSaved': 'Claves API guardadas', 'settings.toast.displaySaved': 'Ajustes de visualización guardados', diff --git a/shared/src/i18n/et/settings.ts b/shared/src/i18n/et/settings.ts index 48e6f9b34..1f1517d10 100644 --- a/shared/src/i18n/et/settings.ts +++ b/shared/src/i18n/et/settings.ts @@ -361,7 +361,6 @@ const settings: TranslationStrings = { 'settings.mfa.disable': 'Keela 2FA', 'settings.mfa.toastEnabled': 'Kaheastmeline autentimine lubatud', 'settings.mfa.toastDisabled': 'Kaheastmeline autentimine keelatud', - 'settings.mfa.demoBlocked': 'Demorežiimis pole saadaval', 'settings.currency': 'Kuvamisvaluuta', 'settings.currencyHint': 'Kulude summad teisendatakse sellesse valuutasse ainult kuvamiseks; algsummad ei muutu.', 'settings.currencyTrip': 'Reisi valuuta', diff --git a/shared/src/i18n/fr/settings.ts b/shared/src/i18n/fr/settings.ts index 2ad3b7555..e2214b652 100644 --- a/shared/src/i18n/fr/settings.ts +++ b/shared/src/i18n/fr/settings.ts @@ -291,7 +291,6 @@ const settings: TranslationStrings = { 'settings.mfa.disable': 'Désactiver 2FA', 'settings.mfa.toastEnabled': 'Authentification à deux facteurs activée', 'settings.mfa.toastDisabled': 'Authentification à deux facteurs désactivée', - 'settings.mfa.demoBlocked': 'Non disponible en mode démo', 'settings.toast.mapSaved': 'Paramètres de carte enregistrés', 'settings.toast.keysSaved': 'Clés API enregistrées', 'settings.toast.displaySaved': "Paramètres d'affichage enregistrés", diff --git a/shared/src/i18n/gr/settings.ts b/shared/src/i18n/gr/settings.ts index 2c97ce17f..731bf6a81 100644 --- a/shared/src/i18n/gr/settings.ts +++ b/shared/src/i18n/gr/settings.ts @@ -361,7 +361,6 @@ const settings: TranslationStrings = { 'settings.mfa.disable': 'Απενεργοποίηση 2FA', 'settings.mfa.toastEnabled': 'Ο έλεγχος ταυτότητας δύο παραγόντων ενεργοποιήθηκε', 'settings.mfa.toastDisabled': 'Ο έλεγχος ταυτότητας δύο παραγόντων απενεργοποιήθηκε', - 'settings.mfa.demoBlocked': 'Δεν είναι διαθέσιμο σε λειτουργία demo', 'settings.currency': 'Νόμισμα εμφάνισης', 'settings.currencyHint': 'Τα ποσά στα Κόστη εμφανίζονται σε αυτό το νόμισμα μόνο για λόγους προβολής, τα αρχικά ποσά δεν αλλάζουν.', diff --git a/shared/src/i18n/hu/settings.ts b/shared/src/i18n/hu/settings.ts index 5110d5bd6..71687d230 100644 --- a/shared/src/i18n/hu/settings.ts +++ b/shared/src/i18n/hu/settings.ts @@ -295,7 +295,6 @@ const settings: TranslationStrings = { 'settings.mfa.disable': '2FA kikapcsolása', 'settings.mfa.toastEnabled': 'Kétfaktoros hitelesítés engedélyezve', 'settings.mfa.toastDisabled': 'Kétfaktoros hitelesítés kikapcsolva', - 'settings.mfa.demoBlocked': 'Demo módban nem érhető el', 'settings.mustChangePassword': 'A folytatás előtt meg kell változtatnod a jelszavad. Kérjük, adj meg egy új jelszót alább.', 'settings.bookingLabels': 'Útvonal-címkék a foglalásokhoz', diff --git a/shared/src/i18n/id/settings.ts b/shared/src/i18n/id/settings.ts index 2eccb3347..4e9e2edec 100644 --- a/shared/src/i18n/id/settings.ts +++ b/shared/src/i18n/id/settings.ts @@ -347,7 +347,6 @@ const settings: TranslationStrings = { 'settings.mfa.disable': 'Nonaktifkan 2FA', 'settings.mfa.toastEnabled': 'Autentikasi dua faktor diaktifkan', 'settings.mfa.toastDisabled': 'Autentikasi dua faktor dinonaktifkan', - 'settings.mfa.demoBlocked': 'Tidak tersedia dalam mode demo', 'settings.bookingLabels': 'Label rute pemesanan', 'settings.bookingLabelsHint': 'Menampilkan nama stasiun / bandara di peta. Jika mati, hanya ikon ditampilkan.', 'settings.currency': 'Mata uang tampilan', diff --git a/shared/src/i18n/it/settings.ts b/shared/src/i18n/it/settings.ts index 69dfff0c4..4336277a9 100644 --- a/shared/src/i18n/it/settings.ts +++ b/shared/src/i18n/it/settings.ts @@ -294,7 +294,6 @@ const settings: TranslationStrings = { 'settings.mfa.disable': 'Disabilita 2FA', 'settings.mfa.toastEnabled': 'Autenticazione a due fattori abilitata', 'settings.mfa.toastDisabled': 'Autenticazione a due fattori disabilitata', - 'settings.mfa.demoBlocked': 'Non disponibile in modalità demo', 'settings.mustChangePassword': 'Devi cambiare la password prima di continuare. Imposta una nuova password qui sotto.', 'settings.bookingLabels': 'Etichette percorsi prenotati', 'settings.bookingLabelsHint': diff --git a/shared/src/i18n/ja/settings.ts b/shared/src/i18n/ja/settings.ts index 9189449d7..ce0dea7ce 100644 --- a/shared/src/i18n/ja/settings.ts +++ b/shared/src/i18n/ja/settings.ts @@ -321,7 +321,6 @@ const settings: TranslationStrings = { 'settings.mfa.disable': '2FAを無効化', 'settings.mfa.toastEnabled': '2FAを有効にしました', 'settings.mfa.toastDisabled': '2FAを無効にしました', - 'settings.mfa.demoBlocked': 'デモモードでは利用できません', 'settings.oauth.modal.machineClient': 'マシンクライアント(ブラウザログインなし)', 'settings.oauth.modal.machineClientHint': 'client_credentials グラントを使用します — リダイレクト URI は不要です。トークンは client_id + client_secret を介して直接発行され、選択したスコープ内であなたとして動作します。', diff --git a/shared/src/i18n/ko/settings.ts b/shared/src/i18n/ko/settings.ts index 558dfc432..a67000639 100644 --- a/shared/src/i18n/ko/settings.ts +++ b/shared/src/i18n/ko/settings.ts @@ -336,7 +336,6 @@ const settings: TranslationStrings = { 'settings.mfa.disable': '2FA 비활성화', 'settings.mfa.toastEnabled': '2단계 인증이 활성화되었습니다', 'settings.mfa.toastDisabled': '2단계 인증이 비활성화되었습니다', - 'settings.mfa.demoBlocked': '데모 모드에서는 사용할 수 없습니다', 'settings.oauth.modal.machineClient': '머신 클라이언트(브라우저 로그인 없음)', 'settings.oauth.modal.machineClientHint': 'client_credentials 권한 부여를 사용합니다 — 리디렉션 URI가 필요하지 않습니다. 토큰은 client_id + client_secret을 통해 직접 발급되며 선택한 범위 내에서 사용자로 작동합니다.', diff --git a/shared/src/i18n/nl/settings.ts b/shared/src/i18n/nl/settings.ts index 3dbcab048..7694c7a10 100644 --- a/shared/src/i18n/nl/settings.ts +++ b/shared/src/i18n/nl/settings.ts @@ -287,7 +287,6 @@ const settings: TranslationStrings = { 'settings.mfa.disable': '2FA uitschakelen', 'settings.mfa.toastEnabled': 'Tweefactorauthenticatie ingeschakeld', 'settings.mfa.toastDisabled': 'Tweefactorauthenticatie uitgeschakeld', - 'settings.mfa.demoBlocked': 'Niet beschikbaar in demomodus', 'settings.toast.mapSaved': 'Kaartinstellingen opgeslagen', 'settings.toast.keysSaved': 'API-sleutels opgeslagen', 'settings.toast.displaySaved': 'Weergave-instellingen opgeslagen', diff --git a/shared/src/i18n/pl/settings.ts b/shared/src/i18n/pl/settings.ts index 1906ad8e2..46877190a 100644 --- a/shared/src/i18n/pl/settings.ts +++ b/shared/src/i18n/pl/settings.ts @@ -292,7 +292,6 @@ const settings: TranslationStrings = { 'settings.mfa.disable': 'Wyłącz 2FA', 'settings.mfa.toastEnabled': 'Uwierzytelnianie dwuskładnikowe zostało włączone', 'settings.mfa.toastDisabled': 'Uwierzytelnianie dwuskładnikowe zostało wyłączone', - 'settings.mfa.demoBlocked': 'Niedostępne w trybie demonstracyjnym', 'settings.bookingLabels': 'Etykiety tras rezerwacji', 'settings.bookingLabelsHint': 'Pokazuje nazwy stacji / lotnisk na mapie. Gdy wyłączone, wyświetlana jest tylko ikona.', diff --git a/shared/src/i18n/ru/settings.ts b/shared/src/i18n/ru/settings.ts index 380dcbd50..79b53628e 100644 --- a/shared/src/i18n/ru/settings.ts +++ b/shared/src/i18n/ru/settings.ts @@ -286,7 +286,6 @@ const settings: TranslationStrings = { 'settings.mfa.disable': 'Отключить 2FA', 'settings.mfa.toastEnabled': 'Двухфакторная аутентификация включена', 'settings.mfa.toastDisabled': 'Двухфакторная аутентификация отключена', - 'settings.mfa.demoBlocked': 'Недоступно в демо-режиме', 'settings.toast.mapSaved': 'Настройки карты сохранены', 'settings.toast.keysSaved': 'API-ключи сохранены', 'settings.toast.displaySaved': 'Настройки отображения сохранены', diff --git a/shared/src/i18n/sk/settings.ts b/shared/src/i18n/sk/settings.ts index ab4f4a33b..908e6e9cd 100644 --- a/shared/src/i18n/sk/settings.ts +++ b/shared/src/i18n/sk/settings.ts @@ -359,7 +359,6 @@ const settings: TranslationStrings = { 'settings.mfa.disable': 'Vypnúť 2FA', 'settings.mfa.toastEnabled': 'Dvojfaktorové overenie zapnuté', 'settings.mfa.toastDisabled': 'Dvojfaktorové overenie vypnuté', - 'settings.mfa.demoBlocked': 'Nie je k dispozícii v demo režime', 'settings.currency': 'Zobrazovaná mena', 'settings.currencyHint': 'Sumy v Nákladoch sa do tejto meny prepočítavajú iba pre zobrazenie; pôvodné sumy zostávajú nezmenené.', diff --git a/shared/src/i18n/sv/settings.ts b/shared/src/i18n/sv/settings.ts index e7cf4e7e0..f4ab8f4be 100644 --- a/shared/src/i18n/sv/settings.ts +++ b/shared/src/i18n/sv/settings.ts @@ -353,7 +353,6 @@ const settings: TranslationStrings = { 'settings.mfa.disable': 'Inaktivera 2FA', 'settings.mfa.toastEnabled': 'Tvåfaktorsautentisering är aktiverad', 'settings.mfa.toastDisabled': 'Tvåfaktorsautentisering är inaktiverad', - 'settings.mfa.demoBlocked': 'Finns inte i demoläge', 'settings.currency': 'Visningsvaluta', 'settings.currencyHint': 'Belopp under Kostnader visas omräknade till denna valuta endast för visning; de ursprungliga beloppen ändras inte.', diff --git a/shared/src/i18n/th/settings.ts b/shared/src/i18n/th/settings.ts index 8b43f7851..1c197ae22 100644 --- a/shared/src/i18n/th/settings.ts +++ b/shared/src/i18n/th/settings.ts @@ -344,7 +344,6 @@ const settings: TranslationStrings = { 'settings.mfa.disable': 'ปิดการใช้งาน 2FA', 'settings.mfa.toastEnabled': 'เปิดใช้งานการรับรองความถูกต้องด้วยสองปัจจัย', 'settings.mfa.toastDisabled': 'การรับรองความถูกต้องด้วยสองปัจจัยถูกปิดใช้งาน', - 'settings.mfa.demoBlocked': 'ไม่สามารถใช้ได้ในโหมดสาธิต', 'settings.currency': 'แสดงสกุลเงิน', 'settings.currencyHint': 'จำนวนเงินในต้นทุนจะแสดงแปลงเป็นสกุลเงินนี้เพื่อแสดงเท่านั้น; จำนวนเงินเดิมไม่มีการเปลี่ยนแปลง', diff --git a/shared/src/i18n/tr/settings.ts b/shared/src/i18n/tr/settings.ts index ec964e60b..3f9be2efc 100644 --- a/shared/src/i18n/tr/settings.ts +++ b/shared/src/i18n/tr/settings.ts @@ -343,7 +343,6 @@ const settings: TranslationStrings = { 'settings.mfa.disable': "2FA'yı devre dışı bırak", 'settings.mfa.toastEnabled': 'İki faktörlü kimlik doğrulama etkin', 'settings.mfa.toastDisabled': 'İki faktörlü kimlik doğrulama devre dışı', - 'settings.mfa.demoBlocked': 'Demo modunda kullanılamaz', 'settings.oauth.modal.machineClient': 'Makine istemcisi (tarayıcıda oturum açma yok)', 'settings.oauth.modal.machineClientHint': "client_credentials iznini kullanın — yönlendirme URI'lerine gerek yoktur. Belirteç doğrudan client_id + client_secret ile verilir ve seçilen kapsamlar dahilinde sizin adınıza hareket eder.", diff --git a/shared/src/i18n/uk/settings.ts b/shared/src/i18n/uk/settings.ts index 7abef2500..c757e7429 100644 --- a/shared/src/i18n/uk/settings.ts +++ b/shared/src/i18n/uk/settings.ts @@ -282,7 +282,6 @@ const settings: TranslationStrings = { 'settings.mfa.disable': 'Вимкнути 2FA', 'settings.mfa.toastEnabled': 'Двофакторна автентифікація увімкнена', 'settings.mfa.toastDisabled': 'Двофакторна автентифікація вимкнена', - 'settings.mfa.demoBlocked': 'Недоступно в демо-режимі', 'settings.toast.mapSaved': 'Налаштування карти збережено', 'settings.toast.keysSaved': 'API-ключі збережено', 'settings.toast.displaySaved': 'Налаштування відображення збережено', diff --git a/shared/src/i18n/vi/settings.ts b/shared/src/i18n/vi/settings.ts index 36e123faa..60c5d1fba 100644 --- a/shared/src/i18n/vi/settings.ts +++ b/shared/src/i18n/vi/settings.ts @@ -355,7 +355,6 @@ const settings: TranslationStrings = { 'settings.mfa.disable': 'Tắt 2FA', 'settings.mfa.toastEnabled': 'Đã bật xác thực hai yếu tố', 'settings.mfa.toastDisabled': 'Xác thực hai yếu tố bị vô hiệu hóa', - 'settings.mfa.demoBlocked': 'Không có sẵn ở chế độ demo', 'settings.currency': 'Tiền tệ hiển thị', 'settings.currencyHint': 'Số tiền trong Chi phí chỉ được quy đổi sang loại tiền tệ này để hiển thị; số tiền gốc không thay đổi.', diff --git a/shared/src/i18n/zh-TW/settings.ts b/shared/src/i18n/zh-TW/settings.ts index ea7f5e9c0..43641b31f 100644 --- a/shared/src/i18n/zh-TW/settings.ts +++ b/shared/src/i18n/zh-TW/settings.ts @@ -318,7 +318,6 @@ const settings: TranslationStrings = { 'settings.mfa.disable': '停用 2FA', 'settings.mfa.toastEnabled': '雙因素認證已啟用', 'settings.mfa.toastDisabled': '雙因素認證已停用', - 'settings.mfa.demoBlocked': '演示模式下不可用', 'settings.toast.mapSaved': '地圖設定已儲存', 'settings.toast.keysSaved': 'API 金鑰已儲存', 'settings.toast.displaySaved': '顯示設定已儲存', diff --git a/shared/src/i18n/zh/settings.ts b/shared/src/i18n/zh/settings.ts index 91010f889..89a3119e9 100644 --- a/shared/src/i18n/zh/settings.ts +++ b/shared/src/i18n/zh/settings.ts @@ -269,7 +269,6 @@ const settings: TranslationStrings = { 'settings.mfa.disable': '停用 2FA', 'settings.mfa.toastEnabled': '双因素认证已启用', 'settings.mfa.toastDisabled': '双因素认证已停用', - 'settings.mfa.demoBlocked': '演示模式下不可用', 'settings.toast.mapSaved': '地图设置已保存', 'settings.toast.keysSaved': 'API 密钥已保存', 'settings.toast.displaySaved': '显示设置已保存',