@planningcenter/chat-react-native 2.2.2-rc.1 → 2.3.0-rc.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/build/components/conversations.d.ts.map +1 -1
- package/build/components/conversations.js +4 -0
- package/build/components/conversations.js.map +1 -1
- package/build/components/display/action_button.d.ts +8 -0
- package/build/components/display/action_button.d.ts.map +1 -0
- package/build/components/display/action_button.js +44 -0
- package/build/components/display/action_button.js.map +1 -0
- package/build/contexts/api_provider.js +2 -2
- package/build/contexts/api_provider.js.map +1 -1
- package/build/hooks/index.d.ts +2 -0
- package/build/hooks/index.d.ts.map +1 -1
- package/build/hooks/index.js +2 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/use_api.d.ts +383 -0
- package/build/hooks/use_api.d.ts.map +1 -0
- package/build/hooks/use_api.js +40 -0
- package/build/hooks/use_api.js.map +1 -0
- package/build/hooks/use_api_client.d.ts +5 -3
- package/build/hooks/use_api_client.d.ts.map +1 -1
- package/build/hooks/use_api_client.js +1 -1
- package/build/hooks/use_api_client.js.map +1 -1
- package/build/hooks/use_chat_permissions.d.ts +172 -0
- package/build/hooks/use_chat_permissions.d.ts.map +1 -0
- package/build/hooks/use_chat_permissions.js +17 -0
- package/build/hooks/use_chat_permissions.js.map +1 -0
- package/build/hooks/use_conversation.d.ts.map +1 -1
- package/build/hooks/use_conversation.js +6 -5
- package/build/hooks/use_conversation.js.map +1 -1
- package/build/hooks/use_suspense_api.d.ts +13 -4
- package/build/hooks/use_suspense_api.d.ts.map +1 -1
- package/build/hooks/use_suspense_api.js +1 -0
- package/build/hooks/use_suspense_api.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build/navigation/index.d.ts +123 -2
- package/build/navigation/index.d.ts.map +1 -1
- package/build/navigation/index.js +40 -4
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/screenLayout.js +1 -1
- package/build/navigation/screenLayout.js.map +1 -1
- package/build/screens/create/conversation_create_screen.d.ts +9 -0
- package/build/screens/create/conversation_create_screen.d.ts.map +1 -0
- package/build/screens/create/conversation_create_screen.js +123 -0
- package/build/screens/create/conversation_create_screen.js.map +1 -0
- package/build/screens/create/conversation_filter_recipients_screen.d.ts +8 -0
- package/build/screens/create/conversation_filter_recipients_screen.d.ts.map +1 -0
- package/build/screens/create/conversation_filter_recipients_screen.js +52 -0
- package/build/screens/create/conversation_filter_recipients_screen.js.map +1 -0
- package/build/screens/create/conversation_select_recipients_screen.d.ts +8 -0
- package/build/screens/create/conversation_select_recipients_screen.d.ts.map +1 -0
- package/build/screens/create/conversation_select_recipients_screen.js +105 -0
- package/build/screens/create/conversation_select_recipients_screen.js.map +1 -0
- package/build/types/resources/app_grant.d.ts +6 -0
- package/build/types/resources/app_grant.d.ts.map +1 -0
- package/build/types/resources/app_grant.js +2 -0
- package/build/types/resources/app_grant.js.map +1 -0
- package/build/types/resources/groups/groups_group_resource.d.ts +12 -0
- package/build/types/resources/groups/groups_group_resource.d.ts.map +1 -0
- package/build/types/resources/groups/groups_group_resource.js +2 -0
- package/build/types/resources/groups/groups_group_resource.js.map +1 -0
- package/build/types/resources/groups/index.d.ts +2 -0
- package/build/types/resources/groups/index.d.ts.map +1 -0
- package/build/types/resources/groups/index.js +2 -0
- package/build/types/resources/groups/index.js.map +1 -0
- package/build/types/resources/index.d.ts +2 -0
- package/build/types/resources/index.d.ts.map +1 -1
- package/build/types/resources/index.js +2 -0
- package/build/types/resources/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/conversations.tsx +8 -0
- package/src/components/display/action_button.tsx +62 -0
- package/src/contexts/api_provider.tsx +2 -2
- package/src/hooks/index.ts +2 -0
- package/src/hooks/use_api.ts +80 -0
- package/src/hooks/use_api_client.ts +13 -15
- package/src/hooks/use_chat_permissions.ts +20 -0
- package/src/hooks/use_conversation.ts +6 -5
- package/src/hooks/use_suspense_api.ts +16 -4
- package/src/index.tsx +1 -1
- package/src/navigation/index.tsx +46 -7
- package/src/navigation/screenLayout.tsx +1 -1
- package/src/screens/create/conversation_create_screen.tsx +148 -0
- package/src/screens/create/conversation_filter_recipients_screen.tsx +79 -0
- package/src/screens/create/conversation_select_recipients_screen.tsx +136 -0
- package/src/types/resources/app_grant.ts +6 -0
- package/src/types/resources/groups/groups_group_resource.ts +12 -0
- package/src/types/resources/groups/index.ts +1 -0
- package/src/types/resources/index.ts +2 -0
- package/build/contexts/index.d.ts +0 -3
- package/build/contexts/index.d.ts.map +0 -1
- package/build/contexts/index.js +0 -3
- package/build/contexts/index.js.map +0 -1
- package/src/contexts/index.ts +0 -2
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { PlatformPressable } from '@react-navigation/elements'
|
|
2
|
+
import { StaticScreenProps, useNavigation } from '@react-navigation/native'
|
|
3
|
+
import React from 'react'
|
|
4
|
+
import { ScrollView, StyleSheet, View } from 'react-native'
|
|
5
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
6
|
+
import { Button, Heading, Icon, Image, Text } from '../../components'
|
|
7
|
+
import { useSuspenseGet, useTheme } from '../../hooks'
|
|
8
|
+
import { GroupsGroupResource } from '../../types'
|
|
9
|
+
|
|
10
|
+
type ConversationSelectRecipientsScreenProps = StaticScreenProps<{
|
|
11
|
+
chat_group_graph_id?: string
|
|
12
|
+
}>
|
|
13
|
+
|
|
14
|
+
const ASPECT_RATIO = 16 / 9
|
|
15
|
+
const THUMBNAIL_WIDTH = 80
|
|
16
|
+
const THUMBNAIL_HEIGHT = THUMBNAIL_WIDTH / ASPECT_RATIO
|
|
17
|
+
|
|
18
|
+
export const ConversationSelectRecipientsScreen = ({}: ConversationSelectRecipientsScreenProps) => {
|
|
19
|
+
const styles = useStyles()
|
|
20
|
+
const navigation = useNavigation()
|
|
21
|
+
const { data: groups = [] } = useSuspenseGet<GroupsGroupResource[]>({
|
|
22
|
+
url: '/me/groups',
|
|
23
|
+
data: {
|
|
24
|
+
perPage: 100,
|
|
25
|
+
fields: {
|
|
26
|
+
Group: ['can_create_conversation', 'name', 'header_image', 'memberships_count'],
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
app: 'groups',
|
|
30
|
+
})
|
|
31
|
+
const groupsWithCreatePermission = groups.filter(g => g.canCreateConversation)
|
|
32
|
+
|
|
33
|
+
const handleNavigateToCreateConversation = (group: GroupsGroupResource) => {
|
|
34
|
+
navigation.navigate('Create', {
|
|
35
|
+
screen: 'ConversationCreate',
|
|
36
|
+
params: {
|
|
37
|
+
group_id: group.id,
|
|
38
|
+
},
|
|
39
|
+
})
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<ScrollView style={styles.container}>
|
|
44
|
+
<View style={styles.section}>
|
|
45
|
+
<View style={styles.sectionHeader}>
|
|
46
|
+
<Heading>My groups</Heading>
|
|
47
|
+
</View>
|
|
48
|
+
<View>
|
|
49
|
+
{groupsWithCreatePermission.map(group => (
|
|
50
|
+
<PlatformPressable
|
|
51
|
+
key={group.id}
|
|
52
|
+
style={styles.row}
|
|
53
|
+
onPress={() => handleNavigateToCreateConversation(group)}
|
|
54
|
+
>
|
|
55
|
+
<Image
|
|
56
|
+
source={{ uri: group.headerImage?.thumbnail }}
|
|
57
|
+
resizeMode="cover"
|
|
58
|
+
style={styles.rowImage}
|
|
59
|
+
alt={`Image for ${group.name}`}
|
|
60
|
+
/>
|
|
61
|
+
<View>
|
|
62
|
+
<Heading variant="h3">{group.name}</Heading>
|
|
63
|
+
<Text>{group.membershipsCount} members</Text>
|
|
64
|
+
</View>
|
|
65
|
+
<Icon name="general.rightChevron" size={16} style={styles.rowIconRight} />
|
|
66
|
+
</PlatformPressable>
|
|
67
|
+
))}
|
|
68
|
+
</View>
|
|
69
|
+
</View>
|
|
70
|
+
<View style={styles.section}>
|
|
71
|
+
<View style={styles.sectionHeader}>
|
|
72
|
+
<Heading>Teams I lead</Heading>
|
|
73
|
+
<Button
|
|
74
|
+
style={styles.selectTeamsButton}
|
|
75
|
+
onPress={() =>
|
|
76
|
+
navigation.navigate('Create', {
|
|
77
|
+
screen: 'ConversationFilterRecipients',
|
|
78
|
+
params: {
|
|
79
|
+
conversation_id: '2196252',
|
|
80
|
+
},
|
|
81
|
+
})
|
|
82
|
+
}
|
|
83
|
+
title="Select teams"
|
|
84
|
+
variant="outline"
|
|
85
|
+
iconNameLeft="general.search"
|
|
86
|
+
/>
|
|
87
|
+
</View>
|
|
88
|
+
</View>
|
|
89
|
+
</ScrollView>
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const useStyles = () => {
|
|
94
|
+
const { bottom } = useSafeAreaInsets()
|
|
95
|
+
const theme = useTheme()
|
|
96
|
+
|
|
97
|
+
return StyleSheet.create({
|
|
98
|
+
container: {
|
|
99
|
+
flex: 1,
|
|
100
|
+
gap: 8,
|
|
101
|
+
},
|
|
102
|
+
section: {
|
|
103
|
+
padding: 16,
|
|
104
|
+
flex: 1,
|
|
105
|
+
},
|
|
106
|
+
sectionHeader: {
|
|
107
|
+
flexDirection: 'row',
|
|
108
|
+
justifyContent: 'space-between',
|
|
109
|
+
},
|
|
110
|
+
selectTeamsButton: {},
|
|
111
|
+
row: {
|
|
112
|
+
flexDirection: 'row',
|
|
113
|
+
alignItems: 'center',
|
|
114
|
+
gap: 12,
|
|
115
|
+
paddingVertical: 16,
|
|
116
|
+
borderBottomWidth: 1,
|
|
117
|
+
borderColor: theme.colors.fillColorNeutral050Base,
|
|
118
|
+
},
|
|
119
|
+
rowImage: {
|
|
120
|
+
width: THUMBNAIL_WIDTH,
|
|
121
|
+
height: THUMBNAIL_HEIGHT,
|
|
122
|
+
borderRadius: 4,
|
|
123
|
+
},
|
|
124
|
+
rowIconRight: {
|
|
125
|
+
marginLeft: 'auto',
|
|
126
|
+
color: theme.colors.fillColorNeutral030,
|
|
127
|
+
},
|
|
128
|
+
routeDebug: {
|
|
129
|
+
alignContent: 'center',
|
|
130
|
+
padding: 16,
|
|
131
|
+
paddingBottom: bottom,
|
|
132
|
+
borderTopWidth: 1,
|
|
133
|
+
borderTopColor: theme.colors.fillColorNeutral050Base,
|
|
134
|
+
},
|
|
135
|
+
})
|
|
136
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ResourceObject } from '../../api_primitives'
|
|
2
|
+
|
|
3
|
+
export interface GroupsGroupResource extends ResourceObject {
|
|
4
|
+
headerImage: {
|
|
5
|
+
thumbnail: string
|
|
6
|
+
medium: string
|
|
7
|
+
original: string
|
|
8
|
+
}
|
|
9
|
+
name: string
|
|
10
|
+
membershipsCount: number
|
|
11
|
+
canCreateConversation: boolean
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './groups_group_resource'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contexts/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA"}
|
package/build/contexts/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/contexts/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA","sourcesContent":["export * from './api_provider'\nexport * from './chat_context'\n"]}
|
package/src/contexts/index.ts
DELETED