@prenta/admin 2.14.8 → 2.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/AdminRoot.d.ts.map +1 -1
  3. package/dist/AdminRoot.js +11 -6
  4. package/dist/AdminRoot.js.map +1 -1
  5. package/dist/LoginRoot.js +3 -3
  6. package/dist/LoginRoot.js.map +1 -1
  7. package/dist/__tests__/assets/prenta-logo.test.js +26 -10
  8. package/dist/__tests__/assets/prenta-logo.test.js.map +1 -1
  9. package/dist/__tests__/layout/sidebar-brand.render.test.js +25 -22
  10. package/dist/__tests__/layout/sidebar-brand.render.test.js.map +1 -1
  11. package/dist/__tests__/views/appearance-settings.render.test.js +9 -0
  12. package/dist/__tests__/views/appearance-settings.render.test.js.map +1 -1
  13. package/dist/__tests__/views/login-branding.render.test.js +15 -30
  14. package/dist/__tests__/views/login-branding.render.test.js.map +1 -1
  15. package/dist/__tests__/views/mcp-connect.render.test.js +54 -4
  16. package/dist/__tests__/views/mcp-connect.render.test.js.map +1 -1
  17. package/dist/__tests__/views/mcp-consent.render.test.d.ts +2 -0
  18. package/dist/__tests__/views/mcp-consent.render.test.d.ts.map +1 -0
  19. package/dist/__tests__/views/mcp-consent.render.test.js +112 -0
  20. package/dist/__tests__/views/mcp-consent.render.test.js.map +1 -0
  21. package/dist/assets/prenta-logo.d.ts +18 -21
  22. package/dist/assets/prenta-logo.d.ts.map +1 -1
  23. package/dist/assets/prenta-logo.js +24 -12
  24. package/dist/assets/prenta-logo.js.map +1 -1
  25. package/dist/components/AuthBranding.d.ts +40 -0
  26. package/dist/components/AuthBranding.d.ts.map +1 -0
  27. package/dist/components/AuthBranding.js +81 -0
  28. package/dist/components/AuthBranding.js.map +1 -0
  29. package/dist/index.d.ts +2 -0
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +1 -0
  32. package/dist/index.js.map +1 -1
  33. package/dist/layout/Sidebar.d.ts.map +1 -1
  34. package/dist/layout/Sidebar.js +15 -23
  35. package/dist/layout/Sidebar.js.map +1 -1
  36. package/dist/prenta-admin.css +1 -1
  37. package/dist/views/ForgotPassword.d.ts +3 -1
  38. package/dist/views/ForgotPassword.d.ts.map +1 -1
  39. package/dist/views/ForgotPassword.js +6 -4
  40. package/dist/views/ForgotPassword.js.map +1 -1
  41. package/dist/views/Login.d.ts +2 -5
  42. package/dist/views/Login.d.ts.map +1 -1
  43. package/dist/views/Login.js +9 -74
  44. package/dist/views/Login.js.map +1 -1
  45. package/dist/views/McpConsent.d.ts.map +1 -1
  46. package/dist/views/McpConsent.js +21 -3
  47. package/dist/views/McpConsent.js.map +1 -1
  48. package/dist/views/ResetPassword.d.ts +3 -1
  49. package/dist/views/ResetPassword.d.ts.map +1 -1
  50. package/dist/views/ResetPassword.js +5 -3
  51. package/dist/views/ResetPassword.js.map +1 -1
  52. package/dist/views/Settings.js +1 -1
  53. package/dist/views/Settings.js.map +1 -1
  54. package/dist/views/SetupWizard.d.ts +3 -1
  55. package/dist/views/SetupWizard.d.ts.map +1 -1
  56. package/dist/views/SetupWizard.js +5 -3
  57. package/dist/views/SetupWizard.js.map +1 -1
  58. package/dist/views/settings/BrandPreviewCard.d.ts.map +1 -1
  59. package/dist/views/settings/BrandPreviewCard.js +5 -6
  60. package/dist/views/settings/BrandPreviewCard.js.map +1 -1
  61. package/dist/views/settings/BrandingCard.d.ts.map +1 -1
  62. package/dist/views/settings/BrandingCard.js +4 -3
  63. package/dist/views/settings/BrandingCard.js.map +1 -1
  64. package/dist/views/settings/McpConnectTab.d.ts +2 -1
  65. package/dist/views/settings/McpConnectTab.d.ts.map +1 -1
  66. package/dist/views/settings/McpConnectTab.js +95 -4
  67. package/dist/views/settings/McpConnectTab.js.map +1 -1
  68. package/package.json +4 -4
  69. package/src/AdminRoot.tsx +15 -5
  70. package/src/LoginRoot.tsx +9 -2
  71. package/src/__tests__/assets/prenta-logo.test.tsx +27 -10
  72. package/src/__tests__/layout/sidebar-brand.render.test.tsx +29 -25
  73. package/src/__tests__/views/appearance-settings.render.test.tsx +11 -0
  74. package/src/__tests__/views/login-branding.render.test.tsx +15 -30
  75. package/src/__tests__/views/mcp-connect.render.test.tsx +79 -5
  76. package/src/__tests__/views/mcp-consent.render.test.tsx +124 -0
  77. package/src/assets/prenta-logo.tsx +55 -53
  78. package/src/components/AuthBranding.tsx +125 -0
  79. package/src/index.ts +2 -0
  80. package/src/layout/Sidebar.tsx +51 -49
  81. package/src/views/ForgotPassword.tsx +12 -5
  82. package/src/views/Login.tsx +15 -89
  83. package/src/views/McpConsent.tsx +37 -10
  84. package/src/views/ResetPassword.tsx +12 -5
  85. package/src/views/Settings.tsx +1 -1
  86. package/src/views/SetupWizard.tsx +12 -5
  87. package/src/views/settings/BrandPreviewCard.tsx +20 -27
  88. package/src/views/settings/BrandingCard.tsx +18 -1
  89. package/src/views/settings/McpConnectTab.tsx +232 -16
  90. package/dist/components/LogoPlaceholder.d.ts +0 -17
  91. package/dist/components/LogoPlaceholder.d.ts.map +0 -1
  92. package/dist/components/LogoPlaceholder.js +0 -13
  93. package/dist/components/LogoPlaceholder.js.map +0 -1
  94. package/src/components/LogoPlaceholder.tsx +0 -55
@@ -1,7 +1,13 @@
1
1
  'use client'
2
2
 
3
3
  import { useState, type FormEvent } from 'react'
4
- import { Shield, Eye, EyeOff, CheckCircle2, AlertTriangle } from 'lucide-react'
4
+ import { Eye, EyeOff, CheckCircle2, AlertTriangle } from 'lucide-react'
5
+ import {
6
+ AuthBrandHero,
7
+ AuthPrentaFooter,
8
+ useAuthBrand,
9
+ type AuthBrandingConfig,
10
+ } from '../components/AuthBranding.js'
5
11
 
6
12
  export interface SetupWizardProps {
7
13
  onComplete: (data: {
@@ -10,6 +16,7 @@ export interface SetupWizardProps {
10
16
  password: string
11
17
  }) => Promise<{ success: boolean; error?: string }>
12
18
  siteName?: string
19
+ branding?: AuthBrandingConfig
13
20
  }
14
21
 
15
22
  function passwordStrength(pw: string): { score: number; label: string; color: string } {
@@ -29,7 +36,8 @@ function passwordStrength(pw: string): { score: number; label: string; color: st
29
36
  const fieldClass =
30
37
  'w-full rounded-lg border border-border bg-input-background px-3 py-2.5 text-sm text-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none'
31
38
 
32
- export function SetupWizard({ onComplete, siteName = 'Prenta CMS' }: SetupWizardProps) {
39
+ export function SetupWizard({ onComplete, siteName = 'Prenta CMS', branding }: SetupWizardProps) {
40
+ const brand = useAuthBrand(branding)
33
41
  const [name, setName] = useState('')
34
42
  const [email, setEmail] = useState('')
35
43
  const [password, setPassword] = useState('')
@@ -96,9 +104,7 @@ export function SetupWizard({ onComplete, siteName = 'Prenta CMS' }: SetupWizard
96
104
  <div className="bg-muted flex min-h-screen items-center justify-center px-4">
97
105
  <div className="w-full max-w-md">
98
106
  <div className="mb-8 text-center">
99
- <div className="bg-primary mx-auto mb-4 flex h-14 w-14 items-center justify-center rounded-xl">
100
- <Shield className="text-primary-foreground h-7 w-7" />
101
- </div>
107
+ <AuthBrandHero brand={brand} />
102
108
  <h1 className="text-foreground text-2xl font-medium">Welcome to {siteName}</h1>
103
109
  <p className="text-muted-foreground mt-2">Create your admin account to get started</p>
104
110
  </div>
@@ -233,6 +239,7 @@ export function SetupWizard({ onComplete, siteName = 'Prenta CMS' }: SetupWizard
233
239
  be replaced by the login screen.
234
240
  </p>
235
241
  </form>
242
+ {brand.showPermanentFooter && <AuthPrentaFooter />}
236
243
  </div>
237
244
  </div>
238
245
  )
@@ -1,21 +1,11 @@
1
1
  'use client'
2
2
 
3
- import type { ResolvedAdminBrand } from '@prenta/core/appearance'
3
+ import { DEFAULT_PRENTA_FAVICON_DATA_URI, type ResolvedAdminBrand } from '@prenta/core/appearance'
4
4
 
5
+ import { PrentaBrandLogo, PrentaMark } from '../../assets/prenta-logo.js'
5
6
  import type { UseAppearanceSettings } from './useAppearanceSettings.js'
6
7
 
7
- function Initials({ initials, size = 'h-8 w-8 text-sm' }: { initials: string; size?: string }) {
8
- return (
9
- <span
10
- className={`bg-brand text-brand-foreground inline-flex shrink-0 items-center justify-center rounded-md font-medium ${size}`}
11
- aria-hidden="true"
12
- >
13
- {initials}
14
- </span>
15
- )
16
- }
17
-
18
- /** Expanded sidebar lockup preview (primary → mark+title → initials). */
8
+ /** Expanded sidebar lockup preview (uploaded logo → mark+title → Prenta placeholder). */
19
9
  function SidebarPreview({ admin, dark }: { admin: ResolvedAdminBrand; dark?: boolean }) {
20
10
  const logo = dark && admin.dark ? admin.dark : admin.primary
21
11
  return (
@@ -34,12 +24,9 @@ function SidebarPreview({ admin, dark }: { admin: ResolvedAdminBrand; dark?: boo
34
24
  </span>
35
25
  </>
36
26
  ) : (
37
- <>
38
- <Initials initials={admin.initials} />
39
- <span className={dark ? 'text-background text-sm' : 'text-sidebar-foreground text-sm'}>
40
- Admin
41
- </span>
42
- </>
27
+ <PrentaBrandLogo
28
+ className={`h-6 w-auto ${dark ? 'text-background' : 'text-sidebar-foreground'}`}
29
+ />
43
30
  )}
44
31
  </div>
45
32
  )
@@ -78,11 +65,17 @@ export function BrandPreviewCard({ s }: { s: UseAppearanceSettings }) {
78
65
  </PreviewTile>
79
66
 
80
67
  <PreviewTile label="Collapsed sidebar">
81
- <div className="bg-sidebar border-sidebar-border flex h-14 w-14 items-center justify-center rounded-md border">
68
+ <div className="bg-sidebar border-sidebar-border flex h-14 w-14 items-center justify-center rounded-md border p-2">
82
69
  {admin.mark ? (
83
70
  <img src={admin.mark.url} alt={admin.mark.alt} className="h-8 w-8 object-contain" />
71
+ ) : admin.primary ? (
72
+ <img
73
+ src={admin.primary.url}
74
+ alt={admin.primary.alt}
75
+ className="max-h-full max-w-full object-contain"
76
+ />
84
77
  ) : (
85
- <Initials initials={admin.initials} />
78
+ <PrentaMark className="text-sidebar-foreground h-auto w-8 object-contain" />
86
79
  )}
87
80
  </div>
88
81
  </PreviewTile>
@@ -105,18 +98,18 @@ export function BrandPreviewCard({ s }: { s: UseAppearanceSettings }) {
105
98
  <span className="text-foreground text-sm">{pub.initials}</span>
106
99
  </>
107
100
  ) : (
108
- <span className="text-foreground text-sm font-medium">{pub.initials}</span>
101
+ <PrentaBrandLogo className="text-foreground h-6 w-auto" />
109
102
  )}
110
103
  </div>
111
104
  </PreviewTile>
112
105
 
113
106
  <PreviewTile label="Favicon">
114
107
  <div className="border-border bg-muted flex h-14 w-14 items-center justify-center rounded-md border p-2">
115
- {faviconUrl ? (
116
- <img src={faviconUrl} alt="Favicon preview" className="h-8 w-8 object-contain" />
117
- ) : (
118
- <span className="text-muted-foreground text-xs">None</span>
119
- )}
108
+ <img
109
+ src={faviconUrl ?? DEFAULT_PRENTA_FAVICON_DATA_URI}
110
+ alt="Favicon preview"
111
+ className="h-8 w-8 object-contain"
112
+ />
120
113
  </div>
121
114
  </PreviewTile>
122
115
  </div>
@@ -10,8 +10,9 @@ import {
10
10
  Trash2,
11
11
  Upload,
12
12
  } from 'lucide-react'
13
- import { useRef, useState } from 'react'
13
+ import { useRef, useState, type ReactNode } from 'react'
14
14
 
15
+ import { PrentaBrandLogo, PrentaMark } from '../../assets/prenta-logo.js'
15
16
  import { MediaPickerModal } from '../../components/MediaPickerModal.js'
16
17
  import { SettingsCard, SettingsControlRow, SettingsSubsection } from './components.js'
17
18
  import {
@@ -38,6 +39,7 @@ function LogoField({
38
39
  accept,
39
40
  square,
40
41
  darkSurface,
42
+ placeholder,
41
43
  brand,
42
44
  assets,
43
45
  uploadingField,
@@ -53,6 +55,7 @@ function LogoField({
53
55
  accept: string
54
56
  square?: boolean
55
57
  darkSurface?: boolean
58
+ placeholder?: ReactNode
56
59
  brand: UseAppearanceSettings['brand']
57
60
  assets: UseAppearanceSettings['assets']
58
61
  uploadingField: BrandAssetField | null
@@ -88,6 +91,8 @@ function LogoField({
88
91
  className="max-h-full max-w-full object-contain"
89
92
  onError={() => setThumbErrorUrl(asset!.url)}
90
93
  />
94
+ ) : placeholder ? (
95
+ placeholder
91
96
  ) : (
92
97
  <ImageIcon size={18} className="text-muted-foreground" aria-hidden="true" />
93
98
  )}
@@ -255,6 +260,12 @@ export function BrandingCard({ s, canEdit }: { s: UseAppearanceSettings; canEdit
255
260
  label="Primary logo"
256
261
  helper="SVG, PNG, WebP, JPEG, GIF, or AVIF, up to 1MB. Best for the public header and full admin sidebar."
257
262
  field="publicPrimaryLogoAssetId"
263
+ placeholder={
264
+ <PrentaBrandLogo
265
+ decorative
266
+ className="text-muted-foreground max-h-full max-w-full opacity-60"
267
+ />
268
+ }
258
269
  warning={warningFor('publicPrimaryLogoAssetId')}
259
270
  {...logoFieldProps}
260
271
  />
@@ -264,6 +275,12 @@ export function BrandingCard({ s, canEdit }: { s: UseAppearanceSettings; canEdit
264
275
  helper="32×32 SVG, PNG, or WebP. A larger square image is fine — it scales down cleanly."
265
276
  field="faviconSourceAssetId"
266
277
  square
278
+ placeholder={
279
+ <PrentaMark
280
+ decorative
281
+ className="text-muted-foreground max-h-full max-w-full opacity-60"
282
+ />
283
+ }
267
284
  warning={warningFor('faviconSourceAssetId')}
268
285
  {...logoFieldProps}
269
286
  accept={FAVICON_ACCEPT}
@@ -1,12 +1,13 @@
1
1
  'use client'
2
2
 
3
3
  import * as Tabs from '@radix-ui/react-tabs'
4
- import { Copy, Loader2 } from 'lucide-react'
5
- import { useEffect, useState } from 'react'
4
+ import { Copy, Loader2, Plus, Trash2 } from 'lucide-react'
5
+ import { useEffect, useState, type FormEvent } from 'react'
6
6
  import { toast } from 'sonner'
7
7
 
8
+ import { Switch } from '../../components/ui/Toggle.js'
8
9
  import { cmsApi } from '../../lib/api.js'
9
- import { SettingsCard } from './components.js'
10
+ import { SettingsCard, SettingsControlRow } from './components.js'
10
11
  import { mcpClientGuides, type McpClientGuide, type McpClientId } from './mcp-connect.js'
11
12
 
12
13
  type Grant = {
@@ -16,6 +17,38 @@ type Grant = {
16
17
  revokedAt: string | null
17
18
  }
18
19
 
20
+ type TrustedClientEntry = {
21
+ value: string
22
+ source: 'config' | 'settings'
23
+ }
24
+
25
+ type McpSettingsData = {
26
+ autoApproveReconnect: boolean
27
+ autoApproveReconnectFromConfig: boolean
28
+ trustedClients: TrustedClientEntry[]
29
+ }
30
+
31
+ function isClientMatchedByTrusted(clientId: string, entries: TrustedClientEntry[]): boolean {
32
+ let clientOrigin = ''
33
+ try {
34
+ clientOrigin = new URL(clientId).origin
35
+ } catch {
36
+ return false
37
+ }
38
+ const normalizedClient = clientId.replace(/\/+$/, '')
39
+ return entries.some((entry) => {
40
+ try {
41
+ const entryUrl = new URL(entry.value)
42
+ if (entryUrl.pathname === '/' && entry.value === entryUrl.origin) {
43
+ return clientOrigin === entryUrl.origin
44
+ }
45
+ return normalizedClient === entry.value
46
+ } catch {
47
+ return false
48
+ }
49
+ })
50
+ }
51
+
19
52
  async function copyText(value: string, label: string) {
20
53
  try {
21
54
  await navigator.clipboard.writeText(value)
@@ -92,11 +125,25 @@ function ClientPanel({ guide, onCreateKey }: { guide: McpClientGuide; onCreateKe
92
125
  * there" setup other site builders use. The URL comes from the server so the
93
126
  * Host header is never trusted.
94
127
  */
95
- export function McpConnectTab({ onNavigate }: { onNavigate?: (path: string) => void }) {
128
+ export function McpConnectTab({
129
+ onNavigate,
130
+ role,
131
+ }: {
132
+ onNavigate?: (path: string) => void
133
+ role?: string
134
+ }) {
135
+ const canManage = role === 'SUPER_ADMIN' || role === 'ADMIN'
96
136
  const [mcpUrl, setMcpUrl] = useState('')
97
137
  const [loadError, setLoadError] = useState<string | null>(null)
98
138
  const [loading, setLoading] = useState(true)
99
139
  const [grants, setGrants] = useState<Grant[]>([])
140
+ const [settings, setSettings] = useState<McpSettingsData>({
141
+ autoApproveReconnect: true,
142
+ autoApproveReconnectFromConfig: false,
143
+ trustedClients: [],
144
+ })
145
+ const [newTrustedInput, setNewTrustedInput] = useState('')
146
+ const [savingSettings, setSavingSettings] = useState(false)
100
147
  const [client, setClient] = useState<McpClientId>('claude-code')
101
148
 
102
149
  function loadGrants() {
@@ -105,6 +152,12 @@ export function McpConnectTab({ onNavigate }: { onNavigate?: (path: string) => v
105
152
  })
106
153
  }
107
154
 
155
+ function loadSettings() {
156
+ void cmsApi<McpSettingsData>('/mcp/oauth/settings').then((res) => {
157
+ if (res.data) setSettings(res.data)
158
+ })
159
+ }
160
+
108
161
  useEffect(() => {
109
162
  let cancelled = false
110
163
  void cmsApi<{ mcpUrl: string }>('/mcp/oauth/setup').then((res) => {
@@ -119,11 +172,64 @@ export function McpConnectTab({ onNavigate }: { onNavigate?: (path: string) => v
119
172
  setMcpUrl(res.data.mcpUrl)
120
173
  })
121
174
  loadGrants()
175
+ loadSettings()
122
176
  return () => {
123
177
  cancelled = true
124
178
  }
125
179
  }, [])
126
180
 
181
+ async function persistMcpSettings(nextReconnect: boolean, nextDbTrusted: string[]) {
182
+ setSavingSettings(true)
183
+ const res = await cmsApi<McpSettingsData>('/mcp/oauth/settings', {
184
+ method: 'PUT',
185
+ body: JSON.stringify({
186
+ autoApproveReconnect: nextReconnect,
187
+ trustedClients: nextDbTrusted,
188
+ }),
189
+ })
190
+ setSavingSettings(false)
191
+ if (res.error || !res.data) {
192
+ toast.error(res.error ?? 'Could not save MCP settings')
193
+ return false
194
+ }
195
+ setSettings(res.data)
196
+ toast.success('MCP settings saved')
197
+ return true
198
+ }
199
+
200
+ function dbTrustedValues(): string[] {
201
+ return settings.trustedClients.filter((e) => e.source === 'settings').map((e) => e.value)
202
+ }
203
+
204
+ async function handleToggleReconnect(next: boolean) {
205
+ if (!canManage || savingSettings) return
206
+ await persistMcpSettings(next, dbTrustedValues())
207
+ }
208
+
209
+ async function handleAddTrusted(e: FormEvent) {
210
+ e.preventDefault()
211
+ const trimmed = newTrustedInput.trim()
212
+ if (!trimmed || !canManage || savingSettings) return
213
+ const ok = await persistMcpSettings(settings.autoApproveReconnect, [
214
+ ...dbTrustedValues(),
215
+ trimmed,
216
+ ])
217
+ if (ok) setNewTrustedInput('')
218
+ }
219
+
220
+ async function handleRemoveTrusted(value: string) {
221
+ if (!canManage || savingSettings) return
222
+ await persistMcpSettings(
223
+ settings.autoApproveReconnect,
224
+ dbTrustedValues().filter((v) => v !== value),
225
+ )
226
+ }
227
+
228
+ async function handleTrustConnectedClient(clientId: string) {
229
+ if (!canManage || savingSettings) return
230
+ await persistMcpSettings(settings.autoApproveReconnect, [...dbTrustedValues(), clientId])
231
+ }
232
+
127
233
  async function revoke(id: string) {
128
234
  const res = await cmsApi<{ note: string }>(`/mcp/oauth/grants/${encodeURIComponent(id)}`, {
129
235
  method: 'DELETE',
@@ -185,6 +291,93 @@ export function McpConnectTab({ onNavigate }: { onNavigate?: (path: string) => v
185
291
  </Tabs.Root>
186
292
  )}
187
293
 
294
+ <SettingsCard
295
+ title="Auto-approve"
296
+ description="Skip the manual Allow click for reconnects or explicitly trusted HTTPS client origins and CIMD URLs."
297
+ >
298
+ <div className="space-y-5">
299
+ <SettingsControlRow
300
+ label="Auto-approve reconnects"
301
+ description={
302
+ settings.autoApproveReconnectFromConfig
303
+ ? 'Managed in prenta.config.ts (mcp.autoApproveReconnect).'
304
+ : 'Automatically allow an app when you have already approved it and have not revoked its access.'
305
+ }
306
+ control={
307
+ <Switch
308
+ aria-label="Auto-approve reconnects"
309
+ checked={settings.autoApproveReconnect}
310
+ disabled={!canManage || savingSettings || settings.autoApproveReconnectFromConfig}
311
+ onCheckedChange={(checked) => void handleToggleReconnect(checked)}
312
+ />
313
+ }
314
+ />
315
+
316
+ <div className="border-border space-y-3 border-t pt-4">
317
+ <div>
318
+ <h3 className="text-foreground text-sm font-medium">Trusted clients</h3>
319
+ <p className="text-muted-foreground mt-0.5 text-xs">
320
+ Enter an HTTPS origin (e.g. <span className="font-mono">https://claude.ai</span>) or
321
+ an exact client metadata URL to grant editorial access without a consent click.
322
+ </p>
323
+ </div>
324
+
325
+ {settings.trustedClients.length === 0 ? (
326
+ <p className="text-muted-foreground text-sm">No trusted clients configured.</p>
327
+ ) : (
328
+ <ul className="space-y-2">
329
+ {settings.trustedClients.map((entry) => (
330
+ <li
331
+ key={`${entry.source}:${entry.value}`}
332
+ className="border-border flex items-center justify-between gap-3 rounded-md border px-3 py-2 text-sm"
333
+ >
334
+ <span className="min-w-0 truncate font-mono text-xs">{entry.value}</span>
335
+ {entry.source === 'config' ? (
336
+ <span className="bg-muted text-muted-foreground shrink-0 rounded px-2 py-0.5 text-xs font-medium whitespace-nowrap">
337
+ Config
338
+ </span>
339
+ ) : canManage ? (
340
+ <button
341
+ type="button"
342
+ disabled={savingSettings}
343
+ aria-label={`Remove ${entry.value}`}
344
+ onClick={() => void handleRemoveTrusted(entry.value)}
345
+ className="text-muted-foreground hover:text-destructive inline-flex shrink-0 items-center gap-1 text-xs font-medium disabled:opacity-50"
346
+ >
347
+ <Trash2 size={13} aria-hidden="true" />
348
+ Remove
349
+ </button>
350
+ ) : null}
351
+ </li>
352
+ ))}
353
+ </ul>
354
+ )}
355
+
356
+ {canManage && (
357
+ <form onSubmit={(e) => void handleAddTrusted(e)} className="flex flex-wrap gap-2">
358
+ <input
359
+ type="url"
360
+ value={newTrustedInput}
361
+ onChange={(e) => setNewTrustedInput(e.target.value)}
362
+ placeholder="https://claude.ai"
363
+ aria-label="Trusted client HTTPS URL"
364
+ disabled={savingSettings}
365
+ className="border-border bg-input-background text-foreground focus-visible:ring-ring min-w-[240px] flex-1 rounded-md border px-3 py-1.5 font-mono text-xs focus-visible:ring-2 focus-visible:outline-none disabled:opacity-50"
366
+ />
367
+ <button
368
+ type="submit"
369
+ disabled={!newTrustedInput.trim() || savingSettings}
370
+ className="border-border text-foreground hover:bg-accent inline-flex items-center gap-1.5 rounded-md border px-3 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50"
371
+ >
372
+ <Plus size={14} aria-hidden="true" />
373
+ Add trusted client
374
+ </button>
375
+ </form>
376
+ )}
377
+ </div>
378
+ </div>
379
+ </SettingsCard>
380
+
188
381
  <SettingsCard
189
382
  title="Connected apps"
190
383
  description="Revoke stops new requests immediately. An access token already issued can keep working for up to 15 minutes."
@@ -193,18 +386,41 @@ export function McpConnectTab({ onNavigate }: { onNavigate?: (path: string) => v
193
386
  <p className="text-muted-foreground text-sm">No apps connected yet.</p>
194
387
  ) : (
195
388
  <ul className="space-y-2">
196
- {grants.map((grant) => (
197
- <li key={grant.id} className="flex items-center justify-between gap-3 text-sm">
198
- <span className="min-w-0 truncate">{grant.clientId}</span>
199
- <button
200
- type="button"
201
- className="text-destructive focus-visible:ring-ring shrink-0 font-medium hover:underline focus-visible:ring-2 focus-visible:outline-none"
202
- onClick={() => void revoke(grant.id)}
203
- >
204
- Revoke
205
- </button>
206
- </li>
207
- ))}
389
+ {grants.map((grant) => {
390
+ const alreadyTrusted = isClientMatchedByTrusted(
391
+ grant.clientId,
392
+ settings.trustedClients,
393
+ )
394
+ return (
395
+ <li key={grant.id} className="flex items-center justify-between gap-3 text-sm">
396
+ <span className="min-w-0 truncate font-mono text-xs">{grant.clientId}</span>
397
+ <div className="flex shrink-0 items-center gap-3">
398
+ {alreadyTrusted ? (
399
+ <span className="bg-muted text-muted-foreground rounded px-2 py-0.5 text-xs font-medium whitespace-nowrap">
400
+ Trusted
401
+ </span>
402
+ ) : canManage ? (
403
+ <button
404
+ type="button"
405
+ disabled={savingSettings}
406
+ aria-label={`Trust ${grant.clientId}`}
407
+ onClick={() => void handleTrustConnectedClient(grant.clientId)}
408
+ className="text-primary focus-visible:ring-ring font-medium hover:underline focus-visible:ring-2 focus-visible:outline-none disabled:opacity-50"
409
+ >
410
+ Trust
411
+ </button>
412
+ ) : null}
413
+ <button
414
+ type="button"
415
+ className="text-destructive focus-visible:ring-ring font-medium hover:underline focus-visible:ring-2 focus-visible:outline-none"
416
+ onClick={() => void revoke(grant.id)}
417
+ >
418
+ Revoke
419
+ </button>
420
+ </div>
421
+ </li>
422
+ )
423
+ })}
208
424
  </ul>
209
425
  )}
210
426
  </SettingsCard>
@@ -1,17 +0,0 @@
1
- /**
2
- * Neutral "logo goes here" placeholder shown when no brand logo has been
3
- * uploaded or configured. Deliberately reads as an empty slot — a dashed
4
- * outline with a muted image icon — rather than a filled initials badge, which
5
- * looks like a user avatar (the real account avatar already lives top-right).
6
- *
7
- * It is automatically superseded the moment a logo is set in Settings →
8
- * Appearance, since every logo branch takes precedence over this fallback.
9
- */
10
- export interface LogoPlaceholderProps {
11
- /** Color treatment so the slot blends with its surface. */
12
- tone: 'sidebar' | 'login';
13
- /** Brand/site name rendered beside the slot (expanded sidebar only). */
14
- label?: string;
15
- }
16
- export declare function LogoPlaceholder({ tone, label }: LogoPlaceholderProps): import("react/jsx-runtime").JSX.Element;
17
- //# sourceMappingURL=LogoPlaceholder.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LogoPlaceholder.d.ts","sourceRoot":"","sources":["../../src/components/LogoPlaceholder.tsx"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AACH,MAAM,WAAW,oBAAoB;IACnC,2DAA2D;IAC3D,IAAI,EAAE,SAAS,GAAG,OAAO,CAAA;IACzB,wEAAwE;IACxE,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,wBAAgB,eAAe,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,oBAAoB,2CAkCpE"}
@@ -1,13 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { ImagePlus } from 'lucide-react';
4
- export function LogoPlaceholder({ tone, label }) {
5
- if (tone === 'login') {
6
- return (_jsx("span", { role: "img", "aria-label": "Logo placeholder", title: "Add a logo in Settings \u2192 Appearance", className: "border-border text-muted-foreground mx-auto mb-4 flex h-14 w-14 items-center justify-center rounded-lg border border-dashed", children: _jsx(ImagePlus, { className: "h-6 w-6", "aria-hidden": "true" }) }));
7
- }
8
- const slot = (_jsx("span", { className: "border-sidebar-border text-sidebar-foreground/50 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-dashed", role: label ? undefined : 'img', "aria-hidden": label ? true : undefined, "aria-label": label ? undefined : 'Logo placeholder', title: "Add a logo in Settings \u2192 Appearance", children: _jsx(ImagePlus, { size: 16, "aria-hidden": "true" }) }));
9
- if (!label)
10
- return slot;
11
- return (_jsxs("div", { className: "flex min-w-0 items-center gap-2.5", children: [slot, _jsx("span", { className: "text-sidebar-foreground truncate text-sm font-medium", children: label })] }));
12
- }
13
- //# sourceMappingURL=LogoPlaceholder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LogoPlaceholder.js","sourceRoot":"","sources":["../../src/components/LogoPlaceholder.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAkBxC,MAAM,UAAU,eAAe,CAAC,EAAE,IAAI,EAAE,KAAK,EAAwB;IACnE,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QACrB,OAAO,CACL,eACE,IAAI,EAAC,KAAK,gBACC,kBAAkB,EAC7B,KAAK,EAAC,0CAAqC,EAC3C,SAAS,EAAC,6HAA6H,YAEvI,KAAC,SAAS,IAAC,SAAS,EAAC,SAAS,iBAAa,MAAM,GAAG,GAC/C,CACR,CAAA;IACH,CAAC;IAED,MAAM,IAAI,GAAG,CACX,eACE,SAAS,EAAC,2IAA2I,EACrJ,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,iBAClB,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,gBACzB,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,kBAAkB,EAClD,KAAK,EAAC,0CAAqC,YAE3C,KAAC,SAAS,IAAC,IAAI,EAAE,EAAE,iBAAc,MAAM,GAAG,GACrC,CACR,CAAA;IAED,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAA;IAEvB,OAAO,CACL,eAAK,SAAS,EAAC,mCAAmC,aAC/C,IAAI,EACL,eAAM,SAAS,EAAC,sDAAsD,YAAE,KAAK,GAAQ,IACjF,CACP,CAAA;AACH,CAAC"}
@@ -1,55 +0,0 @@
1
- 'use client'
2
-
3
- import { ImagePlus } from 'lucide-react'
4
-
5
- /**
6
- * Neutral "logo goes here" placeholder shown when no brand logo has been
7
- * uploaded or configured. Deliberately reads as an empty slot — a dashed
8
- * outline with a muted image icon — rather than a filled initials badge, which
9
- * looks like a user avatar (the real account avatar already lives top-right).
10
- *
11
- * It is automatically superseded the moment a logo is set in Settings →
12
- * Appearance, since every logo branch takes precedence over this fallback.
13
- */
14
- export interface LogoPlaceholderProps {
15
- /** Color treatment so the slot blends with its surface. */
16
- tone: 'sidebar' | 'login'
17
- /** Brand/site name rendered beside the slot (expanded sidebar only). */
18
- label?: string
19
- }
20
-
21
- export function LogoPlaceholder({ tone, label }: LogoPlaceholderProps) {
22
- if (tone === 'login') {
23
- return (
24
- <span
25
- role="img"
26
- aria-label="Logo placeholder"
27
- title="Add a logo in Settings → Appearance"
28
- className="border-border text-muted-foreground mx-auto mb-4 flex h-14 w-14 items-center justify-center rounded-lg border border-dashed"
29
- >
30
- <ImagePlus className="h-6 w-6" aria-hidden="true" />
31
- </span>
32
- )
33
- }
34
-
35
- const slot = (
36
- <span
37
- className="border-sidebar-border text-sidebar-foreground/50 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-dashed"
38
- role={label ? undefined : 'img'}
39
- aria-hidden={label ? true : undefined}
40
- aria-label={label ? undefined : 'Logo placeholder'}
41
- title="Add a logo in Settings → Appearance"
42
- >
43
- <ImagePlus size={16} aria-hidden="true" />
44
- </span>
45
- )
46
-
47
- if (!label) return slot
48
-
49
- return (
50
- <div className="flex min-w-0 items-center gap-2.5">
51
- {slot}
52
- <span className="text-sidebar-foreground truncate text-sm font-medium">{label}</span>
53
- </div>
54
- )
55
- }