@openpeepshq/rn-components 0.5.2 → 0.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openpeepshq/rn-components",
3
- "version": "0.5.2",
3
+ "version": "0.6.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",
@@ -140,8 +140,8 @@
140
140
  "timezones-list": "^3.1.0",
141
141
  "validator": "^13.15.23",
142
142
  "zustand": "^5.0.3",
143
- "@openpeepshq/common": "^0.2.0",
144
- "@openpeepshq/react": "^0.5.1"
143
+ "@openpeepshq/react": "^0.6.0",
144
+ "@openpeepshq/common": "^0.3.0"
145
145
  },
146
146
  "devDependencies": {
147
147
  "@babel/core": "^7.26.7",
@@ -34,7 +34,12 @@ export const ConversationParticipantsModal = ({
34
34
  </ThemedText>
35
35
  </View>
36
36
  {participants.map((profile) => (
37
- <ProfileCard key={profile.id} profile={profile} hasAction={false} />
37
+ <ProfileCard
38
+ key={profile.id}
39
+ profile={profile}
40
+ showAction={false}
41
+ hasAction={false}
42
+ />
38
43
  ))}
39
44
  </BaseSheet>
40
45
  );
@@ -73,7 +73,7 @@ export const ConversationPreviewCard = ({
73
73
  >
74
74
  <View className="flex w-full flex-col gap-x-1 border-b p-3 text-left">
75
75
  <View className="flex flex-row items-center gap-4">
76
- <View className="flex -space-x-2">
76
+ <View className="flex-row -space-x-2">
77
77
  {participants.slice(0, 3).map((p) => (
78
78
  <ProfileAvatar
79
79
  key={p.id}
@@ -1,6 +1,6 @@
1
1
  import {
2
- linkProfileMentions,
3
- type MentionProfileRef,
2
+ preprocessMarkdownSource,
3
+ type MarkdownRenderProps,
4
4
  } from '@openpeepshq/common/lib';
5
5
  import { useNavigation } from '@react-navigation/native';
6
6
  import { NativeStackNavigationProp } from '@react-navigation/native-stack';
@@ -19,19 +19,14 @@ import { hashtagPlugin, hashtagRenderer } from './extensions/hashtag';
19
19
  import { mentionPlugin, mentionRenderer } from './extensions/mention';
20
20
  import { codeBlockRenderer, fenceRenderer } from './extensions/codeBlock';
21
21
  import { codeInlineRenderer } from './extensions/codeInline';
22
+ import { htmlBlockRenderer, htmlInlineRenderer } from './extensions/html';
22
23
  import { markdownTheme } from './theme';
23
24
  import { extractLinks, isEmail, isInternalLink, toGotoUrl } from './utils';
24
25
  import { PreviewLink } from '../preview-link';
25
26
  import { useOpenPeepsTheme } from '../../theme/OpenPeepsThemeProvider';
26
27
  import { recordOutboundClick } from '@openpeepshq/react';
27
28
 
28
- export interface OpenpeepsMarkdownProps {
29
- source: string;
30
- mentions?: MentionProfileRef[];
31
- linkPreviewMode?: 'prepend' | 'append' | 'inline' | 'none';
32
- /** When true, same-origin links open in the system browser instead of in-app navigation. */
33
- newTab?: boolean | ((link: string) => boolean);
34
- }
29
+ export interface OpenpeepsMarkdownProps extends MarkdownRenderProps {}
35
30
 
36
31
  export const OpenpeepsMarkdown = ({
37
32
  source,
@@ -46,7 +41,9 @@ export const OpenpeepsMarkdown = ({
46
41
  useNavigation<NativeStackNavigationProp<MainStackParamList>>();
47
42
 
48
43
  const markdownit = useMemo(() => {
49
- const md = MarkdownIt({ linkify: true, typographer: true });
44
+ // html: true so inline HTML (iframes, etc.) is tokenized and passed
45
+ // to custom renderers that apply the same allowlist as the web side.
46
+ const md = MarkdownIt({ linkify: true, typographer: true, html: true });
50
47
  md.use(hashtagPlugin);
51
48
  md.use(mentionPlugin(mentions));
52
49
  return md;
@@ -62,6 +59,12 @@ export const OpenpeepsMarkdown = ({
62
59
  return typeof newTab === 'function' ? newTab(url) : newTab;
63
60
  };
64
61
 
62
+ const handleIframePress = (url: string) => {
63
+ const origin = BASE_URL as string;
64
+ recordOutboundClick(url, origin);
65
+ Linking.openURL(url);
66
+ };
67
+
65
68
  const handleLinkPress = (url: string) => {
66
69
  const origin = BASE_URL as string;
67
70
  if (shouldOpenExternally(url)) {
@@ -73,7 +76,11 @@ export const OpenpeepsMarkdown = ({
73
76
  };
74
77
 
75
78
  const tokens = useMemo(
76
- () => stringToTokens(linkProfileMentions(source, mentions), markdownit),
79
+ () =>
80
+ stringToTokens(
81
+ preprocessMarkdownSource(source ?? '', mentions),
82
+ markdownit
83
+ ),
77
84
  [source, mentions, markdownit]
78
85
  );
79
86
  const links = useMemo(
@@ -104,6 +111,8 @@ export const OpenpeepsMarkdown = ({
104
111
  code_block: codeBlockRenderer(colors),
105
112
  fence: fenceRenderer(colors),
106
113
  code_inline: codeInlineRenderer(colors),
114
+ html_block: htmlBlockRenderer(handleIframePress),
115
+ html_inline: htmlInlineRenderer(handleIframePress),
107
116
  }}
108
117
  >
109
118
  {ast as unknown as ReactNode[]}
@@ -0,0 +1,94 @@
1
+ import React from 'react';
2
+ import { Linking, StyleSheet, Text, View } from 'react-native';
3
+ import type { RenderFunction } from 'react-native-markdown-display';
4
+ import {
5
+ extractIframeSrcs,
6
+ MARKDOWN_HTML_ALLOWED_TAGS,
7
+ } from '@openpeepshq/common/lib';
8
+
9
+ const TAG_RE = /<\/?([a-zA-Z][a-zA-Z0-9]*)\b[^>]*>/g;
10
+
11
+ /**
12
+ * Renderer for markdown-it `html_inline` tokens.
13
+ * Extracts iframes (rendered as tap-to-open links) and strips other HTML.
14
+ */
15
+ export const htmlInlineRenderer =
16
+ (onIframePress: (url: string) => void): RenderFunction =>
17
+ (node) => {
18
+ const raw =
19
+ typeof node.content === 'string' ? node.content : String(node.content);
20
+ return renderHtmlContent(raw, onIframePress);
21
+ };
22
+
23
+ /**
24
+ * Renderer for markdown-it `html_block` tokens.
25
+ */
26
+ export const htmlBlockRenderer =
27
+ (onIframePress: (url: string) => void): RenderFunction =>
28
+ (node) => {
29
+ const raw =
30
+ typeof node.content === 'string' ? node.content : String(node.content);
31
+ return renderHtmlContent(raw, onIframePress);
32
+ };
33
+
34
+ const renderHtmlContent = (
35
+ raw: string,
36
+ onIframePress: (url: string) => void
37
+ ): React.ReactElement | null => {
38
+ // Iframes: extract src URLs and render as tap-to-open buttons.
39
+ const iframes = extractIframeSrcs(raw);
40
+ if (iframes.length > 0) {
41
+ return (
42
+ <View style={styles.iframeContainer} key={raw.slice(0, 40)}>
43
+ {iframes.map((src, i) => (
44
+ <View key={`${i}-${src.slice(0, 20)}`} style={styles.iframeRow}>
45
+ <Text style={styles.iframeLink} onPress={() => onIframePress(src)}>
46
+ Open embedded content
47
+ </Text>
48
+ <Text
49
+ style={styles.iframeUrl}
50
+ onPress={() => void Linking.openURL(src)}
51
+ >
52
+ {src}
53
+ </Text>
54
+ </View>
55
+ ))}
56
+ </View>
57
+ );
58
+ }
59
+
60
+ // Strip all HTML tags — only allowlisted tags are permitted on the web
61
+ // (via DOMPurify). On RN we render safe tags as text and drop the rest.
62
+ const allowed = new Set<string>(MARKDOWN_HTML_ALLOWED_TAGS);
63
+ const tags: string[] = [];
64
+ let match: RegExpExecArray | null;
65
+ TAG_RE.lastIndex = 0;
66
+ while ((match = TAG_RE.exec(raw)) !== null) {
67
+ tags.push(match[1]?.toLowerCase());
68
+ }
69
+
70
+ // If all tags are allowlisted, strip them and render as text.
71
+ const text = raw.replace(TAG_RE, '');
72
+ if (tags.every((tag) => !tag || allowed.has(tag.toLowerCase()))) {
73
+ return <Text style={styles.text}>{text}</Text>;
74
+ }
75
+
76
+ // Disallowed tags present — strip everything to plain text.
77
+ return <Text style={styles.text}>{text}</Text>;
78
+ };
79
+
80
+ const styles = StyleSheet.create({
81
+ iframeContainer: { marginVertical: 8 },
82
+ iframeRow: { flexDirection: 'column', alignItems: 'flex-start' },
83
+ iframeLink: {
84
+ color: '#007AFF',
85
+ textDecorationLine: 'underline',
86
+ fontSize: 14,
87
+ },
88
+ iframeUrl: {
89
+ color: '#666',
90
+ fontSize: 12,
91
+ marginTop: 4,
92
+ },
93
+ text: { fontSize: 16, lineHeight: 24 },
94
+ });
@@ -1 +1,2 @@
1
1
  export * from './OpenpeepsMarkdown';
2
+ export type { MarkdownRenderProps } from '@openpeepshq/common/lib';
@@ -1,7 +1,10 @@
1
1
  import { stringToTokens } from 'react-native-markdown-display';
2
+ import { toGotoUrl } from '@openpeepshq/common/lib';
2
3
 
3
4
  type Token = ReturnType<typeof stringToTokens>[number];
4
5
 
6
+ export { toGotoUrl };
7
+
5
8
  export const isInternalLink = (href: string, origin: string): boolean => {
6
9
  if (!href || href.includes('goto:/')) {
7
10
  return !!href;
@@ -16,24 +19,6 @@ export const isInternalLink = (href: string, origin: string): boolean => {
16
19
  }
17
20
  };
18
21
 
19
- export const toGotoUrl = (url: string, origin: string): string => {
20
- if (url.includes('goto:/')) {
21
- return url;
22
- }
23
- if (url.startsWith('/') && !url.startsWith('//')) {
24
- return `goto:${url}`;
25
- }
26
- try {
27
- const urlObj = new URL(url);
28
- if (urlObj.origin === origin) {
29
- return `goto:${urlObj.pathname}${urlObj.search}${urlObj.hash}`;
30
- }
31
- } catch {
32
- // fall through
33
- }
34
- return url;
35
- };
36
-
37
22
  export const extractLinks = (token: Token): string[] => {
38
23
  if (token.type === 'link') {
39
24
  return [token.href];
@@ -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="p-4">
30
- <ThemedText className="text-muted-foreground text-sm mb-2">
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
- <ThemedText className="text-xl font-semibold mb-3">
37
- {eventData.name}
38
- </ThemedText>
52
+ <ThemedText className="text-lg font-semibold">
53
+ {eventData.name}
54
+ </ThemedText>
39
55
 
40
- {eventData.recurrence ? (
41
- <ThemedText className="text-muted-foreground text-sm mb-3">
42
- {formatEventRecurrence(eventData.recurrence, t, eventData.start)}
43
- </ThemedText>
44
- ) : null}
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
- {eventData.url && (
47
- <ThemedText className="text-muted-foreground mb-3">
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
- <View className="flex-row items-center">
53
- {eventData?.moderators?.slice(0, 2).map((moderator, index) => (
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
- </View>
58
- </>
76
+ ) : null}
77
+ </View>
59
78
  );
60
79
  };
@@ -20,8 +20,8 @@ const buttonVariants = cva(
20
20
  },
21
21
  size: {
22
22
  default: 'h-10 px-4 py-2 native:h-12 native:px-5 native:py-3',
23
- sm: 'h-9 rounded-md px-3',
24
- lg: 'h-11 rounded-md px-8 native:h-14',
23
+ sm: 'h-9 px-3',
24
+ lg: 'h-11 px-8 native:h-14',
25
25
  icon: 'h-10 w-10',
26
26
  },
27
27
  },
package/src/global.css CHANGED
@@ -4,48 +4,50 @@
4
4
 
5
5
  @layer base {
6
6
  :root {
7
- --background: #ffffff;
8
- --foreground: #0a0a0f;
9
- --card: #ffffff;
10
- --card-foreground: #0a0a0f;
11
- --popover: #ffffff;
12
- --popover-foreground: #0a0a0f;
13
- --primary: #18181b;
14
- --primary-foreground: #fafafa;
15
- --secondary: #f4f4f5;
16
- --secondary-foreground: #18181b;
17
- --muted: #f4f4f5;
18
- --muted-foreground: #71717a;
19
- --accent: #f4f4f5;
20
- --accent-foreground: #18181b;
21
- --destructive: #ef4444;
22
- --destructive-foreground: #fafafa;
23
- --border: #e4e4e7;
24
- --input: #e4e4e7;
25
- --ring: #18181b;
26
- --alpha: #fafafa;
7
+ --background: 255 255 255;
8
+ --foreground: 10 10 11;
9
+ --card: 255 255 255;
10
+ --card-foreground: 10 10 11;
11
+ --popover: 255 255 255;
12
+ --popover-foreground: 10 10 11;
13
+ --primary: 22 22 26;
14
+ --primary-foreground: 250 250 250;
15
+ --secondary: 244 244 245;
16
+ --secondary-foreground: 22 22 26;
17
+ --muted: 244 244 246;
18
+ --muted-foreground: 113 113 122;
19
+ --accent: 244 244 245;
20
+ --accent-foreground: 22 22 26;
21
+ --destructive: 239 68 68;
22
+ --destructive-foreground: 250 250 250;
23
+ --border: 228 228 231;
24
+ --input: 228 228 231;
25
+ --ring: 22 22 26;
26
+ --alpha: 250 250 250;
27
+ --surface-2: 228 228 231;
27
28
  }
28
29
 
29
30
  .dark:root {
30
- --background: #0a0a0f;
31
- --foreground: #fafafa;
32
- --card: #0a0a0f;
33
- --card-foreground: #fafafa;
34
- --popover: #0a0a0f;
35
- --popover-foreground: #fafafa;
36
- --primary: #fafafa;
37
- --primary-foreground: #18181b;
38
- --secondary: #27272a;
39
- --secondary-foreground: #fafafa;
40
- --muted: #27272a;
41
- --muted-foreground: #a1a1aa;
42
- --accent: #27272a;
43
- --accent-foreground: #fafafa;
44
- --destructive: #dc2626;
45
- --destructive-foreground: #fafafa;
46
- --border: #27272a;
47
- --input: #27272a;
48
- --ring: #d4d4d8;
49
- --alpha: #18181b;
31
+ --background: 10 10 15;
32
+ --foreground: 250 250 250;
33
+ --card: 10 10 15;
34
+ --card-foreground: 250 250 250;
35
+ --popover: 10 10 15;
36
+ --popover-foreground: 250 250 250;
37
+ --primary: 250 250 250;
38
+ --primary-foreground: 22 22 26;
39
+ --secondary: 40 40 46;
40
+ --secondary-foreground: 250 250 250;
41
+ --muted: 39 39 42;
42
+ --muted-foreground: 161 161 170;
43
+ --accent: 40 40 46;
44
+ --accent-foreground: 250 250 250;
45
+ --destructive: 220 38 38;
46
+ --destructive-foreground: 250 250 250;
47
+ --border: 40 40 46;
48
+ --input: 40 40 46;
49
+ --ring: 212 212 216;
50
+ --alpha: 24 24 27;
51
+ --surface-2: 63 63 70;
50
52
  }
51
- }
53
+ }
@@ -29,6 +29,8 @@ import {
29
29
  ConversationProfileHeader,
30
30
  MessageInThread,
31
31
  } from '../../components/conversations/index';
32
+ import { ProfileAvatar } from '../../components/profile/Avatar';
33
+ import { ProfileCard } from '../../components/profile/ProfileCard';
32
34
 
33
35
  type ConversationProps = MainScreenProps<'Conversation'>;
34
36
 
@@ -46,12 +48,18 @@ export const ConversationShow = ({ route, navigation }: ConversationProps) => {
46
48
  const [participantsOpen, setParticipantsOpen] = useState(false);
47
49
 
48
50
  const sendMessage = openpeepsApi.createConversationPostAction({ id });
49
- const audience = messages?.[0]?.audience || [];
50
- const headerParticipants =
51
- audience.length === 2
52
- ? audience.filter((p) => p.id !== currentProfile?.id)
53
- : audience;
54
- const isGroupChat = audience.length > 2;
51
+
52
+ // Mirror the web Show page: derive participants from the last message's
53
+ // audience, excluding the current profile.
54
+ const lastMessage = messages?.slice(-1)[0];
55
+ const participants =
56
+ lastMessage?.audience?.filter((a) => a.id !== currentProfile?.id) ?? [];
57
+ const multipleParticipants = participants.length > 1;
58
+
59
+ const participantNames =
60
+ participants.length > 0
61
+ ? participants.map((p) => p.displayName || `@${p.handle}`).join(', ')
62
+ : t('conversations.title', { defaultValue: 'Conversation' });
55
63
 
56
64
  const resetForm = useCallback(() => {
57
65
  setContent('');
@@ -65,7 +73,6 @@ export const ConversationShow = ({ route, navigation }: ConversationProps) => {
65
73
 
66
74
  try {
67
75
  setIsSending(true);
68
- const lastMessage = messages?.slice(-1)[0];
69
76
  await sendMessage({
70
77
  visibility: 'direct',
71
78
  audience: lastMessage?.audience,
@@ -102,6 +109,24 @@ export const ConversationShow = ({ route, navigation }: ConversationProps) => {
102
109
  void markPostsSeen({ postIds: unseenIds });
103
110
  }, [id, currentProfile, messages, isLoading, markPostsSeen]);
104
111
 
112
+ useSetPageHeader(
113
+ isLoading ? undefined : (
114
+ <ConversationProfileHeader
115
+ participants={participants}
116
+ onPress={
117
+ multipleParticipants ? () => setParticipantsOpen(true) : undefined
118
+ }
119
+ />
120
+ ),
121
+ isLoading ? undefined : (
122
+ <TouchableOpacity
123
+ onPress={() => navigation.navigate('ConversationInfo', { id })}
124
+ >
125
+ <InfoIcon size={18} className="text-foreground" />
126
+ </TouchableOpacity>
127
+ )
128
+ );
129
+
105
130
  if (isLoading) {
106
131
  return (
107
132
  <ThemedView className="flex-1 items-center justify-center">
@@ -110,21 +135,42 @@ export const ConversationShow = ({ route, navigation }: ConversationProps) => {
110
135
  );
111
136
  }
112
137
 
113
- useSetPageHeader(
114
- <ConversationProfileHeader
115
- participants={headerParticipants}
116
- onPress={isGroupChat ? () => setParticipantsOpen(true) : undefined}
117
- />,
118
- <TouchableOpacity
119
- onPress={() => navigation.navigate('ConversationInfo', { id })}
120
- >
121
- <InfoIcon size={18} className="text-foreground" />
122
- </TouchableOpacity>
123
- );
124
-
125
138
  return (
126
139
  <ThemedView className="flex-1">
127
140
  <View className="flex-1">
141
+ {/* Section under the page header showing the participants,
142
+ mirroring the web conversation Show page. */}
143
+ <View className="border-b border-border">
144
+ {participants.length === 1 && participants[0] ? (
145
+ <ProfileCard
146
+ profile={participants[0]}
147
+ showAction={false}
148
+ hasAction={false}
149
+ />
150
+ ) : multipleParticipants ? (
151
+ <TouchableOpacity
152
+ onPress={() => setParticipantsOpen(true)}
153
+ className="w-full flex-row items-center gap-2 p-3"
154
+ >
155
+ <View className="flex-row -space-x-2 shrink-0">
156
+ {participants.slice(0, 4).map((p) => (
157
+ <ProfileAvatar
158
+ key={p.id}
159
+ profile={p}
160
+ className="size-9 border-0"
161
+ />
162
+ ))}
163
+ </View>
164
+ <ThemedText
165
+ className="min-w-0 truncate text-sm font-medium"
166
+ numberOfLines={1}
167
+ >
168
+ {participantNames}
169
+ </ThemedText>
170
+ </TouchableOpacity>
171
+ ) : null}
172
+ </View>
173
+
128
174
  <DropdownMenu>
129
175
  <KeyboardAvoidingView
130
176
  className="flex-1"
@@ -143,7 +189,7 @@ export const ConversationShow = ({ route, navigation }: ConversationProps) => {
143
189
  <MessageInThread
144
190
  previous={messages[idx - 1]}
145
191
  message={message}
146
- multipleParticipants={isGroupChat}
192
+ multipleParticipants={multipleParticipants}
147
193
  conversationRootId={id}
148
194
  />
149
195
  </View>
@@ -202,11 +248,11 @@ export const ConversationShow = ({ route, navigation }: ConversationProps) => {
202
248
  </View>
203
249
  </KeyboardAvoidingView>
204
250
  </DropdownMenu>
205
- {isGroupChat && participantsOpen ? (
251
+ {multipleParticipants && participantsOpen ? (
206
252
  <ConversationParticipantsModal
207
253
  open
208
254
  onOpenChange={setParticipantsOpen}
209
- participants={audience}
255
+ participants={participants}
210
256
  />
211
257
  ) : null}
212
258
  </View>
@@ -48,11 +48,7 @@ export const OpenPeepsThemeProvider = ({
48
48
  buttonRadius: resolvedTheme.buttonRadius,
49
49
  radius: resolvedTheme.radius,
50
50
  }),
51
- [
52
- resolvedTheme.buttonRadius,
53
- resolvedTheme.radius,
54
- theme.colors,
55
- ]
51
+ [resolvedTheme.buttonRadius, resolvedTheme.radius, theme.colors]
56
52
  );
57
53
 
58
54
  useEffect(() => {
@@ -1,4 +1,4 @@
1
- import { OpenPeepsTheme, ColorName, ColorValue } from './types';
1
+ import type { OpenPeepsTheme, ColorName, ColorValue } from './types';
2
2
 
3
3
  export const DEFAULT_COLORS: ColorValue[] = [
4
4
  {
@@ -8,7 +8,7 @@ export const DEFAULT_COLORS: ColorValue[] = [
8
8
  },
9
9
  {
10
10
  name: 'foreground',
11
- light: '#0a0a0f',
11
+ light: '#0a0a0b',
12
12
  dark: '#fafafa',
13
13
  },
14
14
  {
@@ -18,7 +18,7 @@ export const DEFAULT_COLORS: ColorValue[] = [
18
18
  },
19
19
  {
20
20
  name: 'card-foreground',
21
- light: '#0a0a0f',
21
+ light: '#0a0a0b',
22
22
  dark: '#fafafa',
23
23
  },
24
24
  {
@@ -28,7 +28,7 @@ export const DEFAULT_COLORS: ColorValue[] = [
28
28
  },
29
29
  {
30
30
  name: 'popover-foreground',
31
- light: '#0a0a0f',
31
+ light: '#0a0a0b',
32
32
  dark: '#fafafa',
33
33
  },
34
34
  {
@@ -43,7 +43,7 @@ export const DEFAULT_COLORS: ColorValue[] = [
43
43
  },
44
44
  {
45
45
  name: 'secondary',
46
- light: '#f4f4f6',
46
+ light: '#f4f4f5',
47
47
  dark: '#28282e',
48
48
  },
49
49
  {
@@ -54,7 +54,7 @@ export const DEFAULT_COLORS: ColorValue[] = [
54
54
  {
55
55
  name: 'muted',
56
56
  light: '#f4f4f6',
57
- dark: '#28282e',
57
+ dark: '#27272a',
58
58
  },
59
59
  {
60
60
  name: 'muted-foreground',
@@ -63,7 +63,7 @@ export const DEFAULT_COLORS: ColorValue[] = [
63
63
  },
64
64
  {
65
65
  name: 'accent',
66
- light: '#f4f4f6',
66
+ light: '#f4f4f5',
67
67
  dark: '#28282e',
68
68
  },
69
69
  {
@@ -2,13 +2,29 @@ import { vars } from 'nativewind';
2
2
  import { mapColors } from './defaults';
3
3
  import type { OpenPeepsTheme } from './types';
4
4
 
5
+ /** Convert a hex color (#rrggbb) to "R G B" channel string for CSS `rgb()` usage. */
6
+ const hexToRgbChannels = (hex: string): string => {
7
+ const sanitized = hex.replaceAll('##', '#');
8
+ const m = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(sanitized);
9
+ if (!m) return hex;
10
+ const [, r, g, b] = m;
11
+ if (r === undefined || g === undefined || b === undefined) return hex;
12
+ return `${parseInt(r, 16)} ${parseInt(g, 16)} ${parseInt(b, 16)}`;
13
+ };
14
+
5
15
  export const getThemeVars = (
6
16
  colors: OpenPeepsTheme['colors'],
7
17
  radii?: { buttonRadius?: string; radius?: string }
8
18
  ) =>
9
19
  vars({
20
+ // CSS custom properties consumed by Tailwind `channel()` classes need
21
+ // "R G B" channel format so `rgb(var(--x) / <alpha-value>)` resolves.
22
+ // The `colors` object keeps hex strings for direct RN style usage.
10
23
  ...Object.fromEntries(
11
- Object.entries(colors).map(([key, value]) => [`--${key}`, value])
24
+ Object.entries(colors).map(([key, value]) => [
25
+ `--${key}`,
26
+ hexToRgbChannels(value),
27
+ ])
12
28
  ),
13
29
  '--theme-rounded-base': radii?.buttonRadius || '9999px',
14
30
  '--theme-rounded-container': radii?.radius || '0.5rem',
@@ -1,5 +1,10 @@
1
1
  const { hairlineWidth } = require('nativewind/theme');
2
2
 
3
+ /** `channel()` pattern: `rgb(var(--name) / <alpha-value>)` so `/N` opacity
4
+ * modifiers (e.g. `bg-primary/10`) work on native. Requires CSS variables to
5
+ * be in "R G B" channel format (see global.css / theme/utils.ts). */
6
+ const channel = (name) => `rgb(var(${name}) / <alpha-value>)`;
7
+
3
8
  export default {
4
9
  // NOTE: Update this to include the paths to all of your component files.
5
10
  darkMode: 'class',
@@ -9,40 +14,51 @@ export default {
9
14
  theme: {
10
15
  extend: {
11
16
  colors: {
12
- border: 'var(--border)',
13
- input: 'var(--input)',
14
- ring: 'var(--ring)',
15
- background: 'var(--background)',
16
- foreground: 'var(--foreground)',
17
- primary: {
18
- DEFAULT: 'var(--primary)',
19
- foreground: 'var(--primary-foreground)',
17
+ 'border': channel('--border'),
18
+ 'input': channel('--input'),
19
+ 'ring': channel('--ring'),
20
+ 'background': channel('--background'),
21
+ 'foreground': channel('--foreground'),
22
+ 'primary': {
23
+ DEFAULT: channel('--primary'),
24
+ foreground: channel('--primary-foreground'),
25
+ },
26
+ 'secondary': {
27
+ DEFAULT: channel('--secondary'),
28
+ foreground: channel('--secondary-foreground'),
20
29
  },
21
- secondary: {
22
- DEFAULT: 'var(--secondary)',
23
- foreground: 'var(--secondary-foreground)',
30
+ 'destructive': {
31
+ DEFAULT: channel('--destructive'),
32
+ foreground: channel('--destructive-foreground'),
24
33
  },
25
- destructive: {
26
- DEFAULT: 'var(--destructive)',
27
- foreground: 'var(--destructive-foreground)',
34
+ 'muted': {
35
+ DEFAULT: channel('--muted'),
36
+ foreground: channel('--muted-foreground'),
28
37
  },
29
- muted: {
30
- DEFAULT: 'var(--muted)',
31
- foreground: 'var(--muted-foreground)',
38
+ 'accent': {
39
+ DEFAULT: channel('--accent'),
40
+ foreground: channel('--accent-foreground'),
32
41
  },
33
- accent: {
34
- DEFAULT: 'var(--accent)',
35
- foreground: 'var(--accent-foreground)',
42
+ 'popover': {
43
+ DEFAULT: channel('--popover'),
44
+ foreground: channel('--popover-foreground'),
36
45
  },
37
- popover: {
38
- DEFAULT: 'var(--popover)',
39
- foreground: 'var(--popover-foreground)',
46
+ 'card': {
47
+ DEFAULT: channel('--card'),
48
+ foreground: channel('--card-foreground'),
40
49
  },
41
- card: {
42
- DEFAULT: 'var(--card)',
43
- foreground: 'var(--card-foreground)',
50
+ // `surface` mirrors `muted` (same token on the web preset).
51
+ 'surface': {
52
+ DEFAULT: channel('--muted'),
53
+ foreground: channel('--muted-foreground'),
44
54
  },
45
- alpha: 'var(--alpha)',
55
+ 'surface-2': channel('--surface-2'),
56
+ 'alpha': channel('--alpha'),
57
+ },
58
+ // Override Tailwind's default `borderColor.DEFAULT` so bare `border`/`border-b`
59
+ // utilities follow the theme border color instead of a static gray.
60
+ borderColor: {
61
+ DEFAULT: channel('--border'),
46
62
  },
47
63
  borderWidth: {
48
64
  hairline: hairlineWidth(),
@@ -53,7 +69,53 @@ export default {
53
69
  md: 'calc(var(--theme-rounded-container, 0.5rem) - 2px)',
54
70
  sm: 'calc(var(--theme-rounded-container, 0.5rem) - 4px)',
55
71
  },
72
+ fontFamily: {
73
+ sans: 'var(--theme-font-family-base, system-ui)',
74
+ heading: 'var(--theme-font-family-heading, system-ui)',
75
+ },
76
+ keyframes: {
77
+ 'accordion-down': {
78
+ from: { height: '0' },
79
+ to: { height: 'var(--radix-accordion-content-height)' },
80
+ },
81
+ 'accordion-up': {
82
+ from: { height: 'var(--radix-accordion-content-height)' },
83
+ to: { height: '0' },
84
+ },
85
+ 'spin': {
86
+ to: { transform: 'rotate(360deg)' },
87
+ },
88
+ },
89
+ animation: {
90
+ 'accordion-down': 'accordion-down 0.2s ease-out',
91
+ 'accordion-up': 'accordion-up 0.2s ease-out',
92
+ 'spin': 'spin 1s linear infinite',
93
+ },
94
+ spacing: {
95
+ 70: '17.5rem',
96
+ 128: '32rem',
97
+ },
56
98
  },
57
99
  },
58
- plugins: [require('tailwindcss-animate')],
100
+ plugins: [
101
+ // Constrain iframes rendered inside markdown prose so they can't
102
+ // break through scroll/overflow boundaries (Safari doesn't clip iframes
103
+ // via overflow:hidden alone).
104
+ function ({ addComponents }) {
105
+ addComponents({
106
+ '.allpeep-markdown iframe': {
107
+ maxWidth: '100% !important',
108
+ width: '100% !important',
109
+ border: '0',
110
+ display: 'block',
111
+ },
112
+ '.allpeep-markdown iframe[style]': {
113
+ // Override inline styles set by markdown source so iframes
114
+ // can never exceed the container bounds.
115
+ maxWidth: '100% !important',
116
+ width: '100% !important',
117
+ },
118
+ });
119
+ },
120
+ ],
59
121
  };