@openpeepshq/rn-components 0.7.2 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/README.md +1 -1
  2. package/package.json +12 -7
  3. package/src/components/custom/navigation/side-menu.tsx +59 -11
  4. package/src/components/icons/iconWithClassName.tsx +21 -0
  5. package/src/components/jams/JamActionsFooter.tsx +8 -2
  6. package/src/components/jams/JamCapacityGate.tsx +1 -1
  7. package/src/components/jams/JamCard.tsx +8 -4
  8. package/src/components/jams/JamConference.tsx +6 -1
  9. package/src/components/jams/JamParticipantConference.tsx +2 -0
  10. package/src/components/jams/JamRoom.tsx +2 -3
  11. package/src/components/jams/LiveJamsSection.tsx +12 -1
  12. package/src/components/jams/LivekitUnavailableNotice.tsx +25 -0
  13. package/src/components/jams/index.ts +1 -0
  14. package/src/components/markdown/MarkdownOverlay.tsx +75 -0
  15. package/src/components/markdown/OpenpeepsMarkdown.tsx +3 -1
  16. package/src/components/markdown/extensions/link.tsx +34 -0
  17. package/src/components/markdown/index.ts +2 -0
  18. package/src/components/navigation/tab-navigator.tsx +39 -17
  19. package/src/components/notifications/NotificationItem.tsx +27 -2
  20. package/src/components/notifications/types/JamStarted.tsx +13 -3
  21. package/src/components/notifications/types/Reply.tsx +1 -5
  22. package/src/components/notifications/types/WaitlistOffer.tsx +61 -0
  23. package/src/components/notifications/types/index.ts +1 -0
  24. package/src/components/post/CompactReplyParent.tsx +16 -15
  25. package/src/components/post/TruncatedMarkdown.tsx +60 -0
  26. package/src/components/post/helpers.ts +2 -2
  27. package/src/components/post/index.ts +2 -0
  28. package/src/components/post/pieces/EventRsvpButton.tsx +99 -5
  29. package/src/components/post/pieces/EventRsvpList.tsx +46 -0
  30. package/src/components/post/pieces/EventRsvpScopeDialog.tsx +30 -19
  31. package/src/components/post/pieces/EventWaitlistJoinDialog.tsx +62 -0
  32. package/src/components/post/pieces/PollContent.tsx +7 -7
  33. package/src/components/post/pieces/PostActions.tsx +89 -23
  34. package/src/components/post/pieces/ShareMenu.tsx +2 -2
  35. package/src/components/post/post-form/DescriptionEditModal.tsx +1 -0
  36. package/src/components/post/post-form/EventForm.tsx +50 -10
  37. package/src/components/post/post-form/ResourceForm.tsx +115 -5
  38. package/src/components/post/types/Article.tsx +6 -2
  39. package/src/components/post/types/Poll.tsx +4 -1
  40. package/src/components/post/types/event/CardEvent.tsx +101 -76
  41. package/src/components/post/types/event/FullEvent.tsx +60 -23
  42. package/src/components/post/types/event/ProfileEventRelationship.tsx +2 -0
  43. package/src/components/post/types/resource/FullResource.tsx +9 -1
  44. package/src/components/preview-link/LocalPreviewLink.tsx +4 -1
  45. package/src/components/preview-link/helpers.ts +5 -1
  46. package/src/components/preview-link/index.ts +1 -0
  47. package/src/components/preview-link/local/WelcomePreview.tsx +59 -0
  48. package/src/components/profile/Avatar.tsx +0 -1
  49. package/src/components/profile/EditProfileForm.tsx +23 -2
  50. package/src/components/profile/ProfileSheet.tsx +1 -1
  51. package/src/components/resources/ResourceCard.tsx +62 -14
  52. package/src/components/resources/ResourceLibrary.tsx +2 -2
  53. package/src/components/ui/badge.tsx +2 -3
  54. package/src/components/ui/bottom-sheet.tsx +0 -6
  55. package/src/components/ui/popup-menu-button.tsx +2 -2
  56. package/src/components/ui/popup-menu-separator.tsx +1 -1
  57. package/src/components/ui/popup-menu.tsx +2 -2
  58. package/src/lib/utils.ts +10 -3
  59. package/src/pages/auth/Register.tsx +34 -4
  60. package/src/pages/conversations/Show.tsx +38 -7
  61. package/src/pages/feeds/Bookmarks.tsx +1 -1
  62. package/src/pages/jams/Index.tsx +6 -4
  63. package/src/pages/posts/New.tsx +1 -1
  64. package/src/pages/resources/Edit.tsx +2 -1
  65. package/src/pages/resources/New.tsx +6 -1
  66. package/src/pages/settings/Account.tsx +46 -2
  67. package/src/pages/settings/Index.tsx +3 -4
  68. package/src/pages/settings/NotificationPreferences.tsx +3 -3
  69. package/src/pages/settings/Theme.tsx +1 -1
  70. 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.7.2",
3
+ "version": "0.8.0",
4
4
  "description": "React Native community screens and shared UI (extracted from the Black Ambition app) for the OpenPeeps stack.",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./src/index.ts",
@@ -142,8 +142,8 @@
142
142
  "timezones-list": "^3.1.0",
143
143
  "validator": "^13.15.23",
144
144
  "zustand": "^5.0.3",
145
- "@openpeepshq/common": "^0.4.0",
146
- "@openpeepshq/react": "^0.7.0"
145
+ "@openpeepshq/react": "^0.8.0",
146
+ "@openpeepshq/common": "^0.4.0"
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": "^8.57.1",
175
- "eslint-config-prettier": "^9.0.0",
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": "~5.8.3"
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
  }
@@ -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
- <Button
131
- variant={'outline'}
132
- size={'icon'}
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
- </Button>
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
- <Button
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
- </Button>
241
+ </SideMenuNavButton>
195
242
  );
196
243
  })}
197
- <Button
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
- </Button>
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 { data: jamState } = openpeepsApi.useJamState(jamPost.id);
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 date={jamEvent?.start} />
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?.slice(0, 2).map((moderator, index) => (
52
- <ParticipantAvatar key={index} profileId={moderator} />
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 { JamEventsProvider, useJamObserver } from '@openpeepshq/react';
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
- <ThemedText className="text-center">
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
+ };
@@ -26,3 +26,4 @@ export * from './JamVideoCall';
26
26
  export * from './JamVideoLayout';
27
27
  export * from './LeaveCloseButton';
28
28
  export * from './LiveJamsSection';
29
+ export * from './LivekitUnavailableNotice';
@@ -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
+ };
@@ -20,13 +20,14 @@ import { mentionPlugin, mentionRenderer } from './extensions/mention';
20
20
  import { codeBlockRenderer, fenceRenderer } from './extensions/codeBlock';
21
21
  import { codeInlineRenderer } from './extensions/codeInline';
22
22
  import { htmlBlockRenderer, htmlInlineRenderer } from './extensions/html';
23
+ import { linkRenderer } from './extensions/link';
23
24
  import { markdownTheme } from './theme';
24
25
  import { extractLinks, isEmail, isInternalLink, toGotoUrl } from './utils';
25
26
  import { PreviewLink } from '../preview-link';
26
27
  import { useOpenPeepsTheme } from '../../theme/OpenPeepsThemeProvider';
27
28
  import { recordOutboundClick } from '@openpeepshq/react';
28
29
 
29
- export interface OpenpeepsMarkdownProps extends MarkdownRenderProps {}
30
+ export type OpenpeepsMarkdownProps = MarkdownRenderProps;
30
31
 
31
32
  export const OpenpeepsMarkdown = ({
32
33
  source,
@@ -113,6 +114,7 @@ export const OpenpeepsMarkdown = ({
113
114
  code_inline: codeInlineRenderer(colors),
114
115
  html_block: htmlBlockRenderer(handleIframePress),
115
116
  html_inline: htmlInlineRenderer(handleIframePress),
117
+ link: linkRenderer(handleLinkPress),
116
118
  }}
117
119
  >
118
120
  {ast as unknown as ReactNode[]}
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import { type RenderFunction } from 'react-native-markdown-display';
3
+ import { isExternalLink } from '@openpeepshq/common/lib';
4
+ import { ThemedText } from '../../ui/themed-text';
5
+ import { BASE_URL } from '../../../lib/constants';
6
+
7
+ /**
8
+ * Custom link renderer that appends a Unicode external-link indicator
9
+ * (↗) after links pointing outside the instance.
10
+ */
11
+ export const linkRenderer =
12
+ (handleLinkPress: (url: string) => void): RenderFunction =>
13
+ (node, children, _parentNodes, styles) => {
14
+ const href = (node as { url?: string }).url || '';
15
+ const origin = BASE_URL as string;
16
+ const isExternal = isExternalLink(href, origin);
17
+
18
+ const rec =
19
+ styles && typeof styles === 'object'
20
+ ? (styles as Record<string, object>)
21
+ : {};
22
+ const linkStyle: object = 'link' in rec && rec.link ? rec.link : {};
23
+
24
+ return (
25
+ <ThemedText
26
+ key={node.key}
27
+ style={[linkStyle, styles?.text]}
28
+ onPress={() => handleLinkPress(href)}
29
+ >
30
+ {children}
31
+ {isExternal ? ' ↗' : null}
32
+ </ThemedText>
33
+ );
34
+ };
@@ -1,2 +1,4 @@
1
1
  export * from './OpenpeepsMarkdown';
2
+ export { MarkdownOverlay } from './MarkdownOverlay';
3
+ export type { MarkdownOverlayProps } from './MarkdownOverlay';
2
4
  export type { MarkdownRenderProps } from '@openpeepshq/common/lib';
@@ -1,5 +1,7 @@
1
1
  import React from 'react';
2
+ import { PlatformPressable } from '@react-navigation/elements';
2
3
  import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
4
+ import { useTranslation } from 'react-i18next';
3
5
  import { TabStackParamList } from './types';
4
6
  import { TAB_ROUTES } from './types';
5
7
  import {
@@ -43,6 +45,16 @@ import { RootLayout } from '../layout';
43
45
 
44
46
  const Tab = createBottomTabNavigator<TabStackParamList>();
45
47
 
48
+ const tabTooltipKeys: Partial<Record<keyof TabStackParamList, string>> = {
49
+ [TAB_ROUTES.HOME]: 'community',
50
+ [TAB_ROUTES.FEED]: 'myFeed',
51
+ [TAB_ROUTES.NEW_POST]: 'newPost',
52
+ [TAB_ROUTES.GROUPS]: 'groups',
53
+ [TAB_ROUTES.NOTIFICATIONS]: 'notifications',
54
+ [TAB_ROUTES.ARTICLES]: 'articles',
55
+ [TAB_ROUTES.RESOURCES]: 'resources',
56
+ };
57
+
46
58
  const TabBarIcon = ({
47
59
  route,
48
60
  focused,
@@ -75,6 +87,7 @@ const TabBarIcon = ({
75
87
  };
76
88
 
77
89
  export const TabNavigator = () => {
90
+ const { t } = useTranslation();
78
91
  const { openpeepsApi } = useOpenpeeps();
79
92
  const {
80
93
  colors: { background },
@@ -97,23 +110,32 @@ export const TabNavigator = () => {
97
110
  return (
98
111
  <Tab.Navigator
99
112
  screenLayout={({ children }) => <RootLayout>{children}</RootLayout>}
100
- screenOptions={({ route }) => ({
101
- headerShown: false,
102
- tabBarShowLabel: false,
103
- tabBarIcon: ({ focused }) => TabBarIcon({ route, focused }),
104
- tabBarItemStyle: {
105
- display,
106
- },
107
- tabBarStyle: {
108
- backgroundColor: background,
109
- borderTopWidth: 0,
110
- height: 80,
111
- paddingBottom: 20,
112
- paddingTop: 10,
113
- elevation: 0,
114
- display,
115
- },
116
- })}
113
+ screenOptions={({ route }) => {
114
+ const tooltipKey = tabTooltipKeys[route.name];
115
+ const tabHint = tooltipKey
116
+ ? t(`navigation.tooltips.${tooltipKey}`)
117
+ : undefined;
118
+ return {
119
+ headerShown: false,
120
+ tabBarShowLabel: false,
121
+ tabBarIcon: ({ focused }) => TabBarIcon({ route, focused }),
122
+ tabBarButton: (props) => (
123
+ <PlatformPressable {...props} accessibilityHint={tabHint} />
124
+ ),
125
+ tabBarItemStyle: {
126
+ display,
127
+ },
128
+ tabBarStyle: {
129
+ backgroundColor: background,
130
+ borderTopWidth: 0,
131
+ height: 80,
132
+ paddingBottom: 20,
133
+ paddingTop: 10,
134
+ elevation: 0,
135
+ display,
136
+ },
137
+ };
138
+ }}
117
139
  initialRouteName={TAB_ROUTES.HOME}
118
140
  >
119
141
  <Tab.Screen name={TAB_ROUTES.HOME} component={FeedsLocal} />