@openpeepshq/rn-components 0.14.1 → 0.15.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.
- package/package.json +3 -3
- package/src/components/buttonOverflow.test.tsx +8 -0
- package/src/components/conversations/ConversationParticipantsModal.tsx +1 -6
- package/src/components/jams/JamChatDrawer.test.tsx +263 -0
- package/src/components/jams/JamChatDrawer.tsx +117 -52
- package/src/components/jams/JamConference.tsx +5 -0
- package/src/components/jams/JamParticipantConference.tsx +7 -4
- package/src/components/jams/JamPeopleDrawer.test.tsx +216 -0
- package/src/components/jams/JamPeopleDrawer.tsx +32 -2
- package/src/components/jams/JamRoomIndicators.test.tsx +190 -38
- package/src/components/jams/JamRoomIndicators.tsx +62 -20
- package/src/components/jams/useTrackSubscriptionBump.test.ts +294 -0
- package/src/components/jams/useTrackSubscriptionBump.ts +44 -0
- package/src/components/post/feed/events/EventsCalendar.test.tsx +33 -18
- package/src/components/post/pieces/ShareMenu.test.tsx +217 -0
- package/src/components/post/pieces/ShareMenu.tsx +107 -61
- package/src/components/post/post-form/VisibilitySheet.test.tsx +153 -0
- package/src/components/post/post-form/VisibilitySheet.tsx +6 -5
- package/src/components/profile/Avatar.test.tsx +147 -0
- package/src/components/profile/Avatar.tsx +26 -0
- package/src/components/profile/ProfileCard.test.tsx +165 -8
- package/src/components/profile/ProfileCard.tsx +63 -10
- package/src/components/profile/ProfileSelector.test.tsx +147 -5
- package/src/components/profile/ProfileSelector.tsx +64 -18
- package/src/pages/conversations/New.test.tsx +340 -0
- package/src/pages/conversations/New.tsx +35 -30
- package/src/pages/events/Index.tsx +4 -1
- package/src/pages/events/My.tsx +1 -1
- package/src/pages/groups/Show.tsx +1 -1
- package/src/theme/useThemeOpacity.test.ts +70 -0
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
2
|
import { ThemedView } from '../../components/ui/themed-view';
|
|
3
|
-
import { ProfileCard } from '../../components/profile/index';
|
|
3
|
+
import { MiniProfileCard, ProfileCard } from '../../components/profile/index';
|
|
4
4
|
import { HeaderActionButton, useSetPageHeader } from '../../components/layout';
|
|
5
5
|
import { EmptyStateContainer } from '../../components/custom/common/index';
|
|
6
6
|
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
|
|
7
7
|
import { useOpenpeeps } from '@openpeepshq/react';
|
|
8
|
-
import { CheckIcon
|
|
8
|
+
import { CheckIcon } from '../../components/icons/index';
|
|
9
9
|
import { ThemedText } from '../../components/ui/themed-text';
|
|
10
|
-
import { ActivityIndicator,
|
|
10
|
+
import { ActivityIndicator, View } from 'react-native';
|
|
11
11
|
import { MainScreenProps } from '../../components/navigation/types/index';
|
|
12
12
|
import { useNewConversationStore } from '../../stores/useNewConversationStore';
|
|
13
13
|
import { Input } from '../../components/ui/input';
|
|
14
14
|
import { profileMatchesQuery } from '../../lib/utils';
|
|
15
15
|
import { blockedPairIds } from '@openpeepshq/common/lib';
|
|
16
|
+
import type { Profile, PublicProfile } from '@openpeepshq/common';
|
|
16
17
|
import { useTranslation } from 'react-i18next';
|
|
17
18
|
|
|
18
19
|
type SelectPrivateMessageMembersProps =
|
|
@@ -46,7 +47,7 @@ export const NewConversation = ({
|
|
|
46
47
|
}, [currentProfile, allProfiles, searchQuery]);
|
|
47
48
|
|
|
48
49
|
useSetPageHeader(
|
|
49
|
-
t('conversations.
|
|
50
|
+
t('conversations.createNew.title'),
|
|
50
51
|
<HeaderActionButton
|
|
51
52
|
title={t('common.next', { defaultValue: 'Next' })}
|
|
52
53
|
onPress={() => navigation.navigate('DraftMessage')}
|
|
@@ -59,7 +60,7 @@ export const NewConversation = ({
|
|
|
59
60
|
<View className="w-full flex flex-row justify-between items-center p-4">
|
|
60
61
|
<Input
|
|
61
62
|
className="flex-1"
|
|
62
|
-
placeholder=
|
|
63
|
+
placeholder={t('conversations.createNew.searchPlaceholder')}
|
|
63
64
|
value={searchQuery}
|
|
64
65
|
onChangeText={setSearchQuery}
|
|
65
66
|
/>
|
|
@@ -68,46 +69,50 @@ export const NewConversation = ({
|
|
|
68
69
|
{isLoading && <ActivityIndicator size={'small'} />}
|
|
69
70
|
|
|
70
71
|
{members.length > 0 && (
|
|
71
|
-
<ThemedView className="
|
|
72
|
-
{members.map((
|
|
73
|
-
<
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
handleSelectProfile={() => removeMember(profile)}
|
|
79
|
-
rightComponent={
|
|
80
|
-
<Pressable onPress={() => removeMember(profile)}>
|
|
81
|
-
<XIcon className="text-foreground" />
|
|
82
|
-
</Pressable>
|
|
83
|
-
}
|
|
84
|
-
/>
|
|
85
|
-
</ThemedView>
|
|
72
|
+
<ThemedView className="my-4 w-full flex-row flex-wrap gap-2">
|
|
73
|
+
{members.map((member) => (
|
|
74
|
+
<MiniProfileCard
|
|
75
|
+
key={member.id}
|
|
76
|
+
profile={member as PublicProfile}
|
|
77
|
+
onPress={() => removeMember(member as Profile)}
|
|
78
|
+
/>
|
|
86
79
|
))}
|
|
87
80
|
</ThemedView>
|
|
88
81
|
)}
|
|
89
82
|
{members.length > 0 && (
|
|
90
83
|
<ThemedText className="text-center">
|
|
91
|
-
{
|
|
84
|
+
{t('conversations.createNew.selectedCount', {
|
|
85
|
+
count: members.length,
|
|
86
|
+
})}
|
|
92
87
|
</ThemedText>
|
|
93
88
|
)}
|
|
94
89
|
|
|
95
|
-
{filteredProfiles?.map((profile
|
|
90
|
+
{filteredProfiles?.map((profile) => {
|
|
91
|
+
const selected = members.some((m) => m.id === profile.id);
|
|
92
|
+
// The candidate rows are bare `ProfileCard` rows with no accessible
|
|
93
|
+
// wrapper, so they carry their own screen-reader identity: without
|
|
94
|
+
// it the whole DM picker is invisible to screen readers (issue
|
|
95
|
+
// #1666 round-10 review S1).
|
|
96
|
+
const rowLabel = selected
|
|
97
|
+
? t('profile.selector.rowSelected', {
|
|
98
|
+
name: profile.displayName || `@${profile.handle}`,
|
|
99
|
+
})
|
|
100
|
+
: profile.displayName || `@${profile.handle}`;
|
|
96
101
|
return (
|
|
97
102
|
<ProfileCard
|
|
98
|
-
key={
|
|
103
|
+
key={profile.id}
|
|
99
104
|
profile={profile}
|
|
100
|
-
hasAction={true}
|
|
101
105
|
actionType="select"
|
|
106
|
+
accessibilityRole="button"
|
|
107
|
+
accessibilityLabel={rowLabel}
|
|
108
|
+
accessibilityState={{ selected }}
|
|
102
109
|
rightComponent={
|
|
103
|
-
|
|
104
|
-
{
|
|
105
|
-
|
|
106
|
-
) : null}
|
|
107
|
-
</>
|
|
110
|
+
selected ? (
|
|
111
|
+
<CheckIcon size={16} className="text-primary" />
|
|
112
|
+
) : null
|
|
108
113
|
}
|
|
109
114
|
handleSelectProfile={() => {
|
|
110
|
-
if (
|
|
115
|
+
if (selected) {
|
|
111
116
|
removeMember(profile);
|
|
112
117
|
} else {
|
|
113
118
|
setMember(profile);
|
|
@@ -88,7 +88,10 @@ export const EventsIndex = ({
|
|
|
88
88
|
},
|
|
89
89
|
]}
|
|
90
90
|
/>
|
|
91
|
-
<EventsView
|
|
91
|
+
<EventsView
|
|
92
|
+
calendar={{ window: tab }}
|
|
93
|
+
list={<EventsFeed query={activeQuery} />}
|
|
94
|
+
/>
|
|
92
95
|
<NewEventButton visibility={visibility} currentProfile={currentProfile} />
|
|
93
96
|
</ThemedView>
|
|
94
97
|
);
|
package/src/pages/events/My.tsx
CHANGED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract test for the real (unmocked) useThemeOpacity hook (issue #1666
|
|
3
|
+
* review S5).
|
|
4
|
+
*
|
|
5
|
+
* The picker-row tint tests in ProfileSelector.test.tsx assert against a
|
|
6
|
+
* MOCKED useThemeOpacity whose values are copied from theme/defaults.ts. If
|
|
7
|
+
* the real hook's signature or the token shape ever changes, that mock would
|
|
8
|
+
* silently drift and the mocked tests would keep passing. This suite pins
|
|
9
|
+
* the real hook directly: it must resolve `background(name, opacity)` to the
|
|
10
|
+
* documented `rgba(...)` shape by feeding the token hex into the real
|
|
11
|
+
* hexWithOpacity color math.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const React = require('react');
|
|
15
|
+
const ReactTestRenderer = require('react-test-renderer');
|
|
16
|
+
|
|
17
|
+
jest.mock('./OpenPeepsThemeProvider', () => ({
|
|
18
|
+
// Mirrors the context shape the real hook reads. Values come from
|
|
19
|
+
// theme/defaults.ts (the default light theme) so the assertions are pinned
|
|
20
|
+
// to the documented palette.
|
|
21
|
+
useOpenPeepsTheme: () => ({
|
|
22
|
+
colors: {
|
|
23
|
+
primary: '#16161a',
|
|
24
|
+
secondary: '#f4f4f5',
|
|
25
|
+
},
|
|
26
|
+
}),
|
|
27
|
+
}));
|
|
28
|
+
|
|
29
|
+
import { useThemeOpacity } from './useThemeOpacity';
|
|
30
|
+
|
|
31
|
+
const UseThemeOpacityProbe = () => {
|
|
32
|
+
const opacity = useThemeOpacity();
|
|
33
|
+
return React.createElement('useThemeOpacityProbe', {
|
|
34
|
+
background: opacity.background,
|
|
35
|
+
border: opacity.border,
|
|
36
|
+
text: opacity.text,
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const renderProbe = () => {
|
|
41
|
+
let tree: ReturnType<typeof ReactTestRenderer.create>;
|
|
42
|
+
ReactTestRenderer.act(() => {
|
|
43
|
+
tree = ReactTestRenderer.create(React.createElement(UseThemeOpacityProbe));
|
|
44
|
+
});
|
|
45
|
+
return tree.root.findByType('useThemeOpacityProbe').props as {
|
|
46
|
+
background: (name: string, opacity: number) => Record<string, unknown>;
|
|
47
|
+
border: (name: string, opacity: number) => Record<string, unknown>;
|
|
48
|
+
text: (name: string, opacity: number) => Record<string, unknown>;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
describe('useThemeOpacity (real hook, issue #1666 review S5)', () => {
|
|
53
|
+
it('resolves background(primary, opacity) to the documented rgba shape', () => {
|
|
54
|
+
const { background } = renderProbe();
|
|
55
|
+
expect(background('primary', 0.15)).toEqual({
|
|
56
|
+
backgroundColor: 'rgba(22, 22, 26, 0.15)',
|
|
57
|
+
});
|
|
58
|
+
expect(background('secondary', 0.4)).toEqual({
|
|
59
|
+
backgroundColor: 'rgba(244, 244, 245, 0.4)',
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('exposes border/text variants on the same hex', () => {
|
|
64
|
+
const { border, text } = renderProbe();
|
|
65
|
+
expect(border('primary', 0.5)).toEqual({
|
|
66
|
+
borderColor: 'rgba(22, 22, 26, 0.5)',
|
|
67
|
+
});
|
|
68
|
+
expect(text('primary', 1)).toEqual({ color: 'rgba(22, 22, 26, 1)' });
|
|
69
|
+
});
|
|
70
|
+
});
|