fix(settings): the checks the settings redesign left red

The phone's MCP card still read the config fold state that the shared hook
no longer holds, so the client failed to typecheck. The phone keeps its
folded config, so it now holds that state itself.

SettingsColumns takes start and end instead of left and right: the prop
types counted as two physical sides for lint:rtl, and in a right-to-left
language the first column is the right one anyway.

Also: an unused icon import, seven files outside the format baseline run
through Prettier, Routing (de) and Services (fr) confirmed as the same word
as in English, and the size and warning baselines lowered to what the
redesign left (AdminPluginsPanel one wrapped line shorter, two promise
warnings, one long function and two non-null assertions in tests fewer).
This commit is contained in:
Maurice
2026-11-13 23:10:05 +00:00
parent 94ac7673a5
commit a0764b9c96
24 changed files with 49 additions and 83 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
{
"src": {
"@typescript-eslint/no-non-null-assertion": 375,
"@typescript-eslint/no-misused-promises": 840,
"@typescript-eslint/no-misused-promises": 838,
"no-console": 88,
"complexity": 218,
"@typescript-eslint/no-explicit-any": 143,
@@ -14,7 +14,7 @@
"react-hooks/exhaustive-deps": 114,
"@typescript-eslint/no-unused-vars": 122,
"react-hooks/immutability": 28,
"max-lines-per-function": 130,
"max-lines-per-function": 129,
"react-hooks/static-components": 50,
"react-hooks/preserve-manual-memoization": 12,
"no-useless-assignment": 7,
@@ -35,7 +35,7 @@
},
"tests": {
"@typescript-eslint/no-explicit-any": 489,
"@typescript-eslint/no-non-null-assertion": 1907,
"@typescript-eslint/no-non-null-assertion": 1905,
"@typescript-eslint/no-misused-promises": 22,
"@typescript-eslint/no-unused-vars": 51,
"@typescript-eslint/no-floating-promises": 33,
+1 -1
View File
@@ -2,7 +2,7 @@
"e2e/help/fixtures.ts": 2291,
"src/api/client.ts": 1873,
"src/components/Admin/AdminPluginsPanel.test.tsx": 2704,
"src/components/Admin/AdminPluginsPanel.tsx": 1266,
"src/components/Admin/AdminPluginsPanel.tsx": 1265,
"src/components/Budget/CostsPanel.test.tsx": 2725,
"src/components/Budget/CostsPanel.tsx": 1607,
"src/components/Map/MapView.tsx": 1200,
+2 -3
View File
@@ -204,8 +204,7 @@ export default function AddonManager({ bagTrackingEnabled, onToggleBagTracking,
/* A card per type, the way every other admin tab sets its cards: Trip in the
left column, Global and Integration in the right one, each card with the
dialogs' head band carrying the type, its count and what it means. Above
them one card says how many are on and finds an addon by name. */
dialogs' head band carrying the type, its count and what it means. */
const groups = [
{ key: 'trip', addons: tripAddons },
{ key: 'global', addons: globalAddons },
@@ -252,5 +251,5 @@ export default function AddonManager({ bagTrackingEnabled, onToggleBagTracking,
)
}
return <SettingsColumns left={cards.start} right={<>{cards.end}{aside}</>} />
return <SettingsColumns start={cards.start} end={<>{cards.end}{aside}</>} />
}
@@ -74,7 +74,7 @@ export default function AdminMcpTokensPanel() {
<div>
{/* The sessions and the tokens side by side: two lists of the same kind. */}
<SettingsColumns
left={<>
start={<>
{/* OAuth Sessions. The tab's own subtitle sits in its band: the sidebar
already names the tab, so a bare heading over the cards only repeated it. */}
<SettingsCard
@@ -120,7 +120,7 @@ export default function AdminMcpTokensPanel() {
)}
</SettingsCard>
</>}
right={<>
end={<>
{/* MCP Tokens */}
<SettingsCard
icon={KeyRound}
@@ -108,7 +108,7 @@ export default function DefaultUserSettingsTab(): React.ReactElement {
return (
<SettingsColumns
left={
start={
<>
<Section title={t('admin.defaultSettings.title')} icon={Settings2} hint={t('admin.defaultSettings.description')}>
@@ -223,7 +223,7 @@ export default function DefaultUserSettingsTab(): React.ReactElement {
)}
</>
}
right={
end={
<Section title={t('settings.map')} icon={MapIcon}>
{/* Map Tile URL */}
<EditorField label={<>{t('settings.mapTemplate')}<ResetButton {...resetOf('map_tile_url')} /></>} hint={t('settings.mapDefaultHint')}>
@@ -92,7 +92,8 @@ function ServiceTile({ allowance }: { allowance: ServiceAllowance }) {
title={`${t('admin.trekApi.quota.remaining')}: ${number.format(quota.remaining)}`}
>
<span className={`font-semibold ${figureTone(quota)}`}>{number.format(quota.used)}</span>
{' / '}{number.format(quota.limit)}
{' / '}
{number.format(quota.limit)}
</span>
</>
)}
@@ -124,11 +124,7 @@ function InstanceConnection({ A }: { A: AiAdmin }) {
<AiConnectPanel scope="instance" onConnected={onConnected} prefill={connection?.prefill ?? null} />
)}
{replacing && (
<button
type="button"
onClick={cancelReplace}
className={`${SETTINGS_BUTTON} self-start`}
>
<button type="button" onClick={cancelReplace} className={`${SETTINGS_BUTTON} self-start`}>
{t('common.cancel')}
</button>
)}
@@ -160,12 +160,7 @@ function LocalModels({ P }: { P: Parsing }) {
</span>
{m.recommended && <StatusPill tone="success">{t('assistant.model.recommended')}</StatusPill>}
{here ? (
<button
type="button"
onClick={() => P.setModel(m.id)}
disabled={chosen}
className={SETTINGS_BUTTON}
>
<button type="button" onClick={() => P.setModel(m.id)} disabled={chosen} className={SETTINGS_BUTTON}>
{chosen ? <Check size={13} strokeWidth={2.4} /> : null}
{t(chosen ? 'admin.addons.ai.parsing.selected' : 'admin.addons.ai.parsing.use')}
</button>
@@ -138,7 +138,7 @@ export default function AdminStoragePanel(): React.ReactElement {
{/* Two columns by length: the health and the backends on the left, which
category goes where on the right, its save bar at the card's foot. */}
<SettingsColumns
left={<>
start={<>
<Section title={t('storage.health.title')} icon={Activity}>
{state.health.replicaFailures.length === 0 ? (
<p className="m-0 flex items-center gap-2 text-content-muted" style={fs(12.5, 'body')}>
@@ -493,7 +493,7 @@ export default function AdminStoragePanel(): React.ReactElement {
onDelete={(enabled) => void handleReclaimDelete(enabled)}
/>
</>}
right={<>
end={<>
<Section title={t('storage.categories.title')} icon={FolderTree}>
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2">
{STORAGE_CATEGORIES.map((category) => {
@@ -47,12 +47,7 @@ export default function StorageReclaimSection({
icon={Eraser}
hint={t('storage.reclaim.hint')}
action={
<button
type="button"
className={SETTINGS_BUTTON}
onClick={onCheck}
disabled={checking}
>
<button type="button" className={SETTINGS_BUTTON} onClick={onCheck} disabled={checking}>
{checking ? (
<Loader2 size={14} strokeWidth={2.2} className="animate-spin" />
) : (
@@ -77,7 +77,7 @@ export default function AccountTab(): React.ReactElement {
{/* Two columns by length: who you are and the second factor on the left,
the password and passkeys on the right. */}
<SettingsColumns
left={<>
start={<>
<Section title={t('settings.account')} icon={User}>
{/* Who is signed in: the picture with its two actions, the role and the SSO link. */}
<div className="flex items-center gap-4 rounded-[14px] border border-edge-faint bg-surface-card px-4 py-3.5">
@@ -315,7 +315,7 @@ export default function AccountTab(): React.ReactElement {
</>
</Section>
</>}
right={<>
end={<>
{/* Change Password */}
{!oidcOnlyMode && (
<Section title={t('settings.changePassword')} icon={Lock}>
@@ -45,7 +45,7 @@ export default function AppearanceSettingsTab(): React.ReactElement {
return (
<>
<SettingsColumns
left={<>
start={<>
{/* ── Theme ───────────────────────────────────────────────── */}
<Section title={tr('settings.appearance.theme', 'Theme')} icon={Paintbrush}>
<SettingRows>
@@ -212,7 +212,7 @@ export default function AppearanceSettingsTab(): React.ReactElement {
</Section>
</>}
right={<>
end={<>
{/* ── Dashboard widgets ───────────────────────────────────── */}
<Section
title={tr('settings.appearance.dashboardWidgets', 'Dashboard widgets')}
@@ -45,7 +45,7 @@ export default function DisplaySettingsTab(): React.ReactElement {
return (
<SettingsColumns
left={<>
start={<>
<Section title={t('settings.general.startup')} icon={Rocket}>
<SettingRows>
{/* Where opening TREK lands */}
@@ -248,7 +248,7 @@ export default function DisplaySettingsTab(): React.ReactElement {
</Section>
</>}
right={
end={
<Section title={t('settings.general.travelMap')} icon={Map}>
<SettingRows>
{/* Preferred map app (#2423): opt-in, the picker stays the default */}
@@ -32,7 +32,7 @@ export default function IntegrationsTab(): React.ReactElement {
{/* What connects your trips with other services on the left, AI and
developer access on the right, every card open on the page. */}
<SettingsColumns
left={
start={
<>
{/* Forwarded booking mails: hides itself where this server or plan has no import. */}
<MailImportSection />
@@ -51,7 +51,7 @@ export default function IntegrationsTab(): React.ReactElement {
{S.llmEnabled && S.ownParsing && !managed && <LlmConnectionSection />}
</>
}
right={
end={
<>
{/* An API key needs no addon, so it leads, ahead of the MCP row. */}
<DemoLock locked={demoLocked} reason={S.t('demo.lock.apiKeys')}>
@@ -52,7 +52,7 @@ export default function OfflineTab(): React.ReactElement {
{/* Two columns by length: what the mode does and what is cached on the
left, the per-trip choice of what to keep on the right. */}
<SettingsColumns
left={<>
start={<>
{/* Offline mode + prepare */}
<Section title={t('settings.offline.mode.title')} icon={CloudOff}>
<SettingRows>
@@ -235,7 +235,7 @@ export default function OfflineTab(): React.ReactElement {
)}
</Section>
</>}
right={<>
end={<>
{/* What to store offline */}
<Section title={t('settings.offline.storage.title')} icon={MapIcon}>
<SettingRows>
@@ -43,7 +43,6 @@ export default function WandererConnectionSection(): React.ReactElement {
</StatusPill>
}
>
<div className={GRID_2}>
<EditorField label={t('wanderer.url')} htmlFor="wanderer-url">
<input
@@ -43,12 +43,7 @@ function HintsButton({ W }: { W: WandererWatchController }) {
return (
<Tooltip label={count ? t('wanderer.watch.hintsCount', { count }) : t('wanderer.watch.empty')}>
<span className="inline-flex">
<button
type="button"
onClick={W.openHints}
disabled={count === 0}
className={`${SETTINGS_BUTTON} relative`}
>
<button type="button" onClick={W.openHints} disabled={count === 0} className={`${SETTINGS_BUTTON} relative`}>
<BellRing size={13} strokeWidth={2.2} />
{t('wanderer.watch.hints')}
{count > 0 && (
@@ -81,32 +81,18 @@ function OwnConnection({ S, own }: { S: AiConnections; own: AiConnectionView })
<SettingRows>
<ConnectionRow kind={own.kind} title={t('assistant.connect.connected', { provider })} detail={own.hint}>
{repairMode ? (
<button
type="button"
onClick={() => S.repair(repairMode)}
className={SETTINGS_BUTTON_PRIMARY}
>
<button type="button" onClick={() => S.repair(repairMode)} className={SETTINGS_BUTTON_PRIMARY}>
{t(repairMode === 'chatgpt' ? 'assistant.errorAction.signIn' : 'assistant.errorAction.replaceKey')}
</button>
) : (
<OpenAssistantButton S={S} />
)}
{own.kind === 'chatgpt' && own.status === 'ok' ? (
<button
type="button"
onClick={() => void signOut()}
disabled={busy}
className={SETTINGS_BUTTON}
>
<button type="button" onClick={() => void signOut()} disabled={busy} className={SETTINGS_BUTTON}>
<LogOut size={14} strokeWidth={2} /> {t('assistant.connect.signOut')}
</button>
) : (
<button
type="button"
onClick={askDisconnect}
disabled={busy}
className={SETTINGS_BUTTON_DANGER}
>
<button type="button" onClick={askDisconnect} disabled={busy} className={SETTINGS_BUTTON_DANGER}>
<Unplug size={14} strokeWidth={2} /> {t('assistant.connect.disconnect')}
</button>
)}
@@ -182,13 +182,14 @@ export function SettingsCard({ icon: Icon, iconFill = false, title, hint, badge,
* grid over a flat list, which pairs cards row by row and leaves a hole under
* the shorter of two. A column with nothing to show drops out and the other
* takes the whole width. The cards carry their own bottom margin, so only the
* gap between the columns is set.
* gap between the columns is set. `start` is the left column, the right one in
* a right-to-left language.
*/
export function SettingsColumns({ left, right }: { left: ReactNode; right: ReactNode }) {
export function SettingsColumns({ start, end }: { start: ReactNode; end: ReactNode }) {
return (
<div className="xl:flex xl:items-start xl:gap-5">
<div className="min-w-0 flex-1 empty:hidden">{left}</div>
<div className="min-w-0 flex-1 empty:hidden">{right}</div>
<div className="min-w-0 flex-1 empty:hidden">{start}</div>
<div className="min-w-0 flex-1 empty:hidden">{end}</div>
</div>
)
}
@@ -1,4 +1,4 @@
import type { ReactNode } from 'react'
import { useState, type ReactNode } from 'react'
import { Check, ChevronDown, ChevronRight, Copy, KeyRound, Plus, RefreshCw, Terminal, Trash2, Key, CircleCheck, RotateCcw } from 'lucide-react'
import { useTranslation } from '../../../i18n'
import { useFormatDate } from '../../../hooks/useDateFormat'
@@ -43,13 +43,12 @@ export default function MSettingsMcp() {
const { t } = useTranslation()
const { formatDate } = useFormatDate()
const demoLocked = useDemoAccountLock()
// The desktop page shows the client config open; the phone keeps it folded.
const [configOpenOAuth, setConfigOpenOAuth] = useState(false)
const [configOpenToken, setConfigOpenToken] = useState(false)
const {
activeMcpTab: activeTab,
setActiveMcpTab: setActiveTab,
configOpenOAuth,
setConfigOpenOAuth,
configOpenToken,
setConfigOpenToken,
copiedKey,
oauthClients: clients,
oauthSessions: sessions,
@@ -79,7 +79,7 @@ export default function AdminNotificationsTab({ admin, t }: AdminNotificationsTa
relay's fields a section under them; the operator's own targets and the
admin-only matrix on the right. */}
<SettingsColumns
left={
start={
<SettingsCard icon={Bell} title={t('admin.notifications.channels')}>
<SettingRows>
{/* The relay is the operator's on a managed install: their host, their
@@ -166,7 +166,7 @@ export default function AdminNotificationsTab({ admin, t }: AdminNotificationsTa
)}
</SettingsCard>
}
right={
end={
// What the operator receives about running the instance: one card, the
// two targets as its blocks, then which event goes out over which channel.
<SettingsCard icon={BellRing} title={t('admin.notifications.adminAlerts')} hint={t('admin.notifications.adminNotificationsHint')}>
+5 -5
View File
@@ -3,7 +3,7 @@ import { adminApi } from '../../api/client'
import { getApiErrorMessage } from '../../types'
import {
AlertTriangle, CheckCircle, Compass, Eye, EyeOff, FileType, Fingerprint, KeyRound, Loader2, LockKeyhole, LogIn,
Plane, RefreshCw, Save, ShieldCheck, XCircle,
Plane, RefreshCw, Save, XCircle,
} from 'lucide-react'
import ToggleSwitch from '../../components/Settings/ToggleSwitch'
import CustomSelect from '../../components/shared/CustomSelect'
@@ -748,13 +748,13 @@ export default function AdminSettingsTab({ admin, t, part }: AdminSettingsTabPro
// Place search and the services on the left, the keys and file types on the right.
return (
<SettingsColumns
left={<>
start={<>
{/* Inside the place search card elsewhere; that card is the operator's here,
sharing place details is still the admin's decision. */}
{managed && <PlaceContribPanel hideWhenSwitchedOff />}
{servicesCard}
</>}
right={<>
end={<>
{apiKeysCard}
{fileTypesCard}
</>}
@@ -767,13 +767,13 @@ export default function AdminSettingsTab({ admin, t, part }: AdminSettingsTabPro
// Split by length, not by kind: single sign-on is the one long form, so the
// right column holds it and the short danger zone under it.
<SettingsColumns
left={
start={
<>
{authCard}
{passkeyCard}
</>
}
right={
end={
<>
{oidcCard}
{dangerCard}
+1 -1
View File
@@ -269,7 +269,7 @@ const admin: TranslationStrings = {
'admin.tabs.config': 'Personalisierung',
'admin.tabs.defaults': 'Standards',
'admin.defaultSettings.title': 'Standard-Benutzereinstellungen',
'admin.defaultSettings.routing': 'Routing',
'admin.defaultSettings.routing': 'Routing', // same-as-en
'admin.defaultSettings.description':
'Instanzweite Standards festlegen. Benutzer, die eine Einstellung nicht geändert haben, sehen diese Werte. Eigene Änderungen haben immer Vorrang.',
'admin.defaultSettings.saved': 'Standard gespeichert',
+1 -1
View File
@@ -77,7 +77,7 @@ const admin: TranslationStrings = {
'admin.invite.deleteError': 'Erreur lors de la suppression du lien',
'admin.tabs.settings': 'Paramètres',
'admin.tabs.security': 'Sécurité',
'admin.tabs.services': 'Services',
'admin.tabs.services': 'Services', // same-as-en
'admin.allowRegistration': 'Autoriser les inscriptions',
'admin.allowRegistrationHint': "Les nouveaux utilisateurs peuvent s'inscrire eux-mêmes",
'admin.authMethods': "Méthodes d'authentification",