@openpeepshq/rn-components 0.13.3 → 0.14.1

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/README.md +2 -0
  2. package/package.json +4 -3
  3. package/src/components/buttonOverflow.test.tsx +455 -0
  4. package/src/components/groups/GroupCard.tsx +26 -23
  5. package/src/components/groups/JoinGroupButton.tsx +7 -2
  6. package/src/components/jams/JamCapacityGate.tsx +9 -1
  7. package/src/components/jams/JamDeviceSelectors.tsx +2 -2
  8. package/src/components/jams/JamFooter.tsx +26 -22
  9. package/src/components/jams/JamLobby.tsx +5 -3
  10. package/src/components/jams/JamParticipantConference.tsx +6 -1
  11. package/src/components/jams/JamPeopleDrawer.tsx +19 -3
  12. package/src/components/jams/JamRequestJoin.tsx +30 -3
  13. package/src/components/jams/JamRoomIndicators.test.tsx +80 -4
  14. package/src/components/jams/JamRoomIndicators.tsx +34 -1
  15. package/src/components/jams/JamVideoCall.tsx +5 -5
  16. package/src/components/jams/LeaveCloseButton.tsx +5 -1
  17. package/src/components/post/pieces/FeedPostStats.tsx +15 -11
  18. package/src/components/post/pieces/PollContent.tsx +1 -1
  19. package/src/components/post/pieces/PostMenu.test.tsx +333 -0
  20. package/src/components/post/pieces/PostMenu.tsx +19 -15
  21. package/src/components/post/post-form/ReplyModal.tsx +1 -1
  22. package/src/components/post/types/Event.tsx +6 -2
  23. package/src/components/profile/Avatar.tsx +4 -1
  24. package/src/components/profile/ProfileWithActionCard.tsx +14 -6
  25. package/src/components/resources/ResourceLibrary.tsx +0 -1
  26. package/src/hooks/use-controlled-sheet.test.tsx +140 -0
  27. package/src/hooks/use-controlled-sheet.ts +25 -2
  28. package/src/lib/post.ts +0 -128
  29. package/src/pages/Explore.tsx +1 -3
  30. package/src/pages/conversations/Info.tsx +1 -1
  31. package/src/pages/conversations/New.tsx +1 -1
  32. package/src/pages/posts/Edit.tsx +1 -1
  33. package/src/pages/posts/New.carryover.test.tsx +245 -0
  34. package/src/pages/posts/New.tsx +19 -3
  35. package/src/pages/posts/Reply.tsx +19 -4
  36. package/src/stores/useLocalPostStore.ts +7 -4
package/README.md CHANGED
@@ -14,6 +14,8 @@ pnpm add @openpeepshq/rn-components
14
14
 
15
15
  Wrap your app with **`OpenpeepsProvider`** from `@openpeepshq/rn-components` (and a credentials store + `baseUrl`) so `useOpenpeeps()` and theme code work. This re-exports the web provider from `@openpeepshq/react` with React Native `AppState` foreground handling wired in — do not import `OpenpeepsProvider` from `@openpeepshq/react` in native apps.
16
16
 
17
+ Also mount **`BottomSheetModalProvider`** from `@gorhom/bottom-sheet` **once at the app root** (e.g. inside your root navigator). Every sheet in this package (`BaseSheet`-based modals) is a gorhom `BottomSheetModal` and silently fails to present without it.
18
+
17
19
  Configure **NativeWind** / Tailwind in the app (include this package in Tailwind `content`), load `src/global.css` from your entry, and supply **`react-native-config`** (or compatible env) for `BASE_URL` and related keys.
18
20
 
19
21
  Wrap Metro with **`withOpenPeepsMetro`** (outside `withNativeWind`) so css-interop observables defer on React 19 and `react-native-sound` 0.11.x can `require()` RN 0.80+ `resolveAssetSource`. Hosts should not patch `react-native-css-interop` or `react-native-sound`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openpeepshq/rn-components",
3
- "version": "0.13.3",
3
+ "version": "0.14.1",
4
4
  "description": "React Native community screens and shared UI (extracted from the Black Ambition app) for the OpenPeeps stack.",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./src/index.ts",
@@ -142,8 +142,9 @@
142
142
  "timezones-list": "^3.1.0",
143
143
  "validator": "^13.15.23",
144
144
  "zustand": "^5.0.3",
145
- "@openpeepshq/common": "^0.8.0",
146
- "@openpeepshq/react": "^0.14.1"
145
+ "@openpeepshq/common": "^0.9.1",
146
+ "@openpeepshq/react": "^0.15.1",
147
+ "@openpeepshq/fetch-client": "^0.2.1"
147
148
  },
148
149
  "devDependencies": {
149
150
  "@babel/core": "^7.26.7",
@@ -0,0 +1,455 @@
1
+ /**
2
+ * Regression tests for #1813 — "buttons do not fit on screen, they go off to
3
+ * the right" (iPhone 11, 414pt). Three horizontal rows used an unbounded
4
+ * `justify-between` layout whose children could not shrink, so when their
5
+ * intrinsic width exceeded the row the rightmost control was pushed past the
6
+ * screen edge:
7
+ *
8
+ * - the feed event card's "View Event" button (post/types/Event.tsx),
9
+ * - the group card's "View" / join button (groups/GroupCard.tsx),
10
+ * - the mobile jam footer's "Leave" button (jams/JamFooter.tsx).
11
+ *
12
+ * The fix gives each row a shrinkable, truncating left side (`min-w-0 flex-1`
13
+ * + `numberOfLines={1}`) and an unsquishable right side (`shrink-0`), mirroring
14
+ * the web `GroupCard` and the `JamDesktopFooter` patterns already in this
15
+ * package. The shrinkable-left role applies to the variable-width text nodes
16
+ * themselves (the event date range, the group name), not just their row
17
+ * wrappers — in Yoga a text with `numberOfLines={1}` alone keeps its intrinsic
18
+ * width and can still push a `shrink-0` sibling off the right edge. These
19
+ * render tests pin those flex roles so the overflow class cannot return.
20
+ *
21
+ * All external modules are mocked (node jest env, no native modules); the host
22
+ * elements forward `className`/`numberOfLines` so the layout classes under
23
+ * test are readable on the rendered tree.
24
+ */
25
+ import { type ReactNode } from 'react';
26
+ import ReactTestRenderer from 'react-test-renderer';
27
+
28
+ const React = require('react');
29
+
30
+ const { mapColors } = require('../theme/defaults');
31
+
32
+ const el =
33
+ (tag: string, props?: Record<string, unknown>) =>
34
+ ({ children, ...rest }: { children?: ReactNode } & Record<string, unknown>) =>
35
+ React.createElement(tag, props ? { ...props, ...rest } : rest, children);
36
+
37
+ jest.mock('react-native', () => ({
38
+ View: el('View'),
39
+ Text: el('Text'),
40
+ Pressable: el('Pressable'),
41
+ }));
42
+
43
+ jest.mock('react-i18next', () => ({
44
+ useTranslation: () => ({
45
+ t: (_key: string, opts?: { defaultValue?: string }) =>
46
+ opts?.defaultValue ?? _key,
47
+ }),
48
+ }));
49
+
50
+ jest.mock('@react-navigation/native', () => ({
51
+ useNavigation: () => ({ navigate: jest.fn() }),
52
+ }));
53
+ jest.mock('@react-navigation/native-stack', () => ({}));
54
+
55
+ jest.mock('@openpeepshq/common', () => ({
56
+ formatBadgeCount: (n: number) => String(n),
57
+ isDeletedProfile: () => false,
58
+ }));
59
+ jest.mock('@openpeepshq/common/lib', () => ({
60
+ formatEventRecurrence: () => '',
61
+ }));
62
+
63
+ jest.mock('@openpeepshq/react', () => ({
64
+ useOpenpeeps: () => ({ queryClient: { invalidateQueries: jest.fn() } }),
65
+ useJamFooterControls: () => ({
66
+ isModerator: false,
67
+ isRecording: false,
68
+ recordingLabel: 'Record',
69
+ recordingEnabled: false,
70
+ busy: false,
71
+ sendReactionEmoji: jest.fn(),
72
+ toggleRecording: jest.fn(),
73
+ raiseHand: jest.fn(),
74
+ }),
75
+ // LeaveCloseButton context hooks (the real component is rendered in its own
76
+ // case below; JamFooter keeps its LeaveCloseButton element mock).
77
+ useJamContext: () => ({
78
+ jam: { moderators: [] },
79
+ jamPost: { id: 'jam-1' },
80
+ occurrence: undefined,
81
+ markIntentionalLeave: jest.fn(),
82
+ }),
83
+ useLeaveCloseJam: () => ({
84
+ busy: false,
85
+ confirmOpen: false,
86
+ setConfirmOpen: jest.fn(),
87
+ handleClick: jest.fn(),
88
+ handleLeave: jest.fn(),
89
+ handleClose: jest.fn(),
90
+ }),
91
+ // FollowUnfollowButton + profile/Avatar helpers (both render for real
92
+ // inside ProfileWithActionCard)
93
+ useFollowProfile: () => ({
94
+ isSelf: false,
95
+ isFollowing: false,
96
+ follow: jest.fn(),
97
+ unfollow: jest.fn(),
98
+ }),
99
+ hueFromHandle: () => 210,
100
+ initialsBackground: () => '#ddd',
101
+ svgCoverSrc: () => undefined,
102
+ getInitials: () => '',
103
+ }));
104
+
105
+ // Real theme defaults (nativewind-free), so useThemeOpacity color math runs
106
+ // as real code (same approach as JamRoomIndicators.test.tsx).
107
+ jest.mock('../theme/OpenPeepsThemeProvider', () => ({
108
+ useOpenPeepsTheme: () => ({
109
+ isDark: false,
110
+ colors: mapColors(false),
111
+ buttonRadius: '9999px',
112
+ refresh: () => {},
113
+ }),
114
+ }));
115
+
116
+ // `lib/utils` imports react-native-config (native module, ESM-only) — mock it
117
+ // wholesale with the helpers the components under test actually use.
118
+ jest.mock('../lib/utils', () => ({
119
+ cn: (...classes: (string | undefined)[]) => classes.filter(Boolean).join(' '),
120
+ formatEventDate: (_d?: unknown) => 'Jan 5',
121
+ }));
122
+
123
+ jest.mock('./ui/avatar', () => ({
124
+ Avatar: (props: Record<string, unknown>) =>
125
+ React.createElement('Avatar', props, props.children as never),
126
+ AvatarImage: () => null,
127
+ AvatarFallback: () => null,
128
+ }));
129
+ jest.mock('./ui/themed-text', () => ({
130
+ ThemedText: el('ThemedText', { forwarded: true }),
131
+ TextClassContext: {
132
+ Provider: ({ children }: { children?: ReactNode }) => children,
133
+ },
134
+ }));
135
+ jest.mock('./ui/button', () => ({
136
+ Button: el('Button', { forwarded: true }),
137
+ }));
138
+ // Default import (`import Toast from …`) in JamFooter /
139
+ // FollowUnfollowButton / JoinGroupButton — expose the `default` shape.
140
+ jest.mock('react-native-toast-message', () => ({
141
+ __esModule: true,
142
+ default: { show: jest.fn() },
143
+ }));
144
+ jest.mock('./icons/index', () => ({
145
+ UsersIcon: () => null,
146
+ UserXIcon: () => null,
147
+ CircleEllipsisIcon: () => null,
148
+ CircleStopIcon: () => null,
149
+ DiscIcon: () => null,
150
+ HandIcon: () => null,
151
+ InfoIcon: () => null,
152
+ LaughIcon: () => null,
153
+ MessageSquareTextIcon: () => null,
154
+ UsersRoundIcon: () => null,
155
+ }));
156
+
157
+ // The feed event card pulls the `custom/common` barrel (CachedImage,
158
+ // ParticipantAvatar), which transitively imports native modules unavailable in
159
+ // the node jest env — render them inert.
160
+ jest.mock('./custom/common/index', () => {
161
+ const React = require('react');
162
+ return {
163
+ CachedImage: (props: { children?: ReactNode }) =>
164
+ React.createElement('CachedImage', null, props.children),
165
+ };
166
+ });
167
+ jest.mock('./custom/common/participant-avatar', () => ({
168
+ ParticipantAvatar: () => null,
169
+ }));
170
+
171
+ jest.mock('./groups/JoinGroupButton', () => ({
172
+ JoinGroupButton: el('JoinGroupButton'),
173
+ }));
174
+ jest.mock('./jams/JamDeviceSelectors', () => ({
175
+ JamMicSelector: () => null,
176
+ JamCameraSelector: () => null,
177
+ JamAudioOutputSelector: () => null,
178
+ }));
179
+ jest.mock('./jams/JamReactionMenu', () => ({
180
+ JamReactionMenu: () => null,
181
+ }));
182
+ jest.mock('./jams/JamToolbarButton', () => ({
183
+ JamToolbarButton: el('JamToolbarButton'),
184
+ toneIconClass: {},
185
+ }));
186
+ const realLeaveCloseButton = jest.requireActual(
187
+ './jams/LeaveCloseButton'
188
+ ) as typeof import('./jams/LeaveCloseButton');
189
+ jest.mock('./jams/LeaveCloseButton', () => ({
190
+ ...realLeaveCloseButton,
191
+ // JamFooter renders the element mock; the dedicated case below renders
192
+ // LeaveCloseButton directly for the real component's guards.
193
+ LeaveCloseButton: el('LeaveCloseButton', { forwarded: true }),
194
+ }));
195
+
196
+ // LiveKit / the footer controls hook are irrelevant to the layout.
197
+ jest.mock('@livekit/react-native', () => ({
198
+ useParticipants: () => [],
199
+ useRoomContext: () => ({ disconnect: jest.fn() }),
200
+ }));
201
+
202
+ import { FeedEvent } from './post/types/Event';
203
+ import { GroupCard } from './groups/GroupCard';
204
+ import { JamFooter } from './jams/JamFooter';
205
+ import { ProfileWithActionCard } from './profile/ProfileWithActionCard';
206
+
207
+ // The real LeaveCloseButton, kept aside from its JamFooter element mock.
208
+ const { LeaveCloseButton: RealLeaveCloseButton } = realLeaveCloseButton;
209
+
210
+ type TreeNode = {
211
+ type: string;
212
+ props?: Record<string, unknown>;
213
+ children?: (string | TreeNode)[];
214
+ };
215
+
216
+ const walk = (node: TreeNode): TreeNode[] => [
217
+ node,
218
+ ...(node.children ?? [])
219
+ .filter((child): child is TreeNode => typeof child !== 'string')
220
+ .flatMap((child) => walk(child)),
221
+ ];
222
+
223
+ const find = (
224
+ node: TreeNode,
225
+ type: string,
226
+ prop: string
227
+ ): TreeNode | undefined =>
228
+ walk(node).find((n) => n.type === type && n.props && prop in n.props);
229
+
230
+ /** First element of `type` whose `className` contains every given token. */
231
+ const findWithClass = (
232
+ node: TreeNode,
233
+ type: string,
234
+ ...tokens: string[]
235
+ ): TreeNode | undefined =>
236
+ walk(node).find((n) => {
237
+ if (n.type !== type || typeof n.props?.className !== 'string') return false;
238
+ return tokens.every((t) => String(n.props!.className).includes(t));
239
+ });
240
+
241
+ const containsText = (node: TreeNode, text: string): boolean =>
242
+ walk(node).some((n) => {
243
+ if (typeof n.children === 'undefined') return false;
244
+ const joined = (n.children ?? [])
245
+ .map((c) => (typeof c === 'string' ? c : containsText(c, text)))
246
+ .filter(Boolean)
247
+ .join(' ');
248
+ return joined.includes(text);
249
+ });
250
+
251
+ const render = (ui: ReactNode): TreeNode => {
252
+ let tree!: ReactTestRenderer.ReactTestRenderer;
253
+ ReactTestRenderer.act(() => {
254
+ tree = ReactTestRenderer.create(ui);
255
+ });
256
+ expect(tree.toJSON()).not.toBeNull();
257
+ return tree.toJSON() as unknown as TreeNode;
258
+ };
259
+
260
+ describe('feed event card (post/types/Event.tsx)', () => {
261
+ const feedPost = {
262
+ id: 'post-1',
263
+ profile: { id: 'owner', displayName: 'Owner' },
264
+ visibility: 'public',
265
+ occurrenceStart: 'start',
266
+ occurrenceEnd: 'end',
267
+ data: { type: 'event', name: 'Meetup', timeZone: 'America/Chicago' },
268
+ };
269
+
270
+ test('long date range: date text truncates and the View Event button stays on-screen', () => {
271
+ const root = render(<FeedEvent post={feedPost as never} />);
272
+ expect(containsText(root, 'View Event')).toBe(true);
273
+
274
+ // The left date text is the shrinkable, truncating side of the row.
275
+ const dateText = find(root, 'ThemedText', 'numberOfLines');
276
+ expect(dateText).toBeDefined();
277
+ expect(dateText!.props?.numberOfLines).toBe(1);
278
+ expect(String(dateText!.props?.className)).toContain(
279
+ 'text-muted-foreground'
280
+ );
281
+ // `numberOfLines` alone does not yield width in Yoga — the text must also
282
+ // be shrinkable, or a long date range pushes the button off-screen again.
283
+ expect(String(dateText!.props?.className)).toContain('min-w-0');
284
+ expect(String(dateText!.props?.className)).toContain('flex-1');
285
+
286
+ // The "View Event" button is the unsquishable right-hand control: it keeps
287
+ // its own width instead of being pushed off the right edge.
288
+ const button = find(root, 'Button', 'onPress');
289
+ expect(button).toBeDefined();
290
+ expect(String(button!.props?.className)).toContain('shrink-0');
291
+ });
292
+
293
+ test('event without an end time still keeps the guard on the button', () => {
294
+ const root = render(
295
+ <FeedEvent post={{ ...feedPost, occurrenceEnd: undefined } as never} />
296
+ );
297
+ const button = find(root, 'Button', 'onPress');
298
+ expect(button).toBeDefined();
299
+ expect(String(button!.props?.className)).toContain('shrink-0');
300
+ });
301
+ });
302
+
303
+ describe('group card (groups/GroupCard.tsx)', () => {
304
+ const group = {
305
+ id: 'g-1',
306
+ name: 'A very long group name that will never fit on one narrow row',
307
+ displayName: 'A very long group name that will never fit on one narrow row',
308
+ membersCount: 42,
309
+ avatar: undefined,
310
+ };
311
+
312
+ test('long group name: name truncates and the action stays on-screen', () => {
313
+ const root = render(
314
+ <GroupCard
315
+ group={group as never}
316
+ isGroupMember
317
+ handleViewGroup={() => {}}
318
+ />
319
+ );
320
+
321
+ // The group name is the shrinkable, truncating side of the inner name row
322
+ // (next to the fixed-width unread badge): it yields width and ellipsizes
323
+ // instead of pushing the badge or the action column off the card.
324
+ const name = findWithClass(
325
+ root,
326
+ 'ThemedText',
327
+ 'min-w-0',
328
+ 'flex-1',
329
+ 'font-semibold'
330
+ );
331
+ expect(name).toBeDefined();
332
+ expect(name!.props?.numberOfLines).toBe(1);
333
+ // The component renders the display name itself (no truncateText
334
+ // pre-truncation), so the full string must be present on the tree.
335
+ expect(
336
+ containsText(root, 'A very long group name that will never fit')
337
+ ).toBe(true);
338
+
339
+ // The action column (View / join) is unsquishable, so it never gets pushed
340
+ // off the right edge.
341
+ const action = findWithClass(root, 'View', 'shrink-0', 'ml-2');
342
+ expect(action).toBeDefined();
343
+ });
344
+
345
+ test('non-member: the action column keeps the shrink guard', () => {
346
+ const root = render(
347
+ <GroupCard
348
+ group={group as never}
349
+ isGroupMember={false}
350
+ handleViewGroup={() => {}}
351
+ />
352
+ );
353
+ // The join control renders, and its action column is still unsquishable.
354
+ const join = [...walk(root)].find((n) => n.type === 'JoinGroupButton');
355
+ expect(join).toBeDefined();
356
+ const action = findWithClass(root, 'View', 'shrink-0', 'ml-2');
357
+ expect(action).toBeDefined();
358
+ });
359
+ });
360
+
361
+ describe('mobile jam footer (jams/JamFooter.tsx)', () => {
362
+ const props = {
363
+ chatOpen: false,
364
+ onToggleChat: () => {},
365
+ peopleOpen: false,
366
+ onTogglePeople: () => {},
367
+ detailsOpen: false,
368
+ onToggleDetails: () => {},
369
+ speakerEnabled: true,
370
+ onSpeakerChange: () => {},
371
+ onToggleSpeaker: () => {},
372
+ };
373
+
374
+ test('device group can yield width; the Leave cluster is fixed', () => {
375
+ const root = render(<JamFooter {...(props as never)} />);
376
+
377
+ const views = [...walk(root)]
378
+ .filter(
379
+ (n) => n.type === 'View' && typeof n.props?.className === 'string'
380
+ )
381
+ .map((n) => String(n.props?.className));
382
+ expect(views.length).toBeGreaterThanOrEqual(2);
383
+
384
+ // The left device-selector group is the shrinkable side of the footer row
385
+ // and clips (never overflows onto) the fixed right cluster.
386
+ const left = views.find(
387
+ (c) => c.includes('min-w-0') && c.includes('flex-1')
388
+ );
389
+ expect(left).toBeDefined();
390
+ expect(left).toContain('overflow-hidden');
391
+
392
+ // The reactions / overflow / Leave cluster is the unsquishable side, so
393
+ // "Leave" can never be pushed past the screen edge.
394
+ const right = views.find((c) => c.includes('shrink-0'));
395
+ expect(right).toBeDefined();
396
+
397
+ // The Leave control is present in the fixed cluster.
398
+ const leave = [...walk(root)].find((n) => n.type === 'LeaveCloseButton');
399
+ expect(leave).toBeDefined();
400
+ });
401
+ });
402
+
403
+ // The real Leave button (round-3 suggestion 4): the JamFooter case mocks this
404
+ // component, so its own guards are pinned here — its context hooks are mocked
405
+ // alongside the other @openpeepshq/react hooks at the top of the file, so it
406
+ // renders without native modules and its Button / text props stay readable.
407
+ describe('real leave/close button (jams/LeaveCloseButton.tsx)', () => {
408
+ test('the Leave label is unsquishable and never wraps', () => {
409
+ const root = render(<RealLeaveCloseButton />);
410
+
411
+ const button = find(root, 'Button', 'onPress');
412
+ expect(button).toBeDefined();
413
+ expect(String(button!.props?.className)).toContain('shrink-0');
414
+ const label = find(root, 'ThemedText', 'numberOfLines');
415
+ expect(label).toBeDefined();
416
+ expect(label!.props?.numberOfLines).toBe(1);
417
+ expect(containsText(root, 'jams.exit.confirm')).toBe(true);
418
+ });
419
+ });
420
+
421
+ // Same overflow class in the profile rows with a trailing follow/unfollow
422
+ // button (round-3 suggestion 1): the card renders at full sheet width in
423
+ // RepostModal/ReactionsModal, so a long name/handle must shrink and truncate
424
+ // instead of pushing the button past the right edge.
425
+ describe('profile with action card (profile/ProfileWithActionCard.tsx)', () => {
426
+ const profile = {
427
+ did: 'did:plc:test',
428
+ handle: 'grace.hopper@example',
429
+ displayName:
430
+ 'A very long display name that will never fit on one narrow row',
431
+ } as never;
432
+
433
+ test('long name: texts truncate and the follow button stays on-screen', () => {
434
+ const root = render(<ProfileWithActionCard profile={profile} />);
435
+
436
+ // The name/handle texts are the shrinkable, truncating side of the row.
437
+ const name = findWithClass(root, 'ThemedText', 'font-bold');
438
+ expect(name).toBeDefined();
439
+ expect(name!.props?.numberOfLines).toBe(1);
440
+ const texts = [...walk(root)].filter((n) => n.type === 'ThemedText');
441
+ expect(
442
+ texts.some((n) => String(n.props?.numberOfLines ?? '') === '1')
443
+ ).toBe(true);
444
+
445
+ // The text column yields width; the follow button never leaves the edge.
446
+ const column = findWithClass(root, 'View', 'min-w-0', 'flex-1');
447
+ expect(column).toBeDefined();
448
+ const action = findWithClass(root, 'View', 'shrink-0');
449
+ expect(action).toBeDefined();
450
+ // FollowUnfollowButton renders for real (its hooks are mocked at the top
451
+ // of the file); its unsquishable wrapper column is the pinned contract.
452
+ const actionButton = findWithClass(action!, 'Button');
453
+ expect(actionButton).toBeDefined();
454
+ });
455
+ });
@@ -4,7 +4,6 @@ import { formatBadgeCount, GroupWithMeta } from '@openpeepshq/common';
4
4
  import { useOpenpeeps } from '@openpeepshq/react';
5
5
  import { Avatar, AvatarFallback, AvatarImage } from '../ui/avatar';
6
6
  import { ThemedText } from '../ui/themed-text';
7
- import { truncateText } from '../../lib/utils';
8
7
  import { Button } from '../ui/button';
9
8
  import { UsersIcon } from '../icons/index';
10
9
  import { useTranslation } from 'react-i18next';
@@ -27,12 +26,12 @@ export const GroupCard = ({
27
26
  const { t } = useTranslation();
28
27
 
29
28
  return (
30
- <View className="flex flex-row justify-between w-full mb-8">
29
+ <View className="flex flex-row items-center justify-between w-full mb-8">
31
30
  <Pressable
32
31
  onPress={handleViewGroup}
33
- className="flex flex-row items-center gap-x-2"
32
+ className="flex min-w-0 flex-1 flex-row items-center gap-x-2"
34
33
  >
35
- <Avatar alt="profile" className="size-16">
34
+ <Avatar alt="profile" className="size-16 shrink-0">
36
35
  {group?.avatar ? (
37
36
  <AvatarImage
38
37
  source={{
@@ -45,10 +44,13 @@ export const GroupCard = ({
45
44
  </AvatarFallback>
46
45
  )}
47
46
  </Avatar>
48
- <View className="ml-2">
47
+ <View className="ml-2 min-w-0 flex-1">
49
48
  <View className="flex-row items-center gap-x-2">
50
- <ThemedText className="text-lg font-semibold">
51
- {truncateText(group.displayName, 25) || '-'}
49
+ <ThemedText
50
+ className="min-w-0 flex-1 text-lg font-semibold"
51
+ numberOfLines={1}
52
+ >
53
+ {group.displayName || '-'}
52
54
  </ThemedText>
53
55
  {unreadCount > 0 ? (
54
56
  <View className="bg-destructive size-5 min-w-5 shrink-0 items-center justify-center rounded-full px-1">
@@ -59,26 +61,27 @@ export const GroupCard = ({
59
61
  ) : null}
60
62
  </View>
61
63
  <View className="flex-row gap-x-3 mt-2 items-center">
62
- <ThemedText className="text-sm">
63
- {group?.membersCount} Member
64
- {group?.membersCount && group?.membersCount > 1 ? 's' : ''}
64
+ <ThemedText className="text-sm" numberOfLines={1}>
65
+ {t('groups.members.count', { count: group?.membersCount ?? 0 })}
65
66
  </ThemedText>
66
67
  </View>
67
68
  </View>
68
69
  </Pressable>
69
- {!isGroupMember ? (
70
- <JoinGroupButton
71
- group={group}
72
- onJoined={async () => {
73
- await queryClient.invalidateQueries();
74
- handleViewGroup();
75
- }}
76
- />
77
- ) : (
78
- <Button variant="outline" onPress={handleViewGroup}>
79
- <ThemedText>{t('groups.actions.view')}</ThemedText>
80
- </Button>
81
- )}
70
+ <View className="flex shrink-0 ml-2">
71
+ {!isGroupMember ? (
72
+ <JoinGroupButton
73
+ group={group}
74
+ onJoined={async () => {
75
+ await queryClient.invalidateQueries();
76
+ handleViewGroup();
77
+ }}
78
+ />
79
+ ) : (
80
+ <Button variant="outline" onPress={handleViewGroup}>
81
+ <ThemedText>{t('groups.actions.view')}</ThemedText>
82
+ </Button>
83
+ )}
84
+ </View>
82
85
  </View>
83
86
  );
84
87
  };
@@ -33,8 +33,13 @@ export const JoinGroupButton = ({ group, onJoined }: JoinGroupButtonProps) => {
33
33
  };
34
34
 
35
35
  return (
36
- <Button variant="outline" disabled={submitting} onPress={onPress}>
37
- <ThemedText>
36
+ <Button
37
+ variant="outline"
38
+ disabled={submitting}
39
+ onPress={onPress}
40
+ className="shrink-0"
41
+ >
42
+ <ThemedText numberOfLines={1}>
38
43
  {submitting ? t('common.states.loading') : t('groups.join.submit')}
39
44
  </ThemedText>
40
45
  </Button>
@@ -7,11 +7,12 @@ import { useCurrentProfile, useRouter } from '@openpeepshq/react';
7
7
  import { Button } from '../ui/button';
8
8
  import { ThemedText } from '../ui/themed-text';
9
9
  import { EventRsvpButton } from '../post/pieces/EventRsvpButton';
10
+ import { JamGuestForm } from './JamGuestForm';
10
11
  import { JamRoomPanel, JamRoomPanelLink } from './JamRoomPanel';
11
12
 
12
13
  export interface JamCapacityGateProps {
13
14
  jamPost: PublicPost;
14
- reason: 'full' | 'rsvp-required' | 'removed';
15
+ reason: 'full' | 'rsvp-required' | 'removed' | 'guest-required';
15
16
  eventName?: string;
16
17
  occurrence?: string;
17
18
  }
@@ -26,6 +27,13 @@ export const JamCapacityGate = ({
26
27
  const me = useCurrentProfile();
27
28
  const router = useRouter();
28
29
  const eventData = jamPost.data?.type === 'event' ? jamPost.data : undefined;
30
+
31
+ // Signed-out visitor on a waiting-room jam: the join POST refuses anonymous
32
+ // requests, so gate on the guest-pass form before they can queue.
33
+ if (reason === 'guest-required' && !me) {
34
+ return <JamGuestForm />;
35
+ }
36
+
29
37
  const showRsvp =
30
38
  (reason === 'rsvp-required' || reason === 'full') &&
31
39
  !!me &&
@@ -195,8 +195,8 @@ export const JamMicSelector = () => {
195
195
  MediaDeviceFailure.PermissionDenied;
196
196
  showMicToast(
197
197
  denied
198
- ? t('jams.mic.lobbyProbeFailed')
199
- : t('jams.mic.enableFailed')
198
+ ? t('jams.device.mic.lobbyProbeFailed')
199
+ : t('jams.device.mic.enableFailed')
200
200
  );
201
201
  })
202
202
  }