@openpeepshq/rn-components 0.12.3 → 0.12.5
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 +3 -3
- package/src/components/CapabilityMatrix.tsx +44 -6
- package/src/components/conversations/ConversationMessageBubble.tsx +3 -6
- package/src/components/custom/common/popover.tsx +4 -1
- package/src/components/custom/modals/media/document-picker-sheet.tsx +10 -3
- package/src/components/custom/modals/media/image-picker-sheet.test.tsx +201 -0
- package/src/components/custom/modals/media/image-picker-sheet.tsx +27 -17
- package/src/components/custom/modals/media/send-media-sheet.tsx +4 -1
- package/src/components/groups/GroupMembersList.test.tsx +156 -0
- package/src/components/groups/GroupMembersList.tsx +4 -1
- package/src/components/jams/JamCallParticipant.tsx +6 -1
- package/src/components/jams/JamDesktopFooter.tsx +6 -1
- package/src/components/jams/JamFooter.tsx +6 -1
- package/src/components/jams/JamGuestForm.tsx +6 -1
- package/src/components/jams/JamObserverShell.tsx +4 -1
- package/src/components/jams/JamRoomIndicators.test.tsx +143 -0
- package/src/components/jams/JamRoomIndicators.tsx +15 -8
- package/src/components/jams/JamToolbarButton.tsx +7 -1
- package/src/components/post/feed/events/EventsCalendar.tsx +6 -2
- package/src/components/post/pieces/EventOccurrenceList.tsx +7 -2
- package/src/components/post/pieces/UnreadPostIndicator.tsx +4 -4
- package/src/components/post/post-form/ComposeAttachments.tsx +6 -2
- package/src/components/post/post-form/ResourceForm.tsx +16 -16
- package/src/components/post/post-form/VisibilitySheet.tsx +3 -1
- package/src/components/post/types/event/FullEvent.test.tsx +136 -15
- package/src/components/post/types/event/FullEvent.tsx +21 -5
- package/src/components/profile/ProfileSelector.test.tsx +115 -0
- package/src/components/profile/ProfileSelector.tsx +2 -2
- package/src/components/profile/ReportProfileOrPostModal.tsx +4 -1
- package/src/components/resources/CategoryPathPicker.tsx +117 -0
- package/src/components/resources/ResourceCard.test.tsx +12 -0
- package/src/components/resources/ResourceCard.tsx +8 -3
- package/src/components/resources/ResourceLibrary.test.tsx +334 -0
- package/src/components/resources/ResourceLibrary.tsx +5 -5
- package/src/components/resources/index.ts +2 -0
- package/src/pages/Welcome.tsx +4 -1
- package/src/theme/OpenPeepsThemeProvider.tsx +6 -5
- package/src/theme/color.ts +29 -0
- package/src/theme/useThemeOpacity.ts +30 -0
- package/src/theme/utils.ts +11 -22
|
@@ -32,6 +32,7 @@ import { Input } from '../ui/input';
|
|
|
32
32
|
import { ThemedText } from '../ui/themed-text';
|
|
33
33
|
import { ChangeGroupRolesModal } from './ChangeGroupRolesModal';
|
|
34
34
|
import { ConfirmMemberRemovalModal } from './ConfirmMemberRemovalModal';
|
|
35
|
+
import { useThemeOpacity } from '../../theme/useThemeOpacity';
|
|
35
36
|
|
|
36
37
|
export interface GroupMembersListProps {
|
|
37
38
|
group: GroupWithMeta;
|
|
@@ -44,6 +45,7 @@ type ActiveModal =
|
|
|
44
45
|
|
|
45
46
|
export const GroupMembersList = ({ group }: GroupMembersListProps) => {
|
|
46
47
|
const { t } = useTranslation();
|
|
48
|
+
const { background } = useThemeOpacity();
|
|
47
49
|
const me = useCurrentProfile();
|
|
48
50
|
const { openpeepsApi } = useOpenpeeps();
|
|
49
51
|
const navigation =
|
|
@@ -100,7 +102,8 @@ export const GroupMembersList = ({ group }: GroupMembersListProps) => {
|
|
|
100
102
|
{member.roles.map((role) => (
|
|
101
103
|
<View
|
|
102
104
|
key={role}
|
|
103
|
-
|
|
105
|
+
style={background('primary', 0.1)}
|
|
106
|
+
className="rounded px-1.5 py-0.5"
|
|
104
107
|
>
|
|
105
108
|
<ThemedText className="text-xs uppercase text-primary">
|
|
106
109
|
{t(`groups.roles.${role}`, { defaultValue: role })}
|
|
@@ -40,6 +40,7 @@ import { cn } from '../../lib/utils';
|
|
|
40
40
|
import { ProfileAvatar } from '../profile/Avatar';
|
|
41
41
|
import { JamAnimatedEmoji } from './JamAnimatedEmoji';
|
|
42
42
|
import { useConnectionLost } from './useParticipantConnection';
|
|
43
|
+
import { useThemeOpacity } from '../../theme/useThemeOpacity';
|
|
43
44
|
|
|
44
45
|
export interface JamCallParticipantProps {
|
|
45
46
|
/** Camera track reference (or placeholder when the camera is off). */
|
|
@@ -166,6 +167,7 @@ const JamParticipantOverlay = ({
|
|
|
166
167
|
onToggleSpotlight?: () => void;
|
|
167
168
|
}) => {
|
|
168
169
|
const { t } = useTranslation();
|
|
170
|
+
const { background } = useThemeOpacity();
|
|
169
171
|
const participant = trackRef.participant;
|
|
170
172
|
const room = useRoomContext();
|
|
171
173
|
const me = useCurrentProfile();
|
|
@@ -217,7 +219,10 @@ const JamParticipantOverlay = ({
|
|
|
217
219
|
<View className="w-full flex-row items-start justify-between">
|
|
218
220
|
<View className="flex-row items-center gap-1">
|
|
219
221
|
{handUp ? (
|
|
220
|
-
<View
|
|
222
|
+
<View
|
|
223
|
+
style={background('background', 0.7)}
|
|
224
|
+
className="rounded-full p-2"
|
|
225
|
+
>
|
|
221
226
|
<HandIcon size={iconSize} className="text-foreground" />
|
|
222
227
|
</View>
|
|
223
228
|
) : null}
|
|
@@ -23,6 +23,7 @@ import { LeaveCloseButton } from './LeaveCloseButton';
|
|
|
23
23
|
import { type JamFooterProps } from './JamFooter';
|
|
24
24
|
import { useFooterControls } from './JamFooter';
|
|
25
25
|
import { ThemedText } from '../ui/themed-text';
|
|
26
|
+
import { useThemeOpacity } from '../../theme/useThemeOpacity';
|
|
26
27
|
|
|
27
28
|
export type JamDesktopFooterProps = JamFooterProps;
|
|
28
29
|
|
|
@@ -46,6 +47,7 @@ export const JamDesktopFooter = ({
|
|
|
46
47
|
onToggleSpeaker,
|
|
47
48
|
}: JamDesktopFooterProps) => {
|
|
48
49
|
const { t } = useTranslation();
|
|
50
|
+
const { background } = useThemeOpacity();
|
|
49
51
|
const { jamEvent } = useJamContext();
|
|
50
52
|
const {
|
|
51
53
|
isModerator,
|
|
@@ -63,7 +65,10 @@ export const JamDesktopFooter = ({
|
|
|
63
65
|
const [reactionMenuOpen, setReactionMenuOpen] = useState(false);
|
|
64
66
|
|
|
65
67
|
return (
|
|
66
|
-
<View
|
|
68
|
+
<View
|
|
69
|
+
style={background('background', 0.75)}
|
|
70
|
+
className="w-full flex-none flex-row items-center justify-between px-4 py-3"
|
|
71
|
+
>
|
|
67
72
|
<ThemedText className="truncate pr-2">
|
|
68
73
|
{truncateText(jamEvent.name, 40)}
|
|
69
74
|
</ThemedText>
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
import { JamReactionMenu } from './JamReactionMenu';
|
|
25
25
|
import { JamToolbarButton, toneIconClass } from './JamToolbarButton';
|
|
26
26
|
import { LeaveCloseButton } from './LeaveCloseButton';
|
|
27
|
+
import { useThemeOpacity } from '../../theme/useThemeOpacity';
|
|
27
28
|
|
|
28
29
|
export interface JamFooterProps {
|
|
29
30
|
chatOpen: boolean;
|
|
@@ -171,6 +172,7 @@ export const JamFooter = ({
|
|
|
171
172
|
onToggleSpeaker,
|
|
172
173
|
}: JamFooterProps) => {
|
|
173
174
|
const { t } = useTranslation();
|
|
175
|
+
const { background } = useThemeOpacity();
|
|
174
176
|
const {
|
|
175
177
|
isModerator,
|
|
176
178
|
isRecording,
|
|
@@ -187,7 +189,10 @@ export const JamFooter = ({
|
|
|
187
189
|
const reactionTone = reactionMenuOpen ? 'active' : 'default';
|
|
188
190
|
|
|
189
191
|
return (
|
|
190
|
-
<View
|
|
192
|
+
<View
|
|
193
|
+
style={background('background', 0.75)}
|
|
194
|
+
className="relative w-full flex-row items-center justify-between gap-x-2 px-2 py-3"
|
|
195
|
+
>
|
|
191
196
|
{reactionMenuOpen ? (
|
|
192
197
|
<View className="absolute bottom-20 left-[5%] right-[5%] z-50 rounded-md p-2">
|
|
193
198
|
<JamReactionMenu
|
|
@@ -9,9 +9,11 @@ import { Input } from '../ui/input';
|
|
|
9
9
|
import { Label } from '../ui/label';
|
|
10
10
|
import { ThemedText } from '../ui/themed-text';
|
|
11
11
|
import { BASE_URL } from '../../lib/constants';
|
|
12
|
+
import { useThemeOpacity } from '../../theme/useThemeOpacity';
|
|
12
13
|
|
|
13
14
|
export const JamGuestForm = () => {
|
|
14
15
|
const { t } = useTranslation();
|
|
16
|
+
const { border } = useThemeOpacity();
|
|
15
17
|
const serverInfo = useServerInfo();
|
|
16
18
|
const { jamPost, jamEvent } = useJamContext();
|
|
17
19
|
const { openpeepsApi } = useOpenpeeps();
|
|
@@ -94,7 +96,10 @@ export const JamGuestForm = () => {
|
|
|
94
96
|
</ThemedText>
|
|
95
97
|
|
|
96
98
|
{error ? (
|
|
97
|
-
<ThemedText
|
|
99
|
+
<ThemedText
|
|
100
|
+
style={border('destructive', 0.4)}
|
|
101
|
+
className="rounded-md border p-2 text-sm text-destructive"
|
|
102
|
+
>
|
|
98
103
|
{error}
|
|
99
104
|
</ThemedText>
|
|
100
105
|
) : null}
|
|
@@ -4,6 +4,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
4
4
|
import { MessageSquareIcon } from '../icons/index';
|
|
5
5
|
import { cn } from '../../lib/utils';
|
|
6
6
|
import { JamChatDrawer } from './JamChatDrawer';
|
|
7
|
+
import { useThemeOpacity } from '../../theme/useThemeOpacity';
|
|
7
8
|
|
|
8
9
|
export interface JamObserverShellProps {
|
|
9
10
|
children: ReactNode;
|
|
@@ -12,6 +13,7 @@ export interface JamObserverShellProps {
|
|
|
12
13
|
/** Observer layout wrapper with read-only persisted chat drawer. */
|
|
13
14
|
export const JamObserverShell = ({ children }: JamObserverShellProps) => {
|
|
14
15
|
const { t } = useTranslation();
|
|
16
|
+
const { background } = useThemeOpacity();
|
|
15
17
|
const [chatOpen, setChatOpen] = useState(false);
|
|
16
18
|
|
|
17
19
|
return (
|
|
@@ -22,9 +24,10 @@ export const JamObserverShell = ({ children }: JamObserverShellProps) => {
|
|
|
22
24
|
accessibilityLabel={t('jams.drawer.chatTitle')}
|
|
23
25
|
accessibilityRole="button"
|
|
24
26
|
onPress={() => setChatOpen((open) => !open)}
|
|
27
|
+
style={chatOpen ? background('primary', 0.15) : undefined}
|
|
25
28
|
className={cn(
|
|
26
29
|
'size-10 items-center justify-center rounded-full',
|
|
27
|
-
chatOpen
|
|
30
|
+
!chatOpen && 'bg-card'
|
|
28
31
|
)}
|
|
29
32
|
>
|
|
30
33
|
<MessageSquareIcon
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Regression test for the "poor connection" banner rendering as raw,
|
|
3
|
+
* transparent text over the jam video grid (issue #1814).
|
|
4
|
+
*
|
|
5
|
+
* Root cause: the banner background was the NativeWind class `bg-accent/90`.
|
|
6
|
+
* NativeWind v4 cannot apply a `/N` opacity modifier to a CSS-variable color
|
|
7
|
+
* (`--accent`), so the class produced *no* background at all. The fix applies
|
|
8
|
+
* the background through `useThemeOpacity`, which builds an inline rgba from
|
|
9
|
+
* the real theme color.
|
|
10
|
+
*
|
|
11
|
+
* Only the React Native surface (and livekit/i18n) is stubbed. The theme hook
|
|
12
|
+
* and the color math (`theme/useThemeOpacity` -> `theme/color`) run as real
|
|
13
|
+
* code, fed by the real `DEFAULT_COLORS` through a mocked
|
|
14
|
+
* `useOpenPeepsTheme`, so a regression in `hexWithOpacity` or in the accent
|
|
15
|
+
* hex values would be caught here. The expected rgba strings are pinned
|
|
16
|
+
* literals, which also pins the 6-digit-hex format the helpers require.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const React = require('react');
|
|
20
|
+
const ReactTestRenderer = require('react-test-renderer');
|
|
21
|
+
|
|
22
|
+
const { mapColors } = require('../../theme/defaults');
|
|
23
|
+
|
|
24
|
+
const mockViewProps: Array<{ style?: unknown; className?: string }> = [];
|
|
25
|
+
let mockQuality = 1; // livekit-client ConnectionQuality.Good
|
|
26
|
+
let mockIsDark = false;
|
|
27
|
+
|
|
28
|
+
jest.mock('react-native', () => {
|
|
29
|
+
const View = (props: {
|
|
30
|
+
style?: unknown;
|
|
31
|
+
className?: string;
|
|
32
|
+
children?: unknown;
|
|
33
|
+
}) => {
|
|
34
|
+
mockViewProps.push({ style: props.style, className: props.className });
|
|
35
|
+
return React.createElement('View', null, props.children);
|
|
36
|
+
};
|
|
37
|
+
const Text = (props: { children?: unknown }) =>
|
|
38
|
+
React.createElement('Text', null, props.children);
|
|
39
|
+
const Pressable = (props: { children?: unknown }) =>
|
|
40
|
+
React.createElement('Pressable', null, props.children);
|
|
41
|
+
return { View, Text, Pressable };
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
jest.mock('@livekit/react-native', () => ({
|
|
45
|
+
useLocalParticipant: () => ({ localParticipant: {} }),
|
|
46
|
+
}));
|
|
47
|
+
|
|
48
|
+
jest.mock('livekit-client', () => ({
|
|
49
|
+
ConnectionQuality: { Good: 1, Poor: 2, Lost: 3 },
|
|
50
|
+
}));
|
|
51
|
+
|
|
52
|
+
jest.mock('react-i18next', () => ({
|
|
53
|
+
useTranslation: () => ({
|
|
54
|
+
t: (key: string, opts?: Record<string, unknown>) =>
|
|
55
|
+
key.replace(/\{\{(\w+)\}\}/g, (_m: string, n: string) =>
|
|
56
|
+
String(opts?.[n] ?? '')
|
|
57
|
+
),
|
|
58
|
+
}),
|
|
59
|
+
}));
|
|
60
|
+
|
|
61
|
+
jest.mock('@openpeepshq/react', () => ({
|
|
62
|
+
useJamRecordingState: () => ({ isRecording: false }),
|
|
63
|
+
useJamRecordingElapsed: () => null,
|
|
64
|
+
}));
|
|
65
|
+
|
|
66
|
+
jest.mock('../icons/index', () => ({
|
|
67
|
+
CircleIcon: () => React.createElement('CircleIcon'),
|
|
68
|
+
XIcon: () => React.createElement('XIcon'),
|
|
69
|
+
}));
|
|
70
|
+
|
|
71
|
+
jest.mock('../ui/themed-text', () => ({
|
|
72
|
+
ThemedText: (props: { children?: unknown; className?: string }) =>
|
|
73
|
+
React.createElement(
|
|
74
|
+
'ThemedText',
|
|
75
|
+
{ className: props.className },
|
|
76
|
+
props.children
|
|
77
|
+
),
|
|
78
|
+
}));
|
|
79
|
+
|
|
80
|
+
// Real theme defaults (nativewind-free), so the assertions below are checked
|
|
81
|
+
// against the hex values the app actually ships.
|
|
82
|
+
jest.mock('../../theme/OpenPeepsThemeProvider', () => ({
|
|
83
|
+
useOpenPeepsTheme: () => ({
|
|
84
|
+
isDark: mockIsDark,
|
|
85
|
+
colors: mapColors(mockIsDark),
|
|
86
|
+
buttonRadius: '9999px',
|
|
87
|
+
refresh: () => {},
|
|
88
|
+
}),
|
|
89
|
+
}));
|
|
90
|
+
|
|
91
|
+
jest.mock('./useParticipantConnection', () => ({
|
|
92
|
+
useConnectionQuality: () => mockQuality,
|
|
93
|
+
}));
|
|
94
|
+
|
|
95
|
+
const { JamNetworkQuality } = require('./JamRoomIndicators');
|
|
96
|
+
|
|
97
|
+
const renderQuality = (quality: number, isDark: boolean) => {
|
|
98
|
+
mockViewProps.length = 0;
|
|
99
|
+
mockQuality = quality;
|
|
100
|
+
mockIsDark = isDark;
|
|
101
|
+
let tree!: ReactTestRenderer.ReactTestRenderer;
|
|
102
|
+
ReactTestRenderer.act(() => {
|
|
103
|
+
tree = ReactTestRenderer.create(React.createElement(JamNetworkQuality));
|
|
104
|
+
});
|
|
105
|
+
return { tree, banner: mockViewProps[mockViewProps.length - 1] };
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
describe('JamNetworkQuality banner background', () => {
|
|
109
|
+
it('renders an opaque inline background (light theme) when the connection is poor', () => {
|
|
110
|
+
const { banner } = renderQuality(2, false); // ConnectionQuality.Poor
|
|
111
|
+
|
|
112
|
+
expect(banner).toBeDefined();
|
|
113
|
+
// The broken `bg-accent/90` class must be gone...
|
|
114
|
+
expect(banner!.className).not.toContain('bg-accent/90');
|
|
115
|
+
// ...and the background must be a real inline rgba value derived from the
|
|
116
|
+
// light accent color (#f4f4f5) at 0.9 opacity — not absent/transparent.
|
|
117
|
+
expect(banner!.style).toEqual({
|
|
118
|
+
backgroundColor: 'rgba(244, 244, 245, 0.9)',
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it('renders the dark accent when the dark theme is active', () => {
|
|
123
|
+
const { banner } = renderQuality(2, true);
|
|
124
|
+
expect(banner).toBeDefined();
|
|
125
|
+
// Dark accent is #28282e (distinct from the light accent above).
|
|
126
|
+
expect((banner!.style as { backgroundColor: string }).backgroundColor).toBe(
|
|
127
|
+
'rgba(40, 40, 46, 0.9)'
|
|
128
|
+
);
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it('also renders the opaque background when the connection is lost', () => {
|
|
132
|
+
const { banner } = renderQuality(3, false); // ConnectionQuality.Lost
|
|
133
|
+
expect(banner).toBeDefined();
|
|
134
|
+
expect((banner!.style as { backgroundColor: string }).backgroundColor).toBe(
|
|
135
|
+
'rgba(244, 244, 245, 0.9)'
|
|
136
|
+
);
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
it('renders nothing when the connection is good', () => {
|
|
140
|
+
renderQuality(1, false); // ConnectionQuality.Good
|
|
141
|
+
expect(mockViewProps).toHaveLength(0);
|
|
142
|
+
});
|
|
143
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { Pressable, View } from 'react-native';
|
|
2
|
+
import { Pressable, Text, View } from 'react-native';
|
|
3
3
|
import { useLocalParticipant } from '@livekit/react-native';
|
|
4
4
|
import { ConnectionQuality } from 'livekit-client';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
@@ -9,14 +9,13 @@ import {
|
|
|
9
9
|
} from '@openpeepshq/react';
|
|
10
10
|
import { CircleIcon, XIcon } from '../icons/index';
|
|
11
11
|
import { ThemedText } from '../ui/themed-text';
|
|
12
|
-
import {
|
|
13
|
-
import { hexWithOpacity } from '../../theme/utils';
|
|
12
|
+
import { useThemeOpacity } from '../../theme/useThemeOpacity';
|
|
14
13
|
import { useConnectionQuality } from './useParticipantConnection';
|
|
15
14
|
|
|
16
15
|
/** Red "recording" pill shown to every participant while egress is active. */
|
|
17
16
|
export const JamRecordingIndicator = () => {
|
|
18
17
|
const { t } = useTranslation();
|
|
19
|
-
const {
|
|
18
|
+
const { background } = useThemeOpacity();
|
|
20
19
|
const { isRecording } = useJamRecordingState();
|
|
21
20
|
const elapsed = useJamRecordingElapsed();
|
|
22
21
|
|
|
@@ -27,7 +26,7 @@ export const JamRecordingIndicator = () => {
|
|
|
27
26
|
return (
|
|
28
27
|
<View
|
|
29
28
|
pointerEvents="none"
|
|
30
|
-
style={
|
|
29
|
+
style={background('destructive', 0.9)}
|
|
31
30
|
className="absolute left-4 top-4 z-50 flex-row items-center gap-2 rounded-full px-3 py-1"
|
|
32
31
|
>
|
|
33
32
|
<CircleIcon
|
|
@@ -45,6 +44,7 @@ export const JamRecordingIndicator = () => {
|
|
|
45
44
|
/** Dismissable banner shown when the local connection quality degrades. */
|
|
46
45
|
export const JamNetworkQuality = () => {
|
|
47
46
|
const { t } = useTranslation();
|
|
47
|
+
const { background } = useThemeOpacity();
|
|
48
48
|
const { localParticipant } = useLocalParticipant();
|
|
49
49
|
const quality = useConnectionQuality(localParticipant);
|
|
50
50
|
const [dismissed, setDismissed] = useState(false);
|
|
@@ -55,11 +55,18 @@ export const JamNetworkQuality = () => {
|
|
|
55
55
|
if (!poor || dismissed) return null;
|
|
56
56
|
|
|
57
57
|
return (
|
|
58
|
-
|
|
58
|
+
// NativeWind v4 can't apply `/N` opacity to CSS-variable colors (e.g.
|
|
59
|
+
// `bg-accent/90`), so the banner background uses an inline rgba style.
|
|
60
|
+
<View
|
|
61
|
+
style={background('accent', 0.9)}
|
|
62
|
+
className="absolute left-4 right-4 top-4 z-50 flex-row items-center gap-3 rounded-lg px-4 py-2"
|
|
63
|
+
>
|
|
59
64
|
<ThemedText className="flex-1 text-sm text-accent-foreground">
|
|
60
|
-
|
|
65
|
+
{/* Raw `Text` (not `ThemedText`) for the bold status label: nesting
|
|
66
|
+
two themed texts would re-apply the base `text-base` defaults. */}
|
|
67
|
+
<Text className="font-medium">
|
|
61
68
|
{t('jams.network.connectionStatus')}
|
|
62
|
-
</
|
|
69
|
+
</Text>{' '}
|
|
63
70
|
{t('jams.network.connectionDetail', { quality })}
|
|
64
71
|
</ThemedText>
|
|
65
72
|
<Pressable
|
|
@@ -7,12 +7,15 @@ import {
|
|
|
7
7
|
DropdownMenuTrigger,
|
|
8
8
|
} from '../ui/dropdown-menu';
|
|
9
9
|
import { cn } from '../../lib/utils';
|
|
10
|
+
import { useThemeOpacity } from '../../theme/useThemeOpacity';
|
|
10
11
|
|
|
11
12
|
export type JamToolbarTone = 'default' | 'active' | 'danger';
|
|
12
13
|
|
|
13
14
|
const toneClasses: Record<JamToolbarTone, string> = {
|
|
14
15
|
default: 'bg-card',
|
|
15
|
-
active
|
|
16
|
+
// `active` uses an inline primary tint (see `toneStyle`); NativeWind can't
|
|
17
|
+
// apply `/N` opacity to CSS-variable colors.
|
|
18
|
+
active: '',
|
|
16
19
|
danger: 'bg-destructive',
|
|
17
20
|
};
|
|
18
21
|
|
|
@@ -46,12 +49,15 @@ export const JamToolbarButton = ({
|
|
|
46
49
|
menuChildren,
|
|
47
50
|
menuTitle,
|
|
48
51
|
}: JamToolbarButtonProps) => {
|
|
52
|
+
const { background } = useThemeOpacity();
|
|
53
|
+
const toneStyle = tone === 'active' ? background('primary', 0.15) : undefined;
|
|
49
54
|
const button = (
|
|
50
55
|
<Pressable
|
|
51
56
|
accessibilityLabel={title}
|
|
52
57
|
accessibilityRole="button"
|
|
53
58
|
disabled={disabled}
|
|
54
59
|
onPress={action}
|
|
60
|
+
style={toneStyle}
|
|
55
61
|
className={cn(
|
|
56
62
|
'relative size-10 shrink-0 items-center justify-center rounded-full p-2',
|
|
57
63
|
toneClasses[tone],
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
type EventsCalendarQuery,
|
|
15
15
|
} from '@openpeepshq/react';
|
|
16
16
|
import { ChevronLeftIcon, ChevronRightIcon } from '../../../icons/index';
|
|
17
|
+
import { useThemeOpacity } from '../../../../theme/useThemeOpacity';
|
|
17
18
|
import { MainStackParamList } from '../../../navigation/types/index';
|
|
18
19
|
import { ThemedText } from '../../../ui/themed-text';
|
|
19
20
|
import { cn } from '../../../../lib/utils';
|
|
@@ -28,6 +29,7 @@ const postKey = (post: PublicPost) =>
|
|
|
28
29
|
|
|
29
30
|
export const EventsCalendar = ({ query, agenda }: EventsCalendarProps) => {
|
|
30
31
|
const { t } = useTranslation();
|
|
32
|
+
const { background } = useThemeOpacity();
|
|
31
33
|
const navigation =
|
|
32
34
|
useNavigation<NativeStackNavigationProp<MainStackParamList>>();
|
|
33
35
|
const {
|
|
@@ -113,10 +115,12 @@ export const EventsCalendar = ({ query, agenda }: EventsCalendarProps) => {
|
|
|
113
115
|
key={cell.key}
|
|
114
116
|
accessibilityState={{ selected: isSelected }}
|
|
115
117
|
onPress={() => setSelectedKey(cell.key)}
|
|
116
|
-
style={{
|
|
118
|
+
style={{
|
|
119
|
+
width: `${100 / 7}%`,
|
|
120
|
+
...(isSelected ? background('primary', 0.1) : {}),
|
|
121
|
+
}}
|
|
117
122
|
className={cn(
|
|
118
123
|
'bg-background min-h-14 p-1 border-[0.5px] border-border items-center',
|
|
119
|
-
isSelected && 'bg-primary/10',
|
|
120
124
|
!cell.inMonth && 'opacity-60'
|
|
121
125
|
)}
|
|
122
126
|
>
|
|
@@ -6,6 +6,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
6
6
|
import type { ExpandedOccurrence } from '@openpeepshq/common/lib';
|
|
7
7
|
import {
|
|
8
8
|
countYesRsvps,
|
|
9
|
+
eventTimeZoneOptions,
|
|
9
10
|
isCapacityEvent,
|
|
10
11
|
sameRecurrenceId,
|
|
11
12
|
} from '@openpeepshq/common/lib';
|
|
@@ -20,9 +21,11 @@ export interface EventOccurrenceListProps {
|
|
|
20
21
|
occurrences: ExpandedOccurrence[];
|
|
21
22
|
currentOccurrenceId?: string;
|
|
22
23
|
recurrenceLabel: string;
|
|
24
|
+
/** IANA zone the occurrence timestamps render in. */
|
|
25
|
+
timeZone?: string;
|
|
23
26
|
}
|
|
24
27
|
|
|
25
|
-
const formatOccurrenceStart = (start: string) =>
|
|
28
|
+
const formatOccurrenceStart = (start: string, timeZone?: string) =>
|
|
26
29
|
new Date(start).toLocaleString(undefined, {
|
|
27
30
|
weekday: 'short',
|
|
28
31
|
month: 'short',
|
|
@@ -30,6 +33,7 @@ const formatOccurrenceStart = (start: string) =>
|
|
|
30
33
|
year: 'numeric',
|
|
31
34
|
hour: '2-digit',
|
|
32
35
|
minute: '2-digit',
|
|
36
|
+
...eventTimeZoneOptions(timeZone),
|
|
33
37
|
});
|
|
34
38
|
|
|
35
39
|
export const EventOccurrenceList: React.FC<EventOccurrenceListProps> = ({
|
|
@@ -38,6 +42,7 @@ export const EventOccurrenceList: React.FC<EventOccurrenceListProps> = ({
|
|
|
38
42
|
occurrences,
|
|
39
43
|
currentOccurrenceId,
|
|
40
44
|
recurrenceLabel,
|
|
45
|
+
timeZone,
|
|
41
46
|
}) => {
|
|
42
47
|
const { t } = useTranslation();
|
|
43
48
|
const event = post.data?.type === 'event' ? post.data : undefined;
|
|
@@ -100,7 +105,7 @@ export const EventOccurrenceList: React.FC<EventOccurrenceListProps> = ({
|
|
|
100
105
|
occurrence.recurrenceId,
|
|
101
106
|
currentOccurrenceId
|
|
102
107
|
);
|
|
103
|
-
const label = formatOccurrenceStart(occurrence.start);
|
|
108
|
+
const label = formatOccurrenceStart(occurrence.start, timeZone);
|
|
104
109
|
const capacity =
|
|
105
110
|
showCapacity && event?.maxAttendees !== undefined
|
|
106
111
|
? ` ${t('events.occurrence.capacity', {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { View } from 'react-native';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { cn } from '../../../lib/utils';
|
|
4
|
+
import { useThemeOpacity } from '../../../theme/useThemeOpacity';
|
|
4
5
|
|
|
5
6
|
interface UnreadPostIndicatorProps {
|
|
6
7
|
show: boolean;
|
|
@@ -19,16 +20,15 @@ export const UnreadPostIndicator = ({
|
|
|
19
20
|
className,
|
|
20
21
|
variant = 'dot',
|
|
21
22
|
}: UnreadPostIndicatorProps) => {
|
|
23
|
+
const { background } = useThemeOpacity();
|
|
22
24
|
if (!show) return null;
|
|
23
25
|
if (variant === 'corner') return null;
|
|
24
26
|
|
|
25
27
|
return (
|
|
26
28
|
<View
|
|
27
29
|
pointerEvents="none"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
className
|
|
31
|
-
)}
|
|
30
|
+
style={background('muted-foreground', 0.45)}
|
|
31
|
+
className={cn('absolute left-1.5 top-6 size-1.5 rounded-full', className)}
|
|
32
32
|
/>
|
|
33
33
|
);
|
|
34
34
|
};
|
|
@@ -8,6 +8,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
8
8
|
import { MediaAttachmentData } from '@openpeepshq/common';
|
|
9
9
|
import { isImageAttachment } from '../../../lib/attachmentHelpers';
|
|
10
10
|
import { AttachmentCard, attachmentId } from './AttachmentCard';
|
|
11
|
+
import { useThemeOpacity } from '../../../theme/useThemeOpacity';
|
|
11
12
|
|
|
12
13
|
interface MediaPreviewProps {
|
|
13
14
|
attachments: MediaAttachmentData[];
|
|
@@ -22,6 +23,7 @@ export const ComposeAttachments: React.FC<MediaPreviewProps> = ({
|
|
|
22
23
|
updateAttachment,
|
|
23
24
|
}) => {
|
|
24
25
|
const { t } = useTranslation();
|
|
26
|
+
const { background } = useThemeOpacity();
|
|
25
27
|
const [currentImageIndex, setCurrentImageIndex] = useState(0);
|
|
26
28
|
|
|
27
29
|
const altModalRef = useRef<BottomSheetModal>(null);
|
|
@@ -88,7 +90,8 @@ export const ComposeAttachments: React.FC<MediaPreviewProps> = ({
|
|
|
88
90
|
accessibilityLabel={t('common.labels.altText', {
|
|
89
91
|
defaultValue: 'Alt text',
|
|
90
92
|
})}
|
|
91
|
-
className="min-h-10 px-3 rounded-full
|
|
93
|
+
className="min-h-10 px-3 rounded-full border border-border items-center justify-center"
|
|
94
|
+
style={background('background', 0.9)}
|
|
92
95
|
>
|
|
93
96
|
<ThemedText className="text-xs font-semibold">ALT</ThemedText>
|
|
94
97
|
</TouchableOpacity>
|
|
@@ -99,7 +102,8 @@ export const ComposeAttachments: React.FC<MediaPreviewProps> = ({
|
|
|
99
102
|
accessibilityLabel={t('posts.attachments.deleteTitle', {
|
|
100
103
|
defaultValue: 'Delete attachment',
|
|
101
104
|
})}
|
|
102
|
-
className="w-10 h-10 rounded-full
|
|
105
|
+
className="w-10 h-10 rounded-full border border-border items-center justify-center"
|
|
106
|
+
style={background('background', 0.9)}
|
|
103
107
|
>
|
|
104
108
|
<XIcon size={18} className="text-foreground" />
|
|
105
109
|
</TouchableOpacity>
|
|
@@ -14,7 +14,11 @@ import {
|
|
|
14
14
|
normalizeResourceTags,
|
|
15
15
|
resourceFormIssues,
|
|
16
16
|
} from '@openpeepshq/common/lib';
|
|
17
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
applyAudienceSetting,
|
|
19
|
+
useCurrentProfile,
|
|
20
|
+
useResourceLibrary,
|
|
21
|
+
} from '@openpeepshq/react';
|
|
18
22
|
import { BottomSheetModal } from '@gorhom/bottom-sheet';
|
|
19
23
|
import {
|
|
20
24
|
AudioPickerSheet,
|
|
@@ -28,6 +32,7 @@ import { ThemedText } from '../../ui/themed-text';
|
|
|
28
32
|
import { ComposeAttachments } from './ComposeAttachments';
|
|
29
33
|
import { OpenpeepsMarkdownInput } from './OpenpeepsMarkdownInput';
|
|
30
34
|
import { VisibilitySelector } from './VisibilitySelector';
|
|
35
|
+
import { CategoryPathPicker } from '../../resources/CategoryPathPicker';
|
|
31
36
|
|
|
32
37
|
export interface ResourceFormProps {
|
|
33
38
|
postData: PostCreationData;
|
|
@@ -47,6 +52,10 @@ export const ResourceForm = ({
|
|
|
47
52
|
const me = useCurrentProfile();
|
|
48
53
|
const resource = postData.data as ResourcePost;
|
|
49
54
|
const [tagDraft, setTagDraft] = useState('');
|
|
55
|
+
const library = useResourceLibrary(
|
|
56
|
+
postData.groupId ?? undefined,
|
|
57
|
+
!postData.groupId
|
|
58
|
+
);
|
|
50
59
|
const imageRef = useRef<BottomSheetModal>(null);
|
|
51
60
|
const videoRef = useRef<BottomSheetModal>(null);
|
|
52
61
|
const audioRef = useRef<BottomSheetModal>(null);
|
|
@@ -211,7 +220,8 @@ export const ResourceForm = ({
|
|
|
211
220
|
</>
|
|
212
221
|
) : (
|
|
213
222
|
<>
|
|
214
|
-
{/*
|
|
223
|
+
{/* Every image pick is single-file so the crop/alt-text dialog
|
|
224
|
+
shows for every image; galleries stay open for further picks (#1789). */}
|
|
215
225
|
{resource.resourceKind === 'gallery' ||
|
|
216
226
|
(resource.attachments ?? []).length === 0 ? (
|
|
217
227
|
<Pressable
|
|
@@ -297,19 +307,10 @@ export const ResourceForm = ({
|
|
|
297
307
|
defaultValue: 'Place in the library',
|
|
298
308
|
})}
|
|
299
309
|
</ThemedText>
|
|
300
|
-
<
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
categoryPath: value
|
|
305
|
-
.split('/')
|
|
306
|
-
.map((segment) => segment.trim())
|
|
307
|
-
.filter(Boolean),
|
|
308
|
-
})
|
|
309
|
-
}
|
|
310
|
-
placeholder={t('resources.form.addLevel', {
|
|
311
|
-
defaultValue: 'Add a folder',
|
|
312
|
-
})}
|
|
310
|
+
<CategoryPathPicker
|
|
311
|
+
path={resource.categoryPath ?? []}
|
|
312
|
+
tree={library.tree}
|
|
313
|
+
onChange={(categoryPath: string[]) => patchResource({ categoryPath })}
|
|
313
314
|
/>
|
|
314
315
|
|
|
315
316
|
<ThemedText className="text-sm font-medium">
|
|
@@ -347,7 +348,6 @@ export const ResourceForm = ({
|
|
|
347
348
|
) : null}
|
|
348
349
|
</View>
|
|
349
350
|
<ImagePickerSheet ref={imageRef} onSelect={addAttachments} />
|
|
350
|
-
{/* Only galleries take more than one file; other kinds pick one. */}
|
|
351
351
|
<VideoPickerSheet
|
|
352
352
|
ref={videoRef}
|
|
353
353
|
multiple={false}
|
|
@@ -230,7 +230,9 @@ export const VisibilitySheet = forwardRef<
|
|
|
230
230
|
<ProfileSelector
|
|
231
231
|
ref={audiencePickerModalRef}
|
|
232
232
|
onSelect={setSelectedProfiles}
|
|
233
|
-
title=
|
|
233
|
+
title={t('posts.form.audienceTitle', {
|
|
234
|
+
defaultValue: 'Who can see this?',
|
|
235
|
+
})}
|
|
234
236
|
initialProfiles={selectedAudience.audience ?? []}
|
|
235
237
|
editMode
|
|
236
238
|
/>
|