@openpeepshq/react 0.11.1 → 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.
@@ -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
  });
@@ -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;
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openpeepshq/react",
3
- "version": "0.11.1",
3
+ "version": "0.12.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -52,9 +52,9 @@
52
52
  "simple-icons": "^16.31.0",
53
53
  "uuidv7": "^1.0.2",
54
54
  "@openpeepshq/client": "^0.3.0",
55
- "@openpeepshq/react-ui": "^0.5.1",
55
+ "@openpeepshq/common": "^0.6.3",
56
56
  "@openpeepshq/greenscreen": "^0.2.1",
57
- "@openpeepshq/common": "^0.6.2"
57
+ "@openpeepshq/react-ui": "^0.5.1"
58
58
  },
59
59
  "peerDependencies": {
60
60
  "react": "^18.3.0 || ^19.0.0",
@@ -15,10 +15,13 @@ import {
15
15
  } from '@livekit/components-react';
16
16
  import { type LocalVideoTrack, Track } from 'livekit-client';
17
17
  import { Blur, Button } from '@openpeepshq/react-ui';
18
+ import { getTheme } from '@openpeepshq/common';
18
19
  import { useNavigate } from '../../contexts/router';
19
20
  import { useT } from '../../i18n';
20
21
  import { useJamLobby } from '../../hooks/jams/useJamLobby';
21
22
  import type { JamJoinParams } from '../../hooks/jams/useJamRoom';
23
+ import { useCurrentProfileSettings } from '../layout/IdentityContext';
24
+ import { useServerInfo } from '../server-data/context';
22
25
  import { audioOutputSupported } from './constants';
23
26
  import { DeviceSelectorPill } from './JamDeviceSelectors';
24
27
  import { JamGuestForm } from './JamGuestForm';
@@ -53,6 +56,13 @@ export function JamLobby({ onJoin }: JamLobbyProps) {
53
56
 
54
57
  const [settings, updateSettings] = useJamLocalSettings();
55
58
 
59
+ const serverInfo = useServerInfo();
60
+ const profileSettings = useCurrentProfileSettings();
61
+ const lobbyBackground = getTheme(
62
+ serverInfo.communityConfig,
63
+ profileSettings,
64
+ ).jamLobbyBackground;
65
+
56
66
  const [audioEnabled, setAudioEnabled] = useState(true);
57
67
  const [videoEnabled, setVideoEnabled] = useState(false);
58
68
  const [audioDeviceId, setAudioDeviceId] = useState('');
@@ -139,114 +149,125 @@ export function JamLobby({ onJoin }: JamLobbyProps) {
139
149
  });
140
150
 
141
151
  return (
142
- <div className="mx-auto flex h-full w-full max-w-lg items-center justify-center p-4">
143
- <div className="bg-background w-full rounded-md border p-4">
144
- <div className="flex items-center justify-between border-b p-2">
145
- <h2 className="text-lg">
146
- {t('jams.lobby.readyTitle', { defaultValue: 'Ready to join' })}
147
- </h2>
148
- <button
149
- type="button"
150
- title={t('jams.exit.title', { defaultValue: 'Leave' })}
151
- className="bg-surface-2 flex size-8 items-center justify-center rounded-full"
152
- onClick={exitLobby}
153
- >
154
- <X className="size-4" />
155
- </button>
156
- </div>
157
-
158
- <div className="flex flex-col items-center p-5">
159
- <h2 className="my-1 text-center text-lg">
160
- {jamEvent.name ||
161
- t('jams.lobby.fallbackTitle', { defaultValue: 'Jam' })}
162
- </h2>
163
-
164
- <div className="relative size-64">
165
- <video
166
- ref={videoRef}
167
- autoPlay
168
- playsInline
169
- muted
170
- className={`size-64 rounded-xl object-cover ${showVideo ? '' : 'hidden'}`}
171
- />
172
- {!showVideo ? (
173
- <div className="bg-surface flex size-64 items-center justify-center rounded-xl">
174
- <p className="text-lg">
175
- {t('jams.lobby.cameraOff', { defaultValue: 'Camera is off' })}
176
- </p>
177
- </div>
178
- ) : null}
152
+ <div className="relative h-full w-full">
153
+ {lobbyBackground ? (
154
+ <img
155
+ src={lobbyBackground}
156
+ alt=""
157
+ className="absolute inset-0 h-full w-full object-cover"
158
+ />
159
+ ) : null}
160
+ <div className="relative mx-auto flex h-full w-full max-w-lg items-center justify-center p-4">
161
+ <div className="bg-background w-full rounded-md border p-4">
162
+ <div className="flex items-center justify-between border-b p-2">
163
+ <h2 className="text-lg">
164
+ {t('jams.lobby.readyTitle', { defaultValue: 'Ready to join' })}
165
+ </h2>
166
+ <button
167
+ type="button"
168
+ title={t('jams.exit.title', { defaultValue: 'Leave' })}
169
+ className="bg-surface-2 flex size-8 items-center justify-center rounded-full"
170
+ onClick={exitLobby}
171
+ >
172
+ <X className="size-4" />
173
+ </button>
179
174
  </div>
180
175
 
181
- <div className="mt-4 flex w-full items-center justify-center gap-x-4">
182
- <DeviceSelectorPill
183
- enabled={audioEnabled}
184
- onToggle={() => setAudioEnabled((on) => !on)}
185
- onIcon={Mic}
186
- offIcon={MicOff}
187
- deviceType="mic"
188
- devices={audioDevices}
189
- activeDeviceId={audioDeviceId}
190
- onDeviceChange={setAudioDeviceId}
191
- />
192
- {audioOutputSupported ? (
176
+ <div className="flex flex-col items-center p-5">
177
+ <h2 className="my-1 text-center text-lg">
178
+ {jamEvent.name ||
179
+ t('jams.lobby.fallbackTitle', { defaultValue: 'Jam' })}
180
+ </h2>
181
+
182
+ <div className="relative size-64">
183
+ <video
184
+ ref={videoRef}
185
+ autoPlay
186
+ playsInline
187
+ muted
188
+ className={`size-64 rounded-xl object-cover ${showVideo ? '' : 'hidden'}`}
189
+ />
190
+ {!showVideo ? (
191
+ <div className="bg-surface flex size-64 items-center justify-center rounded-xl">
192
+ <p className="text-lg">
193
+ {t('jams.lobby.cameraOff', {
194
+ defaultValue: 'Camera is off',
195
+ })}
196
+ </p>
197
+ </div>
198
+ ) : null}
199
+ </div>
200
+
201
+ <div className="mt-4 flex w-full items-center justify-center gap-x-4">
193
202
  <DeviceSelectorPill
194
- enabled={settings.speakerEnabled}
195
- onToggle={() =>
196
- updateSettings({ speakerEnabled: !settings.speakerEnabled })
197
- }
198
- onIcon={Volume2}
199
- offIcon={VolumeX}
200
- deviceType="speaker"
201
- devices={speakerDevices}
202
- activeDeviceId={settings.speakerDeviceId}
203
- onDeviceChange={(speakerDeviceId) =>
204
- updateSettings({ speakerDeviceId })
205
- }
203
+ enabled={audioEnabled}
204
+ onToggle={() => setAudioEnabled((on) => !on)}
205
+ onIcon={Mic}
206
+ offIcon={MicOff}
207
+ deviceType="mic"
208
+ devices={audioDevices}
209
+ activeDeviceId={audioDeviceId}
210
+ onDeviceChange={setAudioDeviceId}
206
211
  />
207
- ) : null}
208
- <DeviceSelectorPill
209
- enabled={videoEnabled}
210
- onToggle={() => setVideoEnabled((on) => !on)}
211
- onIcon={Video}
212
- offIcon={VideoOff}
213
- deviceType="camera"
214
- devices={videoDevices}
215
- activeDeviceId={videoDeviceId}
216
- onDeviceChange={setVideoDeviceId}
217
- />
218
- <JamToolbarButton
219
- title={
220
- settings.blur
221
- ? t('jams.blur.turnOff', { defaultValue: 'Turn off blur' })
222
- : t('jams.blur.blurBackground', {
223
- defaultValue: 'Blur background',
224
- })
225
- }
226
- tone={settings.blur ? 'active' : 'default'}
227
- action={() => updateSettings({ blur: !settings.blur })}
228
- >
229
- <Blur />
230
- </JamToolbarButton>
212
+ {audioOutputSupported ? (
213
+ <DeviceSelectorPill
214
+ enabled={settings.speakerEnabled}
215
+ onToggle={() =>
216
+ updateSettings({ speakerEnabled: !settings.speakerEnabled })
217
+ }
218
+ onIcon={Volume2}
219
+ offIcon={VolumeX}
220
+ deviceType="speaker"
221
+ devices={speakerDevices}
222
+ activeDeviceId={settings.speakerDeviceId}
223
+ onDeviceChange={(speakerDeviceId) =>
224
+ updateSettings({ speakerDeviceId })
225
+ }
226
+ />
227
+ ) : null}
228
+ <DeviceSelectorPill
229
+ enabled={videoEnabled}
230
+ onToggle={() => setVideoEnabled((on) => !on)}
231
+ onIcon={Video}
232
+ offIcon={VideoOff}
233
+ deviceType="camera"
234
+ devices={videoDevices}
235
+ activeDeviceId={videoDeviceId}
236
+ onDeviceChange={setVideoDeviceId}
237
+ />
238
+ <JamToolbarButton
239
+ title={
240
+ settings.blur
241
+ ? t('jams.blur.turnOff', { defaultValue: 'Turn off blur' })
242
+ : t('jams.blur.blurBackground', {
243
+ defaultValue: 'Blur background',
244
+ })
245
+ }
246
+ tone={settings.blur ? 'active' : 'default'}
247
+ action={() => updateSettings({ blur: !settings.blur })}
248
+ >
249
+ <Blur />
250
+ </JamToolbarButton>
251
+ </div>
231
252
  </div>
232
- </div>
233
253
 
234
- <div className="flex w-full flex-col items-center px-5 pb-4">
235
- <Button
236
- variant="default"
237
- title={t('jams.join.submit', { defaultValue: 'Join Jam' })}
238
- loading={submitting}
239
- action={handleJoin}
240
- >
241
- {jamActive
242
- ? t('jams.join.ctaJoin', { defaultValue: 'Join' })
243
- : t('jams.join.ctaStart', { defaultValue: 'Start' })}
244
- </Button>
245
- {error ? (
246
- <div role="alert" className="text-destructive mt-3 text-sm">
247
- {error}
248
- </div>
249
- ) : null}
254
+ <div className="flex w-full flex-col items-center px-5 pb-4">
255
+ <Button
256
+ variant="default"
257
+ title={t('jams.join.submit', { defaultValue: 'Join Jam' })}
258
+ loading={submitting}
259
+ action={handleJoin}
260
+ >
261
+ {jamActive
262
+ ? t('jams.join.ctaJoin', { defaultValue: 'Join' })
263
+ : t('jams.join.ctaStart', { defaultValue: 'Start' })}
264
+ </Button>
265
+ {error ? (
266
+ <div role="alert" className="text-destructive mt-3 text-sm">
267
+ {error}
268
+ </div>
269
+ ) : null}
270
+ </div>
250
271
  </div>
251
272
  </div>
252
273
  </div>
@@ -10,8 +10,6 @@ import { isBlobUrl, revokeBlobUrl } from '../attachmentPreview';
10
10
  export interface ComposeAttachmentsProps {
11
11
  attachments: MediaAttachmentData[];
12
12
  onChange: (attachments: MediaAttachmentData[]) => void;
13
- /** Image picker may select several files at once (resource galleries). */
14
- multipleImages?: boolean;
15
13
  /** Audio picker may select several files at once (default: yes). */
16
14
  multipleAudio?: boolean;
17
15
  }
@@ -65,7 +63,6 @@ export interface ComposeAttachmentsApi {
65
63
  export function useComposeAttachments({
66
64
  attachments,
67
65
  onChange,
68
- multipleImages = false,
69
66
  multipleAudio = true,
70
67
  }: ComposeAttachmentsProps): ComposeAttachmentsApi {
71
68
  const imageInputRef = useRef<HTMLInputElement>(null);
@@ -138,20 +135,6 @@ export function useComposeAttachments({
138
135
  enqueueFile(processed);
139
136
  };
140
137
 
141
- // A single pick keeps the crop/alt-text flow; a bulk pick is enqueued
142
- // directly, since per-file cropping isn't practical for a gallery batch.
143
- const handleImageFilesSelected = async (files: File[]) => {
144
- const first = files[0];
145
- if (!first) return;
146
- if (files.length === 1) {
147
- await handleImageSelected(first);
148
- return;
149
- }
150
- for (const file of files) {
151
- enqueueFile(await convertToWebpIfHeic(file));
152
- }
153
- };
154
-
155
138
  const onUploaded = (key: string, attachment: MediaAttachment) =>
156
139
  setItems((prev) =>
157
140
  prev.map((i) => {
@@ -226,11 +209,12 @@ export function useComposeAttachments({
226
209
  ref={imageInputRef}
227
210
  type="file"
228
211
  accept="image/*,video/*,.mkv"
229
- multiple={multipleImages}
230
212
  className="hidden"
231
213
  onChange={(e) => {
232
- const files = e.target.files;
233
- if (files?.length) void handleImageFilesSelected(Array.from(files));
214
+ // Single pick only, so the crop/alt-text dialog can be shown for
215
+ // every image (see #1789).
216
+ const file = e.target.files?.[0];
217
+ if (file) void handleImageSelected(file);
234
218
  e.target.value = '';
235
219
  }}
236
220
  />
@@ -48,8 +48,6 @@ export const ResourceForm = ({
48
48
  const attachments = useComposeAttachments({
49
49
  attachments: resource.attachments ?? [],
50
50
  onChange: (next) => patchResource({ attachments: next }),
51
- // Only galleries take more than one file; other kinds pick one at a time.
52
- multipleImages: resource.resourceKind === 'gallery',
53
51
  multipleAudio: false,
54
52
  });
55
53
 
@@ -224,7 +222,8 @@ export const ResourceForm = ({
224
222
  </Label>
225
223
  ) : (
226
224
  <div className="space-y-2">
227
- {/* Only galleries take more than one file; other kinds pick once. */}
225
+ {/* Every image pick is single-file so the crop/alt-text dialog
226
+ shows for every image; galleries stay open for further picks (#1789). */}
228
227
  {resource.resourceKind === 'gallery' ||
229
228
  (resource.attachments ?? []).length === 0 ? (
230
229
  <Button
@@ -1,6 +1,7 @@
1
1
  import { useState } from 'react';
2
2
  import type { CategoryNode } from '@openpeepshq/common/lib';
3
3
  import { Button, Input } from '@openpeepshq/react-ui';
4
+ import { categoryPathKey } from '@openpeepshq/common/lib';
4
5
  import { useT } from '../../i18n';
5
6
 
6
7
  export interface CategoryPathPickerProps {
@@ -24,7 +25,7 @@ const NodeList = ({
24
25
  selected.length === node.path.length &&
25
26
  node.path.every((segment, index) => selected[index] === segment);
26
27
  return (
27
- <li key={node.path.join('/')} className="py-0.5">
28
+ <li key={categoryPathKey(node.path)} className="py-0.5">
28
29
  <button
29
30
  type="button"
30
31
  className={`text-sm ${active ? 'text-foreground font-semibold' : 'text-muted-foreground hover:text-foreground'}`}
@@ -6,7 +6,7 @@ import {
6
6
  ChevronRight,
7
7
  } from 'lucide-react';
8
8
  import type { ResourceKind } from '@openpeepshq/common/types';
9
- import { RESOURCE_KINDS } from '@openpeepshq/common/lib';
9
+ import { RESOURCE_KINDS, categoryPathKey } from '@openpeepshq/common/lib';
10
10
  import { Button, Input, LoadingSpinner } from '@openpeepshq/react-ui';
11
11
  import { useEffect, useMemo, useRef, useState } from 'react';
12
12
  import { useT } from '../../i18n';
@@ -48,10 +48,10 @@ const Tree = ({
48
48
  }) => (
49
49
  <ul className="space-y-1">
50
50
  {nodes.map((node) => {
51
- const nodeKey = node.path.join('/');
51
+ const nodeKey = categoryPathKey(node.path);
52
52
  const nodeCount = counts.get(nodeKey) ?? 0;
53
53
  const isExpanded = expanded.has(nodeKey);
54
- const isSelected = selected.join('/') === nodeKey;
54
+ const isSelected = categoryPathKey(selected) === nodeKey;
55
55
  const hasChildren = node.children.length > 0;
56
56
  return (
57
57
  <li key={nodeKey}>
@@ -179,11 +179,11 @@ export const ResourceLibrary = ({ groupId }: ResourceLibraryProps) => {
179
179
  if (!path?.length) continue;
180
180
  rootCount++;
181
181
  for (let i = 1; i <= path.length; i++) {
182
- const key = path.slice(0, i).join('/');
182
+ const key = categoryPathKey(path.slice(0, i));
183
183
  counts.set(key, (counts.get(key) ?? 0) + 1);
184
184
  }
185
185
  }
186
- counts.set('', rootCount);
186
+ counts.set(categoryPathKey([]), rootCount);
187
187
  return counts;
188
188
  }, [library.posts]);
189
189
 
@@ -232,6 +232,35 @@ export function AdminConfigurationCommunityTheme() {
232
232
  </p>
233
233
  </div>
234
234
 
235
+ {/* jam lobby background */}
236
+ <div className="border p-4">
237
+ <h4 className="my-4 text-lg font-semibold">
238
+ {t('configuration.community.jamLobbyBackground')}
239
+ </h4>
240
+ <span>
241
+ {t('configuration.community.jamLobbyBackgroundDescription')}
242
+ </span>
243
+ <div className="flex flex-wrap gap-x-4">
244
+ {(['light', 'dark'] as Mode[]).map((mode) =>
245
+ fileInput(
246
+ (file) =>
247
+ uploadInto(
248
+ file,
249
+ (c, url) => (c.theme[mode].jamLobbyBackground = url),
250
+ 'configuration.community.jamLobbyBackground',
251
+ ),
252
+ t(
253
+ `configuration.community.${mode}Theme.uploadJamLobbyBackground`,
254
+ ),
255
+ cfg.theme[mode].jamLobbyBackground,
256
+ ),
257
+ )}
258
+ </div>
259
+ <p className="py-3 text-sm">
260
+ {t('configuration.community.jamLobbyBackgroundRequirements')}
261
+ </p>
262
+ </div>
263
+
235
264
  {/* background */}
236
265
  <div className="border p-4">
237
266
  <h4 className="my-4 text-lg font-semibold">