@openpeepshq/react 0.11.0 → 0.12.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 (36) hide show
  1. package/dist/components/jams/JamLobby.js +16 -8
  2. package/dist/components/post/post-form/ComposeAttachments.d.ts +1 -3
  3. package/dist/components/post/post-form/ComposeAttachments.js +7 -19
  4. package/dist/components/post/post-form/ComposeAttachments.test.js +13 -22
  5. package/dist/components/post/post-form/EventForm.js +2 -2
  6. package/dist/components/post/post-form/ResourceForm.js +0 -2
  7. package/dist/components/resources/CategoryPathPicker.js +2 -1
  8. package/dist/components/resources/ResourceLibrary.js +5 -5
  9. package/dist/components/resources/ResourceLibrary.test.js +83 -1
  10. package/dist/components/server-data/context.d.ts +2 -0
  11. package/dist/contexts/openpeeps/hooks/other.d.ts +2 -0
  12. package/dist/hooks/settings/useNotificationPreferences.d.ts +1 -0
  13. package/dist/hooks/settings/useNotificationPreferences.js +7 -2
  14. package/dist/pages/admin/ApiKeys.js +14 -6
  15. package/dist/pages/admin/ConfigurationEmail.js +2 -2
  16. package/dist/pages/admin/ConfigurationSso.js +1 -1
  17. package/dist/pages/admin/community/CommunityTheme.js +1 -1
  18. package/dist/pages/admin/community/useCommunityConfig.d.ts +4 -0
  19. package/dist/pages/auth/RequestResetPassword.js +1 -1
  20. package/dist/pages/settings/NotificationPreferences.js +7 -3
  21. package/dist/pages/settings/NotificationPreferences.test.d.ts +1 -0
  22. package/dist/pages/settings/NotificationPreferences.test.js +119 -0
  23. package/package.json +3 -3
  24. package/src/components/jams/JamLobby.tsx +123 -102
  25. package/src/components/post/post-form/ComposeAttachments.tsx +4 -20
  26. package/src/components/post/post-form/EventForm.tsx +2 -2
  27. package/src/components/post/post-form/ResourceForm.tsx +2 -3
  28. package/src/components/resources/CategoryPathPicker.tsx +2 -1
  29. package/src/components/resources/ResourceLibrary.tsx +5 -5
  30. package/src/hooks/settings/useNotificationPreferences.ts +12 -1
  31. package/src/pages/admin/ApiKeys.tsx +20 -9
  32. package/src/pages/admin/ConfigurationEmail.tsx +2 -2
  33. package/src/pages/admin/ConfigurationSso.tsx +2 -1
  34. package/src/pages/admin/community/CommunityTheme.tsx +29 -0
  35. package/src/pages/auth/RequestResetPassword.tsx +1 -1
  36. package/src/pages/settings/NotificationPreferences.tsx +38 -12
@@ -4,9 +4,12 @@ import { Mic, MicOff, Video, VideoOff, Volume2, VolumeX, X, } from 'lucide-react
4
4
  import { useMediaDevices, usePreviewTracks, } from '@livekit/components-react';
5
5
  import { Track } from 'livekit-client';
6
6
  import { Blur, Button } from '@openpeepshq/react-ui';
7
+ import { getTheme } from '@openpeepshq/common';
7
8
  import { useNavigate } from '../../contexts/router/index.js';
8
9
  import { useT } from '../../i18n/index.js';
9
10
  import { useJamLobby } from '../../hooks/jams/useJamLobby.js';
11
+ import { useCurrentProfileSettings } from '../layout/IdentityContext.js';
12
+ import { useServerInfo } from '../server-data/context.js';
10
13
  import { audioOutputSupported } from './constants.js';
11
14
  import { DeviceSelectorPill } from './JamDeviceSelectors.js';
12
15
  import { JamGuestForm } from './JamGuestForm.js';
@@ -24,6 +27,9 @@ export function JamLobby({ onJoin }) {
24
27
  const navigate = useNavigate();
25
28
  const { username, jamEvent, jamActive, canAccess, error, setError, submitting, join, } = useJamLobby({ onJoin });
26
29
  const [settings, updateSettings] = useJamLocalSettings();
30
+ const serverInfo = useServerInfo();
31
+ const profileSettings = useCurrentProfileSettings();
32
+ const lobbyBackground = getTheme(serverInfo.communityConfig, profileSettings).jamLobbyBackground;
27
33
  const [audioEnabled, setAudioEnabled] = useState(true);
28
34
  const [videoEnabled, setVideoEnabled] = useState(false);
29
35
  const [audioDeviceId, setAudioDeviceId] = useState('');
@@ -92,12 +98,14 @@ export function JamLobby({ onJoin }) {
92
98
  audioDeviceId,
93
99
  videoDeviceId,
94
100
  });
95
- return (_jsx("div", { className: "mx-auto flex h-full w-full max-w-lg items-center justify-center p-4", children: _jsxs("div", { className: "bg-background w-full rounded-md border p-4", children: [_jsxs("div", { className: "flex items-center justify-between border-b p-2", children: [_jsx("h2", { className: "text-lg", children: t('jams.lobby.readyTitle', { defaultValue: 'Ready to join' }) }), _jsx("button", { type: "button", title: t('jams.exit.title', { defaultValue: 'Leave' }), className: "bg-surface-2 flex size-8 items-center justify-center rounded-full", onClick: exitLobby, children: _jsx(X, { className: "size-4" }) })] }), _jsxs("div", { className: "flex flex-col items-center p-5", children: [_jsx("h2", { className: "my-1 text-center text-lg", children: jamEvent.name ||
96
- t('jams.lobby.fallbackTitle', { defaultValue: 'Jam' }) }), _jsxs("div", { className: "relative size-64", children: [_jsx("video", { ref: videoRef, autoPlay: true, playsInline: true, muted: true, className: `size-64 rounded-xl object-cover ${showVideo ? '' : 'hidden'}` }), !showVideo ? (_jsx("div", { className: "bg-surface flex size-64 items-center justify-center rounded-xl", children: _jsx("p", { className: "text-lg", children: t('jams.lobby.cameraOff', { defaultValue: 'Camera is off' }) }) })) : null] }), _jsxs("div", { className: "mt-4 flex w-full items-center justify-center gap-x-4", children: [_jsx(DeviceSelectorPill, { enabled: audioEnabled, onToggle: () => setAudioEnabled((on) => !on), onIcon: Mic, offIcon: MicOff, deviceType: "mic", devices: audioDevices, activeDeviceId: audioDeviceId, onDeviceChange: setAudioDeviceId }), audioOutputSupported ? (_jsx(DeviceSelectorPill, { enabled: settings.speakerEnabled, onToggle: () => updateSettings({ speakerEnabled: !settings.speakerEnabled }), onIcon: Volume2, offIcon: VolumeX, deviceType: "speaker", devices: speakerDevices, activeDeviceId: settings.speakerDeviceId, onDeviceChange: (speakerDeviceId) => updateSettings({ speakerDeviceId }) })) : null, _jsx(DeviceSelectorPill, { enabled: videoEnabled, onToggle: () => setVideoEnabled((on) => !on), onIcon: Video, offIcon: VideoOff, deviceType: "camera", devices: videoDevices, activeDeviceId: videoDeviceId, onDeviceChange: setVideoDeviceId }), _jsx(JamToolbarButton, { title: settings.blur
97
- ? t('jams.blur.turnOff', { defaultValue: 'Turn off blur' })
98
- : t('jams.blur.blurBackground', {
99
- defaultValue: 'Blur background',
100
- }), tone: settings.blur ? 'active' : 'default', action: () => updateSettings({ blur: !settings.blur }), children: _jsx(Blur, {}) })] })] }), _jsxs("div", { className: "flex w-full flex-col items-center px-5 pb-4", children: [_jsx(Button, { variant: "default", title: t('jams.join.submit', { defaultValue: 'Join Jam' }), loading: submitting, action: handleJoin, children: jamActive
101
- ? t('jams.join.ctaJoin', { defaultValue: 'Join' })
102
- : t('jams.join.ctaStart', { defaultValue: 'Start' }) }), error ? (_jsx("div", { role: "alert", className: "text-destructive mt-3 text-sm", children: error })) : null] })] }) }));
101
+ return (_jsxs("div", { className: "relative h-full w-full", children: [lobbyBackground ? (_jsx("img", { src: lobbyBackground, alt: "", className: "absolute inset-0 h-full w-full object-cover" })) : null, _jsx("div", { className: "relative mx-auto flex h-full w-full max-w-lg items-center justify-center p-4", children: _jsxs("div", { className: "bg-background w-full rounded-md border p-4", children: [_jsxs("div", { className: "flex items-center justify-between border-b p-2", children: [_jsx("h2", { className: "text-lg", children: t('jams.lobby.readyTitle', { defaultValue: 'Ready to join' }) }), _jsx("button", { type: "button", title: t('jams.exit.title', { defaultValue: 'Leave' }), className: "bg-surface-2 flex size-8 items-center justify-center rounded-full", onClick: exitLobby, children: _jsx(X, { className: "size-4" }) })] }), _jsxs("div", { className: "flex flex-col items-center p-5", children: [_jsx("h2", { className: "my-1 text-center text-lg", children: jamEvent.name ||
102
+ t('jams.lobby.fallbackTitle', { defaultValue: 'Jam' }) }), _jsxs("div", { className: "relative size-64", children: [_jsx("video", { ref: videoRef, autoPlay: true, playsInline: true, muted: true, className: `size-64 rounded-xl object-cover ${showVideo ? '' : 'hidden'}` }), !showVideo ? (_jsx("div", { className: "bg-surface flex size-64 items-center justify-center rounded-xl", children: _jsx("p", { className: "text-lg", children: t('jams.lobby.cameraOff', {
103
+ defaultValue: 'Camera is off',
104
+ }) }) })) : null] }), _jsxs("div", { className: "mt-4 flex w-full items-center justify-center gap-x-4", children: [_jsx(DeviceSelectorPill, { enabled: audioEnabled, onToggle: () => setAudioEnabled((on) => !on), onIcon: Mic, offIcon: MicOff, deviceType: "mic", devices: audioDevices, activeDeviceId: audioDeviceId, onDeviceChange: setAudioDeviceId }), audioOutputSupported ? (_jsx(DeviceSelectorPill, { enabled: settings.speakerEnabled, onToggle: () => updateSettings({ speakerEnabled: !settings.speakerEnabled }), onIcon: Volume2, offIcon: VolumeX, deviceType: "speaker", devices: speakerDevices, activeDeviceId: settings.speakerDeviceId, onDeviceChange: (speakerDeviceId) => updateSettings({ speakerDeviceId }) })) : null, _jsx(DeviceSelectorPill, { enabled: videoEnabled, onToggle: () => setVideoEnabled((on) => !on), onIcon: Video, offIcon: VideoOff, deviceType: "camera", devices: videoDevices, activeDeviceId: videoDeviceId, onDeviceChange: setVideoDeviceId }), _jsx(JamToolbarButton, { title: settings.blur
105
+ ? t('jams.blur.turnOff', { defaultValue: 'Turn off blur' })
106
+ : t('jams.blur.blurBackground', {
107
+ defaultValue: 'Blur background',
108
+ }), tone: settings.blur ? 'active' : 'default', action: () => updateSettings({ blur: !settings.blur }), children: _jsx(Blur, {}) })] })] }), _jsxs("div", { className: "flex w-full flex-col items-center px-5 pb-4", children: [_jsx(Button, { variant: "default", title: t('jams.join.submit', { defaultValue: 'Join Jam' }), loading: submitting, action: handleJoin, children: jamActive
109
+ ? t('jams.join.ctaJoin', { defaultValue: 'Join' })
110
+ : t('jams.join.ctaStart', { defaultValue: 'Start' }) }), error ? (_jsx("div", { role: "alert", className: "text-destructive mt-3 text-sm", children: error })) : null] })] }) })] }));
103
111
  }
@@ -3,8 +3,6 @@ import type { MediaAttachmentData } from '@openpeepshq/common';
3
3
  export interface ComposeAttachmentsProps {
4
4
  attachments: MediaAttachmentData[];
5
5
  onChange: (attachments: MediaAttachmentData[]) => void;
6
- /** Image picker may select several files at once (resource galleries). */
7
- multipleImages?: boolean;
8
6
  /** Audio picker may select several files at once (default: yes). */
9
7
  multipleAudio?: boolean;
10
8
  }
@@ -28,5 +26,5 @@ export interface ComposeAttachmentsApi {
28
26
  * attachments are reported back via `onChange`. Exposes the toolbar pickers and
29
27
  * preview grid separately so callers can lay them out independently.
30
28
  */
31
- export declare function useComposeAttachments({ attachments, onChange, multipleImages, multipleAudio, }: ComposeAttachmentsProps): ComposeAttachmentsApi;
29
+ export declare function useComposeAttachments({ attachments, onChange, multipleAudio, }: ComposeAttachmentsProps): ComposeAttachmentsApi;
32
30
  export declare function ComposeAttachments(props: ComposeAttachmentsProps): import("react/jsx-runtime").JSX.Element;
@@ -33,7 +33,7 @@ const readyItem = (attachment) => ({
33
33
  * attachments are reported back via `onChange`. Exposes the toolbar pickers and
34
34
  * preview grid separately so callers can lay them out independently.
35
35
  */
36
- export function useComposeAttachments({ attachments, onChange, multipleImages = false, multipleAudio = true, }) {
36
+ export function useComposeAttachments({ attachments, onChange, multipleAudio = true, }) {
37
37
  const imageInputRef = useRef(null);
38
38
  const audioInputRef = useRef(null);
39
39
  const documentInputRef = useRef(null);
@@ -79,20 +79,6 @@ export function useComposeAttachments({ attachments, onChange, multipleImages =
79
79
  }
80
80
  enqueueFile(processed);
81
81
  };
82
- // A single pick keeps the crop/alt-text flow; a bulk pick is enqueued
83
- // directly, since per-file cropping isn't practical for a gallery batch.
84
- const handleImageFilesSelected = async (files) => {
85
- const first = files[0];
86
- if (!first)
87
- return;
88
- if (files.length === 1) {
89
- await handleImageSelected(first);
90
- return;
91
- }
92
- for (const file of files) {
93
- enqueueFile(await convertToWebpIfHeic(file));
94
- }
95
- };
96
82
  const onUploaded = (key, attachment) => setItems((prev) => prev.map((i) => {
97
83
  if (i.key !== key)
98
84
  return i;
@@ -125,10 +111,12 @@ export function useComposeAttachments({ attachments, onChange, multipleImages =
125
111
  const pending = items.some((i) => (i.file && !i.attachment && !i.failed) ||
126
112
  i.attachment?.status === 'processing');
127
113
  const previews = items.length > 0 ? (_jsx("div", { className: "grid grid-cols-2 gap-2", children: items.map((item) => (_jsx(AttachmentCard, { item: item, onUploaded: onUploaded, onProcessed: onProcessed, onFailed: onFailed, onRemove: onRemove, onUpdate: onUpdate }, item.key))) })) : null;
128
- const inputs = (_jsxs(_Fragment, { children: [_jsx("input", { ref: imageInputRef, type: "file", accept: "image/*,video/*,.mkv", multiple: multipleImages, className: "hidden", onChange: (e) => {
129
- const files = e.target.files;
130
- if (files?.length)
131
- void handleImageFilesSelected(Array.from(files));
114
+ const inputs = (_jsxs(_Fragment, { children: [_jsx("input", { ref: imageInputRef, type: "file", accept: "image/*,video/*,.mkv", className: "hidden", onChange: (e) => {
115
+ // Single pick only, so the crop/alt-text dialog can be shown for
116
+ // every image (see #1789).
117
+ const file = e.target.files?.[0];
118
+ if (file)
119
+ void handleImageSelected(file);
132
120
  e.target.value = '';
133
121
  } }), _jsx("input", { ref: audioInputRef, type: "file", accept: "audio/*,.mp3,.wav,.ogg,.m4a,.aac,.flac,.opus,.weba", multiple: multipleAudio, className: "hidden", onChange: (e) => {
134
122
  const files = e.target.files;
@@ -27,11 +27,10 @@ vi.mock('./DescriptionEditModal', () => ({
27
27
  const uploadMock = vi.fn();
28
28
  let urlCounter = 0;
29
29
  const imageFile = (name) => new File([new Uint8Array(16)], name, { type: 'image/png' });
30
- const Harness = ({ multipleImages, multipleAudio, onChange, }) => {
30
+ const Harness = ({ multipleAudio, onChange, }) => {
31
31
  const api = useComposeAttachments({
32
32
  attachments: [],
33
33
  onChange,
34
- multipleImages,
35
34
  multipleAudio,
36
35
  });
37
36
  return createElement('div', null, api.previews, api.inputs);
@@ -100,32 +99,24 @@ describe('useComposeAttachments pickers', () => {
100
99
  container.remove();
101
100
  vi.unstubAllGlobals();
102
101
  });
103
- it('marks the image input multiple only when requested', () => {
104
- render({ multipleImages: true, multipleAudio: false });
102
+ it('keeps the image picker single-file so every pick gets the crop dialog', () => {
103
+ render({ multipleAudio: false });
105
104
  const { image, audio } = inputs();
106
- expect(image.multiple).toBe(true);
105
+ expect(image.multiple).toBe(false);
107
106
  expect(audio.multiple).toBe(false);
108
107
  });
109
- it('enqueues each file of a bulk pick without the crop modal', async () => {
110
- const { onChange } = render({ multipleImages: true, multipleAudio: false });
111
- await pickFiles(container, [imageFile('one.png'), imageFile('two.png')]);
112
- expect(uploadMock).toHaveBeenCalledTimes(2);
113
- const ready = onChange.mock.calls.at(-1)?.[0] ?? [];
114
- expect(ready).toHaveLength(2);
115
- const urls = ready.map((attachment) => attachment.url);
116
- expect(new Set(urls).size).toBe(2);
117
- expect(container.querySelector('[data-testid="crop-modal"]')).toBeNull();
118
- });
119
- it('keeps the crop modal for a single image pick', async () => {
120
- render({ multipleImages: true, multipleAudio: false });
108
+ it('routes a single image pick through the crop modal', async () => {
109
+ render({ multipleAudio: false });
121
110
  await pickFiles(container, [imageFile('one.png')]);
122
111
  expect(container.querySelector('[data-testid="crop-modal"]')).not.toBeNull();
123
112
  expect(uploadMock).not.toHaveBeenCalled();
124
113
  });
125
- it('stays single-file by default for post composers', () => {
126
- render({});
127
- const { image, audio } = inputs();
128
- expect(image.multiple).toBe(false);
129
- expect(audio.multiple).toBe(true);
114
+ it('ignores extra files from a multi-select and crops the first', async () => {
115
+ // Guard against a regression if someone re-adds `multiple` to the image
116
+ // input: through the UI this input never allows a multi-select (#1789).
117
+ render({ multipleAudio: false });
118
+ await pickFiles(container, [imageFile('one.png'), imageFile('two.png')]);
119
+ expect(container.querySelector('[data-testid="crop-modal"]')).not.toBeNull();
120
+ expect(uploadMock).not.toHaveBeenCalled();
130
121
  });
131
122
  });
@@ -30,9 +30,9 @@ export const EventForm = ({ postData, onChange, isEdit = false, occurrenceEdit =
30
30
  defaultValue: 'Describe your event',
31
31
  }) }), _jsx(ComposePreviewLinks, { content: event.content }), _jsx("h2", { className: "text-lg", children: t('events.form.dateAndTimeTitle', {
32
32
  defaultValue: 'Date and Time',
33
- }) }), _jsx(Label, { title: t('events.form.startDate', { defaultValue: 'Start Date' }), htmlFor: "event-start", children: _jsx(Input, { id: "event-start", type: "datetime-local", step: 60, value: dateToInputValue(event.start, eventTimeZone), onChange: (e) => changeStart(toIso(e.target.value, eventTimeZone)), "data-testid": "events-start-input" }) }), _jsx(Label, { description: t('events.form.addEndDate', {
33
+ }) }), _jsx(Label, { title: t('events.startDate', { defaultValue: 'Start Date' }), htmlFor: "event-start", children: _jsx(Input, { id: "event-start", type: "datetime-local", step: 60, value: dateToInputValue(event.start, eventTimeZone), onChange: (e) => changeStart(toIso(e.target.value, eventTimeZone)), "data-testid": "events-start-input" }) }), _jsx(Label, { description: t('events.form.addEndDate', {
34
34
  defaultValue: 'Add end date and time',
35
- }), forCheckbox: true, children: _jsx("input", { type: "checkbox", checked: showEndDate, onChange: (e) => toggleEndDate(e.target.checked) }) }), showEndDate ? (_jsxs(_Fragment, { children: [_jsx(Label, { title: t('events.form.endDate', { defaultValue: 'End Date' }), htmlFor: "event-end", children: _jsx(Input, { id: "event-end", type: "datetime-local", step: 60, value: dateToInputValue(event.end, eventTimeZone), onChange: (e) => changeEnd(toIso(e.target.value, eventTimeZone)) }) }), endBeforeStart ? (_jsx("p", { className: "text-destructive text-sm", children: t('events.form.endBeforeStart', {
35
+ }), forCheckbox: true, children: _jsx("input", { type: "checkbox", checked: showEndDate, onChange: (e) => toggleEndDate(e.target.checked) }) }), showEndDate ? (_jsxs(_Fragment, { children: [_jsx(Label, { title: t('events.endDate', { defaultValue: 'End Date' }), htmlFor: "event-end", children: _jsx(Input, { id: "event-end", type: "datetime-local", step: 60, value: dateToInputValue(event.end, eventTimeZone), onChange: (e) => changeEnd(toIso(e.target.value, eventTimeZone)) }) }), endBeforeStart ? (_jsx("p", { className: "text-destructive text-sm", children: t('events.form.endBeforeStart', {
36
36
  defaultValue: 'The end date and time must be after the start date and time.',
37
37
  }) })) : null] })) : null, _jsx(Label, { title: t('events.form.timezone', { defaultValue: 'Timezone' }), htmlFor: "event-timezone", children: _jsx("select", { id: "event-timezone", className: "bg-background w-full rounded-md border px-3 py-2 text-sm", value: eventTimeZone, onChange: (e) => setTimeZone(e.target.value), children: TIMEZONES.map((tz) => (_jsx("option", { value: tz, children: tz }, tz))) }) }), !occurrenceEdit ? (_jsxs(_Fragment, { children: [_jsx(Label, { title: t('events.form.repeat.title', { defaultValue: 'Repeat' }), htmlFor: "event-repeat", children: _jsxs("select", { id: "event-repeat", className: "bg-background w-full rounded-md border px-3 py-2 text-sm", value: repeatFreq, onChange: (e) => applyFreq(e.target.value), "data-testid": "events-repeat-input", children: [_jsx("option", { value: "none", children: t('events.form.repeat.none', {
38
38
  defaultValue: 'Does not repeat',
@@ -21,8 +21,6 @@ export const ResourceForm = ({ postData, onChange, isEdit = false, groupOnly = f
21
21
  const attachments = useComposeAttachments({
22
22
  attachments: resource.attachments ?? [],
23
23
  onChange: (next) => patchResource({ attachments: next }),
24
- // Only galleries take more than one file; other kinds pick one at a time.
25
- multipleImages: resource.resourceKind === 'gallery',
26
24
  multipleAudio: false,
27
25
  });
28
26
  const patchResource = (patch) => {
@@ -1,11 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState } from 'react';
3
3
  import { Button, Input } from '@openpeepshq/react-ui';
4
+ import { categoryPathKey } from '@openpeepshq/common/lib';
4
5
  import { useT } from '../../i18n/index.js';
5
6
  const NodeList = ({ nodes, selected, onSelect, }) => (_jsx("ul", { className: "border-border ml-3 border-l pl-3", children: nodes.map((node) => {
6
7
  const active = selected.length === node.path.length &&
7
8
  node.path.every((segment, index) => selected[index] === segment);
8
- return (_jsxs("li", { className: "py-0.5", children: [_jsx("button", { type: "button", className: `text-sm ${active ? 'text-foreground font-semibold' : 'text-muted-foreground hover:text-foreground'}`, onClick: () => onSelect(node.path), children: node.name }), node.children.length ? (_jsx(NodeList, { nodes: node.children, selected: selected, onSelect: onSelect })) : null] }, node.path.join('/')));
9
+ return (_jsxs("li", { className: "py-0.5", children: [_jsx("button", { type: "button", className: `text-sm ${active ? 'text-foreground font-semibold' : 'text-muted-foreground hover:text-foreground'}`, onClick: () => onSelect(node.path), children: node.name }), node.children.length ? (_jsx(NodeList, { nodes: node.children, selected: selected, onSelect: onSelect })) : null] }, categoryPathKey(node.path)));
9
10
  }) }));
10
11
  export const CategoryPathPicker = ({ path, tree, onChange, }) => {
11
12
  const t = useT();
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { LayoutList, LayoutGrid, BookmarkIcon, ChevronDown, ChevronRight, } from 'lucide-react';
3
- import { RESOURCE_KINDS } from '@openpeepshq/common/lib';
3
+ import { RESOURCE_KINDS, categoryPathKey } from '@openpeepshq/common/lib';
4
4
  import { Button, Input, LoadingSpinner } from '@openpeepshq/react-ui';
5
5
  import { useEffect, useMemo, useRef, useState } from 'react';
6
6
  import { useT } from '../../i18n/index.js';
@@ -12,10 +12,10 @@ const parseKindFilter = (value) => value && RESOURCE_KINDS.includes(value)
12
12
  ? value
13
13
  : 'all';
14
14
  const Tree = ({ nodes, selected, onSelect, counts, expanded, onToggle, t, }) => (_jsx("ul", { className: "space-y-1", children: nodes.map((node) => {
15
- const nodeKey = node.path.join('/');
15
+ const nodeKey = categoryPathKey(node.path);
16
16
  const nodeCount = counts.get(nodeKey) ?? 0;
17
17
  const isExpanded = expanded.has(nodeKey);
18
- const isSelected = selected.join('/') === nodeKey;
18
+ const isSelected = categoryPathKey(selected) === nodeKey;
19
19
  const hasChildren = node.children.length > 0;
20
20
  return (_jsxs("li", { children: [_jsxs("div", { className: "flex items-center gap-1", children: [_jsx("button", { type: "button", className: `text-muted-foreground hover:text-foreground ${hasChildren ? '' : 'invisible'}`, onClick: hasChildren ? () => onToggle(nodeKey) : undefined, "aria-label": isExpanded
21
21
  ? t('resources.library.collapseFolder', {
@@ -92,11 +92,11 @@ export const ResourceLibrary = ({ groupId }) => {
92
92
  continue;
93
93
  rootCount++;
94
94
  for (let i = 1; i <= path.length; i++) {
95
- const key = path.slice(0, i).join('/');
95
+ const key = categoryPathKey(path.slice(0, i));
96
96
  counts.set(key, (counts.get(key) ?? 0) + 1);
97
97
  }
98
98
  }
99
- counts.set('', rootCount);
99
+ counts.set(categoryPathKey([]), rootCount);
100
100
  return counts;
101
101
  }, [library.posts]);
102
102
  const treeNodes = useMemo(() => {
@@ -7,10 +7,14 @@ import { RouterProvider } from '../../contexts/router/index.js';
7
7
  vi.mock('../../i18n', () => ({
8
8
  useT: () => (key, opts) => opts?.defaultValue ?? key,
9
9
  }));
10
+ const mockFeed = vi.hoisted(() => ({ posts: [] }));
10
11
  vi.mock('../../contexts/openpeeps', () => ({
11
12
  useOpenpeeps: () => ({
12
13
  openpeepsApi: {
13
- usePostsByType: () => ({ data: { pages: [[]] }, isPending: false }),
14
+ usePostsByType: () => ({
15
+ data: { pages: [mockFeed.posts] },
16
+ isPending: false,
17
+ }),
14
18
  useCurrentProfileBookmarkedIds: () => ({ data: [] }),
15
19
  },
16
20
  }),
@@ -119,4 +123,82 @@ describe('ResourceLibrary URL filters', () => {
119
123
  expect(location.url).toBe('http://localhost/groups/@x?q=notes#resources');
120
124
  expect(location.replaceWrites).toBe(0);
121
125
  });
126
+ describe('folder tree collision (issue #2148)', () => {
127
+ const slashPost = {
128
+ id: 'p-slash',
129
+ type: 'resource',
130
+ data: {
131
+ type: 'resource',
132
+ title: 'Slash folder',
133
+ categoryPath: ['[TEST] A/B'],
134
+ },
135
+ };
136
+ const nestedPost = {
137
+ id: 'p-nested',
138
+ type: 'resource',
139
+ data: {
140
+ type: 'resource',
141
+ title: 'Nested folder',
142
+ categoryPath: ['[TEST] A', 'B'],
143
+ },
144
+ };
145
+ const renderLibrary = () => {
146
+ mockFeed.posts = [slashPost, nestedPost];
147
+ const location = {
148
+ url: 'http://localhost/groups/@x#resources',
149
+ replaceWrites: 0,
150
+ pushWrites: 0,
151
+ };
152
+ return render(createElement(Harness, { location }, createElement(ResourceLibrary, { groupId: 'g1' })));
153
+ };
154
+ const showTree = async (container) => {
155
+ const toggle = [...container.querySelectorAll('button')].find((button) => button.getAttribute('aria-label') === 'Show folder tree');
156
+ expect(toggle).toBeTruthy();
157
+ await act(async () => {
158
+ toggle?.click();
159
+ });
160
+ // The "All folders" pseudo-root starts collapsed; expand it.
161
+ const expand = [...container.querySelectorAll('button')].find((button) => button.getAttribute('aria-label') === 'Expand folder');
162
+ await act(async () => {
163
+ expand?.click();
164
+ });
165
+ };
166
+ const nameButton = (container, label) => [...container.querySelectorAll('button')].find((button) => button.textContent?.startsWith(label));
167
+ it('renders two separate top-level nodes with counts of 1 each', async () => {
168
+ const container = renderLibrary();
169
+ await showTree(container);
170
+ expect(nameButton(container, '[TEST] A/B(1)')).toBeTruthy();
171
+ expect(nameButton(container, '[TEST] A(1)')).toBeTruthy();
172
+ // Under the old join('/') keying both collapsed into one node of 2.
173
+ expect(nameButton(container, '[TEST] A/B(2)')).toBeUndefined();
174
+ expect(nameButton(container, '[TEST] A(2)')).toBeUndefined();
175
+ });
176
+ it('selects a slash-named folder without highlighting the nested one', async () => {
177
+ const container = renderLibrary();
178
+ await showTree(container);
179
+ const slashNode = nameButton(container, '[TEST] A/B(1)');
180
+ await act(async () => {
181
+ slashNode?.click();
182
+ });
183
+ expect(nameButton(container, '[TEST] A/B(1)')?.className).toContain('font-semibold');
184
+ // The selection filters the list to the slash-named folder's resource,
185
+ // so the nested folder either disappears from the tree or stays
186
+ // unhighlighted — it must never light up with the other one.
187
+ const nested = nameButton(container, '[TEST] A(1)');
188
+ expect(nested?.className ?? '').not.toContain('font-semibold');
189
+ });
190
+ it('expands the nested folder independently of the slash-named one', async () => {
191
+ const container = renderLibrary();
192
+ await showTree(container);
193
+ expect(nameButton(container, 'B(1)')).toBeUndefined();
194
+ // The chevron is the button right before the node-name button.
195
+ const nestedNode = nameButton(container, '[TEST] A(1)');
196
+ const chevron = nestedNode?.previousElementSibling;
197
+ expect(chevron).toBeTruthy();
198
+ await act(async () => {
199
+ chevron?.click();
200
+ });
201
+ expect(nameButton(container, 'B(1)')).toBeTruthy();
202
+ });
203
+ });
122
204
  });
@@ -26,6 +26,7 @@ export declare const useServerInfo: () => {
26
26
  defaultProfileAvatar?: string | undefined;
27
27
  defaultGroupAvatar?: string | undefined;
28
28
  backgroundAuth?: string | undefined;
29
+ jamLobbyBackground?: string | undefined;
29
30
  background?: string | undefined;
30
31
  };
31
32
  dark: {
@@ -38,6 +39,7 @@ export declare const useServerInfo: () => {
38
39
  defaultProfileAvatar?: string | undefined;
39
40
  defaultGroupAvatar?: string | undefined;
40
41
  backgroundAuth?: string | undefined;
42
+ jamLobbyBackground?: string | undefined;
41
43
  background?: string | undefined;
42
44
  };
43
45
  icon?: string | undefined;
@@ -59,6 +59,7 @@ export declare const otherHooks: (client: OpenpeepsClient) => {
59
59
  defaultProfileAvatar?: string | undefined;
60
60
  defaultGroupAvatar?: string | undefined;
61
61
  backgroundAuth?: string | undefined;
62
+ jamLobbyBackground?: string | undefined;
62
63
  background?: string | undefined;
63
64
  };
64
65
  dark: {
@@ -71,6 +72,7 @@ export declare const otherHooks: (client: OpenpeepsClient) => {
71
72
  defaultProfileAvatar?: string | undefined;
72
73
  defaultGroupAvatar?: string | undefined;
73
74
  backgroundAuth?: string | undefined;
75
+ jamLobbyBackground?: string | undefined;
74
76
  background?: string | undefined;
75
77
  };
76
78
  icon?: string | undefined;
@@ -15,6 +15,7 @@ export declare const useNotificationPreferences: ({ ensurePush, }?: UseNotificat
15
15
  } | undefined;
16
16
  }[];
17
17
  settings: ProfileSettings;
18
+ dirty: boolean;
18
19
  setTypeSettings: (type: string, next: ProfileNotificationSettings) => void;
19
20
  save: () => Promise<void>;
20
21
  saving: boolean;
@@ -1,5 +1,5 @@
1
- import { useEffect, useState } from 'react';
2
- import { deepSet, } from '@openpeepshq/common';
1
+ import { useEffect, useMemo, useState } from 'react';
2
+ import { deepEqual, deepSet, } from '@openpeepshq/common';
3
3
  import { useOpenpeeps } from '../../contexts/openpeeps/index.js';
4
4
  import { useT } from '../../i18n/context.js';
5
5
  import { useCurrentProfile } from '../../components/layout/IdentityContext.js';
@@ -20,6 +20,10 @@ export const useNotificationPreferences = ({ ensurePush, } = {}) => {
20
20
  if (settingsQuery.data)
21
21
  setSettings(settingsQuery.data);
22
22
  }, [settingsQuery.data]);
23
+ // Unsaved local edits. Clears once the post-save refetch lands the
24
+ // server copy; stays set when a save fails.
25
+ const dirty = useMemo(() => !!settingsQuery.data &&
26
+ !deepEqual(settings.notifications, settingsQuery.data.notifications), [settings, settingsQuery.data]);
23
27
  const setTypeSettings = (type, next) => {
24
28
  setSettings((current) => {
25
29
  const copy = { ...current };
@@ -70,6 +74,7 @@ export const useNotificationPreferences = ({ ensurePush, } = {}) => {
70
74
  me,
71
75
  types: notificationTypesQuery.data ?? [],
72
76
  settings,
77
+ dirty,
73
78
  setTypeSettings,
74
79
  save,
75
80
  saving,
@@ -87,8 +87,10 @@ export const AdminApiKeys = () => {
87
87
  const cardLabels = {
88
88
  expiresLabel: t('admin.apiKeys.expiresAt', { defaultValue: 'Expires at' }),
89
89
  neverLabel: t('common.states.never', { defaultValue: 'Never' }),
90
- revokeLabel: t('admin.apiKeys.revoke', { defaultValue: 'Revoke' }),
91
- revokedLabel: t('admin.apiKeys.revoked', { defaultValue: 'Revoked' }),
90
+ revokeLabel: t('settings.accessTokens.revoke', { defaultValue: 'Revoke' }),
91
+ revokedLabel: t('settings.accessTokens.revoked', {
92
+ defaultValue: 'Revoked',
93
+ }),
92
94
  noScopesLabel: t('admin.apiKeys.noScopes', { defaultValue: 'No scopes' }),
93
95
  };
94
96
  return (_jsxs("div", { className: "space-y-6 p-4", children: [_jsxs("section", { className: "space-y-3 rounded-md border p-4", children: [_jsx("h2", { className: "text-lg font-medium", children: t('admin.apiKeys.createTitle', {
@@ -97,7 +99,9 @@ export const AdminApiKeys = () => {
97
99
  defaultValue: 'Create a service token for integrations. Copy the token value when it is created.',
98
100
  }) }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "svc-name", children: t('common.labels.name', { defaultValue: 'Name' }) }), _jsx(Input, { id: "svc-name", value: form.name, onChange: (e) => setForm((f) => ({ ...f, name: e.target.value })) })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "svc-description", children: t('common.labels.description', {
99
101
  defaultValue: 'Description',
100
- }) }), _jsx(Input, { id: "svc-description", value: form.description ?? '', onChange: (e) => setForm((f) => ({ ...f, description: e.target.value })) })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "svc-expiration", children: t('admin.apiKeys.expiration', { defaultValue: 'Expiration' }) }), _jsx("select", { id: "svc-expiration", className: "border-input bg-background w-full rounded-md border px-2 py-2 text-sm", value: form.expirationTime ?? '30d', onChange: (e) => setForm((f) => ({ ...f, expirationTime: e.target.value })), children: EXPIRATION_OPTIONS.map((option) => (_jsx("option", { value: option.value, children: t(`admin.apiKeys.expirationOptions.${option.labelKey}`, {
102
+ }) }), _jsx(Input, { id: "svc-description", value: form.description ?? '', onChange: (e) => setForm((f) => ({ ...f, description: e.target.value })) })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "svc-expiration", children: t('settings.accessTokens.expiration', {
103
+ defaultValue: 'Expiration',
104
+ }) }), _jsx("select", { id: "svc-expiration", className: "border-input bg-background w-full rounded-md border px-2 py-2 text-sm", value: form.expirationTime ?? '30d', onChange: (e) => setForm((f) => ({ ...f, expirationTime: e.target.value })), children: EXPIRATION_OPTIONS.map((option) => (_jsx("option", { value: option.value, children: t(`settings.accessTokens.expirationOptions.${option.labelKey}`, {
101
105
  defaultValue: EXPIRATION_OPTION_DEFAULTS[option.labelKey],
102
106
  }) }, option.value))) })] }), _jsx("p", { className: "text-sm font-medium", children: t('admin.apiKeys.scopes', { defaultValue: 'Scopes' }) }), (form.scopes ?? []).map((scope, index) => (_jsxs("div", { className: "flex flex-wrap items-end gap-2", children: [_jsx("select", { className: "border-input bg-background rounded-md border px-2 py-2 text-sm", value: scope.scopeLevel ?? 'read', onChange: (e) => setForm((f) => ({
103
107
  ...f,
@@ -125,12 +129,16 @@ export const AdminApiKeys = () => {
125
129
  { scopeLevel: 'read', resource: { type: 'profiles', id: '*' } },
126
130
  ],
127
131
  })), children: t('admin.apiKeys.addScope', { defaultValue: 'Add Scope' }) }), error ? (_jsx(Toast, { variant: "error", onDismiss: () => setError(undefined), children: error })) : null, _jsx(Button, { variant: "default", disabled: creating, action: create, children: creating
128
- ? t('admin.apiKeys.creating', { defaultValue: 'Creating...' })
132
+ ? t('settings.accessTokens.creating', {
133
+ defaultValue: 'Creating...',
134
+ })
129
135
  : t('admin.apiKeys.create', {
130
136
  defaultValue: 'Create Service Token',
131
- }) }), createdToken ? (_jsxs("div", { className: "rounded-md border p-3", children: [_jsx("p", { className: "text-sm font-semibold", children: t('admin.apiKeys.copyWarning', {
137
+ }) }), createdToken ? (_jsxs("div", { className: "rounded-md border p-3", children: [_jsx("p", { className: "text-sm font-semibold", children: t('settings.accessTokens.copyWarning', {
132
138
  defaultValue: 'Copy this token now. It will not be shown again.',
133
- }) }), _jsxs("div", { className: "mt-2 flex items-start gap-2", children: [_jsx("code", { className: "break-all text-sm", children: createdToken }), _jsx("button", { type: "button", title: t('admin.apiKeys.copy', { defaultValue: 'Copy' }), onClick: () => void navigator.clipboard.writeText(createdToken), children: _jsx(Copy, { className: "size-4" }) })] })] })) : null] }), _jsxs("section", { className: "space-y-3 rounded-md border p-4", children: [_jsx("h2", { className: "text-lg font-medium", children: t('admin.apiKeys.listTitle', {
139
+ }) }), _jsxs("div", { className: "mt-2 flex items-start gap-2", children: [_jsx("code", { className: "break-all text-sm", children: createdToken }), _jsx("button", { type: "button", title: t('settings.accessTokens.copy', {
140
+ defaultValue: 'Copy',
141
+ }), onClick: () => void navigator.clipboard.writeText(createdToken), children: _jsx(Copy, { className: "size-4" }) })] })] })) : null] }), _jsxs("section", { className: "space-y-3 rounded-md border p-4", children: [_jsx("h2", { className: "text-lg font-medium", children: t('admin.apiKeys.listTitle', {
134
142
  defaultValue: 'Service Access Tokens',
135
143
  }) }), activeTokens.length === 0 ? (_jsx("p", { className: "text-muted-foreground text-sm", children: t('admin.apiKeys.empty', {
136
144
  defaultValue: 'No active service access tokens.',
@@ -91,7 +91,7 @@ export function AdminConfigurationEmail() {
91
91
  }
92
92
  return (_jsxs("div", { className: "space-y-6 p-4", children: [_jsx("p", { className: "text-sm opacity-80", children: t('configuration.email.intro') }), _jsx(Form, { ...form, children: _jsxs("form", { className: "flex flex-col gap-6", onSubmit: onSubmit, children: [_jsxs("section", { className: "flex flex-col gap-4", "aria-labelledby": "email-config-transport-heading", children: [_jsx("h3", { id: "email-config-transport-heading", className: "text-base font-semibold", children: t('configuration.email.sections.transport') }), _jsx(FormField, { control: form.control, name: "transportConfig.host", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: t('configuration.email.fields.host') }), _jsx(FormControl, { children: _jsx(Input, { ...field, type: "text", "data-testid": "admin-email-host" }) }), _jsx(FormMessage, {})] })) }), _jsx(FormField, { control: form.control, name: "transportConfig.port", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: t('configuration.email.fields.port') }), _jsx(FormControl, { children: _jsx(Input, { type: "number", value: Number.isNaN(field.value) ? '' : field.value, onChange: (e) => field.onChange(e.target.value === ''
93
93
  ? Number.NaN
94
- : Number(e.target.value)), "data-testid": "admin-email-port" }) }), _jsx(FormMessage, {})] })) }), _jsx(FormField, { control: form.control, name: "transportConfig.auth.user", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: t('configuration.email.fields.authUser') }), _jsx(FormControl, { children: _jsx(Input, { ...field, type: "text", value: field.value ?? '' }) }), _jsx(FormMessage, {})] })) }), _jsx(FormField, { control: form.control, name: "transportConfig.auth.pass", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: t('configuration.email.fields.authPass') }), _jsx(FormDescription, { children: t('configuration.email.fields.authPassDescription') }), _jsx(FormControl, { children: _jsx(Input, { ...field, type: "password", value: field.value ?? '' }) }), _jsx(FormMessage, {})] })) })] }), _jsx(ExpandableBox, { initialOpen: false, title: _jsx("p", { className: "text-base font-semibold", children: t('configuration.email.sections.general') }), children: _jsxs("div", { className: "flex flex-col gap-4 pt-1", children: [_jsx(FormField, { control: form.control, name: "service", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: t('configuration.email.fields.service') }), _jsx(FormControl, { children: _jsx(Input, { ...field, type: "text" }) }), _jsx(FormMessage, {})] })) }), _jsx(FormField, { control: form.control, name: "defaultTemplatePath", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: t('configuration.email.fields.defaultTemplatePath') }), _jsx(FormDescription, { children: t('configuration.email.fields.defaultTemplatePathDescription') }), _jsx(FormControl, { children: _jsx(Input, { ...field, type: "text" }) }), _jsx(FormMessage, {})] })) }), _jsx(FormField, { control: form.control, name: "defaultFrom", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: t('configuration.email.fields.defaultFrom') }), _jsx(FormDescription, { children: t('configuration.email.fields.defaultFromDescription') }), _jsx(FormControl, { children: _jsx(Input, { ...field, type: "text", value: field.value ?? '' }) }), _jsx(FormMessage, {})] })) })] }) }), _jsx("span", { className: "flex justify-end pt-2", children: _jsx(Button, { type: "submit", title: t('common.submit', { defaultValue: 'Submit' }), disabled: !form.formState.isValid || unchanged, loading: form.formState.isSubmitting, variant: "default", "data-testid": "admin-email-submit", children: t('common.submit', { defaultValue: 'Submit' }) }) })] }) }), _jsxs("div", { className: "bg-surface-2 rounded-lg p-4", children: [_jsx("p", { className: "font-medium", children: t('configuration.email.testTitle') }), _jsx("p", { className: "mb-3 text-sm opacity-80", children: t('configuration.email.testHint') }), _jsxs("div", { className: "flex flex-col gap-3 sm:flex-row sm:items-end", children: [_jsxs("label", { className: "flex-1", children: [_jsx("span", { children: t('configuration.email.testRecipient') }), _jsx("input", { type: "email", value: testRecipient, onChange: (e) => setTestRecipient(e.target.value), className: "op-input rounded", placeholder: t('configuration.email.testRecipientPlaceholder'), autoComplete: "email", "data-testid": "admin-email-test-recipient" })] }), _jsx(Button, { variant: "secondary", title: t('configuration.email.sendTest'), action: handleSendTest, disabled: sending, "data-testid": "admin-email-send-test", children: sending
94
+ : Number(e.target.value)), "data-testid": "admin-email-port" }) }), _jsx(FormMessage, {})] })) }), _jsx(FormField, { control: form.control, name: "transportConfig.auth.user", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: t('configuration.email.fields.authUser') }), _jsx(FormControl, { children: _jsx(Input, { ...field, type: "text", value: field.value ?? '' }) }), _jsx(FormMessage, {})] })) }), _jsx(FormField, { control: form.control, name: "transportConfig.auth.pass", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: t('configuration.email.fields.authPass') }), _jsx(FormDescription, { children: t('configuration.email.fields.authPassDescription') }), _jsx(FormControl, { children: _jsx(Input, { ...field, type: "password", value: field.value ?? '' }) }), _jsx(FormMessage, {})] })) })] }), _jsx(ExpandableBox, { initialOpen: false, title: _jsx("p", { className: "text-base font-semibold", children: t('configuration.email.sections.general') }), children: _jsxs("div", { className: "flex flex-col gap-4 pt-1", children: [_jsx(FormField, { control: form.control, name: "service", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: t('configuration.email.fields.service') }), _jsx(FormControl, { children: _jsx(Input, { ...field, type: "text" }) }), _jsx(FormMessage, {})] })) }), _jsx(FormField, { control: form.control, name: "defaultTemplatePath", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: t('configuration.email.fields.defaultTemplatePath') }), _jsx(FormDescription, { children: t('configuration.email.fields.defaultTemplatePathDescription') }), _jsx(FormControl, { children: _jsx(Input, { ...field, type: "text" }) }), _jsx(FormMessage, {})] })) }), _jsx(FormField, { control: form.control, name: "defaultFrom", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: t('configuration.email.fields.defaultFrom') }), _jsx(FormDescription, { children: t('configuration.email.fields.defaultFromDescription') }), _jsx(FormControl, { children: _jsx(Input, { ...field, type: "text", value: field.value ?? '' }) }), _jsx(FormMessage, {})] })) })] }) }), _jsx("span", { className: "flex justify-end pt-2", children: _jsx(Button, { type: "submit", title: t('common.submit', { defaultValue: 'Submit' }), disabled: !form.formState.isValid || unchanged, loading: form.formState.isSubmitting, variant: "default", "data-testid": "admin-email-submit", children: t('common.submit', { defaultValue: 'Submit' }) }) })] }) }), _jsxs("div", { className: "bg-surface-2 rounded-lg p-4", children: [_jsx("p", { className: "font-medium", children: t('configuration.email.testTitle') }), _jsx("p", { className: "mb-3 text-sm opacity-80", children: t('configuration.email.testHint') }), _jsxs("div", { className: "flex flex-col gap-3 sm:flex-row sm:items-end", children: [_jsxs("label", { className: "flex-1", children: [_jsx("span", { children: t('configuration.email.testRecipient') }), _jsx("input", { type: "email", value: testRecipient, onChange: (e) => setTestRecipient(e.target.value), className: "op-input rounded", placeholder: t('configuration.email.testRecipientPlaceholder'), autoComplete: "email", "data-testid": "admin-email-test-recipient" })] }), _jsx(Button, { variant: "secondary", title: t('configuration.email.testTitle'), action: handleSendTest, disabled: sending, "data-testid": "admin-email-send-test", children: sending
95
95
  ? t('common.states.loading')
96
- : t('configuration.email.sendTest') })] }), _jsx("p", { className: "mt-3 text-xs opacity-70", children: t('configuration.email.bounceNote') })] }), status ? (_jsx(Toast, { variant: status.type, testId: "admin-email-toast", onDismiss: () => setStatus(null), children: status.message })) : null] }));
96
+ : t('configuration.email.testTitle') })] }), _jsx("p", { className: "mt-3 text-xs opacity-70", children: t('configuration.email.bounceNote') })] }), status ? (_jsx(Toast, { variant: status.type, testId: "admin-email-toast", onDismiss: () => setStatus(null), children: status.message })) : null] }));
97
97
  }
@@ -84,7 +84,7 @@ export function AdminConfigurationSso() {
84
84
  ];
85
85
  return (_jsxs("div", { className: "space-y-8 p-4", children: [_jsx("p", { className: "text-sm opacity-80", children: t('configuration.sso.intro') }), _jsx(Label, { title: t('configuration.sso.onlySSO'), description: t('configuration.sso.onlySSODescription'), forCheckbox: true, children: _jsx(Switch, { checked: !!sso.onlySSO, onCheckedChange: (onlySSO) => void persist({ onlySSO }), "data-testid": "admin-sso-only" }) }), _jsxs("section", { className: "space-y-3", children: [_jsx("h3", { className: "text-base font-semibold", children: t('configuration.sso.providers') }), listed.length === 0 ? (_jsx("p", { className: "text-muted-foreground text-sm", children: t('configuration.sso.empty') })) : (listed.map((item) => {
86
86
  const isEditing = editing?.bucket === item.bucket && editing.id === item.id;
87
- return (_jsxs("div", { className: "bg-surface-2 space-y-3 rounded-lg p-4", "data-testid": `admin-sso-provider-${item.id}`, children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [_jsxs("div", { children: [_jsx("p", { className: "font-medium", children: item.name }), _jsxs("p", { className: "text-muted-foreground text-xs", children: [t(`configuration.sso.kind.${item.kind}`), " \u00B7 ", item.id] })] }), _jsxs("div", { className: "flex gap-2", children: [_jsx(Button, { variant: "outline", size: "sm", title: t('configuration.sso.editProvider'), action: () => {
87
+ return (_jsxs("div", { className: "bg-surface-2 space-y-3 rounded-lg p-4", "data-testid": `admin-sso-provider-${item.id}`, children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [_jsxs("div", { children: [_jsx("p", { className: "font-medium", children: item.name }), _jsxs("p", { className: "text-muted-foreground text-xs", children: [t(`configuration.sso.types.${item.kind}.title`), " \u00B7", ' ', item.id] })] }), _jsxs("div", { className: "flex gap-2", children: [_jsx(Button, { variant: "outline", size: "sm", title: t('configuration.sso.editProvider'), action: () => {
88
88
  if (isEditing) {
89
89
  setEditing(undefined);
90
90
  setEditForm(undefined);
@@ -53,5 +53,5 @@ export function AdminConfigurationCommunityTheme() {
53
53
  ['OpenpeepsLight', 'configuration.community.lightTheme.mode'],
54
54
  ['OpenpeepsDark', 'configuration.community.darkTheme.mode'],
55
55
  ].map(([base, labelKey]) => (_jsxs("label", { className: "flex items-center gap-2", children: [_jsx("input", { type: "radio", className: "h-4 w-4", checked: cfg.theme.base === base, onChange: () => patch((c) => (c.theme.base = base)) }), _jsx("span", { children: t(labelKey) })] }, base))) })] }), _jsxs("div", { className: "border p-4", children: [_jsx("h4", { className: "my-4 text-lg font-semibold", children: t('configuration.community.color') }), _jsx("span", { children: t('configuration.community.colorDescription') }), _jsx("div", { className: "mt-4 grid gap-6 lg:grid-cols-2", children: ['light', 'dark'].map((mode) => (_jsxs("div", { className: "flex flex-col gap-3", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-x-4 gap-y-2", children: [_jsx("span", { children: t(`configuration.community.${mode}Theme.color`) }), _jsx("input", { className: "border-border !size-8 !rounded-full border [&::-moz-color-swatch]:!m-0 [&::-moz-color-swatch]:!rounded-full [&::-moz-color-swatch]:!border-0 [&::-webkit-color-swatch-wrapper]:!p-0 [&::-webkit-color-swatch]:!rounded-full [&::-webkit-color-swatch]:!border-0", type: "color", value: cfg.theme[mode].primaryHex, onChange: (e) => patch((c) => (c.theme[mode].primaryHex = e.target.value)) }), _jsx("input", { className: "op-input w-32", type: "text", value: cfg.theme[mode].primaryHex, readOnly: true, tabIndex: -1 })] }), _jsx(ThemeColorPreview, { mode: mode, primaryHex: cfg.theme[mode].primaryHex, buttonRadius: cfg.theme[mode].buttonRadius })] }, mode))) })] }), _jsxs("div", { className: "border p-4", children: [_jsx("h4", { className: "my-4 text-lg font-semibold", children: t('configuration.community.typographyAndRadii') }), _jsx("div", { className: "mt-2 grid gap-4 sm:grid-cols-2", children: ['light', 'dark'].map((mode) => (_jsxs("div", { className: "space-y-3", children: [_jsx("div", { className: "font-medium", children: t(`configuration.community.${mode}Theme.mode`) }), _jsxs("label", { className: "block text-sm", children: [t('configuration.community.fontFamily'), _jsx(ThemeFontSelect, { className: "op-input mt-1 w-full", "aria-label": t('configuration.community.fontFamily'), value: cfg.theme[mode].fontFamily, onChange: (fontFamily) => patch((c) => (c.theme[mode].fontFamily = fontFamily)) })] }), _jsxs("label", { className: "block text-sm", children: [t('configuration.community.buttonRadius'), _jsx("input", { className: "op-input mt-1 w-full", type: "text", placeholder: "9999px", value: cfg.theme[mode].buttonRadius ?? '', onChange: (e) => patch((c) => (c.theme[mode].buttonRadius =
56
- e.target.value || undefined)) })] }), _jsxs("label", { className: "block text-sm", children: [t('configuration.community.radius'), _jsx("input", { className: "op-input mt-1 w-full", type: "text", placeholder: "8px", value: cfg.theme[mode].radius ?? '', onChange: (e) => patch((c) => (c.theme[mode].radius = e.target.value || undefined)) })] })] }, mode))) })] }), _jsxs("div", { className: "border p-4", children: [_jsx("h4", { className: "my-4 text-lg font-semibold", children: t('configuration.community.authBackground') }), _jsx("span", { children: t('configuration.community.authBackgroundDescription') }), _jsx("div", { className: "flex flex-wrap gap-x-4", children: ['light', 'dark'].map((mode) => fileInput((file) => uploadInto(file, (c, url) => (c.theme[mode].backgroundAuth = url), 'configuration.community.backgroundAuth'), t(`configuration.community.${mode}Theme.uploadAuthBackground`), cfg.theme[mode].backgroundAuth)) }), _jsx("p", { className: "py-3 text-sm", children: t('configuration.community.authBackgroundRequirements') })] }), _jsxs("div", { className: "border p-4", children: [_jsx("h4", { className: "my-4 text-lg font-semibold", children: t('configuration.community.background') }), _jsx("span", { children: t('configuration.community.backgroundDescription') }), _jsx("div", { className: "flex flex-wrap gap-x-4", children: ['light', 'dark'].map((mode) => fileInput((file) => uploadInto(file, (c, url) => (c.theme[mode].background = url), 'configuration.community.background'), t(`configuration.community.${mode}Theme.uploadBackground`), cfg.theme[mode].background)) }), _jsx("p", { className: "py-3 text-sm", children: t('configuration.community.backgroundRequirements') })] }), _jsxs("div", { className: "border p-4", children: [_jsx("h4", { className: "my-4 text-lg font-semibold", children: t('configuration.community.logo') }), _jsx("span", { children: t('configuration.community.logoDescription') }), _jsx("div", { className: "flex flex-wrap gap-x-4", children: ['light', 'dark'].map((mode) => (_jsxs("div", { children: [_jsx("div", { className: "mb-2 flex flex-wrap gap-x-6 gap-y-2", children: _jsx("img", { className: "h-20 object-contain", alt: t('configuration.community.logo'), src: cfg.theme[mode].logoSmall ?? '/img/logo-small.png' }) }), fileInput((file) => uploadInto(file, (c, url) => (c.theme[mode].logoSmall = url), 'configuration.community.logo'), t(`configuration.community.${mode}Theme.uploadLogo`), undefined, 'hidden')] }, mode))) }), _jsx("p", { className: "py-3 text-sm", children: t('configuration.community.logoRequirements') })] }), _jsx(Button, { variant: "default", action: handleSubmit, disabled: !base || equal(base, cfg), title: t('configuration.community.save'), children: t('configuration.community.save') }), status ? (_jsx(Toast, { variant: "error", onDismiss: () => setStatus(null), children: status })) : null] }));
56
+ e.target.value || undefined)) })] }), _jsxs("label", { className: "block text-sm", children: [t('configuration.community.radius'), _jsx("input", { className: "op-input mt-1 w-full", type: "text", placeholder: "8px", value: cfg.theme[mode].radius ?? '', onChange: (e) => patch((c) => (c.theme[mode].radius = e.target.value || undefined)) })] })] }, mode))) })] }), _jsxs("div", { className: "border p-4", children: [_jsx("h4", { className: "my-4 text-lg font-semibold", children: t('configuration.community.authBackground') }), _jsx("span", { children: t('configuration.community.authBackgroundDescription') }), _jsx("div", { className: "flex flex-wrap gap-x-4", children: ['light', 'dark'].map((mode) => fileInput((file) => uploadInto(file, (c, url) => (c.theme[mode].backgroundAuth = url), 'configuration.community.backgroundAuth'), t(`configuration.community.${mode}Theme.uploadAuthBackground`), cfg.theme[mode].backgroundAuth)) }), _jsx("p", { className: "py-3 text-sm", children: t('configuration.community.authBackgroundRequirements') })] }), _jsxs("div", { className: "border p-4", children: [_jsx("h4", { className: "my-4 text-lg font-semibold", children: t('configuration.community.jamLobbyBackground') }), _jsx("span", { children: t('configuration.community.jamLobbyBackgroundDescription') }), _jsx("div", { className: "flex flex-wrap gap-x-4", children: ['light', 'dark'].map((mode) => fileInput((file) => uploadInto(file, (c, url) => (c.theme[mode].jamLobbyBackground = url), 'configuration.community.jamLobbyBackground'), t(`configuration.community.${mode}Theme.uploadJamLobbyBackground`), cfg.theme[mode].jamLobbyBackground)) }), _jsx("p", { className: "py-3 text-sm", children: t('configuration.community.jamLobbyBackgroundRequirements') })] }), _jsxs("div", { className: "border p-4", children: [_jsx("h4", { className: "my-4 text-lg font-semibold", children: t('configuration.community.background') }), _jsx("span", { children: t('configuration.community.backgroundDescription') }), _jsx("div", { className: "flex flex-wrap gap-x-4", children: ['light', 'dark'].map((mode) => fileInput((file) => uploadInto(file, (c, url) => (c.theme[mode].background = url), 'configuration.community.background'), t(`configuration.community.${mode}Theme.uploadBackground`), cfg.theme[mode].background)) }), _jsx("p", { className: "py-3 text-sm", children: t('configuration.community.backgroundRequirements') })] }), _jsxs("div", { className: "border p-4", children: [_jsx("h4", { className: "my-4 text-lg font-semibold", children: t('configuration.community.logo') }), _jsx("span", { children: t('configuration.community.logoDescription') }), _jsx("div", { className: "flex flex-wrap gap-x-4", children: ['light', 'dark'].map((mode) => (_jsxs("div", { children: [_jsx("div", { className: "mb-2 flex flex-wrap gap-x-6 gap-y-2", children: _jsx("img", { className: "h-20 object-contain", alt: t('configuration.community.logo'), src: cfg.theme[mode].logoSmall ?? '/img/logo-small.png' }) }), fileInput((file) => uploadInto(file, (c, url) => (c.theme[mode].logoSmall = url), 'configuration.community.logo'), t(`configuration.community.${mode}Theme.uploadLogo`), undefined, 'hidden')] }, mode))) }), _jsx("p", { className: "py-3 text-sm", children: t('configuration.community.logoRequirements') })] }), _jsx(Button, { variant: "default", action: handleSubmit, disabled: !base || equal(base, cfg), title: t('configuration.community.save'), children: t('configuration.community.save') }), status ? (_jsx(Toast, { variant: "error", onDismiss: () => setStatus(null), children: status })) : null] }));
57
57
  }
@@ -19,6 +19,7 @@ export declare function useCommunityConfig(): {
19
19
  defaultProfileAvatar?: string | undefined;
20
20
  defaultGroupAvatar?: string | undefined;
21
21
  backgroundAuth?: string | undefined;
22
+ jamLobbyBackground?: string | undefined;
22
23
  background?: string | undefined;
23
24
  };
24
25
  dark: {
@@ -31,6 +32,7 @@ export declare function useCommunityConfig(): {
31
32
  defaultProfileAvatar?: string | undefined;
32
33
  defaultGroupAvatar?: string | undefined;
33
34
  backgroundAuth?: string | undefined;
35
+ jamLobbyBackground?: string | undefined;
34
36
  background?: string | undefined;
35
37
  };
36
38
  icon?: string | undefined;
@@ -98,6 +100,7 @@ export declare function useCommunityConfig(): {
98
100
  defaultProfileAvatar?: string | undefined;
99
101
  defaultGroupAvatar?: string | undefined;
100
102
  backgroundAuth?: string | undefined;
103
+ jamLobbyBackground?: string | undefined;
101
104
  background?: string | undefined;
102
105
  };
103
106
  dark: {
@@ -110,6 +113,7 @@ export declare function useCommunityConfig(): {
110
113
  defaultProfileAvatar?: string | undefined;
111
114
  defaultGroupAvatar?: string | undefined;
112
115
  backgroundAuth?: string | undefined;
116
+ jamLobbyBackground?: string | undefined;
113
117
  background?: string | undefined;
114
118
  };
115
119
  icon?: string | undefined;
@@ -44,7 +44,7 @@ export function RequestResetPassword() {
44
44
  defaultValue: 'Email',
45
45
  }), children: _jsx(Input, { type: "email", "data-testid": "auth-request-reset-email", value: email, onChange: (e) => setEmail(e.target.value), required: true, placeholder: t('auth.requestResetPassword.emailPlaceholder', {
46
46
  defaultValue: 'you@email.org',
47
- }) }) }), error && (_jsx("p", { className: "text-error border-error/40 rounded-md border p-2 text-sm", children: error })), notice && (_jsx(Toast, { variant: "success", testId: "auth-request-reset-success", onDismiss: () => setNotice(null), children: notice })), _jsx(Button, { title: t('auth.requestResetPassword.title', {
47
+ }) }) }), error && (_jsx("p", { className: "text-error border-error/40 rounded-md border p-2 text-sm", children: error })), notice && (_jsx(Toast, { variant: "success", testId: "auth-request-reset-success", onDismiss: () => setNotice(null), children: notice })), _jsx(Button, { title: t('auth.requestResetPassword.heading', {
48
48
  defaultValue: 'Request Password Reset',
49
49
  }), action: handleSubmit, variant: "default", className: "w-full", "data-testid": "auth-request-reset-submit", children: t('auth.requestResetPassword.proceed', { defaultValue: 'Proceed' }) })] }) }));
50
50
  }