@planningcenter/chat-react-native 3.9.3-rc.0 → 3.9.3-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/build/components/display/switch.d.ts.map +1 -1
  2. package/build/components/display/switch.js +1 -4
  3. package/build/components/display/switch.js.map +1 -1
  4. package/build/components/primitive/form_sheet.d.ts +2 -2
  5. package/build/components/primitive/form_sheet.d.ts.map +1 -1
  6. package/build/components/primitive/form_sheet.js +12 -7
  7. package/build/components/primitive/form_sheet.js.map +1 -1
  8. package/build/screens/attachment_actions/attachment_actions_screen.d.ts.map +1 -1
  9. package/build/screens/attachment_actions/attachment_actions_screen.js +10 -2
  10. package/build/screens/attachment_actions/attachment_actions_screen.js.map +1 -1
  11. package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.d.ts.map +1 -1
  12. package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js +14 -9
  13. package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js.map +1 -1
  14. package/build/screens/conversations/components/chat_group_badge.d.ts +3 -1
  15. package/build/screens/conversations/components/chat_group_badge.d.ts.map +1 -1
  16. package/build/screens/conversations/components/chat_group_badge.js +4 -3
  17. package/build/screens/conversations/components/chat_group_badge.js.map +1 -1
  18. package/build/screens/conversations/components/list_header_component.d.ts.map +1 -1
  19. package/build/screens/conversations/components/list_header_component.js +4 -8
  20. package/build/screens/conversations/components/list_header_component.js.map +1 -1
  21. package/build/screens/message_actions_screen.d.ts.map +1 -1
  22. package/build/screens/message_actions_screen.js +6 -3
  23. package/build/screens/message_actions_screen.js.map +1 -1
  24. package/build/screens/reactions_screen.js +3 -3
  25. package/build/screens/reactions_screen.js.map +1 -1
  26. package/build/screens/send_giphy_screen.js +3 -3
  27. package/build/screens/send_giphy_screen.js.map +1 -1
  28. package/build/utils/theme.d.ts +0 -3
  29. package/build/utils/theme.d.ts.map +1 -1
  30. package/build/utils/theme.js +0 -6
  31. package/build/utils/theme.js.map +1 -1
  32. package/package.json +2 -2
  33. package/src/components/display/switch.tsx +1 -5
  34. package/src/components/primitive/form_sheet.tsx +18 -11
  35. package/src/screens/attachment_actions/attachment_actions_screen.tsx +11 -2
  36. package/src/screens/conversation_filter_recipients/conversation_filter_recipients_screen.tsx +15 -9
  37. package/src/screens/conversations/components/chat_group_badge.tsx +4 -3
  38. package/src/screens/conversations/components/list_header_component.tsx +5 -8
  39. package/src/screens/message_actions_screen.tsx +6 -3
  40. package/src/screens/reactions_screen.tsx +3 -3
  41. package/src/screens/send_giphy_screen.tsx +3 -3
  42. package/src/utils/theme.ts +0 -15
@@ -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;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACpC,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAA;AAChG,OAAO,EAAE,2BAA2B,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAA;AAC5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAA;AAE/E,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,EAAE,K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e,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAC5E;IAAA,EAAE,iBAAiB,CAAC,CACrB,CAAA;AACH,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAC7B,MAAM,SAAS,GAAG,YAAY,CAAC,EAAE,qBAAqB,EAAE,GAAG,EAAE,CAAC,CAAA;IAE9D,MAAM,cAAc,GAAG,CAAC,CAAA;IACxB,MAAM,QAAQ,GAAG,EAAE,GAAG,SAAS,CAAA;IAC/B,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,YAAY,EAAE;YACZ,aAAa,EAAE,KAAK;YACpB,cAAc,EAAE,QAAQ;YACxB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,EAAE;YACP,UAAU,EAAE,CAAC;YACb,aAAa,EAAE,EAAE;YACjB,iBAAiB,EAAE,MAAM,CAAC,sBAAsB;YAChD,iBAAiB,EAAE,CAAC;SACrB;QACD,QAAQ,EAAE;YACR,MAAM,EAAE,eAAe;YACvB,KAAK,EAAE,eAAe;YACtB,WAAW,EAAE,cAAc;YAC3B,YAAY,EAAE,EAAE;YAChB,cAAc,EAAE,QAAQ;YACxB,QAAQ,EAAE,QAAQ;SACnB;QACD,aAAa,EAAE;YACb,QAAQ,EAAE,EAAE;SACb;QACD,OAAO,EAAE;YACP,UAAU,EAAE,CAAC;SACd;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable } from '@react-navigation/elements'\nimport { StackActions, StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport { useMutation } from '@tanstack/react-query'\nimport React, { useCallback } from 'react'\nimport { Alert, Platform, StyleSheet, View } from 'react-native'\nimport { Text } from '../components'\nimport { REACTION_EMOJIS, useReactionStyles } from '../components/conversation/message_reaction'\nimport { useCreateAndroidRippleColor, useFontScale, useTheme } from '../hooks'\nimport { useApiClient } from '../hooks/use_api_client'\nimport { useConversationMessages } from '../hooks/use_conversation_messages'\nimport { useMessageReactionToggle } from '../hooks/use_message_reaction_toggle'\nimport { ReactionCountResource } from '../types/resources/reaction'\nimport { Clipboard } from '../utils/native_adapters'\nimport { isNil, omitBy } from 'lodash'\nimport FormSheet, { getFormSheetScreenOptions } from '../components/primitive/form_sheet'\n\nexport const MessageActionsScreenOptions = getFormSheetScreenOptions({\n sheetAllowedDetents: [0.5],\n headerTitle: 'Message actions',\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 styles = useStyles()\n\n const { messages, refetch } = useConversationMessages(\n { conversation_id },\n { refetchOnMount: false }\n )\n const message = messages.find(m => m.id === message_id)\n\n if (!message) fail('Message not found')\n\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 attachmentForCopy = (): string => {\n const giphyTitleLink = message?.attachments.find(\n attachment => attachment.type === 'giphy'\n )?.titleLink\n\n if (giphyTitleLink) return giphyTitleLink\n return ''\n }\n\n const handleCopyPress = () => {\n Clipboard.setStringAsync(message?.text || attachmentForCopy() || '')\n navigation.goBack()\n }\n\n const { handleReactionToggle, isPending } = useMessageReactionToggle({\n conversation_id,\n message,\n onSuccess: () => navigation.goBack(),\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: 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 handleDeleteConfirm = useCallback(() => {\n Alert.alert('Delete message', 'Are you sure you want to permanently delete this message?', [\n { text: 'Cancel', style: 'cancel' },\n { text: 'Delete', style: 'destructive', onPress: () => handleDeleteMessage() },\n ])\n }, [handleDeleteMessage])\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 <FormSheet.Root>\n <View style={styles.reactionList}>\n {availableReactions.map((reaction, index) => (\n <Reaction\n key={index}\n reaction={reaction}\n onPress={() =>\n handleReactionToggle({\n value: reaction.value,\n mine: reaction.mine,\n })\n }\n />\n ))}\n </View>\n <View style={styles.actions}>\n <FormSheet.Action\n onPress={handleCopyPress}\n title=\"Copy text\"\n iconName=\"services.fileCopy\"\n accessibilityHint=\"Copies text and links to clipboard\"\n />\n {message?.mine && (\n <FormSheet.Action\n onPress={() => handleEditPress()}\n title=\"Edit message\"\n iconName=\"accounts.editor\"\n accessibilityHint=\"Opens existing text in the message form input.\"\n />\n )}\n {message?.mine && (\n <FormSheet.Action\n onPress={() => handleViewReadReceiptsPress()}\n title=\"View read receipts\"\n iconName=\"general.checkPerson\"\n accessibilityHint=\"Opens a modal with a list of people who read your message.\"\n />\n )}\n {(message?.mine || canDeleteNonAuthoredMessages) && (\n <FormSheet.Action\n onPress={() => handleDeleteConfirm()}\n title=\"Delete message\"\n iconName=\"publishing.trash\"\n appearance=\"danger\"\n disabled={isPending}\n accessibilityHint=\"Opens a confirmation alert to delete this message permanently.\"\n />\n )}\n </View>\n </FormSheet.Root>\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 const { colors } = useTheme()\n const baseRippleColor = reaction.mine ? colors.interaction : colors.fillColorNeutral060\n const androidRippleColor = useCreateAndroidRippleColor({ color: baseRippleColor })\n\n return (\n <PlatformPressable\n key={reaction.value}\n style={[reactionStyles.reaction, styles.reaction]}\n android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}\n onPress={onPress}\n >\n <Text style={styles.reactionEmoji}>{REACTION_EMOJIS[reaction.value]}</Text>\n </PlatformPressable>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n const fontScale = useFontScale({ maxFontSizeMultiplier: 1.3 })\n\n const btnBorderWidth = 1\n const baseSize = 46 * fontScale\n const reactionBtnSize = Platform.select({\n ios: baseSize,\n android: baseSize + btnBorderWidth * 2,\n })\n\n return StyleSheet.create({\n reactionList: {\n flexDirection: 'row',\n justifyContent: 'center',\n alignItems: 'center',\n gap: 16,\n paddingTop: 8,\n paddingBottom: 16,\n borderBottomColor: colors.borderColorDefaultBase,\n borderBottomWidth: 1,\n },\n reaction: {\n height: reactionBtnSize,\n width: reactionBtnSize,\n borderWidth: btnBorderWidth,\n borderRadius: 32,\n justifyContent: 'center',\n overflow: 'hidden',\n },\n reactionEmoji: {\n fontSize: 24,\n },\n actions: {\n paddingTop: 4,\n },\n })\n}\n"]}
1
+ {"version":3,"file":"message_actions_screen.js","source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G,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,gBAAgB,EAAE;YAChB,UAAU,EAAE,EAAE;SACf;QACD,YAAY,EAAE;YACZ,aAAa,EAAE,KAAK;YACpB,cAAc,EAAE,QAAQ;YACxB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,EAAE;YACP,UAAU,EAAE,CAAC;YACb,aAAa,EAAE,EAAE;YACjB,iBAAiB,EAAE,MAAM,CAAC,sBAAsB;YAChD,iBAAiB,EAAE,CAAC;SACrB;QACD,QAAQ,EAAE;YACR,MAAM,EAAE,eAAe;YACvB,KAAK,EAAE,eAAe;YACtB,WAAW,EAAE,cAAc;YAC3B,YAAY,EAAE,EAAE;YAChB,cAAc,EAAE,QAAQ;YACxB,QAAQ,EAAE,QAAQ;SACnB;QACD,aAAa,EAAE;YACb,QAAQ,EAAE,EAAE;SACb;QACD,OAAO,EAAE;YACP,UAAU,EAAE,CAAC;SACd;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable } from '@react-navigation/elements'\nimport { StackActions, StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport { useMutation } from '@tanstack/react-query'\nimport { isNil, omitBy } from 'lodash'\nimport React, { useCallback } from 'react'\nimport { Alert, Platform, StyleSheet, View } from 'react-native'\nimport { Text } from '../components'\nimport { REACTION_EMOJIS, useReactionStyles } from '../components/conversation/message_reaction'\nimport FormSheet, { getFormSheetScreenOptions } from '../components/primitive/form_sheet'\nimport { useCreateAndroidRippleColor, useFontScale, useTheme } from '../hooks'\nimport { useApiClient } from '../hooks/use_api_client'\nimport { useConversationMessages } from '../hooks/use_conversation_messages'\nimport { useMessageReactionToggle } from '../hooks/use_message_reaction_toggle'\nimport { ReactionCountResource } from '../types/resources/reaction'\nimport { Clipboard } from '../utils/native_adapters'\n\nexport const MessageActionsScreenOptions = getFormSheetScreenOptions({\n sheetAllowedDetents: [0.5],\n headerTitle: 'Message actions',\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 styles = useStyles()\n\n const { messages, refetch } = useConversationMessages(\n { conversation_id },\n { refetchOnMount: false }\n )\n const message = messages.find(m => m.id === message_id)\n\n if (!message) fail('Message not found')\n\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 attachmentForCopy = (): string => {\n const giphyTitleLink = message?.attachments.find(\n attachment => attachment.type === 'giphy'\n )?.titleLink\n\n if (giphyTitleLink) return giphyTitleLink\n return ''\n }\n\n const handleCopyPress = () => {\n Clipboard.setStringAsync(message?.text || attachmentForCopy() || '')\n navigation.goBack()\n }\n\n const { handleReactionToggle, isPending } = useMessageReactionToggle({\n conversation_id,\n message,\n onSuccess: () => navigation.goBack(),\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: 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 handleDeleteConfirm = useCallback(() => {\n Alert.alert('Delete message', 'Are you sure you want to permanently delete this message?', [\n { text: 'Cancel', style: 'cancel' },\n { text: 'Delete', style: 'destructive', onPress: () => handleDeleteMessage() },\n ])\n }, [handleDeleteMessage])\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 <FormSheet.Root style={styles.formSheetContent}>\n <View style={styles.reactionList}>\n {availableReactions.map((reaction, index) => (\n <Reaction\n key={index}\n reaction={reaction}\n onPress={() =>\n handleReactionToggle({\n value: reaction.value,\n mine: reaction.mine,\n })\n }\n />\n ))}\n </View>\n <View style={styles.actions}>\n <FormSheet.Action\n onPress={handleCopyPress}\n title=\"Copy text\"\n iconName=\"services.fileCopy\"\n accessibilityHint=\"Copies text and links to clipboard\"\n />\n {message?.mine && (\n <FormSheet.Action\n onPress={() => handleEditPress()}\n title=\"Edit message\"\n iconName=\"accounts.editor\"\n accessibilityHint=\"Opens existing text in the message form input.\"\n />\n )}\n {message?.mine && (\n <FormSheet.Action\n onPress={() => handleViewReadReceiptsPress()}\n title=\"View read receipts\"\n iconName=\"general.checkPerson\"\n accessibilityHint=\"Opens a modal with a list of people who read your message.\"\n />\n )}\n {(message?.mine || canDeleteNonAuthoredMessages) && (\n <FormSheet.Action\n onPress={() => handleDeleteConfirm()}\n title=\"Delete message\"\n iconName=\"publishing.trash\"\n appearance=\"danger\"\n disabled={isPending}\n accessibilityHint=\"Opens a confirmation alert to delete this message permanently.\"\n />\n )}\n </View>\n </FormSheet.Root>\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 const { colors } = useTheme()\n const baseRippleColor = reaction.mine ? colors.interaction : colors.fillColorNeutral060\n const androidRippleColor = useCreateAndroidRippleColor({ color: baseRippleColor })\n\n return (\n <PlatformPressable\n key={reaction.value}\n style={[reactionStyles.reaction, styles.reaction]}\n android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}\n onPress={onPress}\n >\n <Text style={styles.reactionEmoji}>{REACTION_EMOJIS[reaction.value]}</Text>\n </PlatformPressable>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n const fontScale = useFontScale({ maxFontSizeMultiplier: 1.3 })\n\n const btnBorderWidth = 1\n const baseSize = 46 * fontScale\n const reactionBtnSize = Platform.select({\n ios: baseSize,\n android: baseSize + btnBorderWidth * 2,\n })\n\n return StyleSheet.create({\n formSheetContent: {\n paddingTop: 16,\n },\n reactionList: {\n flexDirection: 'row',\n justifyContent: 'center',\n alignItems: 'center',\n gap: 16,\n paddingTop: 8,\n paddingBottom: 16,\n borderBottomColor: colors.borderColorDefaultBase,\n borderBottomWidth: 1,\n },\n reaction: {\n height: reactionBtnSize,\n width: reactionBtnSize,\n borderWidth: btnBorderWidth,\n borderRadius: 32,\n justifyContent: 'center',\n overflow: 'hidden',\n },\n reactionEmoji: {\n fontSize: 24,\n },\n actions: {\n paddingTop: 4,\n },\n })\n}\n"]}
@@ -5,11 +5,11 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context';
5
5
  import { Avatar, Text } from '../components';
6
6
  import { REACTION_EMOJIS } from '../components/conversation/message_reaction';
7
7
  import { Tabs } from '../components/display/tabs';
8
+ import FormSheet, { getFormSheetScreenOptions } from '../components/primitive/form_sheet';
8
9
  import { useSuspenseGet, useTheme } from '../hooks';
9
10
  import { useConversationMessages } from '../hooks/use_conversation_messages';
10
- import FormSheet, { getFormSheetScreenOptions } from '../components/primitive/form_sheet';
11
- import { platformFontWeightMedium } from '../utils';
12
11
  import { useFontScale } from '../hooks/use_font_scale';
12
+ import { platformFontWeightMedium } from '../utils';
13
13
  export const ReactionsScreenOptions = getFormSheetScreenOptions({
14
14
  sheetAllowedDetents: Platform.select({
15
15
  android: [0.5, 0.94], // Going straight to full 0.94 preserves height of screen on Android
@@ -70,7 +70,7 @@ const useStyles = () => {
70
70
  const fontScale = useFontScale({ maxFontSizeMultiplier: 1.3 });
71
71
  return StyleSheet.create({
72
72
  formSheetContent: {
73
- paddingTop: Platform.select({ android: 4, default: 16 }),
73
+ paddingTop: 16,
74
74
  },
75
75
  contentContainer: {
76
76
  paddingTop: 8,
@@ -1 +1 @@
1
- {"version":3,"file":"reactions_screen.js","sourceRoot":"","sources":["../../src/screens/reactions_screen.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAA;AAC7E,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAA;AAG5E,OAAO,SAAS,EAAE,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAA;AACzF,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAEtD,MAAM,CAAC,MAAM,sBAAsB,GAAG,yBAAyB,CAAC;IAC9D,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YACzB,iBAAiB,EAAE,MAAM,CAAC,sBAAsB;YAChD,iBAAiB,EAAE,CAAC;SACrB;QACD,cAAc,EAAE;YACd,IAAI,EAAE,CAAC;YACP,cAAc,EAAE,QAAQ;YACxB,UAAU,EAAE,QAAQ;YACpB,OAAO,EAAE,EAAE;YACX,SAAS,EAAE,EAAE;SACd;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { StaticScreenProps } from '@react-navigation/native'\nimport React, { memo } from 'react'\nimport { Platform, StyleSheet, View } from 'react-native'\nimport { FlatList } from 'react-native-gesture-handler'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { Avatar, Text } from '../components'\nimport { REACTION_EMOJIS } from '../components/conversation/message_reaction'\nimport { Tabs } from '../components/display/tabs'\nimport { useSuspenseGet, useTheme } from '../hooks'\nimport { useConversationMessages } from '../hooks/use_conversation_messages'\nimport { MemberResource } from '../types'\nimport { ReactionCountResource } from '../types/resources/reaction'\nimport FormSheet, { getFormSheetScreenOptions } from '../components/primitive/form_sheet'\nimport { platformFontWeightMedium } from '../utils'\nimport { useFontScale } from '../hooks/use_font_scale'\n\nexport const ReactionsScreenOptions = getFormSheetScreenOptions({\n sheetAllowedDetents: Platform.select({\n android: [0.5, 0.94], // Going straight to full 0.94 preserves height of screen on Android\n default: [0.5, 1],\n }),\n headerTitle: 'Reactions',\n})\n\nexport type ReactionScreenProps = StaticScreenProps<{\n message_id: string\n conversation_id: number\n reaction_value?: string\n}>\n\nexport function ReactionsScreen({ route }: ReactionScreenProps) {\n const { conversation_id, message_id, reaction_value } = route.params\n const styles = useStyles()\n\n const { messages } = useConversationMessages({ conversation_id }, { refetchOnMount: false })\n const { data: members } = useSuspenseGet<MemberResource[]>({\n url: `/me/conversations/${conversation_id}/members`,\n data: {\n fields: {\n Member: ['id', 'name', 'avatar', 'badges', 'child', 'role'],\n },\n },\n })\n const message = messages.find(m => m.id === message_id)\n const reactionCounts = message?.reactionCounts || []\n const initialReactionCount =\n reactionCounts.find(r => r.value === reaction_value) || reactionCounts[0]\n const [reactionCountValue, setReactionCountValue] = React.useState<\n ReactionCountResource['value']\n >(initialReactionCount.value)\n const reactionCount = reactionCounts.find(r => r.value === reactionCountValue)\n\n if (!reactionCount) {\n return (\n <View style={styles.errorContainer}>\n <Text>No reactions found for this message.</Text>\n </View>\n )\n }\n\n const authorIds = reactionCount.authorIds\n const authors = members.filter(member => authorIds.includes(member.id))\n\n return (\n <FormSheet.Root contentStyle={styles.formSheetContent}>\n <Tabs\n data={reactionCounts}\n activeTab={reactionCount}\n onTabPress={item => {\n setReactionCountValue(item.value)\n }}\n renderItem={({ item }) => (\n <Reaction\n active={reactionCount.id === item.id}\n reaction={item}\n onPress={() => setReactionCountValue(item.value)}\n />\n )}\n style={styles.actions}\n />\n <FlatList\n data={authors}\n contentContainerStyle={styles.contentContainer}\n keyExtractor={item => item.id.toString()}\n renderItem={({ item: author }) => <Author author={author} key={author.id} />}\n />\n </FormSheet.Root>\n )\n}\n\nconst Reaction = ({\n reaction,\n}: {\n active: boolean\n reaction: ReactionCountResource\n onPress: () => void\n}) => {\n const styles = useStyles()\n\n return (\n <View key={reaction.value} style={styles.reaction}>\n <Text style={styles.reactionContent}>{REACTION_EMOJIS[reaction.value]}</Text>\n <Text style={styles.reactionContent}>{reaction.count}</Text>\n </View>\n )\n}\n\ntype AuthorProps = Pick<MemberResource, 'id' | 'name' | 'avatar'>\n\nconst Author = memo(({ author }: { author: AuthorProps }) => {\n const styles = useStyles()\n\n return (\n <View style={styles.authorRow}>\n <Avatar sourceUri={author.avatar} size=\"sm\" />\n <Text variant=\"tertiary\" numberOfLines={2} style={styles.authorName}>\n {author.name}\n </Text>\n </View>\n )\n})\n\nconst useStyles = () => {\n const { colors } = useTheme()\n const { bottom } = useSafeAreaInsets()\n const fontScale = useFontScale({ maxFontSizeMultiplier: 1.3 })\n\n return StyleSheet.create({\n formSheetContent: {\n paddingTop: Platform.select({ android: 4, default: 16 }),\n },\n contentContainer: {\n paddingTop: 8,\n paddingBottom: bottom + Platform.select({ android: 24, default: 16 }),\n },\n authorRow: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n paddingVertical: 8,\n paddingHorizontal: 16,\n flex: 1,\n },\n authorName: {\n flex: 1,\n },\n reaction: {\n paddingHorizontal: 8,\n paddingVertical: 16,\n flexDirection: 'row',\n gap: 4,\n },\n reactionContent: {\n fontSize: 18,\n fontWeight: platformFontWeightMedium,\n },\n actions: {\n minHeight: 68 * fontScale,\n borderBottomColor: colors.borderColorDefaultBase,\n borderBottomWidth: 1,\n },\n errorContainer: {\n flex: 1,\n justifyContent: 'center',\n alignItems: 'center',\n padding: 16,\n marginTop: 30,\n },\n })\n}\n"]}
1
+ {"version":3,"file":"reactions_screen.js","sourceRoot":"","sources":["../../src/screens/reactions_screen.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAA;AAC7E,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAA;AACjD,OAAO,SAAS,EAAE,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAA;AACzF,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAA;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAGtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAA;AAEnD,MAAM,CAAC,MA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YAChD,iBAAiB,EAAE,CAAC;SACrB;QACD,cAAc,EAAE;YACd,IAAI,EAAE,CAAC;YACP,cAAc,EAAE,QAAQ;YACxB,UAAU,EAAE,QAAQ;YACpB,OAAO,EAAE,EAAE;YACX,SAAS,EAAE,EAAE;SACd;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { StaticScreenProps } from '@react-navigation/native'\nimport React, { memo } from 'react'\nimport { Platform, StyleSheet, View } from 'react-native'\nimport { FlatList } from 'react-native-gesture-handler'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { Avatar, Text } from '../components'\nimport { REACTION_EMOJIS } from '../components/conversation/message_reaction'\nimport { Tabs } from '../components/display/tabs'\nimport FormSheet, { getFormSheetScreenOptions } from '../components/primitive/form_sheet'\nimport { useSuspenseGet, useTheme } from '../hooks'\nimport { useConversationMessages } from '../hooks/use_conversation_messages'\nimport { useFontScale } from '../hooks/use_font_scale'\nimport { MemberResource } from '../types'\nimport { ReactionCountResource } from '../types/resources/reaction'\nimport { platformFontWeightMedium } from '../utils'\n\nexport const ReactionsScreenOptions = getFormSheetScreenOptions({\n sheetAllowedDetents: Platform.select({\n android: [0.5, 0.94], // Going straight to full 0.94 preserves height of screen on Android\n default: [0.5, 1],\n }),\n headerTitle: 'Reactions',\n})\n\nexport type ReactionScreenProps = StaticScreenProps<{\n message_id: string\n conversation_id: number\n reaction_value?: string\n}>\n\nexport function ReactionsScreen({ route }: ReactionScreenProps) {\n const { conversation_id, message_id, reaction_value } = route.params\n const styles = useStyles()\n\n const { messages } = useConversationMessages({ conversation_id }, { refetchOnMount: false })\n const { data: members } = useSuspenseGet<MemberResource[]>({\n url: `/me/conversations/${conversation_id}/members`,\n data: {\n fields: {\n Member: ['id', 'name', 'avatar', 'badges', 'child', 'role'],\n },\n },\n })\n const message = messages.find(m => m.id === message_id)\n const reactionCounts = message?.reactionCounts || []\n const initialReactionCount =\n reactionCounts.find(r => r.value === reaction_value) || reactionCounts[0]\n const [reactionCountValue, setReactionCountValue] = React.useState<\n ReactionCountResource['value']\n >(initialReactionCount.value)\n const reactionCount = reactionCounts.find(r => r.value === reactionCountValue)\n\n if (!reactionCount) {\n return (\n <View style={styles.errorContainer}>\n <Text>No reactions found for this message.</Text>\n </View>\n )\n }\n\n const authorIds = reactionCount.authorIds\n const authors = members.filter(member => authorIds.includes(member.id))\n\n return (\n <FormSheet.Root contentStyle={styles.formSheetContent}>\n <Tabs\n data={reactionCounts}\n activeTab={reactionCount}\n onTabPress={item => {\n setReactionCountValue(item.value)\n }}\n renderItem={({ item }) => (\n <Reaction\n active={reactionCount.id === item.id}\n reaction={item}\n onPress={() => setReactionCountValue(item.value)}\n />\n )}\n style={styles.actions}\n />\n <FlatList\n data={authors}\n contentContainerStyle={styles.contentContainer}\n keyExtractor={item => item.id.toString()}\n renderItem={({ item: author }) => <Author author={author} key={author.id} />}\n />\n </FormSheet.Root>\n )\n}\n\nconst Reaction = ({\n reaction,\n}: {\n active: boolean\n reaction: ReactionCountResource\n onPress: () => void\n}) => {\n const styles = useStyles()\n\n return (\n <View key={reaction.value} style={styles.reaction}>\n <Text style={styles.reactionContent}>{REACTION_EMOJIS[reaction.value]}</Text>\n <Text style={styles.reactionContent}>{reaction.count}</Text>\n </View>\n )\n}\n\ntype AuthorProps = Pick<MemberResource, 'id' | 'name' | 'avatar'>\n\nconst Author = memo(({ author }: { author: AuthorProps }) => {\n const styles = useStyles()\n\n return (\n <View style={styles.authorRow}>\n <Avatar sourceUri={author.avatar} size=\"sm\" />\n <Text variant=\"tertiary\" numberOfLines={2} style={styles.authorName}>\n {author.name}\n </Text>\n </View>\n )\n})\n\nconst useStyles = () => {\n const { colors } = useTheme()\n const { bottom } = useSafeAreaInsets()\n const fontScale = useFontScale({ maxFontSizeMultiplier: 1.3 })\n\n return StyleSheet.create({\n formSheetContent: {\n paddingTop: 16,\n },\n contentContainer: {\n paddingTop: 8,\n paddingBottom: bottom + Platform.select({ android: 24, default: 16 }),\n },\n authorRow: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n paddingVertical: 8,\n paddingHorizontal: 16,\n flex: 1,\n },\n authorName: {\n flex: 1,\n },\n reaction: {\n paddingHorizontal: 8,\n paddingVertical: 16,\n flexDirection: 'row',\n gap: 4,\n },\n reactionContent: {\n fontSize: 18,\n fontWeight: platformFontWeightMedium,\n },\n actions: {\n minHeight: 68 * fontScale,\n borderBottomColor: colors.borderColorDefaultBase,\n borderBottomWidth: 1,\n },\n errorContainer: {\n flex: 1,\n justifyContent: 'center',\n alignItems: 'center',\n padding: 16,\n marginTop: 30,\n },\n })\n}\n"]}
@@ -1,12 +1,12 @@
1
1
  import { StackActions, useNavigation } from '@react-navigation/native';
2
2
  import React from 'react';
3
3
  import { Image as NativeImage, Platform, StyleSheet, useWindowDimensions, View } from 'react-native';
4
- import { useGiphy } from '../hooks/use_giphy';
5
4
  import { Button, IconButton, TextButton } from '../components';
6
5
  import { DefaultLoading } from '../components/page/loading';
7
- import { useMessageCreateOrUpdate } from '../hooks/use_message_create_or_update';
8
6
  import FormSheet, { getFormSheetScreenOptions } from '../components/primitive/form_sheet';
9
7
  import { useCreateAndroidRippleColor, useTheme } from '../hooks';
8
+ import { useGiphy } from '../hooks/use_giphy';
9
+ import { useMessageCreateOrUpdate } from '../hooks/use_message_create_or_update';
10
10
  import { tokens } from '../vendor/tapestry/tokens';
11
11
  export const SendGiphyScreenOptions = getFormSheetScreenOptions({
12
12
  headerTitle: 'Send Giphy',
@@ -80,7 +80,7 @@ const useStyles = () => {
80
80
  const { colors } = useTheme();
81
81
  return StyleSheet.create({
82
82
  container: {
83
- paddingTop: Platform.select({ android: 24, default: 32 }),
83
+ paddingTop: 32,
84
84
  paddingHorizontal: 16,
85
85
  gap: 8,
86
86
  },
@@ -1 +1 @@
1
- {"version":3,"file":"send_giphy_screen.js","sourceRoot":"","sources":["../../src/screens/send_giphy_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAqB,aAAa,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CAAC,CAAA;AAED,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;6CA2BiB,CAAA","sourcesContent":["import { StackActions, StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport React from 'react'\nimport { Image as NativeImage, Platform, StyleSheet, useWindowDimensions, View } from 'react-native'\nimport { useGiphy } from '../hooks/use_giphy'\nimport { Button, IconButton, IconString, TextButton } from '../components'\nimport { DefaultLoading } from '../components/page/loading'\nimport { useMessageCreateOrUpdate } from '../hooks/use_message_create_or_update'\nimport FormSheet, { getFormSheetScreenOptions } from '../components/primitive/form_sheet'\nimport { useCreateAndroidRippleColor, useTheme } from '../hooks'\nimport { tokens } from '../vendor/tapestry/tokens'\n\nexport const SendGiphyScreenOptions = getFormSheetScreenOptions({\n headerTitle: 'Send Giphy',\n sheetAllowedDetents: Platform.select({ android: [0.7, 0.94], default: [0.7, 1] }),\n})\n\nexport type SendGiphyScreenProps = StaticScreenProps<{\n conversation_id: number\n search_term: string\n}>\n\nexport function SendGiphyScreen({ route }: SendGiphyScreenProps) {\n const { conversation_id, search_term } = route.params\n const styles = useStyles()\n const navigation = useNavigation()\n\n const { isPending, mutate } = useMessageCreateOrUpdate({\n conversationId: conversation_id,\n })\n const { isSearching, result, nextResult, prevResult } = useGiphy(search_term)\n const disabled = isPending || isSearching\n\n const { width } = useWindowDimensions()\n const size = width - 24\n\n if (!result) return null\n\n const gif = result.giphy.fixed_width\n const { url } = gif\n\n function goBack({ clearInput = false }) {\n if (clearInput) {\n const routes = navigation.getState()?.routes || []\n const conversationParams = routes.find(r => r.name === 'Conversation')?.params || {}\n\n navigation.dispatch(\n StackActions.popTo('Conversation', {\n ...conversationParams,\n conversation_id,\n clear_input: true,\n })\n )\n } else {\n navigation.goBack()\n }\n }\n\n function sendGiphy() {\n if (disabled) return\n\n mutate({ text: '', attachments: [result] })\n goBack({ clearInput: true })\n }\n\n return (\n <FormSheet.Root contentStyle={styles.container}>\n <View style={styles.poweredByGiphyContainer}>\n <NativeImage\n alt=\"Powered by Giphy\"\n style={styles.poweredByGiphyImage}\n source={{ uri: poweredByGiphyImage }}\n />\n </View>\n <View style={styles.controlToolbar} accessibilityRole=\"toolbar\">\n <View style={styles.paginateButtonGroup}>\n <PaginateButton\n name=\"general.leftArrow\"\n accessibilityLabel=\"Previous Giphy\"\n onPress={prevResult}\n disabled={disabled}\n />\n <PaginateButton\n name=\"general.rightArrow\"\n accessibilityLabel=\"Next GIF\"\n onPress={nextResult}\n disabled={disabled}\n />\n </View>\n <View style={styles.formButtonGroup}>\n <TextButton\n onPress={() => goBack({ clearInput: false })}\n maxFontSizeMultiplier={1}\n accessibilityHint=\"Cancels the Giphy selection and closes this modal.\"\n >\n Cancel\n </TextButton>\n <Button\n onPress={sendGiphy}\n title=\"Send\"\n size=\"lg\"\n disabled={disabled}\n maxFontSizeMultiplier={1}\n accessibilityLabel=\"Send Giphy\"\n accessibilityHint=\"Sends the selected Giphy as a message to the conversation.\"\n />\n </View>\n </View>\n {isSearching ? (\n <DefaultLoading />\n ) : (\n <NativeImage\n source={{ uri: url }}\n alt={result.title}\n style={[styles.image, { width: size, height: size }]}\n />\n )}\n </FormSheet.Root>\n )\n}\n\ninterface PaginateButtonProps {\n name: IconString\n accessibilityLabel: string\n onPress: () => void\n disabled: boolean\n}\n\nfunction PaginateButton({ name, accessibilityLabel, onPress, disabled }: PaginateButtonProps) {\n const styles = useStyles()\n const { colors } = useTheme()\n const androidRippleColor = useCreateAndroidRippleColor({ color: colors.interaction })\n\n return (\n <IconButton\n name={name}\n accessibilityLabel={accessibilityLabel}\n size=\"md\"\n appearance=\"interaction\"\n onPress={onPress}\n disabled={disabled}\n style={[styles.paginateButton, disabled && styles.paginateButtonDisabled]}\n android_ripple={{\n color: androidRippleColor,\n borderless: true,\n foreground: true,\n }}\n maxFontSizeMultiplier={1}\n />\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n container: {\n paddingTop: Platform.select({ android: 24, default: 32 }),\n paddingHorizontal: 16,\n gap: 8,\n },\n poweredByGiphyContainer: {\n alignSelf: 'flex-start',\n padding: 4,\n borderRadius: 4,\n backgroundColor: colors.name === 'dark' ? tokens.colorNeutral68 : 'transparent',\n },\n poweredByGiphyImage: {\n width: 170,\n height: 20,\n },\n controlToolbar: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'center',\n },\n formButtonGroup: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 16,\n },\n paginateButtonGroup: {\n flexDirection: 'row',\n gap: 8,\n },\n paginateButton: {\n borderColor: colors.interaction,\n borderWidth: 1,\n height: 28,\n paddingHorizontal: 12,\n borderRadius: 16,\n overflow: 'hidden',\n },\n paginateButtonDisabled: {\n backgroundColor: colors.fillColorButtonNeutralSolidDisabled,\n borderColor: colors.fillColorButtonNeutralSolidDisabled,\n },\n image: {\n borderRadius: 8,\n maxWidth: '100%',\n },\n })\n}\n\nconst poweredByGiphyImage = `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAAAWCAYAAACFbNPBAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA\nGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABa9JREFUeNrsWy1z40gQla8EDAwE\nDAQCDAIMAgwCDA0XBgYGBu5PyM84aLgw8KDBAoMDBgsEAgQEBAQEBARclZ2uepPrne2WRrbls7Pq\nKpWc0UxPz0y//pIyen9/Dwa6LhqNRjNzmwmPcnOl5kzrYZdOQ+GwBVcDirG5LXGNG7rWpu/O3Dcu\nUEz7ytxW7gDT76WtjzYXAdJcW8MjFWR+EoBMAF4ra3wRmmkdG/Psq/kdac8Vfg/mtpAMiRnzt88C\n/xpU7yrAEZvbMxR33NLdAukZ4/okmmturicz1yNA3Be9Ku0rM2+keNlFR14DQK4UHE+K9Wwi6v94\nRlHnfc4HD5Uojx8826zHyQeAfJ6w6tHDa2jhz7czizwzMi969iK1Mu/cCRMjJbTa9JKDSG7M0N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;YACV,MAAM,EAAE,EAAE;SACX;QACD,cAAc,EAAE;YACd,aAAa,EAAE,KAAK;YACpB,cAAc,EAAE,eAAe;YAC/B,UAAU,EAAE,QAAQ;SACrB;QACD,eAAe,EAAE;YACf,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,EAAE;SACR;QACD,mBAAmB,EAAE;YACnB,aAAa,EAAE,KAAK;YACpB,GAAG,EAAE,CAAC;SACP;QACD,cAAc,EAAE;YACd,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,WAAW,EAAE,CAAC;YACd,MAAM,EAAE,EAAE;YACV,iBAAiB,EAAE,EAAE;YACrB,YAAY,EAAE,EAAE;YAChB,QAAQ,EAAE,QAAQ;SACnB;QACD,sBAAsB,EAAE;YACtB,eAAe,EAAE,MAAM,CAAC,mCAAmC;YAC3D,WAAW,EAAE,MAAM,CAAC,mCAAmC;SACxD;QACD,KAAK,EAAE;YACL,YAAY,EAAE,CAAC;YACf,QAAQ,EAAE,MAAM;SACjB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;6CA2BiB,CAAA","sourcesContent":["import { StackActions, StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport React from 'react'\nimport { Image as NativeImage, Platform, StyleSheet, useWindowDimensions, View } from 'react-native'\nimport { Button, IconButton, IconString, TextButton } from '../components'\nimport { DefaultLoading } from '../components/page/loading'\nimport FormSheet, { getFormSheetScreenOptions } from '../components/primitive/form_sheet'\nimport { useCreateAndroidRippleColor, useTheme } from '../hooks'\nimport { useGiphy } from '../hooks/use_giphy'\nimport { useMessageCreateOrUpdate } from '../hooks/use_message_create_or_update'\nimport { tokens } from '../vendor/tapestry/tokens'\n\nexport const SendGiphyScreenOptions = getFormSheetScreenOptions({\n headerTitle: 'Send Giphy',\n sheetAllowedDetents: Platform.select({ android: [0.7, 0.94], default: [0.7, 1] }),\n})\n\nexport type SendGiphyScreenProps = StaticScreenProps<{\n conversation_id: number\n search_term: string\n}>\n\nexport function SendGiphyScreen({ route }: SendGiphyScreenProps) {\n const { conversation_id, search_term } = route.params\n const styles = useStyles()\n const navigation = useNavigation()\n\n const { isPending, mutate } = useMessageCreateOrUpdate({\n conversationId: conversation_id,\n })\n const { isSearching, result, nextResult, prevResult } = useGiphy(search_term)\n const disabled = isPending || isSearching\n\n const { width } = useWindowDimensions()\n const size = width - 24\n\n if (!result) return null\n\n const gif = result.giphy.fixed_width\n const { url } = gif\n\n function goBack({ clearInput = false }) {\n if (clearInput) {\n const routes = navigation.getState()?.routes || []\n const conversationParams = routes.find(r => r.name === 'Conversation')?.params || {}\n\n navigation.dispatch(\n StackActions.popTo('Conversation', {\n ...conversationParams,\n conversation_id,\n clear_input: true,\n })\n )\n } else {\n navigation.goBack()\n }\n }\n\n function sendGiphy() {\n if (disabled) return\n\n mutate({ text: '', attachments: [result] })\n goBack({ clearInput: true })\n }\n\n return (\n <FormSheet.Root contentStyle={styles.container}>\n <View style={styles.poweredByGiphyContainer}>\n <NativeImage\n alt=\"Powered by Giphy\"\n style={styles.poweredByGiphyImage}\n source={{ uri: poweredByGiphyImage }}\n />\n </View>\n <View style={styles.controlToolbar} accessibilityRole=\"toolbar\">\n <View style={styles.paginateButtonGroup}>\n <PaginateButton\n name=\"general.leftArrow\"\n accessibilityLabel=\"Previous Giphy\"\n onPress={prevResult}\n disabled={disabled}\n />\n <PaginateButton\n name=\"general.rightArrow\"\n accessibilityLabel=\"Next GIF\"\n onPress={nextResult}\n disabled={disabled}\n />\n </View>\n <View style={styles.formButtonGroup}>\n <TextButton\n onPress={() => goBack({ clearInput: false })}\n maxFontSizeMultiplier={1}\n accessibilityHint=\"Cancels the Giphy selection and closes this modal.\"\n >\n Cancel\n </TextButton>\n <Button\n onPress={sendGiphy}\n title=\"Send\"\n size=\"lg\"\n disabled={disabled}\n maxFontSizeMultiplier={1}\n accessibilityLabel=\"Send Giphy\"\n accessibilityHint=\"Sends the selected Giphy as a message to the conversation.\"\n />\n </View>\n </View>\n {isSearching ? (\n <DefaultLoading />\n ) : (\n <NativeImage\n source={{ uri: url }}\n alt={result.title}\n style={[styles.image, { width: size, height: size }]}\n />\n )}\n </FormSheet.Root>\n )\n}\n\ninterface PaginateButtonProps {\n name: IconString\n accessibilityLabel: string\n onPress: () => void\n disabled: boolean\n}\n\nfunction PaginateButton({ name, accessibilityLabel, onPress, disabled }: PaginateButtonProps) {\n const styles = useStyles()\n const { colors } = useTheme()\n const androidRippleColor = useCreateAndroidRippleColor({ color: colors.interaction })\n\n return (\n <IconButton\n name={name}\n accessibilityLabel={accessibilityLabel}\n size=\"md\"\n appearance=\"interaction\"\n onPress={onPress}\n disabled={disabled}\n style={[styles.paginateButton, disabled && styles.paginateButtonDisabled]}\n android_ripple={{\n color: androidRippleColor,\n borderless: true,\n foreground: true,\n }}\n maxFontSizeMultiplier={1}\n />\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n container: {\n paddingTop: 32,\n paddingHorizontal: 16,\n gap: 8,\n },\n poweredByGiphyContainer: {\n alignSelf: 'flex-start',\n padding: 4,\n borderRadius: 4,\n backgroundColor: colors.name === 'dark' ? tokens.colorNeutral68 : 'transparent',\n },\n poweredByGiphyImage: {\n width: 170,\n height: 20,\n },\n controlToolbar: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'center',\n },\n formButtonGroup: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 16,\n },\n paginateButtonGroup: {\n flexDirection: 'row',\n gap: 8,\n },\n paginateButton: {\n borderColor: colors.interaction,\n borderWidth: 1,\n height: 28,\n paddingHorizontal: 12,\n borderRadius: 16,\n overflow: 'hidden',\n },\n paginateButtonDisabled: {\n backgroundColor: colors.fillColorButtonNeutralSolidDisabled,\n borderColor: colors.fillColorButtonNeutralSolidDisabled,\n },\n image: {\n borderRadius: 8,\n maxWidth: '100%',\n },\n })\n}\n\n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Ip58CDAChjQWETVMlnAAAAABJRU5ErkJggg==`\n"]}
@@ -33,9 +33,6 @@ interface ChatColors {
33
33
  interaction: string;
34
34
  androidModalHeaderButtonTextColor: ColorValue | string | undefined;
35
35
  iOSModalHeaderButtonTextColor: OpaqueColorValue | string | undefined;
36
- switchTrackTrue: string | undefined;
37
- switchTrackFalse: string | undefined;
38
- switchThumbColor: string | undefined;
39
36
  androidSwitchThumbColor: string | undefined;
40
37
  testColor: string;
41
38
  statusInfoIcon: string;
@@ -1 +1 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/utils/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,gBAAgB,EAAiB,MAAM,cAAc,CAAA;AAE3F,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAA;AAE/E,MAAM,WAAW,SAAU,SAAQ,YAAY;IAC7C,MAAM,EAAE,YAAY,CAAC,QAAQ,CAAC,GAC5B,CAAC,OAAO,mBAAmB,CAAC,KAAK,GAAG,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAA;CACvE;AAED;;;;;;;;;;;;;gDAagD;AAEhD,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,UAAU,CAAA;IAClB,MAAM,EAAE;QACN,YAAY,EAAE,MAAM,CAAA;KACrB,CAAA;IACD,oBAAoB,EAAE,OAAO,CAAA;CAC9B;AAED,eAAO,MAAM,YAAY,gBAAiB,eAAe,KAAG,SAe3D,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;AAE5D,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B,WAAW,EAAE,MAAM,CAAA;IACnB,iCAAiC,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAAA;IAClE,6BAA6B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U,CAAA;IAClB,MAAM,EAAE;QACN,YAAY,EAAE,MAAM,CAAA;KACrB,CAAA;IACD,oBAAoB,EAAE,OAAO,CAAA;CAC9B;AAED,eAAO,MAAM,YAAY,gBAAiB,eAAe,KAAG,SAe3D,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;AAE5D,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B,WAAW,EAAE,MAAM,CAAA;IACnB,iCAAiC,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAAA;IAClE,6BAA6B,EAAE,gBAAgB,GAAG,MAAM,GAAG,SAAS,CAAA;IACpE,uBAAuB,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3C,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,EAAE,MAAM,CAAA;IACtB,cAAc,EAAE,MAAM,CAAA;IACtB,oBAAoB,EAAE,MAAM,CAAA;IAC5B,iBAAiB,EAAE,MAAM,CAAA;IACzB,iBAAiB,EAAE,MAAM,CAAA;IACzB,uBAAuB,EAAE,MAAM,CAAA;IAC/B,iBAAiB,EAAE,MAAM,CAAA;IACzB,iBAAiB,EAAE,MAAM,CAAA;IACzB,uBAAuB,EAAE,MAAM,CAAA;IAC/B,eAAe,EAAE,MAAM,CAAA;IACvB,eAAe,EAAE,MAAM,CAAA;IACvB,qBAAqB,EAAE,MAAM,CAAA;IAC7B,iBAAiB,EAAE,MAAM,CAAA;IACzB,iBAAiB,EAAE,MAAM,CAAA;IACzB,uBAAuB,EAAE,MAAM,CAAA;IAC/B,sBAAsB,EAAE,MAAM,CAAA;CAC/B"}
@@ -22,9 +22,6 @@ const colorsChatLight = {
22
22
  buttonStart: undefined,
23
23
  buttonEnd: undefined,
24
24
  interaction: tokens.fillColorInteractionDefault,
25
- switchTrackTrue: undefined,
26
- switchTrackFalse: undefined,
27
- switchThumbColor: undefined,
28
25
  androidSwitchThumbColor: undefined,
29
26
  testColor: 'hotpink',
30
27
  statusInfoIcon: tokens.iconColorStatusInfoPrimary,
@@ -51,9 +48,6 @@ const colorsChatDark = {
51
48
  buttonStart: undefined,
52
49
  buttonEnd: undefined,
53
50
  interaction: tokens.fillColorInteractionDefaultDark,
54
- switchTrackTrue: undefined,
55
- switchTrackFalse: undefined,
56
- switchThumbColor: undefined,
57
51
  androidSwitchThumbColor: undefined,
58
52
  testColor: 'pink',
59
53
  statusInfoIcon: tokens.iconColorStatusInfoPrimaryDark,
@@ -1 +1 @@
1
- {"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/utils/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiD,aAAa,EAAE,MAAM,cAAc,CAAA;AAC3F,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAA;AA8B/E,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,WAA4B,EAAa,EAAE;IACtE,MAAM,MAAM,GAAG,WAAW,IAAI,OAAO,CAAA;IAErC,MAAM,aAAa,GAAG;QACpB,GAAG,iBAAiB,CAAC,MAAM,CAAC;QAC5B,GAAG,mBAAmB,CAAC,MAAM,CAAC;KAC/B,CAAA;IAED,OAAO;QACL,MAAM,EAAE,aAAa;QACrB,MAAM,EAAE;YACN,YAAY,EAAE,EAAE;SACjB;QACD,oBAAoB,EAAE,IAAI,EAAE,sEAAsE;KACnG,CAAA;AACH,CAAC,CAAA;AAwCD,MAAM,eAAe,GAAe;IAClC,IAAI,EAAE,OAAO;IACb,iCAAiC,EAAE,MAAM,CAAC,2BAA2B;IACrE,6BAA6B,EAAE,aAAa,CAAC,MAAM,CAAC;IACpD,WAAW,EAAE,SAAS;IACtB,SAAS,EAAE,SAAS;IACpB,WAAW,EAAE,MAAM,CAAC,2BAA2B;IAC/C,eAAe,EAA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,CAAC,4BAA4B;IACzD,iBAAiB,EAAE,MAAM,CAAC,iCAAiC;IAC3D,iBAAiB,EAAE,MAAM,CAAC,0BAA0B;IACpD,uBAAuB,EAAE,MAAM,CAAC,+BAA+B;IAC/D,iBAAiB,EAAE,MAAM,CAAC,iCAAiC;IAC3D,iBAAiB,EAAE,MAAM,CAAC,0BAA0B;IACpD,uBAAuB,EAAE,MAAM,CAAC,+BAA+B;IAC/D,eAAe,EAAE,MAAM,CAAC,+BAA+B;IACvD,eAAe,EAAE,MAAM,CAAC,wBAAwB;IAChD,qBAAqB,EAAE,MAAM,CAAC,6BAA6B;IAC3D,iBAAiB,EAAE,MAAM,CAAC,iCAAiC;IAC3D,iBAAiB,EAAE,MAAM,CAAC,0BAA0B;IACpD,uBAAuB,EAAE,MAAM,CAAC,+BAA+B;IAC/D,sBAAsB,EAAE,MAAM,CAAC,0BAA0B;CAC1D,CAAA;AAED,MAAM,iBAAiB,GAAG;IACxB,KAAK,EAAE,eAAe;IACtB,IAAI,EAAE,cAAc;CACrB,CAAA","sourcesContent":["import { ColorSchemeName, ColorValue, OpaqueColorValue, PlatformColor } from 'react-native'\nimport { tokens } from '../vendor/tapestry/tokens'\nimport { aliasTokensColorMap } from '../vendor/tapestry/alias_tokens_color_map'\n\nexport interface ChatTheme extends DefaultTheme {\n colors: DefaultTheme['colors'] &\n (typeof aliasTokensColorMap.light | typeof aliasTokensColorMap.dark)\n}\n\n/** =============================================\n NOTE: The specific values for `colors` and the `productBadge` are temporary examples that can be replaced once we start building out UI. This line's comment can be removed at that time too.\n\n The default theme is intended to support two types of customizations:\n 1. Specific color properties for a chat component (eg. `primaryButtonBackgroundColor`)\n 2. Any styles for a specific component. (Use only one level of nesting.)\n ```\n primaryButton: {\n borderRadius: number\n container: ViewStyle\n text: TextStyle\n }\n ```\n============================================= */\n\nexport interface DefaultTheme {\n colors: ChatColors\n button: {\n borderRadius: number\n }\n showBadgeProductLogo: boolean\n}\n\nexport const defaultTheme = (colorScheme: ColorSchemeName): ChatTheme => {\n const scheme = colorScheme || 'light'\n\n const defaultColors = {\n ...chatThemeColorMap[scheme],\n ...aliasTokensColorMap[scheme],\n }\n\n return {\n colors: defaultColors,\n button: {\n borderRadius: 40,\n },\n showBadgeProductLogo: true, // Overrides visibility of the product logo in `src/display/badge.tsx`\n }\n}\n\nexport type TemporaryDefaultColorsType = Partial<ChatColors>\n\ninterface ChatColors {\n name: string\n buttonStart: string | undefined\n buttonEnd: string | undefined\n interaction: string\n androidModalHeaderButtonTextColor: ColorValue | string | undefined\n iOSModalHeaderButtonTextColor: OpaqueColorValue | string | undefined\n // `switchTrackTrue` is deprecated.\n // TODO: Remove `switchTrackTrue` once CCA stops using it.\n switchTrackTrue: string | undefined\n // `switchTrackFalse` is deprecated.\n // TODO: Remove `switchTrackFalse` once CCA stops using it.\n switchTrackFalse: string | undefined\n // `switchThumbColor` is deprecated. Use `androidSwitchThumbColor` instead.\n // TODO: Remove `switchThumbColor` once CCA is updated to use `androidSwitchThumbColor`.\n switchThumbColor: string | undefined\n androidSwitchThumbColor: string | undefined\n testColor: string\n statusInfoIcon: string\n statusInfoText: string\n statusInfoBackground: string\n statusSuccessIcon: string\n statusSuccessText: string\n statusSuccessBackground: string\n statusWarningIcon: string\n statusWarningText: string\n statusWarningBackground: string\n statusErrorIcon: string\n statusErrorText: string\n statusErrorBackground: string\n statusNeutralIcon: string\n statusNeutralText: string\n statusNeutralBackground: string\n borderColorStatusError: string\n}\n\nconst colorsChatLight: ChatColors = {\n name: 'light',\n androidModalHeaderButtonTextColor: tokens.fillColorInteractionDefault,\n iOSModalHeaderButtonTextColor: PlatformColor('link'),\n buttonStart: undefined,\n buttonEnd: undefined,\n interaction: tokens.fillColorInteractionDefault,\n switchTrackTrue: undefined,\n switchTrackFalse: undefined,\n switchThumbColor: undefined,\n androidSwitchThumbColor: undefined,\n testColor: 'hotpink',\n statusInfoIcon: tokens.iconColorStatusInfoPrimary,\n statusInfoText: tokens.textColorStatusInfo,\n statusInfoBackground: tokens.fillColorStatusInfoGhost,\n statusSuccessIcon: tokens.iconColorStatusSuccessPrimary,\n statusSuccessText: tokens.textColorStatusSuccess,\n statusSuccessBackground: tokens.fillColorStatusSuccessGhost,\n statusWarningIcon: tokens.iconColorStatusWarningPrimary,\n statusWarningText: tokens.textColorStatusWarning,\n statusWarningBackground: tokens.fillColorStatusWarningGhost,\n statusErrorIcon: tokens.iconColorStatusErrorPrimary,\n statusErrorText: tokens.textColorStatusError,\n statusErrorBackground: tokens.fillColorStatusErrorGhost,\n statusNeutralIcon: tokens.iconColorStatusNeutralPrimary,\n statusNeutralText: tokens.textColorStatusNeutral,\n statusNeutralBackground: tokens.fillColorStatusNeutralGhost,\n borderColorStatusError: tokens.borderColorStatusError,\n}\n\nconst colorsChatDark: ChatColors = {\n name: 'dark',\n androidModalHeaderButtonTextColor: tokens.fillColorInteractionDefaultDark,\n iOSModalHeaderButtonTextColor: PlatformColor('link'),\n buttonStart: undefined,\n buttonEnd: undefined,\n interaction: tokens.fillColorInteractionDefaultDark,\n switchTrackTrue: undefined,\n switchTrackFalse: undefined,\n switchThumbColor: undefined,\n androidSwitchThumbColor: undefined,\n testColor: 'pink',\n statusInfoIcon: tokens.iconColorStatusInfoPrimaryDark,\n statusInfoText: tokens.textColorStatusInfoDark,\n statusInfoBackground: tokens.fillColorStatusInfoGhostDark,\n statusSuccessIcon: tokens.iconColorStatusSuccessPrimaryDark,\n statusSuccessText: tokens.textColorStatusSuccessDark,\n statusSuccessBackground: tokens.fillColorStatusSuccessGhostDark,\n statusWarningIcon: tokens.iconColorStatusWarningPrimaryDark,\n statusWarningText: tokens.textColorStatusWarningDark,\n statusWarningBackground: tokens.fillColorStatusWarningGhostDark,\n statusErrorIcon: tokens.iconColorStatusErrorPrimaryDark,\n statusErrorText: tokens.textColorStatusErrorDark,\n statusErrorBackground: tokens.fillColorStatusErrorGhostDark,\n statusNeutralIcon: tokens.iconColorStatusNeutralPrimaryDark,\n statusNeutralText: tokens.textColorStatusNeutralDark,\n statusNeutralBackground: tokens.fillColorStatusNeutralGhostDark,\n borderColorStatusError: tokens.borderColorStatusErrorDark,\n}\n\nconst chatThemeColorMap = {\n light: colorsChatLight,\n dark: colorsChatDark,\n}\n"]}
1
+ {"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/utils/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiD,aAAa,EAAE,MAAM,cAAc,CAAA;AAC3F,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAA;AA8B/E,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,WAA4B,EAAa,EAAE;IACtE,MAAM,MAAM,GAAG,WAAW,IAAI,OAAO,CAAA;IAErC,MAAM,aAAa,GAAG;QACpB,GAAG,iBAAiB,CAAC,MAAM,CAAC;QAC5B,GAAG,mBAAmB,CAAC,MAAM,CAAC;KAC/B,CAAA;IAED,OAAO;QACL,MAAM,EAAE,aAAa;QACrB,MAAM,EAAE;YACN,YAAY,EAAE,EAAE;SACjB;QACD,oBAAoB,EAAE,IAAI,EAAE,sEAAsE;KACnG,CAAA;AACH,CAAC,CAAA;AA+BD,MAAM,eAAe,GAAe;IAClC,IAAI,EAAE,OAAO;IACb,iCAAiC,EAAE,MAAM,CAAC,2BAA2B;IACrE,6BAA6B,EAAE,aAAa,CAAC,MAAM,CAAC;IACpD,WAAW,EAAE,SAAS;IACtB,SAAS,EAAE,SAAS;IACpB,WAAW,EAAE,MAAM,CAAC,2BAA2B;IAC/C,uBAAuB,EAAE,SAAS;IAClC,SAAS,EAAE,SAAS;IACpB,cAAc,EAAE,MAAM,CAAC,0BAA0B;IACjD,cAAc,EAAE,MAAM,CAAC,mBAAmB;IAC1C,oBAAoB,EAAE,MAAM,CAAC,wBAAwB;IACrD,iBAAiB,EAAE,MAAM,CAAC,6BAA6B;IACvD,iBAAiB,EAAE,MAAM,CAAC,sBAAsB;IAChD,uBAAu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M,CAAC,iCAAiC;IAC3D,iBAAiB,EAAE,MAAM,CAAC,0BAA0B;IACpD,uBAAuB,EAAE,MAAM,CAAC,+BAA+B;IAC/D,sBAAsB,EAAE,MAAM,CAAC,0BAA0B;CAC1D,CAAA;AAED,MAAM,iBAAiB,GAAG;IACxB,KAAK,EAAE,eAAe;IACtB,IAAI,EAAE,cAAc;CACrB,CAAA","sourcesContent":["import { ColorSchemeName, ColorValue, OpaqueColorValue, PlatformColor } from 'react-native'\nimport { tokens } from '../vendor/tapestry/tokens'\nimport { aliasTokensColorMap } from '../vendor/tapestry/alias_tokens_color_map'\n\nexport interface ChatTheme extends DefaultTheme {\n colors: DefaultTheme['colors'] &\n (typeof aliasTokensColorMap.light | typeof aliasTokensColorMap.dark)\n}\n\n/** =============================================\n NOTE: The specific values for `colors` and the `productBadge` are temporary examples that can be replaced once we start building out UI. This line's comment can be removed at that time too.\n\n The default theme is intended to support two types of customizations:\n 1. Specific color properties for a chat component (eg. `primaryButtonBackgroundColor`)\n 2. Any styles for a specific component. (Use only one level of nesting.)\n ```\n primaryButton: {\n borderRadius: number\n container: ViewStyle\n text: TextStyle\n }\n ```\n============================================= */\n\nexport interface DefaultTheme {\n colors: ChatColors\n button: {\n borderRadius: number\n }\n showBadgeProductLogo: boolean\n}\n\nexport const defaultTheme = (colorScheme: ColorSchemeName): ChatTheme => {\n const scheme = colorScheme || 'light'\n\n const defaultColors = {\n ...chatThemeColorMap[scheme],\n ...aliasTokensColorMap[scheme],\n }\n\n return {\n colors: defaultColors,\n button: {\n borderRadius: 40,\n },\n showBadgeProductLogo: true, // Overrides visibility of the product logo in `src/display/badge.tsx`\n }\n}\n\nexport type TemporaryDefaultColorsType = Partial<ChatColors>\n\ninterface ChatColors {\n name: string\n buttonStart: string | undefined\n buttonEnd: string | undefined\n interaction: string\n androidModalHeaderButtonTextColor: ColorValue | string | undefined\n iOSModalHeaderButtonTextColor: OpaqueColorValue | string | undefined\n androidSwitchThumbColor: string | undefined\n testColor: string\n statusInfoIcon: string\n statusInfoText: string\n statusInfoBackground: string\n statusSuccessIcon: string\n statusSuccessText: string\n statusSuccessBackground: string\n statusWarningIcon: string\n statusWarningText: string\n statusWarningBackground: string\n statusErrorIcon: string\n statusErrorText: string\n statusErrorBackground: string\n statusNeutralIcon: string\n statusNeutralText: string\n statusNeutralBackground: string\n borderColorStatusError: string\n}\n\nconst colorsChatLight: ChatColors = {\n name: 'light',\n androidModalHeaderButtonTextColor: tokens.fillColorInteractionDefault,\n iOSModalHeaderButtonTextColor: PlatformColor('link'),\n buttonStart: undefined,\n buttonEnd: undefined,\n interaction: tokens.fillColorInteractionDefault,\n androidSwitchThumbColor: undefined,\n testColor: 'hotpink',\n statusInfoIcon: tokens.iconColorStatusInfoPrimary,\n statusInfoText: tokens.textColorStatusInfo,\n statusInfoBackground: tokens.fillColorStatusInfoGhost,\n statusSuccessIcon: tokens.iconColorStatusSuccessPrimary,\n statusSuccessText: tokens.textColorStatusSuccess,\n statusSuccessBackground: tokens.fillColorStatusSuccessGhost,\n statusWarningIcon: tokens.iconColorStatusWarningPrimary,\n statusWarningText: tokens.textColorStatusWarning,\n statusWarningBackground: tokens.fillColorStatusWarningGhost,\n statusErrorIcon: tokens.iconColorStatusErrorPrimary,\n statusErrorText: tokens.textColorStatusError,\n statusErrorBackground: tokens.fillColorStatusErrorGhost,\n statusNeutralIcon: tokens.iconColorStatusNeutralPrimary,\n statusNeutralText: tokens.textColorStatusNeutral,\n statusNeutralBackground: tokens.fillColorStatusNeutralGhost,\n borderColorStatusError: tokens.borderColorStatusError,\n}\n\nconst colorsChatDark: ChatColors = {\n name: 'dark',\n androidModalHeaderButtonTextColor: tokens.fillColorInteractionDefaultDark,\n iOSModalHeaderButtonTextColor: PlatformColor('link'),\n buttonStart: undefined,\n buttonEnd: undefined,\n interaction: tokens.fillColorInteractionDefaultDark,\n androidSwitchThumbColor: undefined,\n testColor: 'pink',\n statusInfoIcon: tokens.iconColorStatusInfoPrimaryDark,\n statusInfoText: tokens.textColorStatusInfoDark,\n statusInfoBackground: tokens.fillColorStatusInfoGhostDark,\n statusSuccessIcon: tokens.iconColorStatusSuccessPrimaryDark,\n statusSuccessText: tokens.textColorStatusSuccessDark,\n statusSuccessBackground: tokens.fillColorStatusSuccessGhostDark,\n statusWarningIcon: tokens.iconColorStatusWarningPrimaryDark,\n statusWarningText: tokens.textColorStatusWarningDark,\n statusWarningBackground: tokens.fillColorStatusWarningGhostDark,\n statusErrorIcon: tokens.iconColorStatusErrorPrimaryDark,\n statusErrorText: tokens.textColorStatusErrorDark,\n statusErrorBackground: tokens.fillColorStatusErrorGhostDark,\n statusNeutralIcon: tokens.iconColorStatusNeutralPrimaryDark,\n statusNeutralText: tokens.textColorStatusNeutralDark,\n statusNeutralBackground: tokens.fillColorStatusNeutralGhostDark,\n borderColorStatusError: tokens.borderColorStatusErrorDark,\n}\n\nconst chatThemeColorMap = {\n light: colorsChatLight,\n dark: colorsChatDark,\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planningcenter/chat-react-native",
3
- "version": "3.9.3-rc.0",
3
+ "version": "3.9.3-rc.2",
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": "249a73a41484ae6fef7ec7ed3ce99754610b7c80"
58
+ "gitHead": "de49441aae912740d1ceb6b140464b535e6b4a44"
59
59
  }
@@ -10,12 +10,8 @@ import { useTheme } from '../../hooks'
10
10
  export function Switch({ disabled, value, ...props }: SwitchProps) {
11
11
  const { colors } = useTheme()
12
12
 
13
- // `switchThumbColor` is deprecated. Use `androidSwitchThumbColor` instead.
14
- // TODO: Remove `switchThumbColor` once CCA is updated to use `androidSwitchThumbColor`.
15
- const androidSwitchThumbColor = colors.androidSwitchThumbColor ?? colors.switchThumbColor
16
-
17
13
  const platformThumbColor = Platform.select({
18
- android: value && !disabled ? androidSwitchThumbColor : colors.fillColorNeutral050Base,
14
+ android: value && !disabled ? colors.androidSwitchThumbColor : colors.fillColorNeutral050Base,
19
15
  ios: undefined,
20
16
  })
21
17
  const platformTrackColor = Platform.select({
@@ -1,3 +1,4 @@
1
+ import { PlatformPressable, useHeaderHeight } from '@react-navigation/elements'
1
2
  import { NativeStackNavigationOptions } from '@react-navigation/native-stack'
2
3
  import React, { ReactNode } from 'react'
3
4
  import {
@@ -11,9 +12,8 @@ import {
11
12
  } from 'react-native'
12
13
  import { useSafeAreaInsets } from 'react-native-safe-area-context'
13
14
  import { useTheme } from '../../hooks'
14
- import { PlatformPressable, useHeaderHeight } from '@react-navigation/elements'
15
- import { Heading, Icon, IconString, Text, Button, TextButton } from '../display'
16
15
  import type { ButtonProps, TextButtonProps } from '../display'
16
+ import { Button, Heading, Icon, IconString, Text, TextButton } from '../display'
17
17
 
18
18
  // =================================
19
19
  // ====== Exports ==================
@@ -62,13 +62,13 @@ type FormSheetComponents = {
62
62
 
63
63
  export default FormSheet as FormSheetComponents
64
64
  export type {
65
- FormSheetRootProps,
66
65
  FormSheetActionProps,
67
- FormSheetHeaderProps,
68
- FormSheetHeaderTitleProps,
69
66
  FormSheetHeaderActionsProps,
70
- FormSheetHeaderSecondaryButtonProps,
71
67
  FormSheetHeaderPrimaryButtonProps,
68
+ FormSheetHeaderProps,
69
+ FormSheetHeaderSecondaryButtonProps,
70
+ FormSheetHeaderTitleProps,
71
+ FormSheetRootProps,
72
72
  }
73
73
 
74
74
  // ====================================
@@ -86,8 +86,8 @@ export function FormSheetRoot({ children, style, contentStyle }: FormSheetRootPr
86
86
 
87
87
  return (
88
88
  <View style={[styles.container, style]} collapsable={false}>
89
- <AndroidSheetGrabber />
90
89
  <View style={[styles.content, contentStyle]}>{children}</View>
90
+ <AndroidSheetGrabber />
91
91
  </View>
92
92
  )
93
93
  }
@@ -118,7 +118,11 @@ interface FormSheetHeaderProps {
118
118
  function FormSheetHeader({ children }: FormSheetHeaderProps) {
119
119
  const styles = useStyles()
120
120
 
121
- return <View style={styles.header}>{children}</View>
121
+ return (
122
+ <View style={styles.header}>
123
+ <View style={styles.headerContent}>{children}</View>
124
+ </View>
125
+ )
122
126
  }
123
127
 
124
128
  FormSheetHeader.displayName = 'FormSheet.Header'
@@ -283,7 +287,8 @@ const useStyles = ({ appearance = 'neutral' }: Styles = {}) => {
283
287
  }),
284
288
  },
285
289
  androidSheetGrabber: {
286
- marginTop: 5,
290
+ position: 'absolute',
291
+ top: 5,
287
292
  width: 34,
288
293
  height: 5,
289
294
  backgroundColor: colors.fillColorNeutral040,
@@ -291,7 +296,6 @@ const useStyles = ({ appearance = 'neutral' }: Styles = {}) => {
291
296
  alignSelf: 'center',
292
297
  },
293
298
  content: {
294
- paddingTop: Platform.select({ android: 16, ios: 20 }),
295
299
  ...Platform.select({
296
300
  android: {
297
301
  maxHeight: '100%', // Ensures content above a list (e.g. FormSheet.Header) don't subtract from the FormSheet's height
@@ -299,12 +303,15 @@ const useStyles = ({ appearance = 'neutral' }: Styles = {}) => {
299
303
  }),
300
304
  },
301
305
  header: {
302
- backgroundColor: colors.fillColorNeutral100Inverted,
303
306
  paddingHorizontal: 16,
307
+ paddingTop: 20,
304
308
  paddingBottom: 16,
309
+ backgroundColor: colors.fillColorNeutral100Inverted,
305
310
  gap: 16,
306
311
  borderBottomWidth: 1,
307
312
  borderBottomColor: colors.borderColorDefaultBase,
313
+ },
314
+ headerContent: {
308
315
  flexDirection: 'row',
309
316
  alignItems: 'center',
310
317
  justifyContent: 'space-between',
@@ -1,6 +1,6 @@
1
1
  import { StaticScreenProps, useNavigation } from '@react-navigation/native'
2
2
  import React, { useCallback } from 'react'
3
- import { Alert, Linking } from 'react-native'
3
+ import { Alert, Linking, StyleSheet } from 'react-native'
4
4
  import FormSheet, { getFormSheetScreenOptions } from '../../components/primitive/form_sheet'
5
5
  import { useDeleteAttachment } from './hooks/useDeleteAttachment'
6
6
 
@@ -30,6 +30,7 @@ export function AttachmentActionsScreen({ route }: AttachmentActionsScreenProps)
30
30
 
31
31
  const attachmentName = getAttachmentLabelName(attachmentContentType)
32
32
  const canDelete = myMessage || canDeleteNonAuthoredMessages
33
+ const styles = useStyles()
33
34
 
34
35
  const { handleDeleteAttachment } = useDeleteAttachment({
35
36
  conversation_id,
@@ -54,7 +55,7 @@ export function AttachmentActionsScreen({ route }: AttachmentActionsScreenProps)
54
55
  }
55
56
 
56
57
  return (
57
- <FormSheet.Root>
58
+ <FormSheet.Root contentStyle={styles.formSheetContent}>
58
59
  <FormSheet.Action
59
60
  iconName="general.newWindow"
60
61
  title="Open in browser"
@@ -75,6 +76,14 @@ export function AttachmentActionsScreen({ route }: AttachmentActionsScreenProps)
75
76
  )
76
77
  }
77
78
 
79
+ const useStyles = () => {
80
+ return StyleSheet.create({
81
+ formSheetContent: {
82
+ paddingTop: 16,
83
+ },
84
+ })
85
+ }
86
+
78
87
  function getAttachmentLabelName(contentType: string) {
79
88
  if (contentType.startsWith('image/')) return 'image'
80
89
  if (contentType.startsWith('video/')) return 'video'
@@ -1,18 +1,18 @@
1
+ import { StackActions, useNavigation } from '@react-navigation/native'
1
2
  import { NativeStackNavigationProp } from '@react-navigation/native-stack'
2
3
  import React, { useCallback } from 'react'
3
4
  import { Platform, StyleSheet } from 'react-native'
4
- import { useSafeAreaInsets } from 'react-native-safe-area-context'
5
5
  import { FlatList } from 'react-native-gesture-handler'
6
+ import { useSafeAreaInsets } from 'react-native-safe-area-context'
6
7
  import { Heading } from '../../components'
8
+ import FormSheet, { getFormSheetScreenOptions } from '../../components/primitive/form_sheet'
7
9
  import { useTheme } from '../../hooks'
8
- import { useFlattenedArrayOfServiceTypesWithTeams } from './hooks/use_flattened_array_of_service_types_with_teams'
9
- import { ConversationFilterRecipientsScreenProps, SectionTypes } from './types'
10
- import { HeaderRow } from './components/header_row'
11
10
  import { tokens } from '../../vendor/tapestry/tokens'
12
11
  import { CheckboxRow } from './components/checkbox_row'
12
+ import { HeaderRow } from './components/header_row'
13
+ import { useFlattenedArrayOfServiceTypesWithTeams } from './hooks/use_flattened_array_of_service_types_with_teams'
13
14
  import { useServiceTypesWithTeams } from './hooks/use_service_types_with_teams'
14
- import { StackActions, useNavigation } from '@react-navigation/native'
15
- import FormSheet, { getFormSheetScreenOptions } from '../../components/primitive/form_sheet'
15
+ import { ConversationFilterRecipientsScreenProps, SectionTypes } from './types'
16
16
 
17
17
  const SERVICE_TYPE_LABELLED_BY_PREFIX = 'header-'
18
18
 
@@ -30,6 +30,7 @@ export const ConversationFilterRecipientsScreen = ({
30
30
  const styles = useStyles()
31
31
  const navigation =
32
32
  useNavigation<NativeStackNavigationProp<ConversationFilterRecipientsScreenProps>>()
33
+ const { team_ids: teamIds } = route.params
33
34
 
34
35
  const { serviceTypes } = useServiceTypesWithTeams()
35
36
  const data = useFlattenedArrayOfServiceTypesWithTeams({
@@ -61,10 +62,13 @@ export const ConversationFilterRecipientsScreen = ({
61
62
  navigation.dispatch(StackActions.popTo('ConversationNew', params))
62
63
  }, [navigation, params])
63
64
 
65
+ const teamIdCount = Number(teamIds?.length)
66
+ const count = teamIdCount > 1 ? ` (${teamIdCount})` : ''
67
+
64
68
  return (
65
- <FormSheet.Root>
69
+ <FormSheet.Root style={styles.root}>
66
70
  <FormSheet.Header>
67
- <FormSheet.HeaderTitle>Teams I lead</FormSheet.HeaderTitle>
71
+ <FormSheet.HeaderTitle>Teams I lead{count}</FormSheet.HeaderTitle>
68
72
  <FormSheet.HeaderActions>
69
73
  <FormSheet.HeaderSecondaryButton
70
74
  onPress={resetTeamFilters}
@@ -126,8 +130,10 @@ const useStyles = () => {
126
130
  const { bottom } = useSafeAreaInsets()
127
131
 
128
132
  return StyleSheet.create({
129
- listContentContainer: {
133
+ root: {
130
134
  backgroundColor: colors.surfaceColor080,
135
+ },
136
+ listContentContainer: {
131
137
  padding: 16,
132
138
  paddingBottom: bottom + Platform.select({ android: 24, default: 16 }),
133
139
  },
@@ -6,8 +6,8 @@ import { useApiGet } from '../../../hooks/use_api'
6
6
  import { GroupResource } from '../../../types/resources/group_resource'
7
7
  import { ConversationScreenProps } from '../conversations_screen'
8
8
 
9
- export const ChatGroupBadge = () => {
10
- const styles = useStyles()
9
+ export const ChatGroupBadge = ({ rowPaddingHorizontal }: { rowPaddingHorizontal: number }) => {
10
+ const styles = useStyles({ rowPaddingHorizontal })
11
11
  const navigation = useNavigation()
12
12
  const route = useRoute<RouteProp<ConversationScreenProps['route']>>()
13
13
  const { chat_group_graph_id } = route.params || {}
@@ -38,10 +38,11 @@ export const ChatGroupBadge = () => {
38
38
  )
39
39
  }
40
40
 
41
- const useStyles = () => {
41
+ const useStyles = ({ rowPaddingHorizontal }: { rowPaddingHorizontal: number }) => {
42
42
  return StyleSheet.create({
43
43
  row: {
44
44
  flexDirection: 'row',
45
+ paddingHorizontal: rowPaddingHorizontal,
45
46
  },
46
47
  })
47
48
  }
@@ -8,6 +8,8 @@ import { useCanDisplayGroups } from '../../../hooks/use_groups'
8
8
  import { ConversationScreenProps } from '../conversations_screen'
9
9
  import { ChatGroupBadge } from './chat_group_badge'
10
10
 
11
+ const ROW_PADDING_HORIZONTAL = 16
12
+
11
13
  enum FilterTypes {
12
14
  All = 'All',
13
15
  Groups = 'Groups',
@@ -122,9 +124,7 @@ export const ListHeaderComponent = () => {
122
124
  accessibilityLabel={showAppFilters ? 'View all filters' : 'View more filters'}
123
125
  />
124
126
  </ScrollView>
125
- <View style={styles.chatGroupBadgeRow}>
126
- <ChatGroupBadge />
127
- </View>
127
+ <ChatGroupBadge rowPaddingHorizontal={ROW_PADDING_HORIZONTAL} />
128
128
  </View>
129
129
  )
130
130
  }
@@ -142,16 +142,13 @@ const useStyles = () => {
142
142
  flexDirection: 'row',
143
143
  justifyContent: 'space-between',
144
144
  paddingTop: 8,
145
- paddingHorizontal: 16,
145
+ paddingHorizontal: ROW_PADDING_HORIZONTAL,
146
146
  },
147
147
  filterRow: {
148
148
  flexDirection: 'row',
149
149
  justifyContent: 'flex-start',
150
150
  gap: 8,
151
- paddingHorizontal: 16,
152
- },
153
- chatGroupBadgeRow: {
154
- paddingHorizontal: 16,
151
+ paddingHorizontal: ROW_PADDING_HORIZONTAL,
155
152
  },
156
153
  })
157
154
  }