@openpeepshq/rn-components 0.6.0 → 0.6.2
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/package.json +7 -6
- package/src/components/conversations/ConversationMessageBubble.tsx +11 -1
- package/src/components/conversations/ConversationParticipantsModal.tsx +6 -1
- package/src/components/conversations/ConversationPreviewCard.tsx +1 -1
- package/src/components/custom/navigation/side-menu.tsx +2 -1
- package/src/components/icons/index.ts +8 -0
- package/src/components/index.ts +1 -0
- package/src/components/navigation/helpers.ts +3 -0
- package/src/components/navigation/main-navigator.tsx +4 -0
- package/src/components/navigation/nativeRouter.tsx +11 -0
- package/src/components/navigation/tab-navigator.tsx +13 -3
- package/src/components/navigation/types/main.ts +6 -0
- package/src/components/navigation/types/tabs.ts +2 -0
- package/src/components/post/CompactReplyParent.tsx +22 -0
- package/src/components/post/FeedPostContent.tsx +4 -0
- package/src/components/post/NewResourceButton.tsx +57 -0
- package/src/components/post/PostDetail.tsx +3 -0
- package/src/components/post/index.ts +1 -0
- package/src/components/post/pieces/PostMenu.tsx +15 -9
- package/src/components/post/post-form/PostTypeSwitcher.tsx +19 -1
- package/src/components/post/post-form/ResourceForm.tsx +221 -0
- package/src/components/post/post-form/index.ts +1 -0
- package/src/components/post/types/Event.tsx +39 -20
- package/src/components/post/types/index.ts +1 -0
- package/src/components/post/types/resource/FullResource.tsx +177 -0
- package/src/components/resources/ResourceCard.tsx +289 -0
- package/src/components/resources/ResourceLibrary.tsx +369 -0
- package/src/components/resources/index.ts +4 -0
- package/src/components/ui/button.tsx +2 -2
- package/src/global.css +16 -14
- package/src/pages/conversations/Show.tsx +54 -12
- package/src/pages/groups/Show.tsx +19 -1
- package/src/pages/index.ts +3 -0
- package/src/pages/resources/Edit.tsx +72 -0
- package/src/pages/resources/Index.tsx +25 -0
- package/src/pages/resources/New.tsx +55 -0
- package/src/theme/OpenPeepsThemeProvider.tsx +1 -5
- package/src/theme/defaults.ts +22 -106
- package/src/theme/utils.ts +22 -0
- package/tailwind.config.js +78 -14
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import React, { useRef, useState } from 'react';
|
|
2
|
+
import { Pressable, View } from 'react-native';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import type {
|
|
5
|
+
AudienceSetting,
|
|
6
|
+
MediaAttachment,
|
|
7
|
+
PostCreationData,
|
|
8
|
+
ResourceKind,
|
|
9
|
+
ResourcePost,
|
|
10
|
+
} from '@openpeepshq/common';
|
|
11
|
+
import { RESOURCE_KINDS, normalizeResourceTags } from '@openpeepshq/common/lib';
|
|
12
|
+
import { applyAudienceSetting, useCurrentProfile } from '@openpeepshq/react';
|
|
13
|
+
import { BottomSheetModal } from '@gorhom/bottom-sheet';
|
|
14
|
+
import {
|
|
15
|
+
AudioPickerSheet,
|
|
16
|
+
DocumentPickerSheet,
|
|
17
|
+
ImagePickerSheet,
|
|
18
|
+
VideoPickerSheet,
|
|
19
|
+
type DocumentPickerSheetHandle,
|
|
20
|
+
} from '../../custom';
|
|
21
|
+
import { Input } from '../../ui/input';
|
|
22
|
+
import { ThemedText } from '../../ui/themed-text';
|
|
23
|
+
import { ComposeAttachments } from './ComposeAttachments';
|
|
24
|
+
import { OpenpeepsMarkdownInput } from './OpenpeepsMarkdownInput';
|
|
25
|
+
import { VisibilitySelector } from './VisibilitySelector';
|
|
26
|
+
|
|
27
|
+
export interface ResourceFormProps {
|
|
28
|
+
postData: PostCreationData;
|
|
29
|
+
onChange: (data: PostCreationData) => void;
|
|
30
|
+
isEdit?: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const ResourceForm = ({
|
|
34
|
+
postData,
|
|
35
|
+
onChange,
|
|
36
|
+
isEdit = false,
|
|
37
|
+
}: ResourceFormProps) => {
|
|
38
|
+
const { t } = useTranslation();
|
|
39
|
+
const me = useCurrentProfile();
|
|
40
|
+
const resource = postData.data as ResourcePost;
|
|
41
|
+
const [tagDraft, setTagDraft] = useState('');
|
|
42
|
+
const imageRef = useRef<BottomSheetModal>(null);
|
|
43
|
+
const videoRef = useRef<BottomSheetModal>(null);
|
|
44
|
+
const audioRef = useRef<BottomSheetModal>(null);
|
|
45
|
+
const documentRef = useRef<DocumentPickerSheetHandle>(null);
|
|
46
|
+
|
|
47
|
+
const patchResource = (patch: Partial<ResourcePost>) =>
|
|
48
|
+
onChange({ ...postData, data: { ...resource, ...patch } });
|
|
49
|
+
|
|
50
|
+
const setAudience = (settings: AudienceSetting) =>
|
|
51
|
+
onChange(applyAudienceSetting(postData, settings, me));
|
|
52
|
+
|
|
53
|
+
const addAttachments = (attachments: MediaAttachment[]) => {
|
|
54
|
+
patchResource({
|
|
55
|
+
attachments: [...(resource.attachments ?? []), ...attachments],
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const addTag = () => {
|
|
60
|
+
patchResource({
|
|
61
|
+
tags: normalizeResourceTags([
|
|
62
|
+
...(resource.tags ?? []),
|
|
63
|
+
...tagDraft.split(/[,\s]+/),
|
|
64
|
+
]),
|
|
65
|
+
});
|
|
66
|
+
setTagDraft('');
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const openMedia = () => {
|
|
70
|
+
if (resource.resourceKind === 'gallery') imageRef.current?.present();
|
|
71
|
+
else if (resource.resourceKind === 'video') videoRef.current?.present();
|
|
72
|
+
else if (resource.resourceKind === 'audio') audioRef.current?.present();
|
|
73
|
+
else if (resource.resourceKind === 'file') void documentRef.current?.open();
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<View>
|
|
78
|
+
<View className="mt-4 gap-y-4 px-3">
|
|
79
|
+
<ThemedText className="text-sm font-medium">
|
|
80
|
+
{t('resources.form.name')}
|
|
81
|
+
</ThemedText>
|
|
82
|
+
<Input
|
|
83
|
+
value={resource.title}
|
|
84
|
+
onChangeText={(title) => patchResource({ title })}
|
|
85
|
+
/>
|
|
86
|
+
|
|
87
|
+
<ThemedText className="text-sm font-medium">
|
|
88
|
+
{t('resources.form.kind')}
|
|
89
|
+
</ThemedText>
|
|
90
|
+
<View className="flex-row flex-wrap gap-2">
|
|
91
|
+
{RESOURCE_KINDS.map((kind) => (
|
|
92
|
+
<Pressable
|
|
93
|
+
key={kind}
|
|
94
|
+
onPress={() =>
|
|
95
|
+
patchResource({ resourceKind: kind as ResourceKind })
|
|
96
|
+
}
|
|
97
|
+
className={`rounded-full px-3 py-1 ${
|
|
98
|
+
resource.resourceKind === kind ? 'bg-primary' : 'bg-muted'
|
|
99
|
+
}`}
|
|
100
|
+
>
|
|
101
|
+
<ThemedText
|
|
102
|
+
className={
|
|
103
|
+
resource.resourceKind === kind
|
|
104
|
+
? 'text-xs text-primary-foreground'
|
|
105
|
+
: 'text-xs text-muted-foreground'
|
|
106
|
+
}
|
|
107
|
+
>
|
|
108
|
+
{t(`resources.kinds.${kind}`)}
|
|
109
|
+
</ThemedText>
|
|
110
|
+
</Pressable>
|
|
111
|
+
))}
|
|
112
|
+
</View>
|
|
113
|
+
|
|
114
|
+
{resource.resourceKind === 'link' ? (
|
|
115
|
+
<>
|
|
116
|
+
<ThemedText className="text-sm font-medium">
|
|
117
|
+
{t('resources.form.url')}
|
|
118
|
+
</ThemedText>
|
|
119
|
+
<Input
|
|
120
|
+
value={resource.url ?? ''}
|
|
121
|
+
onChangeText={(url) => patchResource({ url })}
|
|
122
|
+
autoCapitalize="none"
|
|
123
|
+
/>
|
|
124
|
+
</>
|
|
125
|
+
) : (
|
|
126
|
+
<>
|
|
127
|
+
<Pressable
|
|
128
|
+
onPress={openMedia}
|
|
129
|
+
className="items-center rounded-md border border-input px-3 py-2"
|
|
130
|
+
>
|
|
131
|
+
<ThemedText>{t('resources.form.addMedia')}</ThemedText>
|
|
132
|
+
</Pressable>
|
|
133
|
+
<ComposeAttachments
|
|
134
|
+
attachments={resource.attachments ?? []}
|
|
135
|
+
removeAttachment={(index) =>
|
|
136
|
+
patchResource({
|
|
137
|
+
attachments: (resource.attachments ?? []).filter(
|
|
138
|
+
(_, i) => i !== index
|
|
139
|
+
),
|
|
140
|
+
})
|
|
141
|
+
}
|
|
142
|
+
updateAttachment={(index, attachment) =>
|
|
143
|
+
patchResource({
|
|
144
|
+
attachments: (resource.attachments ?? []).map((item, i) =>
|
|
145
|
+
i === index ? attachment : item
|
|
146
|
+
),
|
|
147
|
+
})
|
|
148
|
+
}
|
|
149
|
+
/>
|
|
150
|
+
</>
|
|
151
|
+
)}
|
|
152
|
+
|
|
153
|
+
<OpenpeepsMarkdownInput
|
|
154
|
+
rows={8}
|
|
155
|
+
maxLength={4000}
|
|
156
|
+
value={resource.content ?? ''}
|
|
157
|
+
onChange={(content) => patchResource({ content })}
|
|
158
|
+
placeholder={t('resources.form.descriptionPlaceholder')}
|
|
159
|
+
/>
|
|
160
|
+
|
|
161
|
+
<ThemedText className="text-sm font-medium">
|
|
162
|
+
{t('resources.form.tags')}
|
|
163
|
+
</ThemedText>
|
|
164
|
+
<Input
|
|
165
|
+
value={tagDraft}
|
|
166
|
+
onChangeText={setTagDraft}
|
|
167
|
+
onSubmitEditing={addTag}
|
|
168
|
+
placeholder={t('resources.form.tagsPlaceholder')}
|
|
169
|
+
/>
|
|
170
|
+
<View className="flex-row flex-wrap gap-1">
|
|
171
|
+
{normalizeResourceTags(resource.tags).map((tag) => (
|
|
172
|
+
<Pressable
|
|
173
|
+
key={tag}
|
|
174
|
+
onPress={() =>
|
|
175
|
+
patchResource({
|
|
176
|
+
tags: (resource.tags ?? []).filter(
|
|
177
|
+
(value) => value.toLowerCase() !== tag
|
|
178
|
+
),
|
|
179
|
+
})
|
|
180
|
+
}
|
|
181
|
+
>
|
|
182
|
+
<ThemedText className="rounded-full bg-muted px-2 py-0.5 text-xs">
|
|
183
|
+
#{tag}
|
|
184
|
+
</ThemedText>
|
|
185
|
+
</Pressable>
|
|
186
|
+
))}
|
|
187
|
+
</View>
|
|
188
|
+
|
|
189
|
+
<ThemedText className="text-sm font-medium">
|
|
190
|
+
{t('resources.form.hierarchy')}
|
|
191
|
+
</ThemedText>
|
|
192
|
+
<Input
|
|
193
|
+
value={(resource.categoryPath ?? []).join(' / ')}
|
|
194
|
+
onChangeText={(value) =>
|
|
195
|
+
patchResource({
|
|
196
|
+
categoryPath: value
|
|
197
|
+
.split('/')
|
|
198
|
+
.map((segment) => segment.trim())
|
|
199
|
+
.filter(Boolean),
|
|
200
|
+
})
|
|
201
|
+
}
|
|
202
|
+
placeholder={t('resources.form.addLevel')}
|
|
203
|
+
/>
|
|
204
|
+
|
|
205
|
+
<ThemedText className="text-sm font-medium">
|
|
206
|
+
{t('resources.form.visibility')}
|
|
207
|
+
</ThemedText>
|
|
208
|
+
<VisibilitySelector
|
|
209
|
+
audienceSetting={postData}
|
|
210
|
+
onChange={setAudience}
|
|
211
|
+
disabled={isEdit}
|
|
212
|
+
showDirect
|
|
213
|
+
/>
|
|
214
|
+
</View>
|
|
215
|
+
<ImagePickerSheet ref={imageRef} onSelect={addAttachments} />
|
|
216
|
+
<VideoPickerSheet ref={videoRef} onSelect={addAttachments} />
|
|
217
|
+
<AudioPickerSheet ref={audioRef} onSelect={addAttachments} />
|
|
218
|
+
<DocumentPickerSheet ref={documentRef} onSelect={addAttachments} />
|
|
219
|
+
</View>
|
|
220
|
+
);
|
|
221
|
+
};
|
|
@@ -1,23 +1,29 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Event, PublicPost } from '@openpeepshq/common';
|
|
3
3
|
import { formatEventRecurrence } from '@openpeepshq/common/lib';
|
|
4
|
-
import { View } from 'react-native';
|
|
4
|
+
import { Pressable, View } from 'react-native';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { useNavigation } from '@react-navigation/native';
|
|
6
7
|
import { CachedImage } from '../../custom/common/index';
|
|
7
8
|
import { ParticipantAvatar } from '../../custom/common/participant-avatar';
|
|
8
9
|
import { ThemedText } from '../../ui/themed-text';
|
|
9
10
|
import { formatEventDate } from '../../../lib/utils';
|
|
11
|
+
import { MainStackParamList } from '../../navigation/types/index';
|
|
12
|
+
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
|
|
13
|
+
import { Button } from '../../ui/button';
|
|
10
14
|
|
|
11
15
|
export const FeedEvent = ({ post }: { post: PublicPost }) => {
|
|
12
16
|
const { t } = useTranslation();
|
|
17
|
+
const navigation =
|
|
18
|
+
useNavigation<NativeStackNavigationProp<MainStackParamList>>();
|
|
13
19
|
const eventData = post.data as Event;
|
|
14
20
|
const start = post.occurrenceStart ?? eventData.start;
|
|
15
21
|
const end = post.occurrenceEnd ?? eventData.end;
|
|
16
22
|
|
|
17
23
|
return (
|
|
18
|
-
|
|
24
|
+
<View className="w-full flex-col gap-1">
|
|
19
25
|
{eventData.image && (
|
|
20
|
-
<View className="w-full aspect-video overflow-hidden">
|
|
26
|
+
<View className="w-full aspect-video overflow-hidden rounded-md">
|
|
21
27
|
<CachedImage
|
|
22
28
|
url={eventData.image}
|
|
23
29
|
className="w-full h-full"
|
|
@@ -26,35 +32,48 @@ export const FeedEvent = ({ post }: { post: PublicPost }) => {
|
|
|
26
32
|
</View>
|
|
27
33
|
)}
|
|
28
34
|
|
|
29
|
-
<View className="
|
|
30
|
-
<ThemedText className="text-muted-foreground text-sm
|
|
35
|
+
<View className="flex-row items-center justify-between">
|
|
36
|
+
<ThemedText className="text-muted-foreground text-sm">
|
|
31
37
|
{formatEventDate(start)}
|
|
32
38
|
{end && ` - ${formatEventDate(end)}`}
|
|
33
39
|
{eventData.timeZone && ` (${eventData.timeZone})`}
|
|
34
40
|
</ThemedText>
|
|
41
|
+
<Button
|
|
42
|
+
variant="outline"
|
|
43
|
+
size="sm"
|
|
44
|
+
onPress={() => navigation.navigate('Post', { id: post.id })}
|
|
45
|
+
>
|
|
46
|
+
<ThemedText className="text-xs">
|
|
47
|
+
{t('posts.event.viewEvent', { defaultValue: 'View Event' })}
|
|
48
|
+
</ThemedText>
|
|
49
|
+
</Button>
|
|
50
|
+
</View>
|
|
35
51
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
52
|
+
<ThemedText className="text-lg font-semibold">
|
|
53
|
+
{eventData.name}
|
|
54
|
+
</ThemedText>
|
|
39
55
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
56
|
+
{eventData.recurrence ? (
|
|
57
|
+
<ThemedText className="text-muted-foreground text-sm">
|
|
58
|
+
{formatEventRecurrence(eventData.recurrence, t, eventData.start)}
|
|
59
|
+
</ThemedText>
|
|
60
|
+
) : null}
|
|
45
61
|
|
|
46
|
-
|
|
47
|
-
|
|
62
|
+
{eventData.url ? (
|
|
63
|
+
<Pressable onPress={() => navigation.navigate('Post', { id: post.id })}>
|
|
64
|
+
<ThemedText className="text-sm text-primary">
|
|
48
65
|
🔗 {eventData.url}
|
|
49
66
|
</ThemedText>
|
|
50
|
-
|
|
67
|
+
</Pressable>
|
|
68
|
+
) : null}
|
|
51
69
|
|
|
52
|
-
|
|
53
|
-
|
|
70
|
+
{eventData?.moderators && eventData.moderators.length > 0 ? (
|
|
71
|
+
<View className="flex-row items-center gap-1">
|
|
72
|
+
{eventData.moderators.slice(0, 2).map((moderator, index) => (
|
|
54
73
|
<ParticipantAvatar key={index} profileId={moderator} />
|
|
55
74
|
))}
|
|
56
75
|
</View>
|
|
57
|
-
|
|
58
|
-
|
|
76
|
+
) : null}
|
|
77
|
+
</View>
|
|
59
78
|
);
|
|
60
79
|
};
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { View, Linking, Pressable } from 'react-native';
|
|
3
|
+
import { useNavigation } from '@react-navigation/native';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import type { PublicPost } from '@openpeepshq/common';
|
|
6
|
+
import { attachmentMediaKind } from '@openpeepshq/common/lib';
|
|
7
|
+
import { FullPostLayout } from '../../FullPostLayout';
|
|
8
|
+
import { PostInfoHeader } from '../../pieces/PostInfoHeader';
|
|
9
|
+
import { PostMarkdown } from '../../Markdown';
|
|
10
|
+
import { ResourceCard } from '../../../resources/ResourceCard';
|
|
11
|
+
import { GalleryModal } from '../../pieces/GalleryModal';
|
|
12
|
+
import { VideoPlayer } from '../../pieces/VideoPlayer';
|
|
13
|
+
import { AudioAttachment } from '../../pieces/AudioAttachment';
|
|
14
|
+
import {
|
|
15
|
+
DownloadIcon,
|
|
16
|
+
ExternalLinkIcon,
|
|
17
|
+
ImageIcon,
|
|
18
|
+
PlayIcon,
|
|
19
|
+
} from '../../../icons';
|
|
20
|
+
|
|
21
|
+
export interface FullResourceProps {
|
|
22
|
+
post: PublicPost;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const FullResource = ({ post }: FullResourceProps) => {
|
|
26
|
+
const { t } = useTranslation();
|
|
27
|
+
const navigation = useNavigation();
|
|
28
|
+
const deleteCallback = () => navigation.goBack();
|
|
29
|
+
const resource = post.data?.type === 'resource' ? post.data : null;
|
|
30
|
+
const [galleryIndex, setGalleryIndex] = useState<number | null>(null);
|
|
31
|
+
const [playerVisible, setPlayerVisible] = useState(false);
|
|
32
|
+
|
|
33
|
+
if (!resource) return null;
|
|
34
|
+
|
|
35
|
+
const handlePreviewClick = () => {
|
|
36
|
+
switch (resource.resourceKind) {
|
|
37
|
+
case 'video':
|
|
38
|
+
case 'audio':
|
|
39
|
+
setPlayerVisible(true);
|
|
40
|
+
break;
|
|
41
|
+
case 'gallery':
|
|
42
|
+
setGalleryIndex(0);
|
|
43
|
+
break;
|
|
44
|
+
case 'file': {
|
|
45
|
+
const att = resource.attachments?.find(
|
|
46
|
+
(a) => attachmentMediaKind(a) === 'file'
|
|
47
|
+
);
|
|
48
|
+
if (att?.url) Linking.openURL(att.url);
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
case 'link':
|
|
52
|
+
if (resource.url) Linking.openURL(resource.url);
|
|
53
|
+
break;
|
|
54
|
+
default:
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const previewLabel = () => {
|
|
60
|
+
switch (resource.resourceKind) {
|
|
61
|
+
case 'video':
|
|
62
|
+
return t('resources.actions.watch', {
|
|
63
|
+
defaultValue: 'Play video',
|
|
64
|
+
});
|
|
65
|
+
case 'audio':
|
|
66
|
+
return t('resources.actions.listen', {
|
|
67
|
+
defaultValue: 'Play audio',
|
|
68
|
+
});
|
|
69
|
+
case 'gallery':
|
|
70
|
+
return t('resources.actions.view', {
|
|
71
|
+
defaultValue: 'View images',
|
|
72
|
+
});
|
|
73
|
+
case 'file':
|
|
74
|
+
return t('resources.actions.download', {
|
|
75
|
+
defaultValue: 'Download',
|
|
76
|
+
});
|
|
77
|
+
case 'link':
|
|
78
|
+
return t('resources.actions.openLink', {
|
|
79
|
+
defaultValue: 'Open link',
|
|
80
|
+
});
|
|
81
|
+
default:
|
|
82
|
+
return '';
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const previewIcon = () => {
|
|
87
|
+
switch (resource.resourceKind) {
|
|
88
|
+
case 'video':
|
|
89
|
+
case 'audio':
|
|
90
|
+
return <PlayIcon size={48} className="text-white" />;
|
|
91
|
+
case 'gallery':
|
|
92
|
+
return <ImageIcon size={48} className="text-white" />;
|
|
93
|
+
case 'file':
|
|
94
|
+
return <DownloadIcon size={48} className="text-white" />;
|
|
95
|
+
case 'link':
|
|
96
|
+
return <ExternalLinkIcon size={48} className="text-white" />;
|
|
97
|
+
default:
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const renderMedia = () => {
|
|
103
|
+
if (resource.resourceKind === 'video' && playerVisible) {
|
|
104
|
+
const videoAtt = resource.attachments?.find(
|
|
105
|
+
(a) => attachmentMediaKind(a) === 'video'
|
|
106
|
+
);
|
|
107
|
+
if (videoAtt) {
|
|
108
|
+
return (
|
|
109
|
+
<ResourceCard
|
|
110
|
+
post={post}
|
|
111
|
+
preview={<VideoPlayer attachment={videoAtt} />}
|
|
112
|
+
/>
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (resource.resourceKind === 'audio' && playerVisible) {
|
|
118
|
+
const audioAtt = resource.attachments?.find(
|
|
119
|
+
(a) => attachmentMediaKind(a) === 'audio'
|
|
120
|
+
);
|
|
121
|
+
if (audioAtt?.url) {
|
|
122
|
+
return (
|
|
123
|
+
<ResourceCard
|
|
124
|
+
post={post}
|
|
125
|
+
preview={
|
|
126
|
+
<AudioAttachment
|
|
127
|
+
src={audioAtt.url}
|
|
128
|
+
label={audioAtt.filename ?? audioAtt.description}
|
|
129
|
+
size={audioAtt.meta?.size}
|
|
130
|
+
/>
|
|
131
|
+
}
|
|
132
|
+
/>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// All kinds: ResourceCard with click overlay
|
|
138
|
+
return (
|
|
139
|
+
<View className="relative">
|
|
140
|
+
<ResourceCard post={post} />
|
|
141
|
+
<View
|
|
142
|
+
className="absolute top-0 left-0 right-0 h-48 items-center justify-center"
|
|
143
|
+
pointerEvents="box-none"
|
|
144
|
+
>
|
|
145
|
+
<View
|
|
146
|
+
className="flex size-20 items-center justify-center rounded-full bg-black/60"
|
|
147
|
+
pointerEvents="auto"
|
|
148
|
+
>
|
|
149
|
+
<Pressable
|
|
150
|
+
onPress={handlePreviewClick}
|
|
151
|
+
accessibilityLabel={previewLabel()}
|
|
152
|
+
>
|
|
153
|
+
{previewIcon()}
|
|
154
|
+
</Pressable>
|
|
155
|
+
</View>
|
|
156
|
+
</View>
|
|
157
|
+
</View>
|
|
158
|
+
);
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
return (
|
|
162
|
+
<FullPostLayout post={post} deleteCallback={deleteCallback}>
|
|
163
|
+
<View className="w-full gap-y-3">
|
|
164
|
+
<PostInfoHeader post={post} showMenu deleteCallback={deleteCallback} />
|
|
165
|
+
{renderMedia()}
|
|
166
|
+
{galleryIndex !== null ? (
|
|
167
|
+
<GalleryModal
|
|
168
|
+
attachments={resource.attachments ?? []}
|
|
169
|
+
initialIndex={galleryIndex}
|
|
170
|
+
onClose={() => setGalleryIndex(null)}
|
|
171
|
+
/>
|
|
172
|
+
) : null}
|
|
173
|
+
{resource?.content ? <PostMarkdown source={resource.content} /> : null}
|
|
174
|
+
</View>
|
|
175
|
+
</FullPostLayout>
|
|
176
|
+
);
|
|
177
|
+
};
|