@planningcenter/chat-react-native 3.6.0-rc.13 → 3.6.0-rc.14

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.
@@ -6,7 +6,7 @@ import { type ButtonProps } from './button';
6
6
  interface BlankStateProps {
7
7
  iconName?: IconString;
8
8
  iconStyle?: IconStyle;
9
- title: string;
9
+ title?: string;
10
10
  titleStyle?: HeadingProps['style'];
11
11
  subtitle?: string;
12
12
  subtitleStyle?: TextProps['style'];
@@ -1 +1 @@
1
- {"version":3,"file":"blank_state.d.ts","sourceRoot":"","sources":["../../../src/components/display/blank_state.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,SAAS,EAAc,MAAM,cAAc,CAAA;AAC/D,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EAAQ,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAA;AAC9D,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAA;AAE7C,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,UAAU,CAAA;AAEnD,UAAU,eAAe;IACvB,QAAQ,CAAC,EAAE,UAAU,CAAA;IACrB,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,CAAA;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,aAAa,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAA;IAClC,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,WAAW,CAAC,EAAE,WAAW,CAAA;CAC1B;AAED,eAAO,MAAM,UAAU,6FASpB,eAAe,gCAoBjB,CAAA"}
1
+ {"version":3,"file":"blank_state.d.ts","sourceRoot":"","sources":["../../../src/components/display/blank_state.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,SAAS,EAAc,MAAM,cAAc,CAAA;AAC/D,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EAAQ,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAA;AAC9D,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAA;AAE7C,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,UAAU,CAAA;AAEnD,UAAU,eAAe;IACvB,QAAQ,CAAC,EAAE,UAAU,CAAA;IACrB,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,CAAA;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,aAAa,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAA;IAClC,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,WAAW,CAAC,EAAE,WAAW,CAAA;CAC1B;AAED,eAAO,MAAM,UAAU,6FASpB,eAAe,gCAsBjB,CAAA"}
@@ -10,9 +10,9 @@ export const BlankState = ({ iconName, title, titleStyle, subtitle, subtitleStyl
10
10
  {iconName && <Icon name={iconName} size={32} style={[styles.icon, iconStyle]}/>}
11
11
 
12
12
  <View style={styles.content}>
13
- <Heading variant="h3" style={[styles.baseText, titleStyle]}>
14
- {title}
15
- </Heading>
13
+ {title && (<Heading variant="h3" style={[styles.baseText, titleStyle]}>
14
+ {title}
15
+ </Heading>)}
16
16
  {subtitle && (<Text variant="tertiary" style={[styles.baseText, subtitleStyle]}>
17
17
  {subtitle}
18
18
  </Text>)}
@@ -1 +1 @@
1
- {"version":3,"file":"blank_state.js","sourceRoot":"","sources":["../../../src/components/display/blank_state.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkB,UAAU,EAAE,MAAM,cAAc,CAAA;AAC/D,OAAO,EAAE,OAAO,EAAqB,MAAM,WAAW,CAAA;AACtD,OAAO,EA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AAI,CAAC,IAAI,WAAW,CAAC,EAAG,CACzE;IAAA,EAAE,IAAI,CAAC,CACR,CAAA;AACH,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAE7B,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE;YACT,IAAI,EAAE,CAAC;YACP,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,QAAQ;YACxB,GAAG,EAAE,EAAE;YACP,OAAO,EAAE,EAAE;SACZ;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,MAAM,CAAC,wBAAwB;SACvC;QACD,OAAO,EAAE;YACP,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,CAAC;YACN,QAAQ,EAAE,GAAG;SACd;QACD,QAAQ,EAAE;YACR,SAAS,EAAE,QAAQ;YACnB,KAAK,EAAE,MAAM,CAAC,yBAAyB;SACxC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { View, type ViewStyle, StyleSheet } from 'react-native'\nimport { Heading, type HeadingProps } from './heading'\nimport { Icon, type IconString, type IconStyle } from './icon'\nimport { Text, type TextProps } from './text'\nimport { useTheme } from '../../hooks'\nimport { Button, type ButtonProps } from './button'\n\ninterface BlankStateProps {\n iconName?: IconString\n iconStyle?: IconStyle\n title: string\n titleStyle?: HeadingProps['style']\n subtitle?: string\n subtitleStyle?: TextProps['style']\n style?: ViewStyle\n buttonProps?: ButtonProps\n}\n\nexport const BlankState = ({\n iconName,\n title,\n titleStyle,\n subtitle,\n subtitleStyle,\n style,\n iconStyle,\n buttonProps,\n}: BlankStateProps) => {\n const styles = useStyles()\n\n return (\n <View style={[styles.container, style]}>\n {iconName && <Icon name={iconName} size={32} style={[styles.icon, iconStyle]} />}\n\n <View style={styles.content}>\n <Heading variant=\"h3\" style={[styles.baseText, titleStyle]}>\n {title}\n </Heading>\n {subtitle && (\n <Text variant=\"tertiary\" style={[styles.baseText, subtitleStyle]}>\n {subtitle}\n </Text>\n )}\n </View>\n {buttonProps && <Button variant=\"outline\" size=\"sm\" {...buttonProps} />}\n </View>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n container: {\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n gap: 16,\n padding: 16,\n },\n icon: {\n color: colors.iconColorDefaultDisabled,\n },\n content: {\n alignItems: 'center',\n gap: 4,\n maxWidth: 250,\n },\n baseText: {\n textAlign: 'center',\n color: colors.textColorDefaultSecondary,\n },\n })\n}\n"]}
1
+ {"version":3,"file":"blank_state.js","sourceRoot":"","sources":["../../../src/components/display/blank_state.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkB,UAAU,EAAE,MAAM,cAAc,CAAA;AAC/D,OAAO,EAAE,OAAO,EAAqB,MAAM,WAAW,CAAA;AACtD,OAAO,EAAE,IAAI,EAAmC,MAAM,QAAQ,CAAA;AAC9D,OAAO,EAAE,IAAI,EAAkB,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,MAAM,EAAoB,MAAM,UAAU,CAAA;AAanD,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EACzB,QAAQ,EACR,KAAK,EACL,UAAU,EACV,QAAQ,EACR,aAAa,EACb,KAAK,EACL,SAAS,EACT,WAAW,GACK,EAAE,EAAE;IACpB,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAE1B,OAAO,CACL,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CACrC;MAAA,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,SA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;AACJ,CAAC,CAAA","sourcesContent":["import { View, type ViewStyle, StyleSheet } from 'react-native'\nimport { Heading, type HeadingProps } from './heading'\nimport { Icon, type IconString, type IconStyle } from './icon'\nimport { Text, type TextProps } from './text'\nimport { useTheme } from '../../hooks'\nimport { Button, type ButtonProps } from './button'\n\ninterface BlankStateProps {\n iconName?: IconString\n iconStyle?: IconStyle\n title?: string\n titleStyle?: HeadingProps['style']\n subtitle?: string\n subtitleStyle?: TextProps['style']\n style?: ViewStyle\n buttonProps?: ButtonProps\n}\n\nexport const BlankState = ({\n iconName,\n title,\n titleStyle,\n subtitle,\n subtitleStyle,\n style,\n iconStyle,\n buttonProps,\n}: BlankStateProps) => {\n const styles = useStyles()\n\n return (\n <View style={[styles.container, style]}>\n {iconName && <Icon name={iconName} size={32} style={[styles.icon, iconStyle]} />}\n\n <View style={styles.content}>\n {title && (\n <Heading variant=\"h3\" style={[styles.baseText, titleStyle]}>\n {title}\n </Heading>\n )}\n {subtitle && (\n <Text variant=\"tertiary\" style={[styles.baseText, subtitleStyle]}>\n {subtitle}\n </Text>\n )}\n </View>\n {buttonProps && <Button variant=\"outline\" size=\"sm\" {...buttonProps} />}\n </View>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n container: {\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n gap: 16,\n padding: 16,\n },\n icon: {\n color: colors.iconColorDefaultDisabled,\n },\n content: {\n alignItems: 'center',\n gap: 4,\n maxWidth: 250,\n },\n baseText: {\n textAlign: 'center',\n color: colors.textColorDefaultSecondary,\n },\n })\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"conversation_select_recipients_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/conversation_select_recipients/conversation_select_recipients_screen.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,OAAO,EAAE,uCAAuC,EAAE,MAAM,sBAAsB,CAAA;AAU9E,eAAO,MAAM,kCAAkC,eAE5C,uCAAuC,sBAyHzC,CAAA"}
1
+ {"version":3,"file":"conversation_select_recipients_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/conversation_select_recipients/conversation_select_recipients_screen.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,OAAO,EAAE,uCAAuC,EAAE,MAAM,sBAAsB,CAAA;AAU9E,eAAO,MAAM,kCAAkC,eAE5C,uCAAuC,sBA2IzC,CAAA"}
@@ -1,7 +1,7 @@
1
1
  import { useNavigation } from '@react-navigation/native';
2
2
  import React from 'react';
3
3
  import { ScrollView, StyleSheet, View } from 'react-native';
4
- import { Button, Heading } from '../../components';
4
+ import { BlankState, Button, Heading } from '../../components';
5
5
  import { useGroupsGroups } from '../../hooks/use_groups_groups';
6
6
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
7
7
  import { ViewMoreLinkRow } from './components/view_more_link_row';
@@ -13,7 +13,7 @@ const MAX_VISIBLE_RECIPIENTS = 5;
13
13
  export const ConversationSelectRecipientsScreen = ({ route, }) => {
14
14
  const styles = useStyles();
15
15
  const navigation = useNavigation();
16
- const { data: groups = [] } = useGroupsGroups();
16
+ const { data: groups = [], isFetching: isGroupsFetching } = useGroupsGroups();
17
17
  const groupsWithCreatePermission = groups.filter(g => g.canCreateConversation);
18
18
  const visibleGroups = groupsWithCreatePermission.slice(0, MAX_VISIBLE_RECIPIENTS);
19
19
  const hasMoreGroups = groupsWithCreatePermission.length > MAX_VISIBLE_RECIPIENTS;
@@ -37,9 +37,10 @@ export const ConversationSelectRecipientsScreen = ({ route, }) => {
37
37
  },
38
38
  });
39
39
  };
40
- const { serviceTypes } = useServiceTypesWithTeams();
40
+ const { serviceTypes, isFetching: isServiceTypesFetching } = useServiceTypesWithTeams();
41
41
  const visibleServiceTypes = serviceTypes.slice(0, MAX_VISIBLE_RECIPIENTS);
42
42
  const hasMoreServiceTypes = serviceTypes.length > MAX_VISIBLE_RECIPIENTS;
43
+ const hasServiceTypes = serviceTypes.length > 0;
43
44
  const handleTeamsNavigateToConversationNew = (teams) => {
44
45
  const teamIds = teams.map(team => team.id);
45
46
  navigation.navigate('New', {
@@ -65,28 +66,32 @@ export const ConversationSelectRecipientsScreen = ({ route, }) => {
65
66
  <Heading variant="h3">My groups</Heading>
66
67
  </View>
67
68
  <View>
68
- {visibleGroups.map(group => {
69
- return (<GroupsRecipientRow key={group.id} group={group} onPress={handleGroupsNavigateToConversationNew}/>);
70
- })}
71
- {hasMoreGroups && (<ViewMoreLinkRow onPress={handleGroupsViewMore} accessibilityHint="Navigate to a full list of your groups."/>)}
72
- {showGroupsDisclaimer && <GroupsWithoutChatDisclaimerRow />}
69
+ {isGroupsFetching ? null : groupsWithCreatePermission.length === 0 ? (<BlankState subtitle="Join a group with chat enabled and permissions to start a new conversation." style={styles.blankState}/>) : (<>
70
+ {visibleGroups.map(group => {
71
+ return (<GroupsRecipientRow key={group.id} group={group} onPress={handleGroupsNavigateToConversationNew}/>);
72
+ })}
73
+ {hasMoreGroups && (<ViewMoreLinkRow onPress={handleGroupsViewMore} accessibilityHint="Navigate to a full list of your groups."/>)}
74
+ {showGroupsDisclaimer && <GroupsWithoutChatDisclaimerRow />}
75
+ </>)}
73
76
  </View>
74
77
  </View>
75
78
  <View style={styles.section}>
76
79
  <View style={styles.sectionHeader}>
77
80
  <Heading variant="h3">Teams I lead</Heading>
78
- <Button style={styles.selectTeamsButton} onPress={() => navigation.navigate('New', {
79
- screen: 'ConversationFilterRecipients',
80
- params: {
81
- source_app_name: 'Services',
82
- },
83
- })} title="Select teams" variant="outline" iconNameLeft="general.search" size="sm"/>
81
+ {hasServiceTypes && (<Button style={styles.selectTeamsButton} onPress={() => navigation.navigate('New', {
82
+ screen: 'ConversationFilterRecipients',
83
+ params: {
84
+ source_app_name: 'Services',
85
+ },
86
+ })} title="Select teams" variant="outline" iconNameLeft="general.search" size="sm"/>)}
84
87
  </View>
85
88
  <View>
86
- {visibleServiceTypes.map(serviceType => {
87
- return (<TeamRecipientRow key={serviceType.id} serviceType={serviceType} onPress={handleTeamsNavigateToConversationNew}/>);
88
- })}
89
- {hasMoreServiceTypes && (<ViewMoreLinkRow onPress={handleServiceTypesViewMore} accessibilityHint="Navigate to a full list of teams you lead."/>)}
89
+ {isServiceTypesFetching ? null : hasServiceTypes ? (<>
90
+ {visibleServiceTypes.map(serviceType => {
91
+ return (<TeamRecipientRow key={serviceType.id} serviceType={serviceType} onPress={handleTeamsNavigateToConversationNew}/>);
92
+ })}
93
+ {hasMoreServiceTypes && (<ViewMoreLinkRow onPress={handleServiceTypesViewMore} accessibilityHint="Navigate to a full list of teams you lead."/>)}
94
+ </>) : (<BlankState subtitle="You don't lead any teams." style={styles.blankState}/>)}
90
95
  </View>
91
96
  </View>
92
97
  </ScrollView>);
@@ -109,6 +114,10 @@ const useStyles = () => {
109
114
  paddingBottom: 4,
110
115
  },
111
116
  selectTeamsButton: {},
117
+ blankState: {
118
+ marginTop: 24,
119
+ marginBottom: 48,
120
+ },
112
121
  });
113
122
  };
114
123
  //# sourceMappingURL=conversation_select_recipients_screen.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"conversation_select_recipients_screen.js","sourceRoot":"","sources":["../../../src/screens/conversation_select_recipients/conversation_select_recipients_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAElD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAElE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AACjE,OAAO,EAAE,8BAA8B,EAAE,MAAM,iDAAiD,CAAA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OAAO,CAAC,CAAC,oCAAoC,CAAC,EAC9C,CACH,CAAA;QACH,CAAC,CAAC,CACF;UAAA,CAAC,mBAAmB,IAAI,CACtB,CAAC,eAAe,CACd,OAAO,CAAC,CAAC,0BAA0B,CAAC,CACpC,iBAAiB,CAAC,4CAA4C,EAC9D,CACH,CACH;QAAA,EAAE,IAAI,CACR;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,UAAU,CAAC,CACd,CAAA;AACH,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,iBAAiB,EAAE,CAAA;IAEtC,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,gBAAgB,EAAE;YAChB,GAAG,EAAE,EAAE;YACP,UAAU,EAAE,EAAE;YACd,aAAa,EAAE,EAAE,GAAG,MAAM;SAC3B;QACD,OAAO,EAAE;YACP,IAAI,EAAE,CAAC;SACR;QACD,aAAa,EAAE;YACb,aAAa,EAAE,KAAK;YACpB,cAAc,EAAE,eAAe;YAC/B,iBAAiB,EAAE,EAAE;YACrB,aAAa,EAAE,CAAC;SACjB;QACD,iBAAiB,EAAE,EAAE;KACtB,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { useNavigation } from '@react-navigation/native'\nimport React from 'react'\nimport { ScrollView, StyleSheet, View } from 'react-native'\nimport { Button, Heading } from '../../components'\nimport { GroupsGroupResource } from '../../types'\nimport { useGroupsGroups } from '../../hooks/use_groups_groups'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { ConversationSelectRecipientsScreenProps } from './types/screen_props'\nimport { ViewMoreLinkRow } from './components/view_more_link_row'\nimport { GroupsWithoutChatDisclaimerRow } from './components/groups_without_chat_disclaimer_row'\nimport { useServiceTypesWithTeams } from '../conversation_filter_recipients/hooks/use_service_types_with_teams'\nimport { ServiceTypeWithTeams } from '../conversation_filter_recipients/types'\nimport { TeamRecipientRow } from './components/team_recipient_row'\nimport { GroupsRecipientRow } from './components/groups_recipient_row'\n\nconst MAX_VISIBLE_RECIPIENTS = 5\n\nexport const ConversationSelectRecipientsScreen = ({\n route,\n}: ConversationSelectRecipientsScreenProps) => {\n const styles = useStyles()\n const navigation = useNavigation()\n\n const { data: groups = [] } = useGroupsGroups()\n const groupsWithCreatePermission = groups.filter(g => g.canCreateConversation)\n const visibleGroups = groupsWithCreatePermission.slice(0, MAX_VISIBLE_RECIPIENTS)\n const hasMoreGroups = groupsWithCreatePermission.length > MAX_VISIBLE_RECIPIENTS\n const hasGroupsWithoutChatPermission = groups.length > groupsWithCreatePermission.length\n const showGroupsDisclaimer = hasGroupsWithoutChatPermission && !hasMoreGroups\n\n const handleGroupsNavigateToConversationNew = (group: GroupsGroupResource) => {\n navigation.navigate('New', {\n screen: 'ConversationNew',\n params: {\n group_id: group.id,\n source_app_name: 'Groups',\n ...route.params,\n },\n })\n }\n\n const handleGroupsViewMore = () => {\n navigation.navigate('New', {\n screen: 'ConversationSelectGroupRecipients',\n params: {\n ...route.params,\n },\n })\n }\n\n const { serviceTypes } = useServiceTypesWithTeams()\n const visibleServiceTypes = serviceTypes.slice(0, MAX_VISIBLE_RECIPIENTS)\n const hasMoreServiceTypes = serviceTypes.length > MAX_VISIBLE_RECIPIENTS\n\n const handleTeamsNavigateToConversationNew = (teams: ServiceTypeWithTeams['teams']) => {\n const teamIds = teams.map(team => team.id)\n\n navigation.navigate('New', {\n screen: 'ConversationNew',\n params: {\n team_ids: teamIds,\n source_app_name: 'Services',\n ...route.params,\n },\n })\n }\n\n const handleServiceTypesViewMore = () => {\n navigation.navigate('New', {\n screen: 'ConversationSelectTeamsILeadRecipients',\n params: {\n ...route.params,\n },\n })\n }\n\n return (\n <ScrollView contentContainerStyle={styles.contentContainer}>\n <View style={styles.section}>\n <View style={styles.sectionHeader}>\n <Heading variant=\"h3\">My groups</Heading>\n </View>\n <View>\n {visibleGroups.map(group => {\n return (\n <GroupsRecipientRow\n key={group.id}\n group={group}\n onPress={handleGroupsNavigateToConversationNew}\n />\n )\n })}\n {hasMoreGroups && (\n <ViewMoreLinkRow\n onPress={handleGroupsViewMore}\n accessibilityHint=\"Navigate to a full list of your groups.\"\n />\n )}\n {showGroupsDisclaimer && <GroupsWithoutChatDisclaimerRow />}\n </View>\n </View>\n <View style={styles.section}>\n <View style={styles.sectionHeader}>\n <Heading variant=\"h3\">Teams I lead</Heading>\n <Button\n style={styles.selectTeamsButton}\n onPress={() =>\n navigation.navigate('New', {\n screen: 'ConversationFilterRecipients',\n params: {\n source_app_name: 'Services',\n },\n })\n }\n title=\"Select teams\"\n variant=\"outline\"\n iconNameLeft=\"general.search\"\n size=\"sm\"\n />\n </View>\n <View>\n {visibleServiceTypes.map(serviceType => {\n return (\n <TeamRecipientRow\n key={serviceType.id}\n serviceType={serviceType}\n onPress={handleTeamsNavigateToConversationNew}\n />\n )\n })}\n {hasMoreServiceTypes && (\n <ViewMoreLinkRow\n onPress={handleServiceTypesViewMore}\n accessibilityHint=\"Navigate to a full list of teams you lead.\"\n />\n )}\n </View>\n </View>\n </ScrollView>\n )\n}\n\nconst useStyles = () => {\n const { bottom } = useSafeAreaInsets()\n\n return StyleSheet.create({\n contentContainer: {\n gap: 24,\n paddingTop: 16,\n paddingBottom: 16 + bottom,\n },\n section: {\n flex: 1,\n },\n sectionHeader: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n paddingHorizontal: 16,\n paddingBottom: 4,\n },\n selectTeamsButton: {},\n })\n}\n"]}
1
+ {"version":3,"file":"conversation_select_recipients_screen.js","sourceRoot":"","sources":["../../../src/screens/conversation_select_recipients/conversation_select_recipients_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MA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M,EAAE,MAAM,EAAE,GAAG,iBAAiB,EAAE,CAAA;IAEtC,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,gBAAgB,EAAE;YAChB,GAAG,EAAE,EAAE;YACP,UAAU,EAAE,EAAE;YACd,aAAa,EAAE,EAAE,GAAG,MAAM;SAC3B;QACD,OAAO,EAAE;YACP,IAAI,EAAE,CAAC;SACR;QACD,aAAa,EAAE;YACb,aAAa,EAAE,KAAK;YACpB,cAAc,EAAE,eAAe;YAC/B,iBAAiB,EAAE,EAAE;YACrB,aAAa,EAAE,CAAC;SACjB;QACD,iBAAiB,EAAE,EAAE;QACrB,UAAU,EAAE;YACV,SAAS,EAAE,EAAE;YACb,YAAY,EAAE,EAAE;SACjB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { useNavigation } from '@react-navigation/native'\nimport React from 'react'\nimport { ScrollView, StyleSheet, View } from 'react-native'\nimport { BlankState, Button, Heading } from '../../components'\nimport { GroupsGroupResource } from '../../types'\nimport { useGroupsGroups } from '../../hooks/use_groups_groups'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { ConversationSelectRecipientsScreenProps } from './types/screen_props'\nimport { ViewMoreLinkRow } from './components/view_more_link_row'\nimport { GroupsWithoutChatDisclaimerRow } from './components/groups_without_chat_disclaimer_row'\nimport { useServiceTypesWithTeams } from '../conversation_filter_recipients/hooks/use_service_types_with_teams'\nimport { ServiceTypeWithTeams } from '../conversation_filter_recipients/types'\nimport { TeamRecipientRow } from './components/team_recipient_row'\nimport { GroupsRecipientRow } from './components/groups_recipient_row'\n\nconst MAX_VISIBLE_RECIPIENTS = 5\n\nexport const ConversationSelectRecipientsScreen = ({\n route,\n}: ConversationSelectRecipientsScreenProps) => {\n const styles = useStyles()\n const navigation = useNavigation()\n\n const { data: groups = [], isFetching: isGroupsFetching } = useGroupsGroups()\n const groupsWithCreatePermission = groups.filter(g => g.canCreateConversation)\n const visibleGroups = groupsWithCreatePermission.slice(0, MAX_VISIBLE_RECIPIENTS)\n const hasMoreGroups = groupsWithCreatePermission.length > MAX_VISIBLE_RECIPIENTS\n const hasGroupsWithoutChatPermission = groups.length > groupsWithCreatePermission.length\n const showGroupsDisclaimer = hasGroupsWithoutChatPermission && !hasMoreGroups\n\n const handleGroupsNavigateToConversationNew = (group: GroupsGroupResource) => {\n navigation.navigate('New', {\n screen: 'ConversationNew',\n params: {\n group_id: group.id,\n source_app_name: 'Groups',\n ...route.params,\n },\n })\n }\n\n const handleGroupsViewMore = () => {\n navigation.navigate('New', {\n screen: 'ConversationSelectGroupRecipients',\n params: {\n ...route.params,\n },\n })\n }\n\n const { serviceTypes, isFetching: isServiceTypesFetching } = useServiceTypesWithTeams()\n const visibleServiceTypes = serviceTypes.slice(0, MAX_VISIBLE_RECIPIENTS)\n const hasMoreServiceTypes = serviceTypes.length > MAX_VISIBLE_RECIPIENTS\n const hasServiceTypes = serviceTypes.length > 0\n\n const handleTeamsNavigateToConversationNew = (teams: ServiceTypeWithTeams['teams']) => {\n const teamIds = teams.map(team => team.id)\n\n navigation.navigate('New', {\n screen: 'ConversationNew',\n params: {\n team_ids: teamIds,\n source_app_name: 'Services',\n ...route.params,\n },\n })\n }\n\n const handleServiceTypesViewMore = () => {\n navigation.navigate('New', {\n screen: 'ConversationSelectTeamsILeadRecipients',\n params: {\n ...route.params,\n },\n })\n }\n\n return (\n <ScrollView contentContainerStyle={styles.contentContainer}>\n <View style={styles.section}>\n <View style={styles.sectionHeader}>\n <Heading variant=\"h3\">My groups</Heading>\n </View>\n <View>\n {isGroupsFetching ? null : groupsWithCreatePermission.length === 0 ? (\n <BlankState\n subtitle=\"Join a group with chat enabled and permissions to start a new conversation.\"\n style={styles.blankState}\n />\n ) : (\n <>\n {visibleGroups.map(group => {\n return (\n <GroupsRecipientRow\n key={group.id}\n group={group}\n onPress={handleGroupsNavigateToConversationNew}\n />\n )\n })}\n {hasMoreGroups && (\n <ViewMoreLinkRow\n onPress={handleGroupsViewMore}\n accessibilityHint=\"Navigate to a full list of your groups.\"\n />\n )}\n {showGroupsDisclaimer && <GroupsWithoutChatDisclaimerRow />}\n </>\n )}\n </View>\n </View>\n <View style={styles.section}>\n <View style={styles.sectionHeader}>\n <Heading variant=\"h3\">Teams I lead</Heading>\n {hasServiceTypes && (\n <Button\n style={styles.selectTeamsButton}\n onPress={() =>\n navigation.navigate('New', {\n screen: 'ConversationFilterRecipients',\n params: {\n source_app_name: 'Services',\n },\n })\n }\n title=\"Select teams\"\n variant=\"outline\"\n iconNameLeft=\"general.search\"\n size=\"sm\"\n />\n )}\n </View>\n <View>\n {isServiceTypesFetching ? null : hasServiceTypes ? (\n <>\n {visibleServiceTypes.map(serviceType => {\n return (\n <TeamRecipientRow\n key={serviceType.id}\n serviceType={serviceType}\n onPress={handleTeamsNavigateToConversationNew}\n />\n )\n })}\n {hasMoreServiceTypes && (\n <ViewMoreLinkRow\n onPress={handleServiceTypesViewMore}\n accessibilityHint=\"Navigate to a full list of teams you lead.\"\n />\n )}\n </>\n ) : (\n <BlankState subtitle=\"You don't lead any teams.\" style={styles.blankState} />\n )}\n </View>\n </View>\n </ScrollView>\n )\n}\n\nconst useStyles = () => {\n const { bottom } = useSafeAreaInsets()\n\n return StyleSheet.create({\n contentContainer: {\n gap: 24,\n paddingTop: 16,\n paddingBottom: 16 + bottom,\n },\n section: {\n flex: 1,\n },\n sectionHeader: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n paddingHorizontal: 16,\n paddingBottom: 4,\n },\n selectTeamsButton: {},\n blankState: {\n marginTop: 24,\n marginBottom: 48,\n },\n })\n}\n"]}
@@ -5,7 +5,6 @@ export declare const MessageActionsScreenOptions: NativeStackNavigationOptions;
5
5
  export type MessageActionsScreenProps = StaticScreenProps<{
6
6
  message_id: string;
7
7
  conversation_id: number;
8
- chat_group_graph_id?: string;
9
8
  canDeleteNonAuthoredMessages?: boolean;
10
9
  }>;
11
10
  export declare function MessageActionsScreen({ route }: MessageActionsScreenProps): React.JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"message_actions_screen.d.ts","sourceRoot":"","sources":["../../src/screens/message_actions_screen.tsx"],"names":[],"mappings":"AACA,OAAO,EAAgB,iBAAiB,EAAiB,MAAM,0BAA0B,CAAA;AACzF,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAA;AAE7E,OAAO,KAAsB,MAAM,OAAO,CAAA;AAc1C,eAAO,MAAM,2BAA2B,EAAE,4BAKzC,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG,iBAAiB,CAAC;IACxD,UAAU,EAAE,MAAM,CAAA;IAClB,eAAe,EAAE,MAAM,CAAA;IACvB,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,4BAA4B,CAAC,EAAE,OAAO,CAAA;CACvC,CAAC,CAAA;AAEF,wBAAgB,oBAAoB,CAAC,EAAE,KAAK,EAAE,EAAE,yBAAyB,qBAiJxE"}
1
+ {"version":3,"file":"message_actions_screen.d.ts","sourceRoot":"","sources":["../../src/screens/message_actions_screen.tsx"],"names":[],"mappings":"AACA,OAAO,EAAgB,iBAAiB,EAAiB,MAAM,0BAA0B,CAAA;AACzF,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAA;AAE7E,OAAO,KAAsB,MAAM,OAAO,CAAA;AAc1C,eAAO,MAAM,2BAA2B,EAAE,4BAKzC,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG,iBAAiB,CAAC;IACxD,UAAU,EAAE,MAAM,CAAA;IAClB,eAAe,EAAE,MAAM,CAAA;IACvB,4BAA4B,CAAC,EAAE,OAAO,CAAA;CACvC,CAAC,CAAA;AAEF,wBAAgB,oBAAoB,CAAC,EAAE,KAAK,EAAE,EAAE,yBAAyB,qBAkJxE"}
@@ -20,7 +20,7 @@ export const MessageActionsScreenOptions = {
20
20
  };
21
21
  export function MessageActionsScreen({ route }) {
22
22
  const navigation = useNavigation();
23
- const { conversation_id, message_id, chat_group_graph_id, canDeleteNonAuthoredMessages } = route.params;
23
+ const { conversation_id, message_id, canDeleteNonAuthoredMessages } = route.params;
24
24
  const apiClient = useApiClient();
25
25
  const queryClient = useQueryClient();
26
26
  const styles = useStyles();
@@ -87,13 +87,15 @@ export function MessageActionsScreen({ route }) {
87
87
  },
88
88
  });
89
89
  const handleEditPress = useCallback(() => {
90
+ const state = navigation.getState?.();
91
+ const targetRoute = state?.routes?.find(r => r.name === 'Conversation');
90
92
  const params = omitBy({
93
+ ...(targetRoute?.params || {}),
91
94
  conversation_id,
92
95
  editing_message_id: message_id,
93
- chat_group_graph_id,
94
96
  }, isNil);
95
97
  navigation.dispatch(StackActions.popTo('Conversation', params));
96
- }, [chat_group_graph_id, navigation, conversation_id, message_id]);
98
+ }, [navigation, conversation_id, message_id]);
97
99
  const handleViewReadReceiptsPress = useCallback(() => {
98
100
  const params = omitBy({
99
101
  conversation_id,
@@ -1 +1 @@
1
- {"version":3,"file":"message_actions_screen.js","sourceRoot":"","sources":["../../src/screens/message_actions_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAqB,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAEzF,OAAO,EAAgB,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACjF,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAA;AAChG,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAA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E,EAAE;KAC3D,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable } from '@react-navigation/elements'\nimport { StackActions, StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport { NativeStackNavigationOptions } from '@react-navigation/native-stack'\nimport { InfiniteData, useMutation, useQueryClient } from '@tanstack/react-query'\nimport React, { useCallback } from 'react'\nimport { Alert, Platform, StyleSheet, useWindowDimensions, View } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { Text, TextButton } from '../components'\nimport { REACTION_EMOJIS, useReactionStyles } from '../components/conversation/message_reaction'\nimport { useTheme } from '../hooks'\nimport { useApiClient } from '../hooks/use_api_client'\nimport { getMessagesRequestArgs, useConversationMessages } from '../hooks/use_conversation_messages'\nimport { ApiCollection, ApiResource, MessageResource } from '../types'\nimport { ReactionCountResource } from '../types/resources/reaction'\nimport { updateRecordInPagesData } from '../utils'\nimport { Clipboard } from '../utils/native_adapters'\nimport { isNil, omitBy } from 'lodash'\n\nexport const MessageActionsScreenOptions: NativeStackNavigationOptions = {\n presentation: 'formSheet',\n headerShown: false,\n sheetAllowedDetents: [0.35],\n sheetGrabberVisible: true,\n}\n\nexport type MessageActionsScreenProps = StaticScreenProps<{\n message_id: string\n conversation_id: number\n chat_group_graph_id?: string\n canDeleteNonAuthoredMessages?: boolean\n}>\n\nexport function MessageActionsScreen({ route }: MessageActionsScreenProps) {\n const navigation = useNavigation()\n const { conversation_id, message_id, chat_group_graph_id, canDeleteNonAuthoredMessages } =\n route.params\n\n const apiClient = useApiClient()\n const queryClient = useQueryClient()\n const styles = useStyles()\n\n const { messages, queryKey, refetch } = useConversationMessages(\n { conversation_id },\n { refetchOnMount: false }\n )\n const message = messages.find(m => m.id === message_id)\n const myReactions = message?.reactionCounts\n .filter(reaction => reaction.mine)\n .map(reaction => reaction.value)\n\n const availableReactions = Object.entries(REACTION_EMOJIS).map(([value, emoji]) => {\n return {\n value: value as ReactionCountResource['value'],\n emoji,\n mine: myReactions?.includes(value as ReactionCountResource['value']),\n }\n })\n\n const handleCopyPress = (text?: string | null) => {\n Clipboard.setStringAsync(text || '')\n navigation.goBack()\n }\n\n const handleReactionPress = useCallback(\n ({ value, mine }: { value: keyof typeof REACTION_EMOJIS; mine?: boolean }) => {\n const requestParams = getMessagesRequestArgs({ conversation_id })\n\n // Value has already been updated\n const endpoint = !mine ? 'react' : 'unreact'\n const url = `/me/conversations/${conversation_id}/messages/${message_id}/${endpoint}`\n const fieldsWithValueJoined = Object.fromEntries(\n Object.entries(requestParams.data.fields).map(([k, v]) => [k, v.join(',')])\n )\n\n return apiClient.chat.post<ApiResource<MessageResource>>({\n url,\n data: {\n ...requestParams.data,\n data: {\n type: 'Message',\n attributes: { value: value },\n },\n fields: fieldsWithValueJoined,\n },\n })\n },\n [apiClient, conversation_id, message_id]\n )\n\n const deleteMessage = useCallback(() => {\n const url = `/me/conversations/${conversation_id}/messages/${message_id}/`\n\n return apiClient.chat.delete({ url })\n }, [apiClient, conversation_id, message_id])\n\n const { mutate: handleReaction, isPending } = useMutation({\n mutationFn: handleReactionPress,\n onSuccess: result => {\n const updatedMessage = result.data\n type QueryData = InfiniteData<ApiCollection<MessageResource>>\n\n queryClient.setQueryData<QueryData>(queryKey, data =>\n updateRecordInPagesData({\n data,\n record: updatedMessage,\n })\n )\n navigation.goBack()\n },\n onError: () => {\n Alert.alert('Oops', 'We were unable to react to this message. Please try again.')\n },\n })\n\n const { mutate: handleDeleteMessage } = useMutation({\n mutationFn: deleteMessage,\n onSuccess: () => {\n refetch()\n navigation.goBack()\n },\n onError: () => {\n Alert.alert('Oops', 'We were unable to delete this message. Please try again.')\n },\n })\n\n const handleEditPress = useCallback(() => {\n const params = omitBy(\n {\n conversation_id,\n editing_message_id: message_id,\n chat_group_graph_id,\n },\n isNil\n )\n navigation.dispatch(StackActions.popTo('Conversation', params))\n }, [chat_group_graph_id, navigation, conversation_id, message_id])\n\n const handleViewReadReceiptsPress = useCallback(() => {\n const params = omitBy(\n {\n conversation_id,\n message_id,\n },\n isNil\n )\n navigation.dispatch(StackActions.popTo('MessageReadReceipts', params))\n }, [navigation, conversation_id, message_id])\n\n return (\n <View style={styles.container}>\n <View style={styles.reactionList}>\n {availableReactions.map((reaction, index) => (\n <Reaction key={index} reaction={reaction} onPress={() => handleReaction(reaction)} />\n ))}\n </View>\n <View style={styles.actions}>\n <View style={styles.actionButton}>\n <TextButton onPress={() => handleCopyPress(message?.text)}>Copy</TextButton>\n {message?.mine && <TextButton onPress={() => handleEditPress()}>Edit</TextButton>}\n {message?.mine && (\n <TextButton onPress={() => handleViewReadReceiptsPress()}>\n View read receipts\n </TextButton>\n )}\n {(message?.mine || canDeleteNonAuthoredMessages) && (\n <TextButton\n appearance=\"danger\"\n onPress={() => handleDeleteMessage()}\n disabled={isPending}\n >\n Delete\n </TextButton>\n )}\n </View>\n </View>\n </View>\n )\n}\n\nconst Reaction = ({\n reaction,\n onPress,\n}: {\n reaction: { value: ReactionCountResource['value']; emoji: string; mine: boolean | undefined }\n onPress: () => void\n}) => {\n const styles = useStyles()\n const reactionStyles = useReactionStyles({ mine: reaction.mine ? 1 : 0 })\n\n return (\n <PlatformPressable\n key={reaction.value}\n style={[reactionStyles.reaction, styles.reaction]}\n onPress={onPress}\n >\n <Text style={reactionStyles.reactionEmoji}>{REACTION_EMOJIS[reaction.value]}</Text>\n </PlatformPressable>\n )\n}\n\nconst useStyles = () => {\n const theme = useTheme()\n const { height } = useWindowDimensions()\n const { bottom } = useSafeAreaInsets()\n const btnBorderWidth = 1\n const baseSize = 44\n const reactionBtnSize = Platform.select({\n ios: baseSize,\n android: baseSize + btnBorderWidth * 2,\n })\n\n return StyleSheet.create({\n container: {\n justifyContent: 'flex-start',\n paddingTop: 12,\n paddingBottom: bottom,\n width: '100%',\n backgroundColor: theme.colors.fillColorNeutral100Inverted,\n height,\n },\n reaction: {\n height: reactionBtnSize,\n width: reactionBtnSize,\n borderWidth: btnBorderWidth,\n borderRadius: 32,\n justifyContent: 'center',\n },\n reactionList: {\n justifyContent: 'center',\n gap: 24,\n paddingVertical: 12,\n flexDirection: 'row',\n borderBottomColor: theme.colors.fillColorNeutral040,\n borderBottomWidth: 1,\n },\n actions: { flex: 1 },\n actionButton: { padding: 12, paddingBottom: 100, gap: 12 },\n })\n}\n"]}
1
+ {"version":3,"file":"message_actions_screen.js","sourceRoot":"","sources":["../../src/screens/message_actions_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAqB,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAEzF,OAAO,EAAgB,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACjF,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAA;AAChG,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAA;AAGpG,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEtC,MAAM,CAAC,MAAM,2BAA2B,GAAiC;IACvE,YAAY,EAAE,WAAW;IACzB,WAAW,EAAE,KAAK;IAClB,mBAAmB,E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AAG,GAAG,EAAE;IACrB,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAA;IACxB,MAAM,EAAE,MAAM,EAAE,GAAG,mBAAmB,EAAE,CAAA;IACxC,MAAM,EAAE,MAAM,EAAE,GAAG,iBAAiB,EAAE,CAAA;IACtC,MAAM,cAAc,GAAG,CAAC,CAAA;IACxB,MAAM,QAAQ,GAAG,EAAE,CAAA;IACnB,MAAM,eAAe,GAAG,QAAQ,CAAC,MAAM,CAAC;QACtC,GAAG,EAAE,QAAQ;QACb,OAAO,EAAE,QAAQ,GAAG,cAAc,GAAG,CAAC;KACvC,CAAC,CAAA;IAEF,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE;YACT,cAAc,EAAE,YAAY;YAC5B,UAAU,EAAE,EAAE;YACd,aAAa,EAAE,MAAM;YACrB,KAAK,EAAE,MAAM;YACb,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,2BAA2B;YACzD,MAAM;SACP;QACD,QAAQ,EAAE;YACR,MAAM,EAAE,eAAe;YACvB,KAAK,EAAE,eAAe;YACtB,WAAW,EAAE,cAAc;YAC3B,YAAY,EAAE,EAAE;YAChB,cAAc,EAAE,QAAQ;SACzB;QACD,YAAY,EAAE;YACZ,cAAc,EAAE,QAAQ;YACxB,GAAG,EAAE,EAAE;YACP,eAAe,EAAE,EAAE;YACnB,aAAa,EAAE,KAAK;YACpB,iBAAiB,EAAE,KAAK,CAAC,MAAM,CAAC,mBAAmB;YACnD,iBAAiB,EAAE,CAAC;SACrB;QACD,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;QACpB,YAAY,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,aAAa,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE;KAC3D,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable } from '@react-navigation/elements'\nimport { StackActions, StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport { NativeStackNavigationOptions } from '@react-navigation/native-stack'\nimport { InfiniteData, useMutation, useQueryClient } from '@tanstack/react-query'\nimport React, { useCallback } from 'react'\nimport { Alert, Platform, StyleSheet, useWindowDimensions, View } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { Text, TextButton } from '../components'\nimport { REACTION_EMOJIS, useReactionStyles } from '../components/conversation/message_reaction'\nimport { useTheme } from '../hooks'\nimport { useApiClient } from '../hooks/use_api_client'\nimport { getMessagesRequestArgs, useConversationMessages } from '../hooks/use_conversation_messages'\nimport { ApiCollection, ApiResource, MessageResource } from '../types'\nimport { ReactionCountResource } from '../types/resources/reaction'\nimport { updateRecordInPagesData } from '../utils'\nimport { Clipboard } from '../utils/native_adapters'\nimport { isNil, omitBy } from 'lodash'\n\nexport const MessageActionsScreenOptions: NativeStackNavigationOptions = {\n presentation: 'formSheet',\n headerShown: false,\n sheetAllowedDetents: [0.35],\n sheetGrabberVisible: true,\n}\n\nexport type MessageActionsScreenProps = StaticScreenProps<{\n message_id: string\n conversation_id: number\n canDeleteNonAuthoredMessages?: boolean\n}>\n\nexport function MessageActionsScreen({ route }: MessageActionsScreenProps) {\n const navigation = useNavigation()\n const { conversation_id, message_id, canDeleteNonAuthoredMessages } = route.params\n\n const apiClient = useApiClient()\n const queryClient = useQueryClient()\n const styles = useStyles()\n\n const { messages, queryKey, refetch } = useConversationMessages(\n { conversation_id },\n { refetchOnMount: false }\n )\n const message = messages.find(m => m.id === message_id)\n const myReactions = message?.reactionCounts\n .filter(reaction => reaction.mine)\n .map(reaction => reaction.value)\n\n const availableReactions = Object.entries(REACTION_EMOJIS).map(([value, emoji]) => {\n return {\n value: value as ReactionCountResource['value'],\n emoji,\n mine: myReactions?.includes(value as ReactionCountResource['value']),\n }\n })\n\n const handleCopyPress = (text?: string | null) => {\n Clipboard.setStringAsync(text || '')\n navigation.goBack()\n }\n\n const handleReactionPress = useCallback(\n ({ value, mine }: { value: keyof typeof REACTION_EMOJIS; mine?: boolean }) => {\n const requestParams = getMessagesRequestArgs({ conversation_id })\n\n // Value has already been updated\n const endpoint = !mine ? 'react' : 'unreact'\n const url = `/me/conversations/${conversation_id}/messages/${message_id}/${endpoint}`\n const fieldsWithValueJoined = Object.fromEntries(\n Object.entries(requestParams.data.fields).map(([k, v]) => [k, v.join(',')])\n )\n\n return apiClient.chat.post<ApiResource<MessageResource>>({\n url,\n data: {\n ...requestParams.data,\n data: {\n type: 'Message',\n attributes: { value: value },\n },\n fields: fieldsWithValueJoined,\n },\n })\n },\n [apiClient, conversation_id, message_id]\n )\n\n const deleteMessage = useCallback(() => {\n const url = `/me/conversations/${conversation_id}/messages/${message_id}/`\n\n return apiClient.chat.delete({ url })\n }, [apiClient, conversation_id, message_id])\n\n const { mutate: handleReaction, isPending } = useMutation({\n mutationFn: handleReactionPress,\n onSuccess: result => {\n const updatedMessage = result.data\n type QueryData = InfiniteData<ApiCollection<MessageResource>>\n\n queryClient.setQueryData<QueryData>(queryKey, data =>\n updateRecordInPagesData({\n data,\n record: updatedMessage,\n })\n )\n navigation.goBack()\n },\n onError: () => {\n Alert.alert('Oops', 'We were unable to react to this message. Please try again.')\n },\n })\n\n const { mutate: handleDeleteMessage } = useMutation({\n mutationFn: deleteMessage,\n onSuccess: () => {\n refetch()\n navigation.goBack()\n },\n onError: () => {\n Alert.alert('Oops', 'We were unable to delete this message. Please try again.')\n },\n })\n\n const handleEditPress = useCallback(() => {\n const state = navigation.getState?.()\n const targetRoute = state?.routes?.find(r => r.name === 'Conversation')\n const params = omitBy(\n {\n ...(targetRoute?.params || {}),\n conversation_id,\n editing_message_id: message_id,\n },\n isNil\n )\n navigation.dispatch(StackActions.popTo('Conversation', params))\n }, [navigation, conversation_id, message_id])\n\n const handleViewReadReceiptsPress = useCallback(() => {\n const params = omitBy(\n {\n conversation_id,\n message_id,\n },\n isNil\n )\n navigation.dispatch(StackActions.popTo('MessageReadReceipts', params))\n }, [navigation, conversation_id, message_id])\n\n return (\n <View style={styles.container}>\n <View style={styles.reactionList}>\n {availableReactions.map((reaction, index) => (\n <Reaction key={index} reaction={reaction} onPress={() => handleReaction(reaction)} />\n ))}\n </View>\n <View style={styles.actions}>\n <View style={styles.actionButton}>\n <TextButton onPress={() => handleCopyPress(message?.text)}>Copy</TextButton>\n {message?.mine && <TextButton onPress={() => handleEditPress()}>Edit</TextButton>}\n {message?.mine && (\n <TextButton onPress={() => handleViewReadReceiptsPress()}>\n View read receipts\n </TextButton>\n )}\n {(message?.mine || canDeleteNonAuthoredMessages) && (\n <TextButton\n appearance=\"danger\"\n onPress={() => handleDeleteMessage()}\n disabled={isPending}\n >\n Delete\n </TextButton>\n )}\n </View>\n </View>\n </View>\n )\n}\n\nconst Reaction = ({\n reaction,\n onPress,\n}: {\n reaction: { value: ReactionCountResource['value']; emoji: string; mine: boolean | undefined }\n onPress: () => void\n}) => {\n const styles = useStyles()\n const reactionStyles = useReactionStyles({ mine: reaction.mine ? 1 : 0 })\n\n return (\n <PlatformPressable\n key={reaction.value}\n style={[reactionStyles.reaction, styles.reaction]}\n onPress={onPress}\n >\n <Text style={reactionStyles.reactionEmoji}>{REACTION_EMOJIS[reaction.value]}</Text>\n </PlatformPressable>\n )\n}\n\nconst useStyles = () => {\n const theme = useTheme()\n const { height } = useWindowDimensions()\n const { bottom } = useSafeAreaInsets()\n const btnBorderWidth = 1\n const baseSize = 44\n const reactionBtnSize = Platform.select({\n ios: baseSize,\n android: baseSize + btnBorderWidth * 2,\n })\n\n return StyleSheet.create({\n container: {\n justifyContent: 'flex-start',\n paddingTop: 12,\n paddingBottom: bottom,\n width: '100%',\n backgroundColor: theme.colors.fillColorNeutral100Inverted,\n height,\n },\n reaction: {\n height: reactionBtnSize,\n width: reactionBtnSize,\n borderWidth: btnBorderWidth,\n borderRadius: 32,\n justifyContent: 'center',\n },\n reactionList: {\n justifyContent: 'center',\n gap: 24,\n paddingVertical: 12,\n flexDirection: 'row',\n borderBottomColor: theme.colors.fillColorNeutral040,\n borderBottomWidth: 1,\n },\n actions: { flex: 1 },\n actionButton: { padding: 12, paddingBottom: 100, gap: 12 },\n })\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planningcenter/chat-react-native",
3
- "version": "3.6.0-rc.13",
3
+ "version": "3.6.0-rc.14",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -55,5 +55,5 @@
55
55
  "prettier": "^3.4.2",
56
56
  "typescript": "<5.6.0"
57
57
  },
58
- "gitHead": "e544a01c7e93c402061db762dc856ecdcc8136b0"
58
+ "gitHead": "076dbebfc05d57666209ab2b6d10739ecf3ad614"
59
59
  }
@@ -8,7 +8,7 @@ import { Button, type ButtonProps } from './button'
8
8
  interface BlankStateProps {
9
9
  iconName?: IconString
10
10
  iconStyle?: IconStyle
11
- title: string
11
+ title?: string
12
12
  titleStyle?: HeadingProps['style']
13
13
  subtitle?: string
14
14
  subtitleStyle?: TextProps['style']
@@ -33,9 +33,11 @@ export const BlankState = ({
33
33
  {iconName && <Icon name={iconName} size={32} style={[styles.icon, iconStyle]} />}
34
34
 
35
35
  <View style={styles.content}>
36
- <Heading variant="h3" style={[styles.baseText, titleStyle]}>
37
- {title}
38
- </Heading>
36
+ {title && (
37
+ <Heading variant="h3" style={[styles.baseText, titleStyle]}>
38
+ {title}
39
+ </Heading>
40
+ )}
39
41
  {subtitle && (
40
42
  <Text variant="tertiary" style={[styles.baseText, subtitleStyle]}>
41
43
  {subtitle}
@@ -1,7 +1,7 @@
1
1
  import { useNavigation } from '@react-navigation/native'
2
2
  import React from 'react'
3
3
  import { ScrollView, StyleSheet, View } from 'react-native'
4
- import { Button, Heading } from '../../components'
4
+ import { BlankState, Button, Heading } from '../../components'
5
5
  import { GroupsGroupResource } from '../../types'
6
6
  import { useGroupsGroups } from '../../hooks/use_groups_groups'
7
7
  import { useSafeAreaInsets } from 'react-native-safe-area-context'
@@ -21,7 +21,7 @@ export const ConversationSelectRecipientsScreen = ({
21
21
  const styles = useStyles()
22
22
  const navigation = useNavigation()
23
23
 
24
- const { data: groups = [] } = useGroupsGroups()
24
+ const { data: groups = [], isFetching: isGroupsFetching } = useGroupsGroups()
25
25
  const groupsWithCreatePermission = groups.filter(g => g.canCreateConversation)
26
26
  const visibleGroups = groupsWithCreatePermission.slice(0, MAX_VISIBLE_RECIPIENTS)
27
27
  const hasMoreGroups = groupsWithCreatePermission.length > MAX_VISIBLE_RECIPIENTS
@@ -48,9 +48,10 @@ export const ConversationSelectRecipientsScreen = ({
48
48
  })
49
49
  }
50
50
 
51
- const { serviceTypes } = useServiceTypesWithTeams()
51
+ const { serviceTypes, isFetching: isServiceTypesFetching } = useServiceTypesWithTeams()
52
52
  const visibleServiceTypes = serviceTypes.slice(0, MAX_VISIBLE_RECIPIENTS)
53
53
  const hasMoreServiceTypes = serviceTypes.length > MAX_VISIBLE_RECIPIENTS
54
+ const hasServiceTypes = serviceTypes.length > 0
54
55
 
55
56
  const handleTeamsNavigateToConversationNew = (teams: ServiceTypeWithTeams['teams']) => {
56
57
  const teamIds = teams.map(team => team.id)
@@ -81,58 +82,75 @@ export const ConversationSelectRecipientsScreen = ({
81
82
  <Heading variant="h3">My groups</Heading>
82
83
  </View>
83
84
  <View>
84
- {visibleGroups.map(group => {
85
- return (
86
- <GroupsRecipientRow
87
- key={group.id}
88
- group={group}
89
- onPress={handleGroupsNavigateToConversationNew}
90
- />
91
- )
92
- })}
93
- {hasMoreGroups && (
94
- <ViewMoreLinkRow
95
- onPress={handleGroupsViewMore}
96
- accessibilityHint="Navigate to a full list of your groups."
85
+ {isGroupsFetching ? null : groupsWithCreatePermission.length === 0 ? (
86
+ <BlankState
87
+ subtitle="Join a group with chat enabled and permissions to start a new conversation."
88
+ style={styles.blankState}
97
89
  />
90
+ ) : (
91
+ <>
92
+ {visibleGroups.map(group => {
93
+ return (
94
+ <GroupsRecipientRow
95
+ key={group.id}
96
+ group={group}
97
+ onPress={handleGroupsNavigateToConversationNew}
98
+ />
99
+ )
100
+ })}
101
+ {hasMoreGroups && (
102
+ <ViewMoreLinkRow
103
+ onPress={handleGroupsViewMore}
104
+ accessibilityHint="Navigate to a full list of your groups."
105
+ />
106
+ )}
107
+ {showGroupsDisclaimer && <GroupsWithoutChatDisclaimerRow />}
108
+ </>
98
109
  )}
99
- {showGroupsDisclaimer && <GroupsWithoutChatDisclaimerRow />}
100
110
  </View>
101
111
  </View>
102
112
  <View style={styles.section}>
103
113
  <View style={styles.sectionHeader}>
104
114
  <Heading variant="h3">Teams I lead</Heading>
105
- <Button
106
- style={styles.selectTeamsButton}
107
- onPress={() =>
108
- navigation.navigate('New', {
109
- screen: 'ConversationFilterRecipients',
110
- params: {
111
- source_app_name: 'Services',
112
- },
113
- })
114
- }
115
- title="Select teams"
116
- variant="outline"
117
- iconNameLeft="general.search"
118
- size="sm"
119
- />
115
+ {hasServiceTypes && (
116
+ <Button
117
+ style={styles.selectTeamsButton}
118
+ onPress={() =>
119
+ navigation.navigate('New', {
120
+ screen: 'ConversationFilterRecipients',
121
+ params: {
122
+ source_app_name: 'Services',
123
+ },
124
+ })
125
+ }
126
+ title="Select teams"
127
+ variant="outline"
128
+ iconNameLeft="general.search"
129
+ size="sm"
130
+ />
131
+ )}
120
132
  </View>
121
133
  <View>
122
- {visibleServiceTypes.map(serviceType => {
123
- return (
124
- <TeamRecipientRow
125
- key={serviceType.id}
126
- serviceType={serviceType}
127
- onPress={handleTeamsNavigateToConversationNew}
128
- />
129
- )
130
- })}
131
- {hasMoreServiceTypes && (
132
- <ViewMoreLinkRow
133
- onPress={handleServiceTypesViewMore}
134
- accessibilityHint="Navigate to a full list of teams you lead."
135
- />
134
+ {isServiceTypesFetching ? null : hasServiceTypes ? (
135
+ <>
136
+ {visibleServiceTypes.map(serviceType => {
137
+ return (
138
+ <TeamRecipientRow
139
+ key={serviceType.id}
140
+ serviceType={serviceType}
141
+ onPress={handleTeamsNavigateToConversationNew}
142
+ />
143
+ )
144
+ })}
145
+ {hasMoreServiceTypes && (
146
+ <ViewMoreLinkRow
147
+ onPress={handleServiceTypesViewMore}
148
+ accessibilityHint="Navigate to a full list of teams you lead."
149
+ />
150
+ )}
151
+ </>
152
+ ) : (
153
+ <BlankState subtitle="You don't lead any teams." style={styles.blankState} />
136
154
  )}
137
155
  </View>
138
156
  </View>
@@ -159,5 +177,9 @@ const useStyles = () => {
159
177
  paddingBottom: 4,
160
178
  },
161
179
  selectTeamsButton: {},
180
+ blankState: {
181
+ marginTop: 24,
182
+ marginBottom: 48,
183
+ },
162
184
  })
163
185
  }
@@ -26,14 +26,12 @@ export const MessageActionsScreenOptions: NativeStackNavigationOptions = {
26
26
  export type MessageActionsScreenProps = StaticScreenProps<{
27
27
  message_id: string
28
28
  conversation_id: number
29
- chat_group_graph_id?: string
30
29
  canDeleteNonAuthoredMessages?: boolean
31
30
  }>
32
31
 
33
32
  export function MessageActionsScreen({ route }: MessageActionsScreenProps) {
34
33
  const navigation = useNavigation()
35
- const { conversation_id, message_id, chat_group_graph_id, canDeleteNonAuthoredMessages } =
36
- route.params
34
+ const { conversation_id, message_id, canDeleteNonAuthoredMessages } = route.params
37
35
 
38
36
  const apiClient = useApiClient()
39
37
  const queryClient = useQueryClient()
@@ -124,16 +122,18 @@ export function MessageActionsScreen({ route }: MessageActionsScreenProps) {
124
122
  })
125
123
 
126
124
  const handleEditPress = useCallback(() => {
125
+ const state = navigation.getState?.()
126
+ const targetRoute = state?.routes?.find(r => r.name === 'Conversation')
127
127
  const params = omitBy(
128
128
  {
129
+ ...(targetRoute?.params || {}),
129
130
  conversation_id,
130
131
  editing_message_id: message_id,
131
- chat_group_graph_id,
132
132
  },
133
133
  isNil
134
134
  )
135
135
  navigation.dispatch(StackActions.popTo('Conversation', params))
136
- }, [chat_group_graph_id, navigation, conversation_id, message_id])
136
+ }, [navigation, conversation_id, message_id])
137
137
 
138
138
  const handleViewReadReceiptsPress = useCallback(() => {
139
139
  const params = omitBy(