@openpeepshq/rn-components 0.3.6 → 0.3.7
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 +1 -1
- package/src/components/custom/common/empty-state-container.tsx +42 -114
- package/src/components/custom/headers/tab-screens-header.tsx +3 -4
- package/src/components/custom/navigation/side-menu.tsx +2 -2
- package/src/components/navigation/auth-wrapper.tsx +1 -1
- package/src/components/notifications/NotificationItem.tsx +1 -1
- package/src/components/notifications/NotificationsList.tsx +5 -1
- package/src/components/post/Feed.tsx +3 -1
- package/src/components/post/FeedPost.tsx +32 -37
- package/src/components/post/FeedPostContent.tsx +6 -8
- package/src/components/post/feed/events/EventsFeed.tsx +1 -0
- package/src/components/post/pieces/PostActions.tsx +46 -121
- package/src/components/post/pieces/PostInfoHeader.tsx +9 -5
- package/src/components/post/post-form/Footer.tsx +47 -64
- package/src/components/post/post-form/OpenpeepsMarkdownInput.tsx +3 -0
- package/src/components/post/post-form/PollComposerFields.tsx +2 -2
- package/src/components/post/post-form/PostForm.tsx +133 -129
- package/src/components/post/types/Note.tsx +1 -1
- package/src/components/post/types/Poll.tsx +1 -1
- package/src/components/post/types/article/CardArticle.tsx +1 -1
- package/src/components/post/types/event/CardEvent.tsx +1 -1
- package/src/components/post/types/event/FullEvent.tsx +21 -20
- package/src/components/profile/ProfileCard.tsx +1 -1
- package/src/components/profile/ProfileHeader.tsx +8 -10
- package/src/pages/Explore.tsx +30 -5
- package/src/pages/Members.tsx +2 -2
- package/src/pages/conversations/Index.tsx +1 -1
- package/src/pages/conversations/New.tsx +8 -1
- package/src/pages/groups/Index.tsx +8 -1
- package/src/pages/groups/Info.tsx +4 -4
- package/src/pages/groups/Show.tsx +42 -3
- package/src/pages/posts/Edit.tsx +43 -5
- package/src/pages/posts/New.tsx +121 -74
- package/src/pages/posts/Reply.tsx +77 -49
- package/src/pages/profile/Followers.tsx +4 -1
- package/src/pages/profile/Following.tsx +4 -1
|
@@ -1,78 +1,61 @@
|
|
|
1
1
|
import { View } from 'react-native';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { ThemedText } from '../../ui/themed-text';
|
|
2
|
+
import React, { type ReactNode } from 'react';
|
|
4
3
|
import { Button } from '../../ui/button';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
FilmIcon,
|
|
8
|
-
ChartColumnIcon,
|
|
9
|
-
NotebookIcon,
|
|
10
|
-
PaperclipIcon,
|
|
11
|
-
NewspaperIcon,
|
|
12
|
-
} from '../../icons/index';
|
|
13
|
-
import { PostCreationData, PostType } from '@openpeepshq/common';
|
|
14
|
-
import { maxContentLength, maxArticleContentLength } from '../../../lib/utils';
|
|
4
|
+
import { ImageIcon, AudioLinesIcon, PaperclipIcon } from '../../icons/index';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
15
6
|
|
|
16
7
|
interface FooterProps {
|
|
17
|
-
content: PostCreationData;
|
|
18
8
|
onImagePress: () => void;
|
|
19
|
-
|
|
20
|
-
onVideoPress: () => void;
|
|
21
|
-
onPollPress: () => void;
|
|
9
|
+
onAudioPress: () => void;
|
|
22
10
|
onDocumentPress: () => void;
|
|
23
|
-
|
|
24
|
-
|
|
11
|
+
typeSwitcher?: ReactNode;
|
|
12
|
+
hideMedia?: boolean;
|
|
25
13
|
}
|
|
26
14
|
|
|
27
|
-
export
|
|
28
|
-
content,
|
|
15
|
+
export const Footer = ({
|
|
29
16
|
onImagePress,
|
|
30
|
-
|
|
31
|
-
onPollPress,
|
|
17
|
+
onAudioPress,
|
|
32
18
|
onDocumentPress,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}: FooterProps) {
|
|
19
|
+
typeSwitcher,
|
|
20
|
+
hideMedia = false,
|
|
21
|
+
}: FooterProps) => {
|
|
22
|
+
const { t } = useTranslation();
|
|
23
|
+
|
|
36
24
|
return (
|
|
37
|
-
<View className="
|
|
38
|
-
<View className="flex-row
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
) : (
|
|
71
|
-
<NewspaperIcon size={24} className="text-foreground" />
|
|
72
|
-
)}
|
|
73
|
-
</Button>
|
|
74
|
-
</View>
|
|
25
|
+
<View className="border-t border-border bg-background px-4 py-3">
|
|
26
|
+
<View className="flex-row items-center justify-between">
|
|
27
|
+
{hideMedia ? (
|
|
28
|
+
<View />
|
|
29
|
+
) : (
|
|
30
|
+
<View className="flex-row items-center gap-2">
|
|
31
|
+
<Button
|
|
32
|
+
size="icon"
|
|
33
|
+
variant="ghost"
|
|
34
|
+
accessibilityLabel={t('posts.form.addImage')}
|
|
35
|
+
onPress={onImagePress}
|
|
36
|
+
>
|
|
37
|
+
<ImageIcon size={20} className="text-foreground" />
|
|
38
|
+
</Button>
|
|
39
|
+
<Button
|
|
40
|
+
size="icon"
|
|
41
|
+
variant="ghost"
|
|
42
|
+
accessibilityLabel={t('posts.form.addAudio')}
|
|
43
|
+
onPress={onAudioPress}
|
|
44
|
+
>
|
|
45
|
+
<AudioLinesIcon size={20} className="text-foreground" />
|
|
46
|
+
</Button>
|
|
47
|
+
<Button
|
|
48
|
+
size="icon"
|
|
49
|
+
variant="ghost"
|
|
50
|
+
accessibilityLabel={t('posts.form.addDocument')}
|
|
51
|
+
onPress={onDocumentPress}
|
|
52
|
+
>
|
|
53
|
+
<PaperclipIcon size={20} className="text-foreground" />
|
|
54
|
+
</Button>
|
|
55
|
+
</View>
|
|
56
|
+
)}
|
|
57
|
+
{typeSwitcher}
|
|
75
58
|
</View>
|
|
76
59
|
</View>
|
|
77
60
|
);
|
|
78
|
-
}
|
|
61
|
+
};
|
|
@@ -30,6 +30,7 @@ export interface OpenpeepsMarkdownInputProps {
|
|
|
30
30
|
/** Extra classes for the textarea. */
|
|
31
31
|
className?: string;
|
|
32
32
|
testId?: string;
|
|
33
|
+
autoFocus?: boolean;
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
const mentionQueryFrom = (text: string, cursor: number) => {
|
|
@@ -51,6 +52,7 @@ export const OpenpeepsMarkdownInput = ({
|
|
|
51
52
|
previewButton = true,
|
|
52
53
|
className,
|
|
53
54
|
testId,
|
|
55
|
+
autoFocus = false,
|
|
54
56
|
}: OpenpeepsMarkdownInputProps) => {
|
|
55
57
|
const { t } = useTranslation();
|
|
56
58
|
const { openpeepsApi } = useOpenpeeps();
|
|
@@ -191,6 +193,7 @@ export const OpenpeepsMarkdownInput = ({
|
|
|
191
193
|
) : null}
|
|
192
194
|
|
|
193
195
|
<Textarea
|
|
196
|
+
autoFocus={autoFocus}
|
|
194
197
|
numberOfLines={rows}
|
|
195
198
|
value={value}
|
|
196
199
|
maxLength={maxLength}
|
|
@@ -31,7 +31,7 @@ export const PollComposerFields: React.FC<PollFormProps> = ({
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
return (
|
|
34
|
-
<View className="
|
|
34
|
+
<View className="pt-4 w-full flex flex-col gap-4">
|
|
35
35
|
{options?.map((_, index) => (
|
|
36
36
|
<View key={index} className="flex-row gap-x-1 items-center w-full">
|
|
37
37
|
<FormField
|
|
@@ -92,7 +92,7 @@ export const PollComposerFields: React.FC<PollFormProps> = ({
|
|
|
92
92
|
<ThemedText className="text-muted-foreground">
|
|
93
93
|
{expiresAt
|
|
94
94
|
? formatDateTime(new Date(expiresAt))
|
|
95
|
-
: '
|
|
95
|
+
: t('posts.form.poll.expiresAt')}
|
|
96
96
|
</ThemedText>
|
|
97
97
|
</TouchableOpacity>
|
|
98
98
|
</View>
|
|
@@ -1,26 +1,29 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
2
|
+
import { Pressable, View } from 'react-native';
|
|
3
3
|
import { UseFormReturn } from 'react-hook-form';
|
|
4
|
+
import { BottomSheetModal } from '@gorhom/bottom-sheet';
|
|
5
|
+
import { AudienceSetting, type PostCreationData } from '@openpeepshq/common';
|
|
6
|
+
import { audienceSummary, useOpenpeeps } from '@openpeepshq/react';
|
|
7
|
+
import { useTranslation } from 'react-i18next';
|
|
4
8
|
import { ProfileAvatar } from '../../profile/Avatar';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { Form, FormTextarea, FormField } from '../../ui/form';
|
|
9
|
+
import { ThemedText } from '../../ui/themed-text';
|
|
10
|
+
import { Switch } from '../../ui/switch';
|
|
11
|
+
import { ChevronDownIcon, MegaphoneIcon } from '../../icons/index';
|
|
9
12
|
import { ComposeAttachments } from './ComposeAttachments';
|
|
10
|
-
import {
|
|
13
|
+
import { ComposePreviewLinks } from './ComposePreviewLinks';
|
|
14
|
+
import { OpenpeepsMarkdownInput } from './OpenpeepsMarkdownInput';
|
|
11
15
|
import { PollComposerFields } from './PollComposerFields';
|
|
12
|
-
import {
|
|
16
|
+
import { VisibilitySheet } from './VisibilitySheet';
|
|
13
17
|
|
|
14
|
-
import { useOpenpeeps } from '@openpeepshq/react';
|
|
15
|
-
import { BottomSheetModal } from '@gorhom/bottom-sheet';
|
|
16
|
-
|
|
17
|
-
import { ProfileSelector } from '../../profile/index';
|
|
18
18
|
interface PostFormProps {
|
|
19
19
|
autoFocus?: boolean;
|
|
20
20
|
canEditVisibility?: boolean;
|
|
21
21
|
postData: PostCreationData;
|
|
22
22
|
setPostData: (postData: PostCreationData) => void;
|
|
23
23
|
form: UseFormReturn<PostCreationData>;
|
|
24
|
+
showNotify?: boolean;
|
|
25
|
+
notify?: boolean;
|
|
26
|
+
onNotifyChange?: (value: boolean) => void;
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
export const PostForm = ({
|
|
@@ -29,12 +32,13 @@ export const PostForm = ({
|
|
|
29
32
|
postData,
|
|
30
33
|
setPostData,
|
|
31
34
|
form,
|
|
35
|
+
showNotify = false,
|
|
36
|
+
notify = false,
|
|
37
|
+
onNotifyChange,
|
|
32
38
|
}: PostFormProps) => {
|
|
33
39
|
const { currentProfile } = useOpenpeeps();
|
|
34
|
-
const profileModalRef = useRef<BottomSheetModal>(null);
|
|
35
|
-
|
|
36
40
|
const { t } = useTranslation();
|
|
37
|
-
|
|
41
|
+
const visibilityModalRef = useRef<BottomSheetModal>(null);
|
|
38
42
|
const { subscribe } = form;
|
|
39
43
|
|
|
40
44
|
useEffect(
|
|
@@ -59,125 +63,125 @@ export const PostForm = ({
|
|
|
59
63
|
[postData, form, setPostData]
|
|
60
64
|
);
|
|
61
65
|
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}, []);
|
|
66
|
+
const selectedGroupName = useMemo(() => {
|
|
67
|
+
if (!postData.groupId) {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
return currentProfile?.memberships?.find(
|
|
71
|
+
(membership) => membership.group.id === postData.groupId
|
|
72
|
+
)?.group.displayName;
|
|
73
|
+
}, [currentProfile?.memberships, postData.groupId]);
|
|
70
74
|
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const handle = `@${profile.handle}`;
|
|
75
|
-
|
|
76
|
-
const currentContent = form.getValues('data.content') || '';
|
|
77
|
-
const newContent = currentContent.replace(/@[^\s@]*$/, `${handle} `);
|
|
78
|
-
|
|
79
|
-
const newPostData = {
|
|
80
|
-
...postData,
|
|
81
|
-
data: {
|
|
82
|
-
...postData.data,
|
|
83
|
-
content: newContent,
|
|
84
|
-
},
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
form.reset(newPostData);
|
|
88
|
-
setPostData(newPostData);
|
|
89
|
-
},
|
|
90
|
-
[form, postData, setPostData]
|
|
91
|
-
);
|
|
75
|
+
const content = form.watch('data.content') ?? '';
|
|
76
|
+
const isQuestion = postData.data.type === 'question';
|
|
77
|
+
const isNote = postData.data.type === 'note';
|
|
92
78
|
|
|
93
79
|
return (
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
<
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
attachments: postData.data.attachments?.filter(
|
|
119
|
-
(_, i) => i !== index
|
|
120
|
-
),
|
|
121
|
-
},
|
|
122
|
-
};
|
|
123
|
-
form.reset(newPostData);
|
|
124
|
-
setPostData(newPostData);
|
|
125
|
-
}}
|
|
126
|
-
updateAttachment={(index, attachment) => {
|
|
127
|
-
const newPostData = {
|
|
128
|
-
...postData,
|
|
129
|
-
data: {
|
|
130
|
-
...postData.data,
|
|
131
|
-
attachments: postData.data.attachments?.map((a, i) =>
|
|
132
|
-
i === index ? attachment : a
|
|
133
|
-
),
|
|
134
|
-
},
|
|
135
|
-
};
|
|
136
|
-
form.reset(newPostData);
|
|
137
|
-
setPostData(newPostData);
|
|
138
|
-
}}
|
|
139
|
-
/>
|
|
140
|
-
)}
|
|
141
|
-
|
|
142
|
-
<FormField
|
|
143
|
-
control={form.control}
|
|
144
|
-
name={'data.content'}
|
|
145
|
-
render={({ field: { onChange, value, ...rest } }) => (
|
|
146
|
-
<FormTextarea
|
|
147
|
-
autoFocus={autoFocus}
|
|
148
|
-
containerClassName={'w-full'}
|
|
149
|
-
className={cn(
|
|
150
|
-
'px-4 py-2 border-0 text-foreground ',
|
|
151
|
-
contentInputHeight
|
|
80
|
+
<View className="px-4 pb-4">
|
|
81
|
+
{currentProfile ? (
|
|
82
|
+
<Pressable
|
|
83
|
+
disabled={!canEditVisibility}
|
|
84
|
+
accessibilityLabel={t('posts.form.changeAudience')}
|
|
85
|
+
onPress={() => visibilityModalRef.current?.present()}
|
|
86
|
+
className="mb-3 w-full flex-row items-center gap-3 rounded-md border border-border p-3"
|
|
87
|
+
>
|
|
88
|
+
<ProfileAvatar className="size-10" profile={currentProfile} />
|
|
89
|
+
<View className="min-w-0 flex-1">
|
|
90
|
+
<View className="flex-row items-center gap-1">
|
|
91
|
+
<ThemedText className="font-medium" numberOfLines={1}>
|
|
92
|
+
{currentProfile.displayName ?? currentProfile.handle}
|
|
93
|
+
</ThemedText>
|
|
94
|
+
{canEditVisibility ? (
|
|
95
|
+
<ChevronDownIcon size={16} className="text-muted-foreground" />
|
|
96
|
+
) : null}
|
|
97
|
+
</View>
|
|
98
|
+
<ThemedText className="text-sm text-muted-foreground">
|
|
99
|
+
{audienceSummary(
|
|
100
|
+
postData.visibility,
|
|
101
|
+
t,
|
|
102
|
+
selectedGroupName,
|
|
103
|
+
postData.audience?.length
|
|
152
104
|
)}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
105
|
+
</ThemedText>
|
|
106
|
+
</View>
|
|
107
|
+
</Pressable>
|
|
108
|
+
) : null}
|
|
109
|
+
|
|
110
|
+
<OpenpeepsMarkdownInput
|
|
111
|
+
autoFocus={autoFocus}
|
|
112
|
+
value={content}
|
|
113
|
+
onChange={(text) => form.setValue('data.content', text)}
|
|
114
|
+
placeholder={
|
|
115
|
+
isQuestion
|
|
116
|
+
? t('posts.form.poll.question')
|
|
117
|
+
: t('posts.form.note.placeholder')
|
|
118
|
+
}
|
|
119
|
+
/>
|
|
120
|
+
|
|
121
|
+
<ComposePreviewLinks content={content} />
|
|
122
|
+
|
|
123
|
+
{isNote && (postData.data.attachments?.length ?? 0) > 0 ? (
|
|
124
|
+
<ComposeAttachments
|
|
125
|
+
attachments={postData.data.attachments ?? []}
|
|
126
|
+
removeAttachment={(index) => {
|
|
127
|
+
const newPostData = {
|
|
128
|
+
...postData,
|
|
129
|
+
data: {
|
|
130
|
+
...postData.data,
|
|
131
|
+
attachments: postData.data.attachments?.filter(
|
|
132
|
+
(_, i) => i !== index
|
|
133
|
+
),
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
form.reset(newPostData);
|
|
137
|
+
setPostData(newPostData);
|
|
138
|
+
}}
|
|
139
|
+
updateAttachment={(index, attachment) => {
|
|
140
|
+
const newPostData = {
|
|
141
|
+
...postData,
|
|
142
|
+
data: {
|
|
143
|
+
...postData.data,
|
|
144
|
+
attachments: postData.data.attachments?.map((item, i) =>
|
|
145
|
+
i === index ? attachment : item
|
|
146
|
+
),
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
form.reset(newPostData);
|
|
150
|
+
setPostData(newPostData);
|
|
151
|
+
}}
|
|
179
152
|
/>
|
|
180
|
-
|
|
181
|
-
|
|
153
|
+
) : null}
|
|
154
|
+
|
|
155
|
+
{isQuestion ? (
|
|
156
|
+
<PollComposerFields form={form} postData={postData} />
|
|
157
|
+
) : null}
|
|
158
|
+
|
|
159
|
+
{showNotify ? (
|
|
160
|
+
<View className="flex-row items-center justify-between py-3">
|
|
161
|
+
<View className="flex-row items-center gap-2">
|
|
162
|
+
<MegaphoneIcon size={20} className="text-foreground" />
|
|
163
|
+
<ThemedText className="text-base">
|
|
164
|
+
{t('posts.form.notifyEveryone')}
|
|
165
|
+
</ThemedText>
|
|
166
|
+
</View>
|
|
167
|
+
<Switch
|
|
168
|
+
checked={notify}
|
|
169
|
+
onCheckedChange={onNotifyChange ?? (() => undefined)}
|
|
170
|
+
/>
|
|
171
|
+
</View>
|
|
172
|
+
) : null}
|
|
173
|
+
|
|
174
|
+
<VisibilitySheet
|
|
175
|
+
type="post"
|
|
176
|
+
ref={visibilityModalRef}
|
|
177
|
+
showDirect
|
|
178
|
+
audienceSetting={{
|
|
179
|
+
visibility: postData.visibility,
|
|
180
|
+
groupId: postData.groupId || undefined,
|
|
181
|
+
audience: postData.audience || [],
|
|
182
|
+
}}
|
|
183
|
+
onSubmit={handleAudienceSelect}
|
|
184
|
+
/>
|
|
185
|
+
</View>
|
|
182
186
|
);
|
|
183
187
|
};
|
|
@@ -22,7 +22,7 @@ export const FeedNote = ({ post }: Props) =>
|
|
|
22
22
|
</View>
|
|
23
23
|
) : (
|
|
24
24
|
<View>
|
|
25
|
-
<ThemedText className="text-
|
|
25
|
+
<ThemedText className="text-destructive">
|
|
26
26
|
This Feed-Note Component was used but the post type on the server is not
|
|
27
27
|
of type "note". Please report this to the Developers
|
|
28
28
|
</ThemedText>
|
|
@@ -24,7 +24,7 @@ export const FeedPoll = ({ post }: Props) =>
|
|
|
24
24
|
</View>
|
|
25
25
|
) : (
|
|
26
26
|
<View>
|
|
27
|
-
<ThemedText className="text-
|
|
27
|
+
<ThemedText className="text-destructive">
|
|
28
28
|
This Feed-Note Component was used but the post type on the server is not
|
|
29
29
|
of type "note". Please report this to the Developers
|
|
30
30
|
</ThemedText>
|
|
@@ -24,7 +24,7 @@ export const ArticleCard = ({ post }: CardArticleProps) => {
|
|
|
24
24
|
id: post.id,
|
|
25
25
|
});
|
|
26
26
|
}}
|
|
27
|
-
className="
|
|
27
|
+
className="mb-6 w-full rounded-lg border border-border"
|
|
28
28
|
>
|
|
29
29
|
{article.image && (
|
|
30
30
|
<View className="w-full h-[200px]">
|
|
@@ -46,7 +46,7 @@ export const CardEvent = ({ post, showEventDate = true }: CardEventProps) => {
|
|
|
46
46
|
occurrence: occurrenceId,
|
|
47
47
|
});
|
|
48
48
|
}}
|
|
49
|
-
className="
|
|
49
|
+
className="mb-6 w-full rounded-lg border border-border"
|
|
50
50
|
>
|
|
51
51
|
<View className="w-full aspect-video overflow-hidden rounded-t-md">
|
|
52
52
|
<Image
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { useMemo, useRef } from 'react';
|
|
2
2
|
import { useOpenpeeps } from '@openpeepshq/react';
|
|
3
|
-
import { EmptyStateContainer } from '../../../custom/index';
|
|
4
3
|
import {
|
|
5
4
|
MoreVerticalIcon,
|
|
6
5
|
ShareIcon,
|
|
@@ -80,7 +79,9 @@ export const FullEvent: React.FC<FullEventProps> = ({ post, occurrence }) => {
|
|
|
80
79
|
const navigation =
|
|
81
80
|
useNavigation<NativeStackNavigationProp<MainStackParamList>>();
|
|
82
81
|
const { openNewPost } = useNewPostModal();
|
|
83
|
-
const [tabValue, setTabValue] = React.useState(
|
|
82
|
+
const [tabValue, setTabValue] = React.useState(
|
|
83
|
+
(post?.data as Event)?.content ? 'description' : 'discussions'
|
|
84
|
+
);
|
|
84
85
|
const { setContt } = useNewConversationStore();
|
|
85
86
|
|
|
86
87
|
const group = useMemo(() => post?.group as Group, [post]);
|
|
@@ -330,17 +331,19 @@ export const FullEvent: React.FC<FullEventProps> = ({ post, occurrence }) => {
|
|
|
330
331
|
className="w-full mx-auto flex-col gap-1.5 mt-5"
|
|
331
332
|
>
|
|
332
333
|
<TabsList className="flex-row w-full bg-transparent border-muted rounded-none border-b p-0 px-3">
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
334
|
+
{event?.content ? (
|
|
335
|
+
<TabsTrigger
|
|
336
|
+
value="description"
|
|
337
|
+
onPress={() => {
|
|
338
|
+
setTabValue('description');
|
|
339
|
+
}}
|
|
340
|
+
className={`${
|
|
341
|
+
tabValue === 'description' ? 'border-b-2 border-foreground' : ''
|
|
342
|
+
}`}
|
|
343
|
+
>
|
|
344
|
+
<ThemedText>Description</ThemedText>
|
|
345
|
+
</TabsTrigger>
|
|
346
|
+
) : null}
|
|
344
347
|
<TabsTrigger
|
|
345
348
|
value="discussions"
|
|
346
349
|
className={`${
|
|
@@ -366,13 +369,11 @@ export const FullEvent: React.FC<FullEventProps> = ({ post, occurrence }) => {
|
|
|
366
369
|
</TabsTrigger>
|
|
367
370
|
)}
|
|
368
371
|
</TabsList>
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
<OpenpeepsMarkdown source={event
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
)}
|
|
375
|
-
</TabsContent>
|
|
372
|
+
{event?.content ? (
|
|
373
|
+
<TabsContent value="description" className="p-0">
|
|
374
|
+
<OpenpeepsMarkdown source={event.content} linkPreviewMode="none" />
|
|
375
|
+
</TabsContent>
|
|
376
|
+
) : null}
|
|
376
377
|
<TabsContent value="discussions" className="flex-1 p-0">
|
|
377
378
|
<ReplyBox post={post} />
|
|
378
379
|
{descendentThreads.map((thread) => (
|
|
@@ -70,7 +70,7 @@ export const MiniProfileCard = ({
|
|
|
70
70
|
showAction = true,
|
|
71
71
|
}: MiniProfileCardProps) => {
|
|
72
72
|
return (
|
|
73
|
-
<View className="flex flex-row gap-x-2
|
|
73
|
+
<View className="flex flex-row items-center gap-x-2 rounded-md border border-border px-2 py-2">
|
|
74
74
|
<ProfileAvatar profile={profile} className="size-8" />
|
|
75
75
|
<ThemedText>
|
|
76
76
|
{truncateText(profile.displayName, 10) || `@${profile.handle}`}
|
|
@@ -24,16 +24,14 @@ export const ProfileHeader = ({
|
|
|
24
24
|
const roles = profile.roles ?? [];
|
|
25
25
|
return (
|
|
26
26
|
<View className="relative mb-8">
|
|
27
|
-
<View className="relative aspect-[3/1] w-full bg-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
profile.header
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
resizeMode="cover"
|
|
36
|
-
/>
|
|
27
|
+
<View className="relative aspect-[3/1] w-full bg-surface-2">
|
|
28
|
+
{profile.header ? (
|
|
29
|
+
<Image
|
|
30
|
+
source={{ uri: profile.header }}
|
|
31
|
+
className="h-full w-full"
|
|
32
|
+
resizeMode="cover"
|
|
33
|
+
/>
|
|
34
|
+
) : null}
|
|
37
35
|
<View className="absolute -bottom-12 left-4 z-10">
|
|
38
36
|
<ProfileAvatar profile={profile} className="size-24" />
|
|
39
37
|
</View>
|