@shellui/core 0.3.0 → 0.4.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 (75) hide show
  1. package/package.json +2 -2
  2. package/src/app.tsx +31 -3
  3. package/src/components/ui/dialog.tsx +26 -6
  4. package/src/components/ui/sonner.tsx +9 -5
  5. package/src/features/admin/AdminView.tsx +5 -49
  6. package/src/features/admin/config.ts +15 -0
  7. package/src/features/admin/index.ts +4 -0
  8. package/src/features/admin/routes.tsx +14 -0
  9. package/src/features/admin/utils.ts +79 -0
  10. package/src/features/auth/AuthProvider.tsx +68 -13
  11. package/src/features/auth/backends/shellui.ts +8 -1
  12. package/src/features/auth/components/AccessPendingView.tsx +112 -0
  13. package/src/features/auth/components/LoginButton.tsx +5 -10
  14. package/src/features/auth/components/LoginView.tsx +20 -2
  15. package/src/features/auth/components/OAuthCallbackView.tsx +211 -50
  16. package/src/features/auth/hooks/useAuth.tsx +8 -1
  17. package/src/features/auth/utils/authRequestError.spec.ts +52 -0
  18. package/src/features/auth/utils/authRequestError.ts +45 -0
  19. package/src/features/auth/utils/buildAuthUrlWithNext.spec.ts +18 -0
  20. package/src/features/auth/utils/buildAuthUrlWithNext.ts +12 -0
  21. package/src/features/auth/utils/index.ts +8 -0
  22. package/src/features/auth/utils/isTokenAutoRefreshDisabled.spec.ts +71 -0
  23. package/src/features/auth/utils/isTokenAutoRefreshDisabled.ts +18 -0
  24. package/src/features/config/ConfigProvider.ts +1 -1
  25. package/src/features/config/types.ts +46 -5
  26. package/src/features/layouts/AppLayout.tsx +3 -3
  27. package/src/features/layouts/OverlayShell.tsx +17 -28
  28. package/src/features/layouts/resolveSdkNavigatePath.spec.ts +55 -0
  29. package/src/features/layouts/resolveSdkNavigatePath.ts +68 -0
  30. package/src/features/settings/SettingsIcons.tsx +35 -0
  31. package/src/features/settings/SettingsProvider.tsx +79 -10
  32. package/src/features/settings/SettingsRoutes.tsx +14 -6
  33. package/src/features/settings/SettingsView.tsx +11 -5
  34. package/src/features/settings/components/Advanced.tsx +117 -44
  35. package/src/features/settings/components/Develop.tsx +38 -0
  36. package/src/features/settings/components/ServiceWorker.tsx +52 -25
  37. package/src/features/settings/components/Storage.tsx +138 -0
  38. package/src/features/settings/components/UpdateApp.tsx +1 -1
  39. package/src/features/settings/components/develop/StoragePickerTestButtons.tsx +148 -0
  40. package/src/features/settings/components/develop/UploadToastTestButton.tsx +29 -0
  41. package/src/features/settings/utils/buildSettingsForPropagation.spec.ts +55 -1
  42. package/src/features/settings/utils/buildSettingsForPropagation.ts +34 -0
  43. package/src/features/settings/utils/mergePreferencesIntoSettings.spec.ts +1 -1
  44. package/src/features/settings/utils/toSettingsUser.spec.ts +4 -0
  45. package/src/features/settings/utils/toSettingsUser.ts +2 -0
  46. package/src/features/sonner/SonnerContext.tsx +44 -60
  47. package/src/features/storage/StorageBridge.tsx +50 -0
  48. package/src/features/storage/StoragePickerContext.tsx +214 -0
  49. package/src/features/storage/api.spec.ts +303 -0
  50. package/src/features/storage/api.ts +414 -0
  51. package/src/features/storage/handleRequest.spec.ts +88 -0
  52. package/src/features/storage/handleRequest.ts +53 -0
  53. package/src/features/storage/quota.spec.ts +151 -0
  54. package/src/features/storage/quota.ts +104 -0
  55. package/src/features/storage/uploads/UploadToastCard.tsx +442 -0
  56. package/src/features/storage/uploads/UploadToaster.tsx +41 -0
  57. package/src/features/storage/uploads/handleTrackedUpload.spec.ts +170 -0
  58. package/src/features/storage/uploads/handleTrackedUpload.ts +97 -0
  59. package/src/features/storage/uploads/types.ts +24 -0
  60. package/src/features/storage/uploads/uploadQueue.spec.ts +118 -0
  61. package/src/features/storage/uploads/uploadQueue.ts +349 -0
  62. package/src/features/storage/uploads/useUploadQueue.ts +30 -0
  63. package/src/i18n/translations/en/common.json +33 -0
  64. package/src/i18n/translations/en/settings.json +56 -4
  65. package/src/i18n/translations/fr/common.json +33 -0
  66. package/src/i18n/translations/fr/settings.json +56 -4
  67. package/src/index.css +2 -1
  68. package/src/index.ts +2 -0
  69. package/src/lib/z-index.ts +9 -3
  70. package/src/routes/components/NavigationItemRoute.tsx +2 -1
  71. package/src/routes/routes.tsx +2 -13
  72. package/src/service-worker/register.ts +217 -101
  73. package/src/service-worker/sw-dev.ts +5 -1
  74. package/src/service-worker/sw.ts +5 -1
  75. package/src/shellui-target.d.ts +2 -0
@@ -10,6 +10,7 @@ import { SettingsContext } from './SettingsContext';
10
10
  import { useConfig } from '../config/useConfig';
11
11
  import type { NavigationItem } from '../config/types';
12
12
  import { useAuth } from '../auth/hooks/useAuth';
13
+ import { isAdminFrame } from '../admin/utils';
13
14
  import { defaultTheme } from '../theme/themes';
14
15
  import {
15
16
  buildSettingsForPropagation,
@@ -19,6 +20,7 @@ import {
19
20
  mergePreferencesIntoSettings,
20
21
  toSettingsUser,
21
22
  } from './utils';
23
+ import { unregisterServiceWorker } from '../../service-worker/register';
22
24
 
23
25
  const logger = getLogger('shellcore');
24
26
 
@@ -88,6 +90,7 @@ const defaultAppearance: Appearance = {
88
90
  const defaultSettings: Settings = {
89
91
  developerFeatures: {
90
92
  enabled: false,
93
+ disableTokenAutoRefresh: false,
91
94
  },
92
95
  errorReporting: {
93
96
  enabled: true,
@@ -110,7 +113,7 @@ const defaultSettings: Settings = {
110
113
  consentedCookieHosts: [],
111
114
  },
112
115
  serviceWorker: {
113
- enabled: true,
116
+ enabled: false,
114
117
  },
115
118
  user: null,
116
119
  accessToken: null,
@@ -151,6 +154,13 @@ export function SettingsProvider({ children }: { children: ReactNode }) {
151
154
  ...parsed.logging?.namespaces,
152
155
  },
153
156
  },
157
+ developerFeatures: {
158
+ enabled:
159
+ parsed.developerFeatures?.enabled ?? defaultSettings.developerFeatures.enabled,
160
+ disableTokenAutoRefresh:
161
+ parsed.developerFeatures?.disableTokenAutoRefresh ??
162
+ defaultSettings.developerFeatures.disableTokenAutoRefresh,
163
+ },
154
164
  appearance: {
155
165
  ...defaultAppearance,
156
166
  ...parsed.appearance,
@@ -179,8 +189,8 @@ export function SettingsProvider({ children }: { children: ReactNode }) {
179
189
  : (defaultSettings.cookieConsent?.consentedCookieHosts ?? []),
180
190
  },
181
191
  serviceWorker: {
182
- // Migrate from legacy "caching" key if present
183
- enabled: parsed.serviceWorker?.enabled ?? parsed.caching?.enabled ?? true,
192
+ // Migrate from legacy "caching" key if present; default off for new installs
193
+ enabled: parsed.serviceWorker?.enabled ?? parsed.caching?.enabled ?? false,
184
194
  },
185
195
  user: parsed.user ?? null,
186
196
  accessToken: null,
@@ -206,28 +216,47 @@ export function SettingsProvider({ children }: { children: ReactNode }) {
206
216
 
207
217
  const isTrustedFrameForAuthToken = useCallback(
208
218
  (frameSrc: string): boolean => {
209
- const adminUrl = config?.backend?.adminUrl?.trim();
210
- if (adminUrl && isFrameForNavigationItem(frameSrc, adminUrl)) {
219
+ if (isAdminFrame(frameSrc, config)) {
220
+ return true;
221
+ }
222
+ // Trust admin-panel iframe apps (navigation + storage files explorer / viewer modals).
223
+ const adminNavItems = config?.administration?.navigation ?? [];
224
+ if (
225
+ adminNavItems.some(
226
+ (item) =>
227
+ item.openIn !== 'external' &&
228
+ Boolean(item.url?.trim()) &&
229
+ isFrameForNavigationItem(frameSrc, item.url),
230
+ )
231
+ ) {
232
+ return true;
233
+ }
234
+ const filesUrl = config?.storage?.filesUrl?.trim();
235
+ if (filesUrl && isFrameForNavigationItem(frameSrc, filesUrl)) {
211
236
  return true;
212
237
  }
213
238
  return navigationItems.some(
214
239
  (item) => item.safeForAuthToken !== false && isFrameForNavigationItem(frameSrc, item.url),
215
240
  );
216
241
  },
217
- [config?.backend?.adminUrl, navigationItems],
242
+ [config, navigationItems],
218
243
  );
219
244
 
245
+ const accessTokenRef = useRef<string | null>(session?.accessToken ?? null);
246
+ accessTokenRef.current = session?.accessToken ?? null;
247
+
220
248
  const propagateSettingsToIframes = useCallback(
221
249
  (baseSettings: Settings) => {
222
250
  const iframes = shellui.frameRegistry.getAllIframes();
223
251
  if (iframes.length === 0) return;
224
252
  const lang = baseSettings.language?.code || 'en';
253
+ const accessToken = accessTokenRef.current;
225
254
  for (const [uuid, iframe] of iframes) {
226
255
  const frameSrc = iframe?.src ?? '';
227
256
  const includeAuthAccessToken = isTrustedFrameForAuthToken(frameSrc);
228
257
  const settingsToPropagate = buildSettingsForPropagation(baseSettings, config, lang, {
229
258
  includeAuthAccessToken,
230
- accessToken: session?.accessToken ?? null,
259
+ accessToken,
231
260
  });
232
261
  shellui.sendMessage({
233
262
  type: 'SHELLUI_SETTINGS',
@@ -236,7 +265,24 @@ export function SettingsProvider({ children }: { children: ReactNode }) {
236
265
  });
237
266
  }
238
267
  },
239
- [config, isTrustedFrameForAuthToken, session?.accessToken],
268
+ [config, isTrustedFrameForAuthToken],
269
+ );
270
+
271
+ const pushSettingsToFrame = useCallback(
272
+ (iframeUuid: string, frameSrc: string, baseSettings: Settings) => {
273
+ const lang = baseSettings.language?.code || 'en';
274
+ const includeAuthAccessToken = isTrustedFrameForAuthToken(frameSrc);
275
+ const settingsToPropagate = buildSettingsForPropagation(baseSettings, config, lang, {
276
+ includeAuthAccessToken,
277
+ accessToken: accessTokenRef.current,
278
+ });
279
+ shellui.sendMessage({
280
+ type: 'SHELLUI_SETTINGS',
281
+ payload: { settings: settingsToPropagate },
282
+ to: [iframeUuid],
283
+ });
284
+ },
285
+ [config, isTrustedFrameForAuthToken],
240
286
  );
241
287
 
242
288
  // When the shell rotates the JWT, `authUser` often does not change, so the user-sync effect
@@ -430,7 +476,7 @@ export function SettingsProvider({ children }: { children: ReactNode }) {
430
476
  : false;
431
477
  const settingsToPropagate = buildSettingsForPropagation(currentSettings, config, lang, {
432
478
  includeAuthAccessToken,
433
- accessToken: session?.accessToken ?? null,
479
+ accessToken: accessTokenRef.current,
434
480
  });
435
481
 
436
482
  // Route through the full parent -> child -> ... -> requester path so deep descendants
@@ -468,12 +514,32 @@ export function SettingsProvider({ children }: { children: ReactNode }) {
468
514
  },
469
515
  );
470
516
 
517
+ // After an iframe finishes SDK init, re-push current settings (incl. rotated JWT).
518
+ // Covers races where the frame registered after a refresh broadcast, or remounted.
519
+ const cleanupInitialized = shellui.addMessageListener(
520
+ 'SHELLUI_INITIALIZED',
521
+ (_message: ShellUIMessage, event: MessageEvent) => {
522
+ if (typeof window === 'undefined' || window.parent !== window) {
523
+ return;
524
+ }
525
+ const source = event.source;
526
+ if (!source) return;
527
+ const match = shellui.frameRegistry
528
+ .getAllIframes()
529
+ .find(([, iframe]) => iframe?.contentWindow === source);
530
+ if (!match) return;
531
+ const [iframeUuid, iframe] = match;
532
+ pushSettingsToFrame(iframeUuid, iframe?.src ?? '', settingsRef.current ?? defaultSettings);
533
+ },
534
+ );
535
+
471
536
  return () => {
472
537
  cleanup();
473
538
  cleanupSettings();
474
539
  cleanupSettingsRequested();
540
+ cleanupInitialized();
475
541
  };
476
- }, [config, isTrustedFrameForAuthToken, propagateSettingsToIframes, session?.accessToken]);
542
+ }, [config, isTrustedFrameForAuthToken, propagateSettingsToIframes, pushSettingsToFrame]);
477
543
 
478
544
  useEffect(() => {
479
545
  if (
@@ -576,6 +642,9 @@ export function SettingsProvider({ children }: { children: ReactNode }) {
576
642
  }
577
643
  keysToRemove.forEach((key) => localStorage.removeItem(key));
578
644
 
645
+ // Stop any active service worker after reset (default is disabled)
646
+ void unregisterServiceWorker();
647
+
579
648
  // Reset settings to defaults
580
649
  const newSettings = defaultSettings;
581
650
  settingsRef.current = newSettings;
@@ -7,6 +7,7 @@ import {
7
7
  FileTextIcon,
8
8
  PackageIcon,
9
9
  RefreshDoubleIcon,
10
+ HardDriveIcon,
10
11
  } from './SettingsIcons';
11
12
  import { Appearance } from './components/Appearance';
12
13
  import { LanguageAndRegion } from './components/LanguageAndRegion';
@@ -16,6 +17,7 @@ import { Develop } from './components/Develop';
16
17
  import { DataPrivacy } from './components/DataPrivacy';
17
18
  import { ServiceWorker } from './components/ServiceWorker';
18
19
  import { LegalDocumentsPanel } from './components/LegalDocumentsPanel';
20
+ import { Storage } from './components/Storage';
19
21
  import { isTauri } from '../../service-worker/register';
20
22
 
21
23
  export const createSettingsRoutes = (t: (key: string) => string) => [
@@ -31,6 +33,18 @@ export const createSettingsRoutes = (t: (key: string) => string) => [
31
33
  path: 'language-and-region',
32
34
  element: <LanguageAndRegion />,
33
35
  },
36
+ {
37
+ name: t('routes.dataPrivacy'),
38
+ icon: ShieldIcon,
39
+ path: 'data-privacy',
40
+ element: <DataPrivacy />,
41
+ },
42
+ {
43
+ name: t('routes.storage'),
44
+ icon: HardDriveIcon,
45
+ path: 'storage',
46
+ element: <Storage />,
47
+ },
34
48
  {
35
49
  name: t('routes.updateApp'),
36
50
  icon: RefreshDoubleIcon,
@@ -43,12 +57,6 @@ export const createSettingsRoutes = (t: (key: string) => string) => [
43
57
  path: 'advanced',
44
58
  element: <Advanced />,
45
59
  },
46
- {
47
- name: t('routes.dataPrivacy'),
48
- icon: ShieldIcon,
49
- path: 'data-privacy',
50
- element: <DataPrivacy />,
51
- },
52
60
  {
53
61
  name: t('routes.legalDocuments'),
54
62
  icon: FileTextIcon,
@@ -32,13 +32,14 @@ import type { NavigationItem } from '../config/types';
32
32
  import { cn } from '../../lib/utils';
33
33
  import { useAuth } from '../auth/hooks/useAuth';
34
34
  import { getLegalDocuments } from '../legal/legalDocuments';
35
+ import { isStorageSettingsEnabled } from '../storage/quota';
35
36
 
36
37
  export const SettingsView = () => {
37
38
  const location = useLocation();
38
39
  const navigate = useNavigate();
39
40
  const { settings } = useSettings();
40
41
  const { config } = useConfig();
41
- const { user, session, logout } = useAuth();
42
+ const { user, session, logout, isAuthenticated } = useAuth();
42
43
  const { t, i18n } = useTranslation('settings');
43
44
  // Re-check isTauri after mount and after a short delay so we catch late-injected __TAURI__ in dev
44
45
  const [isTauriEnv, setIsTauriEnv] = useState(() => isTauri());
@@ -78,11 +79,15 @@ export const SettingsView = () => {
78
79
  }, [settings.developerFeatures.enabled, routesWithoutTauriSw]);
79
80
 
80
81
  const settingsNavRoutes = useMemo(() => {
81
- if (getLegalDocuments(config).length > 0) {
82
- return filteredRoutes;
82
+ let routes = filteredRoutes;
83
+ if (getLegalDocuments(config).length === 0) {
84
+ routes = routes.filter((route) => route.path !== 'legal-documents');
83
85
  }
84
- return filteredRoutes.filter((route) => route.path !== 'legal-documents');
85
- }, [filteredRoutes, config]);
86
+ if (!isStorageSettingsEnabled(config) || !isAuthenticated) {
87
+ routes = routes.filter((route) => route.path !== 'storage');
88
+ }
89
+ return routes;
90
+ }, [filteredRoutes, config, isAuthenticated]);
86
91
 
87
92
  // Application settings from navigation items with settings URL
88
93
  const applicationRoutes = useMemo(() => {
@@ -150,6 +155,7 @@ export const SettingsView = () => {
150
155
  ['appearance', 'language-and-region', 'data-privacy'].includes(route.path),
151
156
  ),
152
157
  ...userRoute,
158
+ ...settingsNavRoutes.filter((route) => route.path === 'storage'),
153
159
  ],
154
160
  },
155
161
  {
@@ -1,3 +1,4 @@
1
+ import { useState } from 'react';
1
2
  import { useTranslation } from 'react-i18next';
2
3
  import { Switch } from '../../../components/ui/switch';
3
4
  import { useConfig } from '../../config/useConfig';
@@ -6,6 +7,8 @@ import { useSettings } from '../hooks/useSettings';
6
7
  import { Button } from '../../../components/ui/button';
7
8
  import { shellui } from '@shellui/sdk';
8
9
  import { useCookieConsent } from '../../cookieConsent/useCookieConsent';
10
+ import { AlertTriangleIcon, ChevronDownIcon, CodeIcon } from '../SettingsIcons';
11
+ import { cn } from '../../../lib/utils';
9
12
 
10
13
  export const Advanced = () => {
11
14
  const { t } = useTranslation('settings');
@@ -13,6 +16,7 @@ export const Advanced = () => {
13
16
  const { settings, updateSetting, resetAllData } = useSettings();
14
17
  const errorReportingConfigured = Boolean(config?.sentry?.dsn);
15
18
  const { isAccepted: sentryConsentAccepted } = useCookieConsent('sentry.io');
19
+ const [dangerZoneOpen, setDangerZoneOpen] = useState(false);
16
20
 
17
21
  const handleErrorReportingChange = (checked: boolean) => {
18
22
  // Don't allow enabling if cookie consent hasn't been approved
@@ -84,58 +88,127 @@ export const Advanced = () => {
84
88
  )}
85
89
  </div>
86
90
 
87
- <div className="flex items-center justify-between">
88
- <div className="space-y-0.5">
89
- <label
90
- htmlFor="developer-features"
91
- className="text-sm font-medium leading-none"
92
- style={{ fontFamily: 'var(--heading-font-family, inherit)' }}
91
+ <div
92
+ className={cn(
93
+ 'rounded-lg border p-4 transition-colors',
94
+ settings.developerFeatures.enabled
95
+ ? 'border-primary/40 bg-primary/5'
96
+ : 'border-border bg-muted/30',
97
+ )}
98
+ >
99
+ <div className="flex items-start gap-3">
100
+ <div
101
+ className={cn(
102
+ 'flex h-10 w-10 shrink-0 items-center justify-center rounded-md',
103
+ settings.developerFeatures.enabled
104
+ ? 'bg-primary/15 text-primary'
105
+ : 'bg-muted text-muted-foreground',
106
+ )}
107
+ aria-hidden
93
108
  >
94
- {t('advanced.developerFeatures.label')}
95
- </label>
96
- <p className="text-sm text-muted-foreground">
97
- {t('advanced.developerFeatures.description')}
98
- </p>
109
+ <CodeIcon />
110
+ </div>
111
+ <div className="min-w-0 flex-1 space-y-3">
112
+ <div className="flex items-start justify-between gap-3">
113
+ <div className="space-y-1">
114
+ <div className="flex flex-wrap items-center gap-2">
115
+ <label
116
+ htmlFor="developer-features"
117
+ className="text-sm font-medium leading-none"
118
+ style={{ fontFamily: 'var(--heading-font-family, inherit)' }}
119
+ >
120
+ {t('advanced.developerFeatures.label')}
121
+ </label>
122
+ {settings.developerFeatures.enabled && (
123
+ <span className="rounded-full bg-primary/15 px-2 py-0.5 text-[11px] font-medium text-primary">
124
+ {t('advanced.developerFeatures.badge')}
125
+ </span>
126
+ )}
127
+ </div>
128
+ <p className="text-sm text-muted-foreground">
129
+ {t('advanced.developerFeatures.description')}
130
+ </p>
131
+ </div>
132
+ <Switch
133
+ id="developer-features"
134
+ checked={settings.developerFeatures.enabled}
135
+ onCheckedChange={(checked) =>
136
+ updateSetting('developerFeatures', { enabled: checked })
137
+ }
138
+ />
139
+ </div>
140
+ <div className="rounded-md border border-border/60 bg-background/60 px-3 py-2">
141
+ <p className="text-xs text-muted-foreground">
142
+ {settings.developerFeatures.enabled
143
+ ? t('advanced.developerFeatures.hintEnabled')
144
+ : t('advanced.developerFeatures.hintDisabled')}
145
+ </p>
146
+ </div>
147
+ </div>
99
148
  </div>
100
- <Switch
101
- id="developer-features"
102
- checked={settings.developerFeatures.enabled}
103
- onCheckedChange={(checked) => updateSetting('developerFeatures', { enabled: checked })}
104
- />
105
149
  </div>
106
150
 
107
- <div className="border-t pt-6 mt-6">
108
- <div className="space-y-4">
109
- <div className="space-y-0.5">
110
- <h3
111
- className="text-sm font-semibold leading-none text-destructive"
112
- style={{ fontFamily: 'var(--heading-font-family, inherit)' }}
151
+ <div className="mt-8">
152
+ <div className="rounded-lg border border-destructive/30 bg-destructive/5">
153
+ <button
154
+ type="button"
155
+ className="flex w-full cursor-pointer items-start gap-3 p-4 text-left"
156
+ aria-expanded={dangerZoneOpen}
157
+ onClick={() => setDangerZoneOpen((open) => !open)}
158
+ >
159
+ <div
160
+ className="flex h-10 w-10 shrink-0 items-center justify-center rounded-md bg-destructive/15 text-destructive"
161
+ aria-hidden
113
162
  >
114
- {t('advanced.dangerZone.title')}
115
- </h3>
116
- <p className="text-sm text-muted-foreground">{t('advanced.dangerZone.description')}</p>
117
- </div>
118
-
119
- <div className="space-y-2">
120
- <div className="space-y-0.5">
121
- <label
122
- className="text-sm font-medium leading-none"
123
- style={{ fontFamily: 'var(--heading-font-family, inherit)' }}
124
- >
125
- {t('advanced.dangerZone.reset.title')}
126
- </label>
163
+ <AlertTriangleIcon />
164
+ </div>
165
+ <div className="min-w-0 flex-1 space-y-1">
166
+ <div className="flex flex-wrap items-center gap-2">
167
+ <h3
168
+ className="text-sm font-semibold leading-none text-destructive"
169
+ style={{ fontFamily: 'var(--heading-font-family, inherit)' }}
170
+ >
171
+ {t('advanced.dangerZone.title')}
172
+ </h3>
173
+ <span className="rounded-full bg-destructive/15 px-2 py-0.5 text-[11px] font-medium text-destructive">
174
+ {t('advanced.dangerZone.badge')}
175
+ </span>
176
+ </div>
127
177
  <p className="text-sm text-muted-foreground">
128
- {t('advanced.dangerZone.reset.warning')}
178
+ {t('advanced.dangerZone.description')}
129
179
  </p>
130
180
  </div>
131
- <Button
132
- variant="destructive"
133
- onClick={handleResetClick}
134
- className="w-full sm:w-auto"
135
- >
136
- {t('advanced.dangerZone.reset.button')}
137
- </Button>
138
- </div>
181
+ <ChevronDownIcon
182
+ className={cn(
183
+ 'mt-1 shrink-0 text-destructive transition-transform',
184
+ dangerZoneOpen && 'rotate-180',
185
+ )}
186
+ />
187
+ </button>
188
+
189
+ {dangerZoneOpen && (
190
+ <div className="space-y-3 border-t border-destructive/20 px-4 pb-4 pt-3">
191
+ <div className="space-y-1">
192
+ <label
193
+ className="text-sm font-medium leading-none"
194
+ style={{ fontFamily: 'var(--heading-font-family, inherit)' }}
195
+ >
196
+ {t('advanced.dangerZone.reset.title')}
197
+ </label>
198
+ <p className="text-sm text-muted-foreground">
199
+ {t('advanced.dangerZone.reset.warning')}
200
+ </p>
201
+ </div>
202
+
203
+ <Button
204
+ variant="destructive"
205
+ onClick={handleResetClick}
206
+ className="w-full sm:w-auto"
207
+ >
208
+ {t('advanced.dangerZone.reset.button')}
209
+ </Button>
210
+ </div>
211
+ )}
139
212
  </div>
140
213
  </div>
141
214
  </div>
@@ -11,9 +11,11 @@ import { Switch } from '../../../components/ui/switch';
11
11
  import { Select } from '../../../components/ui/select';
12
12
  import { Button } from '../../../components/ui/button';
13
13
  import { ToastTestButtons } from './develop/ToastTestButtons';
14
+ import { UploadToastTestButton } from './develop/UploadToastTestButton';
14
15
  import { DialogTestButtons } from './develop/DialogTestButtons';
15
16
  import { ModalTestButtons } from './develop/ModalTestButtons';
16
17
  import { DrawerTestButtons } from './develop/DrawerTestButtons';
18
+ import { StoragePickerTestButtons } from './develop/StoragePickerTestButtons';
17
19
  import { captureException } from '../../sentry/initSentry';
18
20
  import { useCookieConsent } from '../../cookieConsent/useCookieConsent';
19
21
  import type { LayoutType } from '../../config/types';
@@ -163,6 +165,40 @@ export const Develop = () => {
163
165
  </div>
164
166
  </div>
165
167
 
168
+ <div>
169
+ <h3
170
+ className="text-lg font-semibold mb-2"
171
+ style={{ fontFamily: 'var(--heading-font-family, inherit)' }}
172
+ >
173
+ {t('develop.auth.title')}
174
+ </h3>
175
+ <div className="space-y-4">
176
+ <div className="flex items-center justify-between">
177
+ <div className="space-y-0.5">
178
+ <label
179
+ htmlFor="disable-token-auto-refresh"
180
+ className="text-sm font-medium leading-none"
181
+ style={{ fontFamily: 'var(--heading-font-family, inherit)' }}
182
+ >
183
+ {t('develop.auth.disableTokenAutoRefresh.label')}
184
+ </label>
185
+ <p className="text-sm text-muted-foreground">
186
+ {t('develop.auth.disableTokenAutoRefresh.description')}
187
+ </p>
188
+ </div>
189
+ <Switch
190
+ id="disable-token-auto-refresh"
191
+ checked={settings.developerFeatures?.disableTokenAutoRefresh || false}
192
+ onCheckedChange={(checked) =>
193
+ updateSetting('developerFeatures', {
194
+ disableTokenAutoRefresh: checked,
195
+ })
196
+ }
197
+ />
198
+ </div>
199
+ </div>
200
+ </div>
201
+
166
202
  <div>
167
203
  <h3
168
204
  className="text-lg font-semibold mb-2"
@@ -172,9 +208,11 @@ export const Develop = () => {
172
208
  </h3>
173
209
  <div className="space-y-4">
174
210
  <ToastTestButtons />
211
+ <UploadToastTestButton />
175
212
  <DialogTestButtons />
176
213
  <ModalTestButtons />
177
214
  <DrawerTestButtons />
215
+ <StoragePickerTestButtons />
178
216
  {errorReportingConfigured && (
179
217
  <div className="flex items-center justify-between">
180
218
  <div className="space-y-0.5">