@planningcenter/chat-react-native 3.9.3-rc.1 → 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.
- package/build/components/display/switch.d.ts.map +1 -1
- package/build/components/display/switch.js +1 -4
- package/build/components/display/switch.js.map +1 -1
- package/build/components/primitive/form_sheet.d.ts +2 -2
- package/build/components/primitive/form_sheet.d.ts.map +1 -1
- package/build/components/primitive/form_sheet.js +12 -7
- package/build/components/primitive/form_sheet.js.map +1 -1
- package/build/screens/attachment_actions/attachment_actions_screen.d.ts.map +1 -1
- package/build/screens/attachment_actions/attachment_actions_screen.js +10 -2
- package/build/screens/attachment_actions/attachment_actions_screen.js.map +1 -1
- package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.d.ts.map +1 -1
- package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js +14 -9
- package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js.map +1 -1
- package/build/screens/message_actions_screen.d.ts.map +1 -1
- package/build/screens/message_actions_screen.js +6 -3
- package/build/screens/message_actions_screen.js.map +1 -1
- package/build/screens/reactions_screen.js +3 -3
- package/build/screens/reactions_screen.js.map +1 -1
- package/build/screens/send_giphy_screen.js +3 -3
- package/build/screens/send_giphy_screen.js.map +1 -1
- package/build/utils/theme.d.ts +0 -3
- package/build/utils/theme.d.ts.map +1 -1
- package/build/utils/theme.js +0 -6
- package/build/utils/theme.js.map +1 -1
- package/package.json +2 -2
- package/src/components/display/switch.tsx +1 -5
- package/src/components/primitive/form_sheet.tsx +18 -11
- package/src/screens/attachment_actions/attachment_actions_screen.tsx +11 -2
- package/src/screens/conversation_filter_recipients/conversation_filter_recipients_screen.tsx +15 -9
- package/src/screens/message_actions_screen.tsx +6 -3
- package/src/screens/reactions_screen.tsx +3 -3
- package/src/screens/send_giphy_screen.tsx +3 -3
- package/src/utils/theme.ts +0 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../../src/components/display/switch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAO/C,wBAAgB,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../../src/components/display/switch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAO/C,wBAAgB,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,WAAW,qBAwBhE"}
|
|
@@ -6,11 +6,8 @@ import { useTheme } from '../../hooks';
|
|
|
6
6
|
// =================================
|
|
7
7
|
export function Switch({ disabled, value, ...props }) {
|
|
8
8
|
const { colors } = useTheme();
|
|
9
|
-
// `switchThumbColor` is deprecated. Use `androidSwitchThumbColor` instead.
|
|
10
|
-
// TODO: Remove `switchThumbColor` once CCA is updated to use `androidSwitchThumbColor`.
|
|
11
|
-
const androidSwitchThumbColor = colors.androidSwitchThumbColor ?? colors.switchThumbColor;
|
|
12
9
|
const platformThumbColor = Platform.select({
|
|
13
|
-
android: value && !disabled ? androidSwitchThumbColor : colors.fillColorNeutral050Base,
|
|
10
|
+
android: value && !disabled ? colors.androidSwitchThumbColor : colors.fillColorNeutral050Base,
|
|
14
11
|
ios: undefined,
|
|
15
12
|
});
|
|
16
13
|
const platformTrackColor = Platform.select({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.js","sourceRoot":"","sources":["../../../src/components/display/switch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,iBAAiB,EA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AiB,CAChB,IAAI,KAAK,CAAC,CACV,UAAU,CAAC,CAAC,kBAAkB,CAAC,CAC/B,UAAU,CAAC,CAAC,kBAAkB,CAAC,CAC/B,KAAK,CAAC,CAAC,KAAK,CAAC,CACb,QAAQ,CAAC,CAAC,QAAQ,CAAC,EACnB,CACH,CAAA;AACH,CAAC","sourcesContent":["import React from 'react'\nimport { Platform, Switch as ReactNativeSwitch } from 'react-native'\nimport type { SwitchProps } from 'react-native'\nimport { useTheme } from '../../hooks'\n\n// =================================\n// ====== Component ================\n// =================================\n\nexport function Switch({ disabled, value, ...props }: SwitchProps) {\n const { colors } = useTheme()\n\n const platformThumbColor = Platform.select({\n android: value && !disabled ? colors.androidSwitchThumbColor : colors.fillColorNeutral050Base,\n ios: undefined,\n })\n const platformTrackColor = Platform.select({\n android: {\n true: disabled ? colors.fillColorNeutral060 : undefined,\n false: disabled ? colors.fillColorNeutral060 : colors.fillColorNeutral030,\n },\n ios: undefined,\n })\n\n return (\n <ReactNativeSwitch\n {...props}\n thumbColor={platformThumbColor}\n trackColor={platformTrackColor}\n value={value}\n disabled={disabled}\n />\n )\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { NativeStackNavigationOptions } from '@react-navigation/native-stack';
|
|
2
2
|
import React, { ReactNode } from 'react';
|
|
3
3
|
import { type AccessibilityRole, type StyleProp, type ViewStyle } from 'react-native';
|
|
4
|
-
import { IconString } from '../display';
|
|
5
4
|
import type { ButtonProps, TextButtonProps } from '../display';
|
|
5
|
+
import { IconString } from '../display';
|
|
6
6
|
/**
|
|
7
7
|
* Screen options for the formsheet's NativeStackNavigation route
|
|
8
8
|
* @param {string} options.headerTitle - Doesn't show in UI but good to have for semantic reasons.
|
|
@@ -22,7 +22,7 @@ type FormSheetComponents = {
|
|
|
22
22
|
};
|
|
23
23
|
declare const _default: FormSheetComponents;
|
|
24
24
|
export default _default;
|
|
25
|
-
export type {
|
|
25
|
+
export type { FormSheetActionProps, FormSheetHeaderActionsProps, FormSheetHeaderPrimaryButtonProps, FormSheetHeaderProps, FormSheetHeaderSecondaryButtonProps, FormSheetHeaderTitleProps, FormSheetRootProps, };
|
|
26
26
|
interface FormSheetRootProps {
|
|
27
27
|
children: ReactNode;
|
|
28
28
|
style?: StyleProp<ViewStyle>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form_sheet.d.ts","sourceRoot":"","sources":["../../../src/components/primitive/form_sheet.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"form_sheet.d.ts","sourceRoot":"","sources":["../../../src/components/primitive/form_sheet.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAA;AAC7E,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACxC,OAAO,EAKL,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAA;AAGrB,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC9D,OAAO,EAAyB,UAAU,EAAoB,MAAM,YAAY,CAAA;AAMhF;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,mDAInC,4BAA4B,KAAQ,4BAQrC,CAAA;AAYF,KAAK,mBAAmB,GAAG;IACzB,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAA;IAClC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAAC,CAAA;IACtC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAAC,CAAA;IACtC,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CAAC,CAAA;IAChD,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CAAC,CAAA;IACpD,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,mCAAmC,CAAC,CAAA;IACpE,mBAAmB,EAAE,KAAK,CAAC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,EAAE,OAAO,CAAA;CACnB"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { PlatformPressable, useHeaderHeight } from '@react-navigation/elements';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { Platform, StyleSheet, View, useWindowDimensions, } from 'react-native';
|
|
3
4
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
4
5
|
import { useTheme } from '../../hooks';
|
|
5
|
-
import {
|
|
6
|
-
import { Heading, Icon, Text, Button, TextButton } from '../display';
|
|
6
|
+
import { Button, Heading, Icon, Text, TextButton } from '../display';
|
|
7
7
|
// =================================
|
|
8
8
|
// ====== Exports ==================
|
|
9
9
|
// =================================
|
|
@@ -36,8 +36,8 @@ export default FormSheet;
|
|
|
36
36
|
export function FormSheetRoot({ children, style, contentStyle }) {
|
|
37
37
|
const styles = useStyles();
|
|
38
38
|
return (<View style={[styles.container, style]} collapsable={false}>
|
|
39
|
-
<AndroidSheetGrabber />
|
|
40
39
|
<View style={[styles.content, contentStyle]}>{children}</View>
|
|
40
|
+
<AndroidSheetGrabber />
|
|
41
41
|
</View>);
|
|
42
42
|
}
|
|
43
43
|
FormSheetRoot.displayName = 'FormSheet.Root';
|
|
@@ -53,7 +53,9 @@ function AndroidSheetGrabber() {
|
|
|
53
53
|
}
|
|
54
54
|
function FormSheetHeader({ children }) {
|
|
55
55
|
const styles = useStyles();
|
|
56
|
-
return <View style={styles.header}>
|
|
56
|
+
return (<View style={styles.header}>
|
|
57
|
+
<View style={styles.headerContent}>{children}</View>
|
|
58
|
+
</View>);
|
|
57
59
|
}
|
|
58
60
|
FormSheetHeader.displayName = 'FormSheet.Header';
|
|
59
61
|
function FormSheetHeaderTitle({ children }) {
|
|
@@ -127,7 +129,8 @@ const useStyles = ({ appearance = 'neutral' } = {}) => {
|
|
|
127
129
|
}),
|
|
128
130
|
},
|
|
129
131
|
androidSheetGrabber: {
|
|
130
|
-
|
|
132
|
+
position: 'absolute',
|
|
133
|
+
top: 5,
|
|
131
134
|
width: 34,
|
|
132
135
|
height: 5,
|
|
133
136
|
backgroundColor: colors.fillColorNeutral040,
|
|
@@ -135,7 +138,6 @@ const useStyles = ({ appearance = 'neutral' } = {}) => {
|
|
|
135
138
|
alignSelf: 'center',
|
|
136
139
|
},
|
|
137
140
|
content: {
|
|
138
|
-
paddingTop: Platform.select({ android: 16, ios: 20 }),
|
|
139
141
|
...Platform.select({
|
|
140
142
|
android: {
|
|
141
143
|
maxHeight: '100%', // Ensures content above a list (e.g. FormSheet.Header) don't subtract from the FormSheet's height
|
|
@@ -143,12 +145,15 @@ const useStyles = ({ appearance = 'neutral' } = {}) => {
|
|
|
143
145
|
}),
|
|
144
146
|
},
|
|
145
147
|
header: {
|
|
146
|
-
backgroundColor: colors.fillColorNeutral100Inverted,
|
|
147
148
|
paddingHorizontal: 16,
|
|
149
|
+
paddingTop: 20,
|
|
148
150
|
paddingBottom: 16,
|
|
151
|
+
backgroundColor: colors.fillColorNeutral100Inverted,
|
|
149
152
|
gap: 16,
|
|
150
153
|
borderBottomWidth: 1,
|
|
151
154
|
borderBottomColor: colors.borderColorDefaultBase,
|
|
155
|
+
},
|
|
156
|
+
headerContent: {
|
|
152
157
|
flexDirection: 'row',
|
|
153
158
|
alignItems: 'center',
|
|
154
159
|
justifyContent: 'space-between',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form_sheet.js","sourceRoot":"","sources":["../../../src/components/primitive/form_sheet.tsx"],"names":[],"mappings":"AACA,OAAO,KAAoB,MAAM,OAAO,CAAA;AACxC,OAAO,EACL,QAAQ,EACR,UAAU,EACV,IAAI,EACJ,mBAAmB,GAIpB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC/E,OAAO,EAAE,OAAO,EAA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AE,CAAC;YACT,eAAe,EAAE,MAAM,CAAC,mBAAmB;YAC3C,YAAY,EAAE,GAAG;YACjB,SAAS,EAAE,QAAQ;SACpB;QACD,OAAO,EAAE;YACP,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;YACrD,GAAG,QAAQ,CAAC,MAAM,CAAC;gBACjB,OAAO,EAAE;oBACP,SAAS,EAAE,MAAM,EAAE,kGAAkG;iBACtH;aACF,CAAC;SACH;QACD,MAAM,EAAE;YACN,eAAe,EAAE,MAAM,CAAC,2BAA2B;YACnD,iBAAiB,EAAE,EAAE;YACrB,aAAa,EAAE,EAAE;YACjB,GAAG,EAAE,EAAE;YACP,iBAAiB,EAAE,CAAC;YACpB,iBAAiB,EAAE,MAAM,CAAC,sBAAsB;YAChD,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,eAAe;SAChC;QACD,WAAW,EAAE;YACX,SAAS,EAAE,MAAM;SAClB;QACD,aAAa,EAAE;YACb,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,EAAE;SACR;QACD,eAAe,EAAE;YACf,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,eAAe,EAAE,EAAE;YACnB,iBAAiB,EAAE,EAAE;YACrB,GAAG,EAAE,CAAC;SACP;QACD,UAAU,EAAE;YACV,KAAK,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC,SAAS;SACjD;QACD,WAAW,EAAE;YACX,KAAK,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC,SAAS;SACjD;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { NativeStackNavigationOptions } from '@react-navigation/native-stack'\nimport React, { ReactNode } from 'react'\nimport {\n Platform,\n StyleSheet,\n View,\n useWindowDimensions,\n type AccessibilityRole,\n type StyleProp,\n type ViewStyle,\n} from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { useTheme } from '../../hooks'\nimport { PlatformPressable, useHeaderHeight } from '@react-navigation/elements'\nimport { Heading, Icon, IconString, Text, Button, TextButton } from '../display'\nimport type { ButtonProps, TextButtonProps } from '../display'\n\n// =================================\n// ====== Exports ==================\n// =================================\n\n/**\n * Screen options for the formsheet's NativeStackNavigation route\n * @param {string} options.headerTitle - Doesn't show in UI but good to have for semantic reasons.\n * @param {number[]} [options.sheetAllowedDetents] - Controls the height increments the sheet grows to. To prevent bugs in Android, do not specify more then two values and use [0.94] instead of [1] to go full screen.\n * @param {NativeStackNavigationOptions} [options.rest] - Adds or overrides any valid NativeStackNavigationOptions\n * @returns {NativeStackNavigationOptions} Merged NativeStackNavigationOptions\n */\nexport const getFormSheetScreenOptions = ({\n headerTitle,\n sheetAllowedDetents = [0.25],\n ...rest\n}: NativeStackNavigationOptions = {}): NativeStackNavigationOptions => ({\n presentation: 'formSheet',\n headerShown: false,\n sheetAllowedDetents,\n sheetCornerRadius: 16,\n sheetGrabberVisible: true,\n headerTitle,\n ...rest,\n})\n\nconst FormSheet = {\n Root: FormSheetRoot,\n Action: FormSheetAction,\n Header: FormSheetHeader,\n HeaderTitle: FormSheetHeaderTitle,\n HeaderActions: FormSheetHeaderActions,\n HeaderSecondaryButton: FormSheetHeaderSecondaryButton,\n HeaderPrimaryButton: FormSheetHeaderPrimaryButton,\n} as const\n\ntype FormSheetComponents = {\n Root: React.FC<FormSheetRootProps>\n Action: React.FC<FormSheetActionProps>\n Header: React.FC<FormSheetHeaderProps>\n HeaderTitle: React.FC<FormSheetHeaderTitleProps>\n HeaderActions: React.FC<FormSheetHeaderActionsProps>\n HeaderSecondaryButton: React.FC<FormSheetHeaderSecondaryButtonProps>\n HeaderPrimaryButton: React.FC<FormSheetHeaderPrimaryButtonProps>\n}\n\nexport default FormSheet as FormSheetComponents\nexport type {\n FormSheetRootProps,\n FormSheetActionProps,\n FormSheetHeaderProps,\n FormSheetHeaderTitleProps,\n FormSheetHeaderActionsProps,\n FormSheetHeaderSecondaryButtonProps,\n FormSheetHeaderPrimaryButtonProps,\n}\n\n// ====================================\n// ====== ActionsFormSheetRoot ========\n// ====================================\n\ninterface FormSheetRootProps {\n children: ReactNode\n style?: StyleProp<ViewStyle>\n contentStyle?: StyleProp<ViewStyle>\n}\n\nexport function FormSheetRoot({ children, style, contentStyle }: FormSheetRootProps) {\n const styles = useStyles()\n\n return (\n <View style={[styles.container, style]} collapsable={false}>\n <AndroidSheetGrabber />\n <View style={[styles.content, contentStyle]}>{children}</View>\n </View>\n )\n}\n\nFormSheetRoot.displayName = 'FormSheet.Root'\n\n// ====================================\n// ====== AndroidSheetGrabber =========\n// ====================================\n\nfunction AndroidSheetGrabber() {\n const styles = useStyles()\n\n return Platform.select({\n android: <View style={styles.androidSheetGrabber} />,\n ios: null,\n })\n}\n\n// ====================================\n// ====== FormSheetHeader =============\n// ====================================\n\ninterface FormSheetHeaderProps {\n children: ReactNode\n}\n\nfunction FormSheetHeader({ children }: FormSheetHeaderProps) {\n const styles = useStyles()\n\n return <View style={styles.header}>{children}</View>\n}\n\nFormSheetHeader.displayName = 'FormSheet.Header'\n\n// ====================================\n// ====== FormSheetHeaderTitle ========\n// ====================================\n\ninterface FormSheetHeaderTitleProps {\n children: ReactNode\n}\n\nfunction FormSheetHeaderTitle({ children }: FormSheetHeaderTitleProps) {\n const styles = useStyles()\n\n return (\n <Heading variant=\"h3\" style={styles.headerTitle} maxFontSizeMultiplier={1}>\n {children}\n </Heading>\n )\n}\n\nFormSheetHeaderTitle.displayName = 'FormSheet.HeaderTitle'\n\n// ====================================\n// ====== FormSheetHeaderActions ======\n// ====================================\n\ninterface FormSheetHeaderActionsProps {\n children: ReactNode\n}\n\nfunction FormSheetHeaderActions({ children }: FormSheetHeaderActionsProps) {\n const styles = useStyles()\n\n return <View style={styles.headerActions}>{children}</View>\n}\n\nFormSheetHeaderActions.displayName = 'FormSheet.HeaderActions'\n\n// ===========================================\n// ====== FormSheetHeaderSecondaryButton ====\n// ===========================================\n\ninterface FormSheetHeaderSecondaryButtonProps\n extends Omit<TextButtonProps, 'maxFontSizeMultiplier'> {}\n\nfunction FormSheetHeaderSecondaryButton(props: FormSheetHeaderSecondaryButtonProps) {\n return <TextButton {...props} maxFontSizeMultiplier={1} />\n}\n\nFormSheetHeaderSecondaryButton.displayName = 'FormSheet.HeaderSecondaryButton'\n\n// =========================================\n// ====== FormSheetHeaderPrimaryButton ====\n// =========================================\n\ninterface FormSheetHeaderPrimaryButtonProps extends Omit<ButtonProps, 'maxFontSizeMultiplier'> {}\n\nfunction FormSheetHeaderPrimaryButton(props: FormSheetHeaderPrimaryButtonProps) {\n return <Button {...props} maxFontSizeMultiplier={1} />\n}\n\nFormSheetHeaderPrimaryButton.displayName = 'FormSheet.HeaderPrimaryButton'\n\n// ====================================\n// ====== ActionsFormSheetAction ======\n// ====================================\n\nconst FORM_SHEET_ACTION_APPEARANCES = {\n neutral: 'neutral',\n danger: 'danger',\n} as const\n\ntype FormSheetActionAppearanceUnion =\n (typeof FORM_SHEET_ACTION_APPEARANCES)[keyof typeof FORM_SHEET_ACTION_APPEARANCES]\n\ninterface FormSheetActionProps {\n title: string\n iconName: IconString\n onPress: () => void\n accessibilityLabel?: string\n accessibilityHint?: string\n accessibilityRole?: AccessibilityRole\n appearance?: FormSheetActionAppearanceUnion\n disabled?: boolean\n}\n\nfunction FormSheetAction({\n title,\n iconName,\n onPress,\n accessibilityLabel,\n accessibilityHint,\n accessibilityRole = 'button',\n appearance = 'neutral',\n disabled = false,\n}: FormSheetActionProps) {\n const styles = useStyles({ appearance })\n\n return (\n <PlatformPressable\n onPress={onPress}\n accessibilityLabel={accessibilityLabel}\n accessibilityHint={accessibilityHint}\n accessibilityRole={accessibilityRole}\n style={styles.actionPressable}\n disabled={disabled}\n >\n <Icon name={iconName} size={16} accessibilityElementsHidden style={styles.actionIcon} />\n <Text style={styles.actionTitle}>{title}</Text>\n </PlatformPressable>\n )\n}\n\nFormSheetAction.displayName = 'FormSheet.Action'\n\n// ==================================\n// ====== Styles ====================\n// ==================================\n\ninterface Styles {\n appearance?: FormSheetActionAppearanceUnion\n}\n\nconst useStyles = ({ appearance = 'neutral' }: Styles = {}) => {\n const { colors } = useTheme()\n const { height } = useWindowDimensions()\n const { bottom, top } = useSafeAreaInsets()\n const headerHeight = useHeaderHeight()\n\n const containerHeight = Platform.select({\n ios: height - top - headerHeight,\n default: null,\n })\n\n const appearanceColorsMap = {\n neutral: {\n iconColor: colors.iconColorDefaultPrimary,\n textColor: colors.textColorDefaultPrimary,\n },\n danger: {\n iconColor: colors.fillColorStatusErrorMedium,\n textColor: colors.fillColorStatusErrorMedium,\n },\n }\n\n return StyleSheet.create({\n container: {\n justifyContent: 'flex-start',\n paddingBottom: bottom,\n width: '100%',\n backgroundColor: colors.fillColorNeutral100Inverted,\n height: containerHeight,\n ...Platform.select({\n ios: {\n flexGrow: 1, // Ensures the FormSheet children respond to the formsheet height changing on iOS\n },\n android: {\n maxHeight: '100%', // Ensures lists to scroll on Android\n },\n }),\n },\n androidSheetGrabber: {\n marginTop: 5,\n width: 34,\n height: 5,\n backgroundColor: colors.fillColorNeutral040,\n borderRadius: 100,\n alignSelf: 'center',\n },\n content: {\n paddingTop: Platform.select({ android: 16, ios: 20 }),\n ...Platform.select({\n android: {\n maxHeight: '100%', // Ensures content above a list (e.g. FormSheet.Header) don't subtract from the FormSheet's height\n },\n }),\n },\n header: {\n backgroundColor: colors.fillColorNeutral100Inverted,\n paddingHorizontal: 16,\n paddingBottom: 16,\n gap: 16,\n borderBottomWidth: 1,\n borderBottomColor: colors.borderColorDefaultBase,\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n },\n headerTitle: {\n textAlign: 'left',\n },\n headerActions: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 16,\n },\n actionPressable: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingVertical: 12,\n paddingHorizontal: 16,\n gap: 8,\n },\n actionIcon: {\n color: appearanceColorsMap[appearance].iconColor,\n },\n actionTitle: {\n color: appearanceColorsMap[appearance].textColor,\n },\n })\n}\n"]}
|
|
1
|
+
{"version":3,"file":"form_sheet.js","sourceRoot":"","sources":["../../../src/components/primitive/form_sheet.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAE/E,OAAO,KAAoB,MAAM,OAAO,CAAA;AACxC,OAAO,EACL,QAAQ,EACR,UAAU,EACV,IAAI,EACJ,mBAAmB,GAIpB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAc,IAAI,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEhF,oCAAoC;AACpC,oCAAoC;AACpC,oCAAoC;AAEpC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,EACxC,WAAW,EACX,mBAAmB,GAAG,CAAC,IAAI,CAAC,EAC5B,GAAG,IAAI,KACyB,EAAE,EAAgC,EAAE,CAAC,CAAC;IACtE,YAAY,EAAE,WAAW;IACzB,WAAW,EAAE,KAAK;IAClB,mBAAmB;IACnB,iBAAiB,EAAE,EAAE;IACrB,mBAAmB,EAAE,IAAI;IACzB,WAAW;IACX,GAAG,IAAI;CACR,CAAC,CAAA;AAEF,MAAM,SAAS,GAAG;IAChB,IAAI,EAAE,aAAa;IACnB,MAAM,EAAE,eAAe;IACvB,MAAM,EAAE,eAAe;IACvB,WAAW,EAAE,oBAAoB;IACjC,aAAa,EAAE,sBAAsB;IACrC,qBAAqB,EAAE,8BAA8B;IACrD,mBAAmB,EAAE,4BAA4B;CACzC,CAAA;AAYV,eAAe,SAAgC,CAAA;AAqB/C,MAAM,UAAU,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AAS,EAAE,MAAM;SAClB;QACD,aAAa,EAAE;YACb,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,EAAE;SACR;QACD,eAAe,EAAE;YACf,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,eAAe,EAAE,EAAE;YACnB,iBAAiB,EAAE,EAAE;YACrB,GAAG,EAAE,CAAC;SACP;QACD,UAAU,EAAE;YACV,KAAK,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC,SAAS;SACjD;QACD,WAAW,EAAE;YACX,KAAK,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC,SAAS;SACjD;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable, useHeaderHeight } from '@react-navigation/elements'\nimport { NativeStackNavigationOptions } from '@react-navigation/native-stack'\nimport React, { ReactNode } from 'react'\nimport {\n Platform,\n StyleSheet,\n View,\n useWindowDimensions,\n type AccessibilityRole,\n type StyleProp,\n type ViewStyle,\n} from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { useTheme } from '../../hooks'\nimport type { ButtonProps, TextButtonProps } from '../display'\nimport { Button, Heading, Icon, IconString, Text, TextButton } from '../display'\n\n// =================================\n// ====== Exports ==================\n// =================================\n\n/**\n * Screen options for the formsheet's NativeStackNavigation route\n * @param {string} options.headerTitle - Doesn't show in UI but good to have for semantic reasons.\n * @param {number[]} [options.sheetAllowedDetents] - Controls the height increments the sheet grows to. To prevent bugs in Android, do not specify more then two values and use [0.94] instead of [1] to go full screen.\n * @param {NativeStackNavigationOptions} [options.rest] - Adds or overrides any valid NativeStackNavigationOptions\n * @returns {NativeStackNavigationOptions} Merged NativeStackNavigationOptions\n */\nexport const getFormSheetScreenOptions = ({\n headerTitle,\n sheetAllowedDetents = [0.25],\n ...rest\n}: NativeStackNavigationOptions = {}): NativeStackNavigationOptions => ({\n presentation: 'formSheet',\n headerShown: false,\n sheetAllowedDetents,\n sheetCornerRadius: 16,\n sheetGrabberVisible: true,\n headerTitle,\n ...rest,\n})\n\nconst FormSheet = {\n Root: FormSheetRoot,\n Action: FormSheetAction,\n Header: FormSheetHeader,\n HeaderTitle: FormSheetHeaderTitle,\n HeaderActions: FormSheetHeaderActions,\n HeaderSecondaryButton: FormSheetHeaderSecondaryButton,\n HeaderPrimaryButton: FormSheetHeaderPrimaryButton,\n} as const\n\ntype FormSheetComponents = {\n Root: React.FC<FormSheetRootProps>\n Action: React.FC<FormSheetActionProps>\n Header: React.FC<FormSheetHeaderProps>\n HeaderTitle: React.FC<FormSheetHeaderTitleProps>\n HeaderActions: React.FC<FormSheetHeaderActionsProps>\n HeaderSecondaryButton: React.FC<FormSheetHeaderSecondaryButtonProps>\n HeaderPrimaryButton: React.FC<FormSheetHeaderPrimaryButtonProps>\n}\n\nexport default FormSheet as FormSheetComponents\nexport type {\n FormSheetActionProps,\n FormSheetHeaderActionsProps,\n FormSheetHeaderPrimaryButtonProps,\n FormSheetHeaderProps,\n FormSheetHeaderSecondaryButtonProps,\n FormSheetHeaderTitleProps,\n FormSheetRootProps,\n}\n\n// ====================================\n// ====== ActionsFormSheetRoot ========\n// ====================================\n\ninterface FormSheetRootProps {\n children: ReactNode\n style?: StyleProp<ViewStyle>\n contentStyle?: StyleProp<ViewStyle>\n}\n\nexport function FormSheetRoot({ children, style, contentStyle }: FormSheetRootProps) {\n const styles = useStyles()\n\n return (\n <View style={[styles.container, style]} collapsable={false}>\n <View style={[styles.content, contentStyle]}>{children}</View>\n <AndroidSheetGrabber />\n </View>\n )\n}\n\nFormSheetRoot.displayName = 'FormSheet.Root'\n\n// ====================================\n// ====== AndroidSheetGrabber =========\n// ====================================\n\nfunction AndroidSheetGrabber() {\n const styles = useStyles()\n\n return Platform.select({\n android: <View style={styles.androidSheetGrabber} />,\n ios: null,\n })\n}\n\n// ====================================\n// ====== FormSheetHeader =============\n// ====================================\n\ninterface FormSheetHeaderProps {\n children: ReactNode\n}\n\nfunction FormSheetHeader({ children }: FormSheetHeaderProps) {\n const styles = useStyles()\n\n return (\n <View style={styles.header}>\n <View style={styles.headerContent}>{children}</View>\n </View>\n )\n}\n\nFormSheetHeader.displayName = 'FormSheet.Header'\n\n// ====================================\n// ====== FormSheetHeaderTitle ========\n// ====================================\n\ninterface FormSheetHeaderTitleProps {\n children: ReactNode\n}\n\nfunction FormSheetHeaderTitle({ children }: FormSheetHeaderTitleProps) {\n const styles = useStyles()\n\n return (\n <Heading variant=\"h3\" style={styles.headerTitle} maxFontSizeMultiplier={1}>\n {children}\n </Heading>\n )\n}\n\nFormSheetHeaderTitle.displayName = 'FormSheet.HeaderTitle'\n\n// ====================================\n// ====== FormSheetHeaderActions ======\n// ====================================\n\ninterface FormSheetHeaderActionsProps {\n children: ReactNode\n}\n\nfunction FormSheetHeaderActions({ children }: FormSheetHeaderActionsProps) {\n const styles = useStyles()\n\n return <View style={styles.headerActions}>{children}</View>\n}\n\nFormSheetHeaderActions.displayName = 'FormSheet.HeaderActions'\n\n// ===========================================\n// ====== FormSheetHeaderSecondaryButton ====\n// ===========================================\n\ninterface FormSheetHeaderSecondaryButtonProps\n extends Omit<TextButtonProps, 'maxFontSizeMultiplier'> {}\n\nfunction FormSheetHeaderSecondaryButton(props: FormSheetHeaderSecondaryButtonProps) {\n return <TextButton {...props} maxFontSizeMultiplier={1} />\n}\n\nFormSheetHeaderSecondaryButton.displayName = 'FormSheet.HeaderSecondaryButton'\n\n// =========================================\n// ====== FormSheetHeaderPrimaryButton ====\n// =========================================\n\ninterface FormSheetHeaderPrimaryButtonProps extends Omit<ButtonProps, 'maxFontSizeMultiplier'> {}\n\nfunction FormSheetHeaderPrimaryButton(props: FormSheetHeaderPrimaryButtonProps) {\n return <Button {...props} maxFontSizeMultiplier={1} />\n}\n\nFormSheetHeaderPrimaryButton.displayName = 'FormSheet.HeaderPrimaryButton'\n\n// ====================================\n// ====== ActionsFormSheetAction ======\n// ====================================\n\nconst FORM_SHEET_ACTION_APPEARANCES = {\n neutral: 'neutral',\n danger: 'danger',\n} as const\n\ntype FormSheetActionAppearanceUnion =\n (typeof FORM_SHEET_ACTION_APPEARANCES)[keyof typeof FORM_SHEET_ACTION_APPEARANCES]\n\ninterface FormSheetActionProps {\n title: string\n iconName: IconString\n onPress: () => void\n accessibilityLabel?: string\n accessibilityHint?: string\n accessibilityRole?: AccessibilityRole\n appearance?: FormSheetActionAppearanceUnion\n disabled?: boolean\n}\n\nfunction FormSheetAction({\n title,\n iconName,\n onPress,\n accessibilityLabel,\n accessibilityHint,\n accessibilityRole = 'button',\n appearance = 'neutral',\n disabled = false,\n}: FormSheetActionProps) {\n const styles = useStyles({ appearance })\n\n return (\n <PlatformPressable\n onPress={onPress}\n accessibilityLabel={accessibilityLabel}\n accessibilityHint={accessibilityHint}\n accessibilityRole={accessibilityRole}\n style={styles.actionPressable}\n disabled={disabled}\n >\n <Icon name={iconName} size={16} accessibilityElementsHidden style={styles.actionIcon} />\n <Text style={styles.actionTitle}>{title}</Text>\n </PlatformPressable>\n )\n}\n\nFormSheetAction.displayName = 'FormSheet.Action'\n\n// ==================================\n// ====== Styles ====================\n// ==================================\n\ninterface Styles {\n appearance?: FormSheetActionAppearanceUnion\n}\n\nconst useStyles = ({ appearance = 'neutral' }: Styles = {}) => {\n const { colors } = useTheme()\n const { height } = useWindowDimensions()\n const { bottom, top } = useSafeAreaInsets()\n const headerHeight = useHeaderHeight()\n\n const containerHeight = Platform.select({\n ios: height - top - headerHeight,\n default: null,\n })\n\n const appearanceColorsMap = {\n neutral: {\n iconColor: colors.iconColorDefaultPrimary,\n textColor: colors.textColorDefaultPrimary,\n },\n danger: {\n iconColor: colors.fillColorStatusErrorMedium,\n textColor: colors.fillColorStatusErrorMedium,\n },\n }\n\n return StyleSheet.create({\n container: {\n justifyContent: 'flex-start',\n paddingBottom: bottom,\n width: '100%',\n backgroundColor: colors.fillColorNeutral100Inverted,\n height: containerHeight,\n ...Platform.select({\n ios: {\n flexGrow: 1, // Ensures the FormSheet children respond to the formsheet height changing on iOS\n },\n android: {\n maxHeight: '100%', // Ensures lists to scroll on Android\n },\n }),\n },\n androidSheetGrabber: {\n position: 'absolute',\n top: 5,\n width: 34,\n height: 5,\n backgroundColor: colors.fillColorNeutral040,\n borderRadius: 100,\n alignSelf: 'center',\n },\n content: {\n ...Platform.select({\n android: {\n maxHeight: '100%', // Ensures content above a list (e.g. FormSheet.Header) don't subtract from the FormSheet's height\n },\n }),\n },\n header: {\n paddingHorizontal: 16,\n paddingTop: 20,\n paddingBottom: 16,\n backgroundColor: colors.fillColorNeutral100Inverted,\n gap: 16,\n borderBottomWidth: 1,\n borderBottomColor: colors.borderColorDefaultBase,\n },\n headerContent: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n },\n headerTitle: {\n textAlign: 'left',\n },\n headerActions: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 16,\n },\n actionPressable: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingVertical: 12,\n paddingHorizontal: 16,\n gap: 8,\n },\n actionIcon: {\n color: appearanceColorsMap[appearance].iconColor,\n },\n actionTitle: {\n color: appearanceColorsMap[appearance].textColor,\n },\n })\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment_actions_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/attachment_actions/attachment_actions_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAiB,MAAM,0BAA0B,CAAA;AAC3E,OAAO,KAAsB,MAAM,OAAO,CAAA;AAK1C,eAAO,MAAM,8BAA8B,uEAEzC,CAAA;AAEF,MAAM,MAAM,4BAA4B,GAAG,iBAAiB,CAAC;IAC3D,YAAY,EAAE,MAAM,CAAA;IACpB,qBAAqB,EAAE,MAAM,CAAA;IAC7B,aAAa,EAAE,MAAM,CAAA;IACrB,eAAe,EAAE,MAAM,CAAA;IACvB,4BAA4B,EAAE,OAAO,CAAA;IACrC,SAAS,EAAE,OAAO,CAAA;CACnB,CAAC,CAAA;AAEF,wBAAgB,uBAAuB,CAAC,EAAE,KAAK,EAAE,EAAE,4BAA4B,
|
|
1
|
+
{"version":3,"file":"attachment_actions_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/attachment_actions/attachment_actions_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAiB,MAAM,0BAA0B,CAAA;AAC3E,OAAO,KAAsB,MAAM,OAAO,CAAA;AAK1C,eAAO,MAAM,8BAA8B,uEAEzC,CAAA;AAEF,MAAM,MAAM,4BAA4B,GAAG,iBAAiB,CAAC;IAC3D,YAAY,EAAE,MAAM,CAAA;IACpB,qBAAqB,EAAE,MAAM,CAAA;IAC7B,aAAa,EAAE,MAAM,CAAA;IACrB,eAAe,EAAE,MAAM,CAAA;IACvB,4BAA4B,EAAE,OAAO,CAAA;IACrC,SAAS,EAAE,OAAO,CAAA;CACnB,CAAC,CAAA;AAEF,wBAAgB,uBAAuB,CAAC,EAAE,KAAK,EAAE,EAAE,4BAA4B,qBAyD9E"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { 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
|
export const AttachmentActionsScreenOptions = getFormSheetScreenOptions({
|
|
@@ -11,6 +11,7 @@ export function AttachmentActionsScreen({ route }) {
|
|
|
11
11
|
const { attachmentId, attachmentContentType, attachmentUrl, conversation_id, canDeleteNonAuthoredMessages, myMessage, } = route.params;
|
|
12
12
|
const attachmentName = getAttachmentLabelName(attachmentContentType);
|
|
13
13
|
const canDelete = myMessage || canDeleteNonAuthoredMessages;
|
|
14
|
+
const styles = useStyles();
|
|
14
15
|
const { handleDeleteAttachment } = useDeleteAttachment({
|
|
15
16
|
conversation_id,
|
|
16
17
|
attachmentId,
|
|
@@ -26,11 +27,18 @@ export function AttachmentActionsScreen({ route }) {
|
|
|
26
27
|
Linking.openURL(attachmentUrl);
|
|
27
28
|
navigation.goBack();
|
|
28
29
|
};
|
|
29
|
-
return (<FormSheet.Root>
|
|
30
|
+
return (<FormSheet.Root contentStyle={styles.formSheetContent}>
|
|
30
31
|
<FormSheet.Action iconName="general.newWindow" title="Open in browser" accessibilityRole="link" accessibilityLabel={`Open ${attachmentName} in browser`} accessibilityHint={`${attachmentName} can be downloaded and shared through the browser.`} onPress={handleOpenInBrowser}/>
|
|
31
32
|
{canDelete && (<FormSheet.Action appearance="danger" iconName="publishing.trash" title={`Delete ${attachmentName}`} onPress={handleDeleteConfirm}/>)}
|
|
32
33
|
</FormSheet.Root>);
|
|
33
34
|
}
|
|
35
|
+
const useStyles = () => {
|
|
36
|
+
return StyleSheet.create({
|
|
37
|
+
formSheetContent: {
|
|
38
|
+
paddingTop: 16,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
};
|
|
34
42
|
function getAttachmentLabelName(contentType) {
|
|
35
43
|
if (contentType.startsWith('image/'))
|
|
36
44
|
return 'image';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment_actions_screen.js","sourceRoot":"","sources":["../../../src/screens/attachment_actions/attachment_actions_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAC3E,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"attachment_actions_screen.js","sourceRoot":"","sources":["../../../src/screens/attachment_actions/attachment_actions_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,aAAa,EAAE,MAAM,0BAA0B,C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AC,UAAU,CAAC,cAAc,CAAC;QAAE,OAAO,MAAM,CAAA;IAEzD,OAAO,EAAE,CAAA;AACX,CAAC","sourcesContent":["import { StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport React, { useCallback } from 'react'\nimport { Alert, Linking, StyleSheet } from 'react-native'\nimport FormSheet, { getFormSheetScreenOptions } from '../../components/primitive/form_sheet'\nimport { useDeleteAttachment } from './hooks/useDeleteAttachment'\n\nexport const AttachmentActionsScreenOptions = getFormSheetScreenOptions({\n headerTitle: 'Attachment actions',\n})\n\nexport type AttachmentActionsScreenProps = StaticScreenProps<{\n attachmentId: string\n attachmentContentType: string\n attachmentUrl: string\n conversation_id: number\n canDeleteNonAuthoredMessages: boolean\n myMessage: boolean\n}>\n\nexport function AttachmentActionsScreen({ route }: AttachmentActionsScreenProps) {\n const navigation = useNavigation()\n const {\n attachmentId,\n attachmentContentType,\n attachmentUrl,\n conversation_id,\n canDeleteNonAuthoredMessages,\n myMessage,\n } = route.params\n\n const attachmentName = getAttachmentLabelName(attachmentContentType)\n const canDelete = myMessage || canDeleteNonAuthoredMessages\n const styles = useStyles()\n\n const { handleDeleteAttachment } = useDeleteAttachment({\n conversation_id,\n attachmentId,\n attachmentName,\n })\n\n const handleDeleteConfirm = useCallback(() => {\n Alert.alert(\n `Delete ${attachmentName}`,\n 'Are you sure you want to permanently delete this attachment?',\n [\n { text: 'Cancel', style: 'cancel' },\n { text: 'Delete', style: 'destructive', onPress: () => handleDeleteAttachment() },\n ]\n )\n }, [attachmentName, handleDeleteAttachment])\n\n const handleOpenInBrowser = () => {\n Linking.openURL(attachmentUrl)\n navigation.goBack()\n }\n\n return (\n <FormSheet.Root contentStyle={styles.formSheetContent}>\n <FormSheet.Action\n iconName=\"general.newWindow\"\n title=\"Open in browser\"\n accessibilityRole=\"link\"\n accessibilityLabel={`Open ${attachmentName} in browser`}\n accessibilityHint={`${attachmentName} can be downloaded and shared through the browser.`}\n onPress={handleOpenInBrowser}\n />\n {canDelete && (\n <FormSheet.Action\n appearance=\"danger\"\n iconName=\"publishing.trash\"\n title={`Delete ${attachmentName}`}\n onPress={handleDeleteConfirm}\n />\n )}\n </FormSheet.Root>\n )\n}\n\nconst useStyles = () => {\n return StyleSheet.create({\n formSheetContent: {\n paddingTop: 16,\n },\n })\n}\n\nfunction getAttachmentLabelName(contentType: string) {\n if (contentType.startsWith('image/')) return 'image'\n if (contentType.startsWith('video/')) return 'video'\n if (contentType.startsWith('audio/')) return 'audio'\n if (contentType === 'application/pdf') return 'PDF'\n if (contentType.startsWith('application/')) return 'file'\n\n return ''\n}\n"]}
|
package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_filter_recipients_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/conversation_filter_recipients/conversation_filter_recipients_screen.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"conversation_filter_recipients_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/conversation_filter_recipients/conversation_filter_recipients_screen.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsB,MAAM,OAAO,CAAA;AAY1C,OAAO,EAAE,uCAAuC,EAAgB,MAAM,SAAS,CAAA;AAI/E,eAAO,MAAM,0CAA0C,uEAMrD,CAAA;AAEF,eAAO,MAAM,kCAAkC,eAE5C,uCAAuC,sBAiGzC,CAAA"}
|
package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
+
import { StackActions, useNavigation } from '@react-navigation/native';
|
|
1
2
|
import React, { useCallback } from 'react';
|
|
2
3
|
import { Platform, StyleSheet } from 'react-native';
|
|
3
|
-
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
4
4
|
import { FlatList } from 'react-native-gesture-handler';
|
|
5
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
5
6
|
import { Heading } from '../../components';
|
|
7
|
+
import FormSheet, { getFormSheetScreenOptions } from '../../components/primitive/form_sheet';
|
|
6
8
|
import { useTheme } from '../../hooks';
|
|
7
|
-
import { useFlattenedArrayOfServiceTypesWithTeams } from './hooks/use_flattened_array_of_service_types_with_teams';
|
|
8
|
-
import { SectionTypes } from './types';
|
|
9
|
-
import { HeaderRow } from './components/header_row';
|
|
10
9
|
import { tokens } from '../../vendor/tapestry/tokens';
|
|
11
10
|
import { CheckboxRow } from './components/checkbox_row';
|
|
11
|
+
import { HeaderRow } from './components/header_row';
|
|
12
|
+
import { useFlattenedArrayOfServiceTypesWithTeams } from './hooks/use_flattened_array_of_service_types_with_teams';
|
|
12
13
|
import { useServiceTypesWithTeams } from './hooks/use_service_types_with_teams';
|
|
13
|
-
import {
|
|
14
|
-
import FormSheet, { getFormSheetScreenOptions } from '../../components/primitive/form_sheet';
|
|
14
|
+
import { SectionTypes } from './types';
|
|
15
15
|
const SERVICE_TYPE_LABELLED_BY_PREFIX = 'header-';
|
|
16
16
|
export const ConversationFilterReceipientsScreenOptions = getFormSheetScreenOptions({
|
|
17
17
|
sheetAllowedDetents: Platform.select({
|
|
@@ -23,6 +23,7 @@ export const ConversationFilterReceipientsScreenOptions = getFormSheetScreenOpti
|
|
|
23
23
|
export const ConversationFilterRecipientsScreen = ({ route, }) => {
|
|
24
24
|
const styles = useStyles();
|
|
25
25
|
const navigation = useNavigation();
|
|
26
|
+
const { team_ids: teamIds } = route.params;
|
|
26
27
|
const { serviceTypes } = useServiceTypesWithTeams();
|
|
27
28
|
const data = useFlattenedArrayOfServiceTypesWithTeams({
|
|
28
29
|
data: serviceTypes,
|
|
@@ -45,9 +46,11 @@ export const ConversationFilterRecipientsScreen = ({ route, }) => {
|
|
|
45
46
|
const applyTeamFilters = useCallback(() => {
|
|
46
47
|
navigation.dispatch(StackActions.popTo('ConversationNew', params));
|
|
47
48
|
}, [navigation, params]);
|
|
48
|
-
|
|
49
|
+
const teamIdCount = Number(teamIds?.length);
|
|
50
|
+
const count = teamIdCount > 1 ? ` (${teamIdCount})` : '';
|
|
51
|
+
return (<FormSheet.Root style={styles.root}>
|
|
49
52
|
<FormSheet.Header>
|
|
50
|
-
<FormSheet.HeaderTitle>Teams I lead</FormSheet.HeaderTitle>
|
|
53
|
+
<FormSheet.HeaderTitle>Teams I lead{count}</FormSheet.HeaderTitle>
|
|
51
54
|
<FormSheet.HeaderActions>
|
|
52
55
|
<FormSheet.HeaderSecondaryButton onPress={resetTeamFilters} accessibilityHint="Cancels any selected teams and closes this modal.">
|
|
53
56
|
Cancel
|
|
@@ -74,8 +77,10 @@ const useStyles = () => {
|
|
|
74
77
|
const { colors } = useTheme();
|
|
75
78
|
const { bottom } = useSafeAreaInsets();
|
|
76
79
|
return StyleSheet.create({
|
|
77
|
-
|
|
80
|
+
root: {
|
|
78
81
|
backgroundColor: colors.surfaceColor080,
|
|
82
|
+
},
|
|
83
|
+
listContentContainer: {
|
|
79
84
|
padding: 16,
|
|
80
85
|
paddingBottom: bottom + Platform.select({ android: 24, default: 16 }),
|
|
81
86
|
},
|
package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_filter_recipients_screen.js","sourceRoot":"","sources":["../../../src/screens/conversation_filter_recipients/conversation_filter_recipients_screen.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"conversation_filter_recipients_screen.js","sourceRoot":"","sources":["../../../src/screens/conversation_filter_recipients/conversation_filter_recipients_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAEtE,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AACvD,OAAO,EAAE,iBAAiB,EAAE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H,KAAK,YAAY,CAAC,IAAI;oBACpB,OAAO,CACL,CAAC,WAAW,CACV,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAChB,KAAK,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CACzB,uBAAuB,CAAC,CAAC,GAAG,+BAA+B,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CACxF,cAAc,CAAC,CAAC,cAAc,CAAC,EAC/B,CACH,CAAA;gBACH;oBACE,OAAO,IAAI,CAAA;YACf,CAAC;QACH,CAAC,CAAC,EAEN;IAAA,EAAE,SAAS,CAAC,IAAI,CAAC,CAClB,CAAA;AACH,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAC7B,MAAM,EAAE,MAAM,EAAE,GAAG,iBAAiB,EAAE,CAAA;IAEtC,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,IAAI,EAAE;YACJ,eAAe,EAAE,MAAM,CAAC,eAAe;SACxC;QACD,oBAAoB,EAAE;YACpB,OAAO,EAAE,EAAE;YACX,aAAa,EAAE,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;SACtE;QACD,UAAU,EAAE;YACV,aAAa,EAAE,EAAE;SAClB;QACD,QAAQ,EAAE;YACR,oBAAoB,EAAE,MAAM,CAAC,cAAc;YAC3C,kBAAkB,EAAE,MAAM,CAAC,cAAc;SAC1C;QACD,OAAO,EAAE;YACP,uBAAuB,EAAE,MAAM,CAAC,cAAc;YAC9C,qBAAqB,EAAE,MAAM,CAAC,cAAc;YAC5C,YAAY,EAAE,EAAE;SACjB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { StackActions, useNavigation } from '@react-navigation/native'\nimport { NativeStackNavigationProp } from '@react-navigation/native-stack'\nimport React, { useCallback } from 'react'\nimport { Platform, StyleSheet } from 'react-native'\nimport { FlatList } from 'react-native-gesture-handler'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { Heading } from '../../components'\nimport FormSheet, { getFormSheetScreenOptions } from '../../components/primitive/form_sheet'\nimport { useTheme } from '../../hooks'\nimport { tokens } from '../../vendor/tapestry/tokens'\nimport { CheckboxRow } from './components/checkbox_row'\nimport { HeaderRow } from './components/header_row'\nimport { useFlattenedArrayOfServiceTypesWithTeams } from './hooks/use_flattened_array_of_service_types_with_teams'\nimport { useServiceTypesWithTeams } from './hooks/use_service_types_with_teams'\nimport { ConversationFilterRecipientsScreenProps, SectionTypes } from './types'\n\nconst SERVICE_TYPE_LABELLED_BY_PREFIX = 'header-'\n\nexport const ConversationFilterReceipientsScreenOptions = getFormSheetScreenOptions({\n sheetAllowedDetents: Platform.select({\n android: [0.75, 0.94],\n default: [0.75, 1],\n }),\n headerTitle: 'Teams I lead',\n})\n\nexport const ConversationFilterRecipientsScreen = ({\n route,\n}: ConversationFilterRecipientsScreenProps) => {\n const styles = useStyles()\n const navigation =\n useNavigation<NativeStackNavigationProp<ConversationFilterRecipientsScreenProps>>()\n const { team_ids: teamIds } = route.params\n\n const { serviceTypes } = useServiceTypesWithTeams()\n const data = useFlattenedArrayOfServiceTypesWithTeams({\n data: serviceTypes,\n firstRowStyle: styles.firstRow,\n lastRowStyle: styles.lastRow,\n })\n\n const { params } = route\n const noTeamsSelected = params.team_ids?.length === 0 || !params.team_ids\n const applyButtonAccessibilityHint = noTeamsSelected\n ? 'Select at least one team to navigate to the final step in creating your conversation.'\n : 'Saves selected teams and navigates to the final step to create your conversation.'\n\n const setTeamFilters = useCallback(\n ({ team_ids }: { team_ids: number[] }) => {\n navigation.setParams({\n team_ids,\n })\n },\n [navigation]\n )\n\n const resetTeamFilters = useCallback(() => {\n navigation.goBack()\n }, [navigation])\n\n const applyTeamFilters = useCallback(() => {\n navigation.dispatch(StackActions.popTo('ConversationNew', params))\n }, [navigation, params])\n\n const teamIdCount = Number(teamIds?.length)\n const count = teamIdCount > 1 ? ` (${teamIdCount})` : ''\n\n return (\n <FormSheet.Root style={styles.root}>\n <FormSheet.Header>\n <FormSheet.HeaderTitle>Teams I lead{count}</FormSheet.HeaderTitle>\n <FormSheet.HeaderActions>\n <FormSheet.HeaderSecondaryButton\n onPress={resetTeamFilters}\n accessibilityHint=\"Cancels any selected teams and closes this modal.\"\n >\n Cancel\n </FormSheet.HeaderSecondaryButton>\n <FormSheet.HeaderPrimaryButton\n title=\"Apply\"\n accessibilityHint={applyButtonAccessibilityHint}\n onPress={applyTeamFilters}\n disabled={noTeamsSelected}\n />\n </FormSheet.HeaderActions>\n </FormSheet.Header>\n\n <FlatList\n data={data}\n ListHeaderComponent={\n <Heading variant=\"h3\" style={styles.listHeader}>\n Service Types\n </Heading>\n }\n contentContainerStyle={styles.listContentContainer}\n keyExtractor={item =>\n `${item.type === SectionTypes.header ? item.data.serviceTypeId : item.data.teamId}`\n }\n renderItem={({ item }) => {\n switch (item.type) {\n case SectionTypes.header:\n return (\n <HeaderRow\n data={item.data}\n style={item.sectionStyle}\n nativeID={`${SERVICE_TYPE_LABELLED_BY_PREFIX}${item.data.serviceTypeId}`}\n setTeamFilters={setTeamFilters}\n />\n )\n case SectionTypes.team:\n return (\n <CheckboxRow\n data={item.data}\n style={item.sectionStyle}\n accessibilityLabelledBy={`${SERVICE_TYPE_LABELLED_BY_PREFIX}${item.data.serviceTypeId}`}\n setTeamFilters={setTeamFilters}\n />\n )\n default:\n return null\n }\n }}\n />\n </FormSheet.Root>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n const { bottom } = useSafeAreaInsets()\n\n return StyleSheet.create({\n root: {\n backgroundColor: colors.surfaceColor080,\n },\n listContentContainer: {\n padding: 16,\n paddingBottom: bottom + Platform.select({ android: 24, default: 16 }),\n },\n listHeader: {\n paddingBottom: 16,\n },\n firstRow: {\n borderTopStartRadius: tokens.borderRadiusLg,\n borderTopEndRadius: tokens.borderRadiusLg,\n },\n lastRow: {\n borderBottomStartRadius: tokens.borderRadiusLg,\n borderBottomEndRadius: tokens.borderRadiusLg,\n marginBottom: 16,\n },\n })\n}\n"]}
|
|
@@ -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;
|
|
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;AAGzF,OAAO,KAAsB,MAAM,OAAO,CAAA;AAY1C,eAAO,MAAM,2BAA2B,uEAGtC,CAAA;AAEF,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,qBAoJxE"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { PlatformPressable } from '@react-navigation/elements';
|
|
2
2
|
import { StackActions, useNavigation } from '@react-navigation/native';
|
|
3
3
|
import { useMutation } from '@tanstack/react-query';
|
|
4
|
+
import { isNil, omitBy } from 'lodash';
|
|
4
5
|
import React, { useCallback } from 'react';
|
|
5
6
|
import { Alert, Platform, StyleSheet, View } from 'react-native';
|
|
6
7
|
import { Text } from '../components';
|
|
7
8
|
import { REACTION_EMOJIS, useReactionStyles } from '../components/conversation/message_reaction';
|
|
9
|
+
import FormSheet, { getFormSheetScreenOptions } from '../components/primitive/form_sheet';
|
|
8
10
|
import { useCreateAndroidRippleColor, useFontScale, useTheme } from '../hooks';
|
|
9
11
|
import { useApiClient } from '../hooks/use_api_client';
|
|
10
12
|
import { useConversationMessages } from '../hooks/use_conversation_messages';
|
|
11
13
|
import { useMessageReactionToggle } from '../hooks/use_message_reaction_toggle';
|
|
12
14
|
import { Clipboard } from '../utils/native_adapters';
|
|
13
|
-
import { isNil, omitBy } from 'lodash';
|
|
14
|
-
import FormSheet, { getFormSheetScreenOptions } from '../components/primitive/form_sheet';
|
|
15
15
|
export const MessageActionsScreenOptions = getFormSheetScreenOptions({
|
|
16
16
|
sheetAllowedDetents: [0.5],
|
|
17
17
|
headerTitle: 'Message actions',
|
|
@@ -87,7 +87,7 @@ export function MessageActionsScreen({ route }) {
|
|
|
87
87
|
}, isNil);
|
|
88
88
|
navigation.dispatch(StackActions.popTo('MessageReadReceipts', params));
|
|
89
89
|
}, [navigation, conversation_id, message_id]);
|
|
90
|
-
return (<FormSheet.Root>
|
|
90
|
+
return (<FormSheet.Root style={styles.formSheetContent}>
|
|
91
91
|
<View style={styles.reactionList}>
|
|
92
92
|
{availableReactions.map((reaction, index) => (<Reaction key={index} reaction={reaction} onPress={() => handleReactionToggle({
|
|
93
93
|
value: reaction.value,
|
|
@@ -122,6 +122,9 @@ const useStyles = () => {
|
|
|
122
122
|
android: baseSize + btnBorderWidth * 2,
|
|
123
123
|
});
|
|
124
124
|
return StyleSheet.create({
|
|
125
|
+
formSheetContent: {
|
|
126
|
+
paddingTop: 16,
|
|
127
|
+
},
|
|
125
128
|
reactionList: {
|
|
126
129
|
flexDirection: 'row',
|
|
127
130
|
justifyContent: 'center',
|
|
@@ -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,K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AAE,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","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,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACtC,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,SAAS,EAAE,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAA;AACzF,OAAO,EAAE,2BAA2B,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,UAAU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;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:
|
|
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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AAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;SACzD;QACD,gBAAgB,EAAE;YAChB,UAAU,EAAE,CAAC;YACb,aAAa,EAAE,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;SACtE;QACD,SAAS,EAAE;YACT,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,CAAC;YACN,eAAe,EAAE,CAAC;YAClB,iBAAiB,EAAE,EAAE;YACrB,IAAI,EAAE,CAAC;SACR;QACD,UAAU,EAAE;YACV,IAAI,EAAE,CAAC;SACR;QACD,QAAQ,EAAE;YACR,iBAAiB,EAAE,CAAC;YACpB,eAAe,EAAE,EAAE;YACnB,aAAa,EAAE,KAAK;YACpB,GAAG,EAAE,CAAC;SACP;QACD,eAAe,EAAE;YACf,QAAQ,EAAE,EAAE;YACZ,UAAU,EAAE,wBAAwB;SACrC;QACD,OAAO,EAAE;YACP,SAAS,EAAE,EAAE,GAAG,SAAS;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":[],"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QACvB,gBAAgB,EAAE;YAChB,UAAU,EAAE,EAAE;SACf;QACD,gBAAgB,EAAE;YAChB,UAAU,EAAE,CAAC;YACb,aAAa,EAAE,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;SACtE;QACD,SAAS,EAAE;YACT,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,CAAC;YACN,eAAe,EAAE,CAAC;YAClB,iBAAiB,EAAE,EAAE;YACrB,IAAI,EAAE,CAAC;SACR;QACD,UAAU,EAAE;YACV,IAAI,EAAE,CAAC;SACR;QACD,QAAQ,EAAE;YACR,iBAAiB,EAAE,CAAC;YACpB,eAAe,EAAE,EAAE;YACnB,aAAa,EAAE,KAAK;YACpB,GAAG,EAAE,CAAC;SACP;QACD,eAAe,EAAE;YACf,QAAQ,EAAE,EAAE;YACZ,UAAU,EAAE,wBAAwB;SACrC;QACD,OAAO,EAAE;YACP,SAAS,EAAE,EAAE,GAAG,SAAS;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 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:
|
|
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,EAAE,MAAM,0BAA0B,CAAA;AACzF,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,KAAK,IAAI,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACpG,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAc,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,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O,EAAE,CAAC;YACV,YAAY,EAAE,CAAC;YACf,eAAe,EAAE,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,aAAa;SAChF;QACD,mBAAmB,EAAE;YACnB,KAAK,EAAE,GAAG;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 { 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/cCRMjJbTa9JKDSG7M0N5M\nWDn9iOeUHWpl+hTs2UQZF6HvnrVNIGMFfpq8ltdEUhQeiyvr+FgLm1Pl0WVvWtb8sT6+bkZL5aBJ\nli1ZVLKGmN+GFDM8X3exlB6UCh4qUmTe9eRFKL96VTzVF/MshZ6sjg2tDknSF4pyECoTduALl69p\nr3CYpDB3aP7OnhOgqP3NXBkbeocFU9/bhjBj1yJjwpRFs3Al+IjzGB6Z4fHWdW+wJlpHaP7eWqBB\nqRdQ5n8VvksFHL8ov/ltZd8ZvkskwvmJlXMteLdnYa96zXtI1wCEmQDYZSBX9zqHVodWsSocuCVS\nph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AAC;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\nconst poweredByGiphyImage = `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAAAWCAYAAACFbNPBAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA\nGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABa9JREFUeNrsWy1z40gQla8EDAwE\nDAQCDAIMAgwCDA0XBgYGBu5PyM84aLgw8KDBAoMDBgsEAgQEBAQEBARclZ2uepPrne2WRrbls7Pq\nKpWc0UxPz0y//pIyen9/Dwa6LhqNRjNzmwmPcnOl5kzrYZdOQ+GwBVcDirG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7dtiniAExpBAKYaINtYh+KIl50GEfzwkIX6ufnDnU+tri\nPY8KOTsDxFHQGiEVxaN7mzsIVi5ylCwHHwuQCjwKgO5GCq9gOXxjSQuOTLDUaYvXkWjqYd1TVqy4\ngww3dn54z0AArC/FweXT9lwTsVBrderQ6lCA0MFqJbwCSnSLqpEFTMhAVbAEr2IHnrHnFiA1S+K7\nhiEpqxJFx26S4XUDuWpPd73HAR3zZrlWPHjMwk4C3sYzUT2LRfeoFNVKZBB4hEsSSDbIxX6rbB4T\nWp0qB+GC2no8KdK9+V2Cv03g3Y/obEzPgWPzk7HkPaCsUtz7pliXBHMsqOLCQppYeHdR8QoVm8d6\nIhr7o8m6C6Fd0BK2NSbXSjslpmuWe6XO/vwfAClRXUs8Ddj6yDDubOFo2HETqhaQJCwBj9m4TPAG\nBZ6VTiyeYbxrZdpCkj341Q5oQyZP5qGwlfB3hTXUDXvjjtkrVarSYy1W9lLwgJS7PZjnr4KC9fkt\nVKq05Z7AuEryBkhDaCVVlFKPfqRAO6E9C359WWjb3zymb+XXtg7PeQ7am659ET5J3xQtUCxJmEGI\nmUfuI95fB38gDZ+7XzARmPBmPFYqZctLrnx9Bho+Vrx8WjcktT7g2AxbOADkM3uRGiDpGucTqE79\nweIQYg10sSD5xt5ezwL9K1/K/xIl1yk98kOfPl1A6tPWVAjwqQIeOq6VRsP/pF8vOZ/L5MP/ovew\nxwNABhpIp58CDAChjQWETVMlnAAAAABJRU5ErkJggg==`\n"]}
|
package/build/utils/theme.d.ts
CHANGED
|
@@ -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,EAAE,gBAAgB,GAAG,MAAM,GAAG,SAAS,CAAA;
|
|
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,CAA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AAE,MAAM,CAAA;IACzB,iBAAiB,EAAE,MAAM,CAAA;IACzB,uBAAuB,EAAE,MAAM,CAAA;IAC/B,sBAAsB,EAAE,MAAM,CAAA;CAC/B"}
|
package/build/utils/theme.js
CHANGED
|
@@ -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,
|
package/build/utils/theme.js.map
CHANGED
|
@@ -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,MA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AAwB;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 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.
|
|
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": "
|
|
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
|
|
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
|
-
|
|
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'
|
package/src/screens/conversation_filter_recipients/conversation_filter_recipients_screen.tsx
CHANGED
|
@@ -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 {
|
|
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
|
-
|
|
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
|
},
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { PlatformPressable } from '@react-navigation/elements'
|
|
2
2
|
import { StackActions, StaticScreenProps, useNavigation } from '@react-navigation/native'
|
|
3
3
|
import { useMutation } from '@tanstack/react-query'
|
|
4
|
+
import { isNil, omitBy } from 'lodash'
|
|
4
5
|
import React, { useCallback } from 'react'
|
|
5
6
|
import { Alert, Platform, StyleSheet, View } from 'react-native'
|
|
6
7
|
import { Text } from '../components'
|
|
7
8
|
import { REACTION_EMOJIS, useReactionStyles } from '../components/conversation/message_reaction'
|
|
9
|
+
import FormSheet, { getFormSheetScreenOptions } from '../components/primitive/form_sheet'
|
|
8
10
|
import { useCreateAndroidRippleColor, useFontScale, useTheme } from '../hooks'
|
|
9
11
|
import { useApiClient } from '../hooks/use_api_client'
|
|
10
12
|
import { useConversationMessages } from '../hooks/use_conversation_messages'
|
|
11
13
|
import { useMessageReactionToggle } from '../hooks/use_message_reaction_toggle'
|
|
12
14
|
import { ReactionCountResource } from '../types/resources/reaction'
|
|
13
15
|
import { Clipboard } from '../utils/native_adapters'
|
|
14
|
-
import { isNil, omitBy } from 'lodash'
|
|
15
|
-
import FormSheet, { getFormSheetScreenOptions } from '../components/primitive/form_sheet'
|
|
16
16
|
|
|
17
17
|
export const MessageActionsScreenOptions = getFormSheetScreenOptions({
|
|
18
18
|
sheetAllowedDetents: [0.5],
|
|
@@ -122,7 +122,7 @@ export function MessageActionsScreen({ route }: MessageActionsScreenProps) {
|
|
|
122
122
|
}, [navigation, conversation_id, message_id])
|
|
123
123
|
|
|
124
124
|
return (
|
|
125
|
-
<FormSheet.Root>
|
|
125
|
+
<FormSheet.Root style={styles.formSheetContent}>
|
|
126
126
|
<View style={styles.reactionList}>
|
|
127
127
|
{availableReactions.map((reaction, index) => (
|
|
128
128
|
<Reaction
|
|
@@ -213,6 +213,9 @@ const useStyles = () => {
|
|
|
213
213
|
})
|
|
214
214
|
|
|
215
215
|
return StyleSheet.create({
|
|
216
|
+
formSheetContent: {
|
|
217
|
+
paddingTop: 16,
|
|
218
|
+
},
|
|
216
219
|
reactionList: {
|
|
217
220
|
flexDirection: 'row',
|
|
218
221
|
justifyContent: 'center',
|
|
@@ -6,13 +6,13 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
|
6
6
|
import { Avatar, Text } from '../components'
|
|
7
7
|
import { REACTION_EMOJIS } from '../components/conversation/message_reaction'
|
|
8
8
|
import { Tabs } from '../components/display/tabs'
|
|
9
|
+
import FormSheet, { getFormSheetScreenOptions } from '../components/primitive/form_sheet'
|
|
9
10
|
import { useSuspenseGet, useTheme } from '../hooks'
|
|
10
11
|
import { useConversationMessages } from '../hooks/use_conversation_messages'
|
|
12
|
+
import { useFontScale } from '../hooks/use_font_scale'
|
|
11
13
|
import { MemberResource } from '../types'
|
|
12
14
|
import { ReactionCountResource } from '../types/resources/reaction'
|
|
13
|
-
import FormSheet, { getFormSheetScreenOptions } from '../components/primitive/form_sheet'
|
|
14
15
|
import { platformFontWeightMedium } from '../utils'
|
|
15
|
-
import { useFontScale } from '../hooks/use_font_scale'
|
|
16
16
|
|
|
17
17
|
export const ReactionsScreenOptions = getFormSheetScreenOptions({
|
|
18
18
|
sheetAllowedDetents: Platform.select({
|
|
@@ -127,7 +127,7 @@ const useStyles = () => {
|
|
|
127
127
|
|
|
128
128
|
return StyleSheet.create({
|
|
129
129
|
formSheetContent: {
|
|
130
|
-
paddingTop:
|
|
130
|
+
paddingTop: 16,
|
|
131
131
|
},
|
|
132
132
|
contentContainer: {
|
|
133
133
|
paddingTop: 8,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { StackActions, StaticScreenProps, 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, IconString, 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
|
|
|
12
12
|
export const SendGiphyScreenOptions = getFormSheetScreenOptions({
|
|
@@ -154,7 +154,7 @@ const useStyles = () => {
|
|
|
154
154
|
|
|
155
155
|
return StyleSheet.create({
|
|
156
156
|
container: {
|
|
157
|
-
paddingTop:
|
|
157
|
+
paddingTop: 32,
|
|
158
158
|
paddingHorizontal: 16,
|
|
159
159
|
gap: 8,
|
|
160
160
|
},
|
package/src/utils/theme.ts
CHANGED
|
@@ -56,15 +56,6 @@ interface ChatColors {
|
|
|
56
56
|
interaction: string
|
|
57
57
|
androidModalHeaderButtonTextColor: ColorValue | string | undefined
|
|
58
58
|
iOSModalHeaderButtonTextColor: OpaqueColorValue | string | undefined
|
|
59
|
-
// `switchTrackTrue` is deprecated.
|
|
60
|
-
// TODO: Remove `switchTrackTrue` once CCA stops using it.
|
|
61
|
-
switchTrackTrue: string | undefined
|
|
62
|
-
// `switchTrackFalse` is deprecated.
|
|
63
|
-
// TODO: Remove `switchTrackFalse` once CCA stops using it.
|
|
64
|
-
switchTrackFalse: string | undefined
|
|
65
|
-
// `switchThumbColor` is deprecated. Use `androidSwitchThumbColor` instead.
|
|
66
|
-
// TODO: Remove `switchThumbColor` once CCA is updated to use `androidSwitchThumbColor`.
|
|
67
|
-
switchThumbColor: string | undefined
|
|
68
59
|
androidSwitchThumbColor: string | undefined
|
|
69
60
|
testColor: string
|
|
70
61
|
statusInfoIcon: string
|
|
@@ -92,9 +83,6 @@ const colorsChatLight: ChatColors = {
|
|
|
92
83
|
buttonStart: undefined,
|
|
93
84
|
buttonEnd: undefined,
|
|
94
85
|
interaction: tokens.fillColorInteractionDefault,
|
|
95
|
-
switchTrackTrue: undefined,
|
|
96
|
-
switchTrackFalse: undefined,
|
|
97
|
-
switchThumbColor: undefined,
|
|
98
86
|
androidSwitchThumbColor: undefined,
|
|
99
87
|
testColor: 'hotpink',
|
|
100
88
|
statusInfoIcon: tokens.iconColorStatusInfoPrimary,
|
|
@@ -122,9 +110,6 @@ const colorsChatDark: ChatColors = {
|
|
|
122
110
|
buttonStart: undefined,
|
|
123
111
|
buttonEnd: undefined,
|
|
124
112
|
interaction: tokens.fillColorInteractionDefaultDark,
|
|
125
|
-
switchTrackTrue: undefined,
|
|
126
|
-
switchTrackFalse: undefined,
|
|
127
|
-
switchThumbColor: undefined,
|
|
128
113
|
androidSwitchThumbColor: undefined,
|
|
129
114
|
testColor: 'pink',
|
|
130
115
|
statusInfoIcon: tokens.iconColorStatusInfoPrimaryDark,
|