@openpeepshq/rn-components 0.7.2 → 0.8.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.
- package/README.md +1 -1
- package/package.json +11 -6
- package/src/components/custom/modals/media/audio-picker-sheet.tsx +21 -25
- package/src/components/custom/modals/media/document-picker-sheet.tsx +22 -16
- package/src/components/custom/modals/media/video-picker-sheet.tsx +4 -2
- package/src/components/custom/navigation/side-menu.tsx +59 -11
- package/src/components/icons/iconWithClassName.tsx +21 -0
- package/src/components/jams/JamActionsFooter.tsx +8 -2
- package/src/components/jams/JamCapacityGate.tsx +1 -1
- package/src/components/jams/JamCard.tsx +8 -4
- package/src/components/jams/JamConference.tsx +6 -1
- package/src/components/jams/JamParticipantConference.tsx +2 -0
- package/src/components/jams/JamRoom.tsx +2 -3
- package/src/components/jams/LiveJamsSection.tsx +12 -1
- package/src/components/jams/LivekitUnavailableNotice.tsx +25 -0
- package/src/components/jams/index.ts +1 -0
- package/src/components/markdown/MarkdownOverlay.tsx +75 -0
- package/src/components/markdown/OpenpeepsMarkdown.tsx +3 -1
- package/src/components/markdown/extensions/link.tsx +34 -0
- package/src/components/markdown/index.ts +2 -0
- package/src/components/navigation/tab-navigator.tsx +39 -17
- package/src/components/notifications/NotificationItem.tsx +27 -2
- package/src/components/notifications/types/JamStarted.tsx +13 -3
- package/src/components/notifications/types/Reply.tsx +1 -5
- package/src/components/notifications/types/WaitlistOffer.tsx +61 -0
- package/src/components/notifications/types/index.ts +1 -0
- package/src/components/post/CompactReplyParent.tsx +16 -15
- package/src/components/post/TruncatedMarkdown.tsx +60 -0
- package/src/components/post/helpers.ts +2 -2
- package/src/components/post/index.ts +2 -0
- package/src/components/post/pieces/EventRsvpButton.tsx +99 -5
- package/src/components/post/pieces/EventRsvpList.tsx +46 -0
- package/src/components/post/pieces/EventRsvpScopeDialog.tsx +30 -19
- package/src/components/post/pieces/EventWaitlistJoinDialog.tsx +62 -0
- package/src/components/post/pieces/PollContent.tsx +7 -7
- package/src/components/post/pieces/PostActions.tsx +89 -23
- package/src/components/post/pieces/ShareMenu.tsx +2 -2
- package/src/components/post/post-form/DescriptionEditModal.tsx +1 -0
- package/src/components/post/post-form/EventForm.tsx +50 -10
- package/src/components/post/post-form/ResourceForm.tsx +131 -8
- package/src/components/post/types/Article.tsx +6 -2
- package/src/components/post/types/Poll.tsx +4 -1
- package/src/components/post/types/event/CardEvent.tsx +101 -76
- package/src/components/post/types/event/FullEvent.tsx +60 -23
- package/src/components/post/types/event/ProfileEventRelationship.tsx +2 -0
- package/src/components/post/types/resource/FullResource.tsx +9 -1
- package/src/components/preview-link/LocalPreviewLink.tsx +4 -1
- package/src/components/preview-link/helpers.ts +5 -1
- package/src/components/preview-link/index.ts +1 -0
- package/src/components/preview-link/local/WelcomePreview.tsx +59 -0
- package/src/components/profile/Avatar.tsx +0 -1
- package/src/components/profile/EditProfileForm.tsx +23 -2
- package/src/components/profile/ProfileSheet.tsx +1 -1
- package/src/components/resources/ResourceCard.tsx +62 -14
- package/src/components/resources/ResourceLibrary.tsx +2 -2
- package/src/components/ui/badge.tsx +2 -3
- package/src/components/ui/bottom-sheet.tsx +0 -6
- package/src/components/ui/popup-menu-button.tsx +2 -2
- package/src/components/ui/popup-menu-separator.tsx +1 -1
- package/src/components/ui/popup-menu.tsx +2 -2
- package/src/lib/utils.ts +10 -3
- package/src/pages/auth/Register.tsx +34 -4
- package/src/pages/conversations/Show.tsx +38 -7
- package/src/pages/feeds/Bookmarks.tsx +1 -1
- package/src/pages/jams/Index.tsx +6 -4
- package/src/pages/posts/New.tsx +1 -1
- package/src/pages/resources/Edit.tsx +2 -1
- package/src/pages/resources/New.tsx +6 -1
- package/src/pages/settings/Account.tsx +46 -2
- package/src/pages/settings/Index.tsx +3 -4
- package/src/pages/settings/NotificationPreferences.tsx +3 -3
- package/src/pages/settings/Theme.tsx +1 -1
- package/src/components/icons/iconWithClassName.ts +0 -12
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ const { withNativeWind } = require('nativewind/metro');
|
|
|
23
23
|
const { withOpenPeepsMetro } = require('@openpeepshq/rn-components/metro');
|
|
24
24
|
|
|
25
25
|
module.exports = withOpenPeepsMetro(
|
|
26
|
-
withNativeWind(config, { input: './src/global.css' })
|
|
26
|
+
withNativeWind(config, { input: './src/global.css' })
|
|
27
27
|
);
|
|
28
28
|
```
|
|
29
29
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openpeepshq/rn-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.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",
|
|
@@ -143,7 +143,7 @@
|
|
|
143
143
|
"validator": "^13.15.23",
|
|
144
144
|
"zustand": "^5.0.3",
|
|
145
145
|
"@openpeepshq/common": "^0.4.0",
|
|
146
|
-
"@openpeepshq/react": "^0.
|
|
146
|
+
"@openpeepshq/react": "^0.8.1"
|
|
147
147
|
},
|
|
148
148
|
"devDependencies": {
|
|
149
149
|
"@babel/core": "^7.26.7",
|
|
@@ -168,12 +168,15 @@
|
|
|
168
168
|
"@types/react": "^19.1.1",
|
|
169
169
|
"@types/react-test-renderer": "^18.3.1",
|
|
170
170
|
"@types/validator": "^13.15.10",
|
|
171
|
+
"@typescript-eslint/eslint-plugin": "^8.72.0",
|
|
172
|
+
"@typescript-eslint/parser": "^8.72.0",
|
|
171
173
|
"babel-plugin-module-resolver": "^5.0.2",
|
|
172
174
|
"commitlint": "^17.0.2",
|
|
173
175
|
"del-cli": "^5.1.0",
|
|
174
|
-
"eslint": "^
|
|
175
|
-
"eslint-config-prettier": "^9.
|
|
176
|
+
"eslint": "^10.1.0",
|
|
177
|
+
"eslint-config-prettier": "^9.1.0",
|
|
176
178
|
"eslint-plugin-prettier": "^5.0.1",
|
|
179
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
177
180
|
"icon-set-creator": "^1.2.6",
|
|
178
181
|
"jest": "^29.7.0",
|
|
179
182
|
"prettier": "^3.0.3",
|
|
@@ -182,7 +185,8 @@
|
|
|
182
185
|
"release-it": "^17.10.0",
|
|
183
186
|
"ts-jest": "^29.3.4",
|
|
184
187
|
"turbo": "^1.10.7",
|
|
185
|
-
"typescript": "
|
|
188
|
+
"typescript": "^6.0.2",
|
|
189
|
+
"@eslint/js": "^9.17.0"
|
|
186
190
|
},
|
|
187
191
|
"commitlint": {
|
|
188
192
|
"extends": [
|
|
@@ -278,6 +282,7 @@
|
|
|
278
282
|
"lint": "eslint \"src/**/*.{js,ts,tsx}\"",
|
|
279
283
|
"clean": "del-cli lib",
|
|
280
284
|
"build": "bob build",
|
|
281
|
-
"release": "release-it"
|
|
285
|
+
"release": "release-it",
|
|
286
|
+
"format": "prettier --write --ignore-path ../../.prettierignore ."
|
|
282
287
|
}
|
|
283
288
|
}
|
|
@@ -23,12 +23,14 @@ const { width: SCREEN_WIDTH } = Dimensions.get('window');
|
|
|
23
23
|
|
|
24
24
|
interface AudioPickerSheetProps {
|
|
25
25
|
onSelect: (audioAttachments: MediaAttachment[]) => void | Promise<void>;
|
|
26
|
+
/** When false, the sheet selects a single file (no multiple toggle). */
|
|
27
|
+
multiple?: boolean;
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
export const AudioPickerSheet = forwardRef<
|
|
29
31
|
BottomSheetModal,
|
|
30
32
|
AudioPickerSheetProps
|
|
31
|
-
>(({ onSelect }, ref) => {
|
|
33
|
+
>(({ onSelect, multiple = true }, ref) => {
|
|
32
34
|
const [selectedAudios, setSelectedAudios] = useState<string[]>([]);
|
|
33
35
|
const [isMultipleSelect, setIsMultipleSelect] = useState(false);
|
|
34
36
|
const [currentAudioIndex, setCurrentAudioIndex] = useState(0);
|
|
@@ -122,39 +124,33 @@ export const AudioPickerSheet = forwardRef<
|
|
|
122
124
|
<View className="flex-1">
|
|
123
125
|
{renderSelectedAudiosPreview()}
|
|
124
126
|
|
|
125
|
-
|
|
126
|
-
<View className="flex-row items-center
|
|
127
|
-
<
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
size={'icon'}
|
|
139
|
-
className="rounded-full"
|
|
140
|
-
onPress={handleMicrophonePress}>
|
|
141
|
-
<MicIcon size={16} className="text-foreground" />
|
|
142
|
-
</Button> */}
|
|
127
|
+
{multiple ? (
|
|
128
|
+
<View className="flex-row justify-between items-center px-4 py-3">
|
|
129
|
+
<View className="flex-row items-center gap-4">
|
|
130
|
+
<Button
|
|
131
|
+
variant={isMultipleSelect ? 'secondary' : 'ghost'}
|
|
132
|
+
size={'sm'}
|
|
133
|
+
onPress={() => setIsMultipleSelect(!isMultipleSelect)}
|
|
134
|
+
>
|
|
135
|
+
<Text className="text-foreground text-base font-medium">
|
|
136
|
+
{t('common.form.selectMultiple')}
|
|
137
|
+
</Text>
|
|
138
|
+
</Button>
|
|
139
|
+
</View>
|
|
143
140
|
</View>
|
|
144
|
-
|
|
141
|
+
) : null}
|
|
145
142
|
|
|
146
143
|
<Button
|
|
147
144
|
variant={'ghost'}
|
|
148
145
|
onPress={async () => {
|
|
149
146
|
const result = await pick({
|
|
150
147
|
type: 'audio',
|
|
151
|
-
multiple: isMultipleSelect,
|
|
148
|
+
multiple: multiple && isMultipleSelect,
|
|
152
149
|
});
|
|
153
150
|
if (result) {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
]);
|
|
151
|
+
const uris = result.map((r) => r.uri);
|
|
152
|
+
// Single mode replaces the pick; multiple mode appends.
|
|
153
|
+
setSelectedAudios(multiple ? [...selectedAudios, ...uris] : uris);
|
|
158
154
|
}
|
|
159
155
|
}}
|
|
160
156
|
>
|
|
@@ -39,6 +39,8 @@ import {
|
|
|
39
39
|
|
|
40
40
|
interface DocumentPickerSheetProps {
|
|
41
41
|
onSelect: (documentAttachments: MediaAttachment[]) => void | Promise<void>;
|
|
42
|
+
/** When false, the picker is limited to a single file. */
|
|
43
|
+
multiple?: boolean;
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
export type DocumentPickerSheetHandle = {
|
|
@@ -89,7 +91,7 @@ const mergePickedDocs = (
|
|
|
89
91
|
export const DocumentPickerSheet = forwardRef<
|
|
90
92
|
DocumentPickerSheetHandle,
|
|
91
93
|
DocumentPickerSheetProps
|
|
92
|
-
>(({ onSelect }, ref) => {
|
|
94
|
+
>(({ onSelect, multiple = true }, ref) => {
|
|
93
95
|
const sheetRef = useRef<BottomSheetModal>(null);
|
|
94
96
|
const descriptionSheetRef = useRef<BottomSheetModal>(null);
|
|
95
97
|
|
|
@@ -111,14 +113,16 @@ export const DocumentPickerSheet = forwardRef<
|
|
|
111
113
|
|
|
112
114
|
const results = await pick({
|
|
113
115
|
type: [...ATTACHMENT_DOCUMENT_TYPES],
|
|
114
|
-
allowMultiSelection:
|
|
116
|
+
allowMultiSelection: multiple,
|
|
115
117
|
mode: 'import',
|
|
116
118
|
});
|
|
117
119
|
|
|
118
|
-
setSelectedDocs((prev) =>
|
|
120
|
+
setSelectedDocs((prev) =>
|
|
121
|
+
multiple ? mergePickedDocs(prev, results) : results
|
|
122
|
+
);
|
|
119
123
|
return results;
|
|
120
124
|
},
|
|
121
|
-
[]
|
|
125
|
+
[multiple]
|
|
122
126
|
);
|
|
123
127
|
|
|
124
128
|
const open = useCallback(async () => {
|
|
@@ -317,18 +321,20 @@ export const DocumentPickerSheet = forwardRef<
|
|
|
317
321
|
</View>
|
|
318
322
|
))}
|
|
319
323
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
324
|
+
{multiple ? (
|
|
325
|
+
<Button
|
|
326
|
+
variant="ghost"
|
|
327
|
+
className="flex-row items-center justify-center mt-2 border border-dashed border-border"
|
|
328
|
+
onPress={handlePickDocument}
|
|
329
|
+
>
|
|
330
|
+
<PlusIcon size={16} className="text-foreground mr-2" />
|
|
331
|
+
<Text className="text-foreground font-medium">
|
|
332
|
+
{t('form.documentInput.addMore', {
|
|
333
|
+
defaultValue: 'Add more files',
|
|
334
|
+
})}
|
|
335
|
+
</Text>
|
|
336
|
+
</Button>
|
|
337
|
+
) : null}
|
|
332
338
|
</View>
|
|
333
339
|
);
|
|
334
340
|
};
|
|
@@ -13,6 +13,8 @@ import { bottomSheetClose } from '../../../../lib/bottom-sheet-ref';
|
|
|
13
13
|
|
|
14
14
|
interface VideoPickerSheetProps {
|
|
15
15
|
onSelect: (videoAttachments: MediaAttachment[]) => void | Promise<void>;
|
|
16
|
+
/** When false, the library picker is limited to a single video. */
|
|
17
|
+
multiple?: boolean;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
// Videos are selected via the system photo picker (launchImageLibrary), which
|
|
@@ -21,7 +23,7 @@ interface VideoPickerSheetProps {
|
|
|
21
23
|
export const VideoPickerSheet = forwardRef<
|
|
22
24
|
BottomSheetModal,
|
|
23
25
|
VideoPickerSheetProps
|
|
24
|
-
>(({ onSelect }, ref) => {
|
|
26
|
+
>(({ onSelect, multiple = true }, ref) => {
|
|
25
27
|
const [isLoading, setIsLoading] = useState(false);
|
|
26
28
|
const { t } = useTranslation();
|
|
27
29
|
const { openpeepsApi } = useOpenpeeps();
|
|
@@ -54,7 +56,7 @@ export const VideoPickerSheet = forwardRef<
|
|
|
54
56
|
const handleLibrary = async () => {
|
|
55
57
|
const result = await launchImageLibrary({
|
|
56
58
|
mediaType: 'video',
|
|
57
|
-
selectionLimit: 0,
|
|
59
|
+
selectionLimit: multiple ? 0 : 1,
|
|
58
60
|
});
|
|
59
61
|
if (result.didCancel || !result.assets?.length) {
|
|
60
62
|
return;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ScrollView, useColorScheme } from 'react-native';
|
|
2
|
+
import { Platform, ScrollView, useColorScheme } from 'react-native';
|
|
3
3
|
import { Separator } from '../../ui/separator';
|
|
4
4
|
import { TouchableOpacity, View } from 'react-native';
|
|
5
5
|
import { Button } from '../../ui/button';
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
LibraryIcon,
|
|
24
24
|
} from '../../icons/index';
|
|
25
25
|
import { ThemedText } from '../../ui/themed-text';
|
|
26
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from '../../ui/tooltip';
|
|
26
27
|
import { useWindowSize } from '../../../hooks/helper';
|
|
27
28
|
import { toAbsoluteMediaUrl } from '../../../lib/media-url';
|
|
28
29
|
import { formatBadgeCount, getTheme } from '@openpeepshq/common';
|
|
@@ -47,6 +48,48 @@ const menuIcons: Record<string, React.ComponentType<LucideProps>> = {
|
|
|
47
48
|
settings: SettingsIcon,
|
|
48
49
|
resources: LibraryIcon,
|
|
49
50
|
};
|
|
51
|
+
const SideMenuNavButton = ({
|
|
52
|
+
tooltip,
|
|
53
|
+
accessibilityLabel,
|
|
54
|
+
onPress,
|
|
55
|
+
children,
|
|
56
|
+
className,
|
|
57
|
+
variant = 'ghost',
|
|
58
|
+
size,
|
|
59
|
+
}: {
|
|
60
|
+
tooltip?: string;
|
|
61
|
+
accessibilityLabel: string;
|
|
62
|
+
onPress: () => void;
|
|
63
|
+
children: React.ReactNode;
|
|
64
|
+
className?: string;
|
|
65
|
+
variant?: 'ghost' | 'outline';
|
|
66
|
+
size?: 'icon';
|
|
67
|
+
}) => {
|
|
68
|
+
const button = (
|
|
69
|
+
<Button
|
|
70
|
+
variant={variant}
|
|
71
|
+
size={size}
|
|
72
|
+
className={className}
|
|
73
|
+
accessibilityLabel={accessibilityLabel}
|
|
74
|
+
accessibilityHint={tooltip}
|
|
75
|
+
onPress={onPress}
|
|
76
|
+
>
|
|
77
|
+
{children}
|
|
78
|
+
</Button>
|
|
79
|
+
);
|
|
80
|
+
if (Platform.OS !== 'web' || !tooltip) {
|
|
81
|
+
return button;
|
|
82
|
+
}
|
|
83
|
+
return (
|
|
84
|
+
<Tooltip>
|
|
85
|
+
<TooltipTrigger asChild>{button}</TooltipTrigger>
|
|
86
|
+
<TooltipContent side="right">
|
|
87
|
+
<ThemedText>{tooltip}</ThemedText>
|
|
88
|
+
</TooltipContent>
|
|
89
|
+
</Tooltip>
|
|
90
|
+
);
|
|
91
|
+
};
|
|
92
|
+
|
|
50
93
|
interface SideMenuProps {
|
|
51
94
|
handleNavigation: ({
|
|
52
95
|
target,
|
|
@@ -127,13 +170,15 @@ export const SideMenu = ({
|
|
|
127
170
|
<View className="flex flex-row justify-between items-center">
|
|
128
171
|
<ProfileAvatar profile={currentProfile} className="w-16 h-16" />
|
|
129
172
|
{isMediumScreenOrLarger && (
|
|
130
|
-
<
|
|
131
|
-
variant=
|
|
132
|
-
size=
|
|
173
|
+
<SideMenuNavButton
|
|
174
|
+
variant="outline"
|
|
175
|
+
size="icon"
|
|
176
|
+
accessibilityLabel={t('navigation.openNotifications')}
|
|
177
|
+
tooltip={t('navigation.tooltips.notifications')}
|
|
133
178
|
onPress={onNotificationPress}
|
|
134
179
|
>
|
|
135
180
|
<BellIcon className="text-foreground" size={20} />
|
|
136
|
-
</
|
|
181
|
+
</SideMenuNavButton>
|
|
137
182
|
)}
|
|
138
183
|
</View>
|
|
139
184
|
<View>
|
|
@@ -157,11 +202,13 @@ export const SideMenu = ({
|
|
|
157
202
|
if (!Icon) {
|
|
158
203
|
return null;
|
|
159
204
|
}
|
|
205
|
+
const tooltip = item.tooltipKey ? t(item.tooltipKey) : undefined;
|
|
160
206
|
return (
|
|
161
|
-
<
|
|
207
|
+
<SideMenuNavButton
|
|
162
208
|
key={item.id}
|
|
163
|
-
variant="ghost"
|
|
164
209
|
className="flex-row items-center w-full mb-4 justify-start p-4"
|
|
210
|
+
accessibilityLabel={t(item.labelKey)}
|
|
211
|
+
tooltip={tooltip}
|
|
165
212
|
onPress={() => {
|
|
166
213
|
setCurrentRoute(item.id);
|
|
167
214
|
handleNavigation({ target: item.id });
|
|
@@ -191,12 +238,13 @@ export const SideMenu = ({
|
|
|
191
238
|
</View>
|
|
192
239
|
) : null}
|
|
193
240
|
</View>
|
|
194
|
-
</
|
|
241
|
+
</SideMenuNavButton>
|
|
195
242
|
);
|
|
196
243
|
})}
|
|
197
|
-
<
|
|
198
|
-
variant="ghost"
|
|
244
|
+
<SideMenuNavButton
|
|
199
245
|
className="flex-row items-center space-x-3 w-full mb-4 justify-start"
|
|
246
|
+
accessibilityLabel={t('navigation.logOut')}
|
|
247
|
+
tooltip={t('navigation.tooltips.logOut')}
|
|
200
248
|
onPress={() => {
|
|
201
249
|
logout();
|
|
202
250
|
close?.();
|
|
@@ -206,7 +254,7 @@ export const SideMenu = ({
|
|
|
206
254
|
<ThemedText className="-mt-1 tracking-wider text-destructive native:text-lg">
|
|
207
255
|
{t('navigation.logOut')}
|
|
208
256
|
</ThemedText>
|
|
209
|
-
</
|
|
257
|
+
</SideMenuNavButton>
|
|
210
258
|
</ScrollView>
|
|
211
259
|
</View>
|
|
212
260
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
import type { LucideIcon, LucideProps } from 'lucide-react-native';
|
|
3
|
+
import { cssInterop } from 'nativewind';
|
|
4
|
+
|
|
5
|
+
// Rounded stroke endpoints to match the web app's lucide-react defaults.
|
|
6
|
+
export const iconWithClassName = (icon: LucideIcon) => {
|
|
7
|
+
const WrappedIcon = cssInterop(icon, {
|
|
8
|
+
className: {
|
|
9
|
+
target: 'style',
|
|
10
|
+
nativeStyleToProp: {
|
|
11
|
+
color: true,
|
|
12
|
+
opacity: true,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
}) as ComponentType<LucideProps>;
|
|
16
|
+
|
|
17
|
+
const WithRoundedStrokes: ComponentType<LucideProps> = (props) => (
|
|
18
|
+
<WrappedIcon strokeLinecap="round" strokeLinejoin="round" {...props} />
|
|
19
|
+
);
|
|
20
|
+
return WithRoundedStrokes;
|
|
21
|
+
};
|
|
@@ -23,7 +23,8 @@ export const JamActionsFooter = ({ jamPost }: JamActionsFooterProps) => {
|
|
|
23
23
|
const { t } = useTranslation();
|
|
24
24
|
const { openpeepsApi } = useOpenpeeps();
|
|
25
25
|
|
|
26
|
-
const
|
|
26
|
+
const occurrence = jamPost.occurrenceRecurrenceId;
|
|
27
|
+
const { data: jamState } = openpeepsApi.useJamState(jamPost.id, occurrence);
|
|
27
28
|
const { data: serverInfo } = openpeepsApi.useServerInfo();
|
|
28
29
|
const livekitEnabled = serverInfo?.jams.livekit.enabled;
|
|
29
30
|
|
|
@@ -47,7 +48,11 @@ export const JamActionsFooter = ({ jamPost }: JamActionsFooterProps) => {
|
|
|
47
48
|
onPress={() => {
|
|
48
49
|
Share.share({
|
|
49
50
|
message: t('posts.actions.shareMessage'),
|
|
50
|
-
url: `${BASE_URL}/events/${jamPost.id}/jam
|
|
51
|
+
url: `${BASE_URL}/events/${jamPost.id}/jam${
|
|
52
|
+
occurrence
|
|
53
|
+
? `?occurrence=${encodeURIComponent(occurrence)}`
|
|
54
|
+
: ''
|
|
55
|
+
}`,
|
|
51
56
|
});
|
|
52
57
|
}}
|
|
53
58
|
>
|
|
@@ -70,6 +75,7 @@ export const JamActionsFooter = ({ jamPost }: JamActionsFooterProps) => {
|
|
|
70
75
|
onPress={() => {
|
|
71
76
|
navigation.navigate('JamSession', {
|
|
72
77
|
jamId: jamPost.id,
|
|
78
|
+
occurrence,
|
|
73
79
|
});
|
|
74
80
|
}}
|
|
75
81
|
>
|
|
@@ -27,7 +27,7 @@ export const JamCapacityGate = ({
|
|
|
27
27
|
const router = useRouter();
|
|
28
28
|
const eventData = jamPost.data?.type === 'event' ? jamPost.data : undefined;
|
|
29
29
|
const showRsvp =
|
|
30
|
-
reason === 'rsvp-required' &&
|
|
30
|
+
(reason === 'rsvp-required' || reason === 'full') &&
|
|
31
31
|
!!me &&
|
|
32
32
|
!!eventData &&
|
|
33
33
|
isCapacityEvent(eventData);
|
|
@@ -30,7 +30,9 @@ export const JamCard = ({ jamPost, type = 'upcoming' }: JamCardProps) => {
|
|
|
30
30
|
<View className="min-w-0 flex-1 flex-col gap-y-3">
|
|
31
31
|
<View className="flex-row flex-wrap items-center gap-x-1">
|
|
32
32
|
<ThemedText>Happening</ThemedText>
|
|
33
|
-
<UpdatingDate
|
|
33
|
+
<UpdatingDate
|
|
34
|
+
date={jamPost.occurrenceStart ?? jamEvent?.start}
|
|
35
|
+
/>
|
|
34
36
|
</View>
|
|
35
37
|
<ThemedText className="text-lg font-semibold">
|
|
36
38
|
{jamEvent?.name || 'Jam'}
|
|
@@ -48,9 +50,11 @@ export const JamCard = ({ jamPost, type = 'upcoming' }: JamCardProps) => {
|
|
|
48
50
|
)}
|
|
49
51
|
</View>
|
|
50
52
|
<View className=" flex flex-row items-center">
|
|
51
|
-
{jam?.moderators
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
{jam?.moderators
|
|
54
|
+
?.slice(0, 2)
|
|
55
|
+
.map((moderator, index) => (
|
|
56
|
+
<ParticipantAvatar key={index} profileId={moderator} />
|
|
57
|
+
))}
|
|
54
58
|
{(jam?.moderators?.length ?? 0) > 2 && (
|
|
55
59
|
<ThemedText className="ml-1">
|
|
56
60
|
+{(jam?.moderators?.length ?? 0) - 2}
|
|
@@ -6,7 +6,11 @@ import {
|
|
|
6
6
|
useTracks,
|
|
7
7
|
} from '@livekit/react-native';
|
|
8
8
|
import { Track } from 'livekit-client';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
JamEventsProvider,
|
|
11
|
+
useDropLateAudio,
|
|
12
|
+
useJamObserver,
|
|
13
|
+
} from '@openpeepshq/react';
|
|
10
14
|
import { JamObserverShell } from './JamObserverShell';
|
|
11
15
|
import { JamParticipantConference } from './JamParticipantConference';
|
|
12
16
|
import { JamVideoLayout } from './JamVideoLayout';
|
|
@@ -47,6 +51,7 @@ const JamObserverConference = () => {
|
|
|
47
51
|
|
|
48
52
|
const JamObserverRoom = () => {
|
|
49
53
|
const room = useRoomContext();
|
|
54
|
+
useDropLateAudio(room);
|
|
50
55
|
return (
|
|
51
56
|
<JamEventsProvider room={room}>
|
|
52
57
|
<JamObserverConference />
|
|
@@ -11,6 +11,7 @@ import { Track } from 'livekit-client';
|
|
|
11
11
|
import { truncateText } from '@openpeepshq/common';
|
|
12
12
|
import {
|
|
13
13
|
JamEventsProvider,
|
|
14
|
+
useDropLateAudio,
|
|
14
15
|
useJamContext,
|
|
15
16
|
useJamLocalSettings,
|
|
16
17
|
} from '@openpeepshq/react';
|
|
@@ -138,6 +139,7 @@ const JamParticipantConferenceInner = () => {
|
|
|
138
139
|
*/
|
|
139
140
|
export const JamParticipantConference = () => {
|
|
140
141
|
const room = useRoomContext();
|
|
142
|
+
useDropLateAudio(room);
|
|
141
143
|
return (
|
|
142
144
|
<JamEventsProvider room={room}>
|
|
143
145
|
<JamParticipantConferenceInner />
|
|
@@ -10,6 +10,7 @@ import { JamLobby } from './JamLobby';
|
|
|
10
10
|
import { JamRequestJoin } from './JamRequestJoin';
|
|
11
11
|
import { JamRoomPanel, JamRoomPanelLink } from './JamRoomPanel';
|
|
12
12
|
import { JamVideoCall } from './JamVideoCall';
|
|
13
|
+
import { LivekitUnavailableNotice } from './LivekitUnavailableNotice';
|
|
13
14
|
|
|
14
15
|
export interface JamRoomProps {
|
|
15
16
|
jamPost: PublicPost;
|
|
@@ -61,9 +62,7 @@ const JamRoomInner = () => {
|
|
|
61
62
|
if (!livekitEnabled) {
|
|
62
63
|
return (
|
|
63
64
|
<JamRoomPanel title={jamEvent.name}>
|
|
64
|
-
<
|
|
65
|
-
{t('jams.unavailable.message')}
|
|
66
|
-
</ThemedText>
|
|
65
|
+
<LivekitUnavailableNotice className="text-center" />
|
|
67
66
|
<JamRoomPanelLink
|
|
68
67
|
label={t('jams.room.viewEvent')}
|
|
69
68
|
onPress={() => router.navigate({ type: 'post', id: jamPost.id })}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { ActivityIndicator, Pressable, View } from 'react-native';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import { useOpenpeeps } from '@openpeepshq/react';
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
} from '../icons/index';
|
|
10
10
|
import { CardEvent } from '../post/types/event/CardEvent';
|
|
11
11
|
import { ThemedText } from '../ui/themed-text';
|
|
12
|
+
import { LivekitUnavailableNotice } from './LivekitUnavailableNotice';
|
|
12
13
|
|
|
13
14
|
export const LiveJamsSection = () => {
|
|
14
15
|
const { t } = useTranslation();
|
|
@@ -16,6 +17,14 @@ export const LiveJamsSection = () => {
|
|
|
16
17
|
const liveJamsQuery = openpeepsApi.useJams();
|
|
17
18
|
const [open, setOpen] = useState(true);
|
|
18
19
|
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (!liveJamsQuery.isError) return;
|
|
22
|
+
console.error(
|
|
23
|
+
'[openpeeps] Live jams failed to load. Community admins can diagnose LiveKit at /admin/diagnostics/livekit.',
|
|
24
|
+
liveJamsQuery.error
|
|
25
|
+
);
|
|
26
|
+
}, [liveJamsQuery.isError, liveJamsQuery.error]);
|
|
27
|
+
|
|
19
28
|
return (
|
|
20
29
|
<View className="mb-8">
|
|
21
30
|
<Pressable
|
|
@@ -35,6 +44,8 @@ export const LiveJamsSection = () => {
|
|
|
35
44
|
{open ? (
|
|
36
45
|
liveJamsQuery.isLoading ? (
|
|
37
46
|
<ActivityIndicator size="small" />
|
|
47
|
+
) : liveJamsQuery.isError ? (
|
|
48
|
+
<LivekitUnavailableNotice />
|
|
38
49
|
) : (liveJamsQuery.data ?? []).length ? (
|
|
39
50
|
<View className="gap-2">
|
|
40
51
|
{(liveJamsQuery.data ?? []).map((jam) => (
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { useCanDiagnoseLivekit } from '@openpeepshq/react';
|
|
4
|
+
import { ThemedText } from '../ui/themed-text';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Shown when live jams are off or the live list fails. Native has no in-app
|
|
8
|
+
* admin shell, so admins who can diagnose see a hint pointing at the web
|
|
9
|
+
* diagnostics page rather than a dead link.
|
|
10
|
+
*/
|
|
11
|
+
export const LivekitUnavailableNotice = ({
|
|
12
|
+
className = 'text-sm text-destructive',
|
|
13
|
+
}: {
|
|
14
|
+
className?: string;
|
|
15
|
+
}) => {
|
|
16
|
+
const { t } = useTranslation();
|
|
17
|
+
const canDiagnose = useCanDiagnoseLivekit();
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<ThemedText className={className}>
|
|
21
|
+
{t('jams.unavailable.message')}
|
|
22
|
+
{canDiagnose ? ` ${t('jams.unavailable.diagnoseHint')}` : ''}
|
|
23
|
+
</ThemedText>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { useTranslation } from 'react-i18next';
|
|
2
|
+
import { Modal, Pressable, ScrollView, View } from 'react-native';
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
|
+
import { OpenpeepsMarkdown } from './OpenpeepsMarkdown';
|
|
5
|
+
import { ThemedText } from '../ui/themed-text';
|
|
6
|
+
import { Button } from '../ui/button';
|
|
7
|
+
|
|
8
|
+
export interface MarkdownOverlayProps {
|
|
9
|
+
/** Full markdown rendered inside the overlay when expanded. */
|
|
10
|
+
source: string;
|
|
11
|
+
/** Pressable trigger content (usually the clamped excerpt). */
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
/** Accessibility label for the long-press target. */
|
|
14
|
+
label?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Reusable pressable-driven overlay: long-pressing `children` opens a centered
|
|
19
|
+
* Modal rendering `source` as full markdown. Used by `TruncatedMarkdown` so every
|
|
20
|
+
* abbreviated preview can reveal its full markdown content on touch devices
|
|
21
|
+
* (where hover is unavailable). The backdrop and close button both dismiss it.
|
|
22
|
+
*/
|
|
23
|
+
export const MarkdownOverlay = ({
|
|
24
|
+
source,
|
|
25
|
+
children,
|
|
26
|
+
label,
|
|
27
|
+
}: MarkdownOverlayProps) => {
|
|
28
|
+
const { t } = useTranslation();
|
|
29
|
+
const [open, setOpen] = useState(false);
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<>
|
|
33
|
+
<Pressable
|
|
34
|
+
accessibilityRole="button"
|
|
35
|
+
accessibilityLabel={
|
|
36
|
+
label ??
|
|
37
|
+
t('posts.truncatedMarkdown.show', { defaultValue: 'Show more' })
|
|
38
|
+
}
|
|
39
|
+
accessibilityHint={t('posts.truncatedMarkdown.showHint', {
|
|
40
|
+
defaultValue: 'Long press to read the full text',
|
|
41
|
+
})}
|
|
42
|
+
onLongPress={() => setOpen(true)}
|
|
43
|
+
>
|
|
44
|
+
{children}
|
|
45
|
+
</Pressable>
|
|
46
|
+
|
|
47
|
+
<Modal
|
|
48
|
+
visible={open}
|
|
49
|
+
transparent
|
|
50
|
+
animationType="fade"
|
|
51
|
+
onRequestClose={() => setOpen(false)}
|
|
52
|
+
>
|
|
53
|
+
<Pressable
|
|
54
|
+
onPress={() => setOpen(false)}
|
|
55
|
+
className="bg-black/60 flex-1 items-center justify-center"
|
|
56
|
+
>
|
|
57
|
+
<View className="w-11/12 max-w-lg rounded-lg bg-background p-4 max-h-[80%]">
|
|
58
|
+
<ScrollView>
|
|
59
|
+
<OpenpeepsMarkdown source={source} linkPreviewMode="none" />
|
|
60
|
+
</ScrollView>
|
|
61
|
+
<View className="mt-4 flex justify-end">
|
|
62
|
+
<Button onPress={() => setOpen(false)}>
|
|
63
|
+
<ThemedText>
|
|
64
|
+
{t('posts.truncatedMarkdown.close', {
|
|
65
|
+
defaultValue: 'Close',
|
|
66
|
+
})}
|
|
67
|
+
</ThemedText>
|
|
68
|
+
</Button>
|
|
69
|
+
</View>
|
|
70
|
+
</View>
|
|
71
|
+
</Pressable>
|
|
72
|
+
</Modal>
|
|
73
|
+
</>
|
|
74
|
+
);
|
|
75
|
+
};
|