@planningcenter/chat-react-native 3.4.0 → 3.4.1-qa-165.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/conversation/attachments/image_attachment.d.ts +6 -1
- package/build/components/conversation/attachments/image_attachment.d.ts.map +1 -1
- package/build/components/conversation/attachments/image_attachment.js +125 -11
- package/build/components/conversation/attachments/image_attachment.js.map +1 -1
- package/build/components/conversation/disabled_replies_banners.d.ts +3 -0
- package/build/components/conversation/disabled_replies_banners.d.ts.map +1 -0
- package/build/components/conversation/disabled_replies_banners.js +41 -0
- package/build/components/conversation/disabled_replies_banners.js.map +1 -0
- package/build/components/conversation/empty_conversation_blank_state.d.ts +2 -0
- package/build/components/conversation/empty_conversation_blank_state.d.ts.map +1 -0
- package/build/components/conversation/empty_conversation_blank_state.js +5 -0
- package/build/components/conversation/empty_conversation_blank_state.js.map +1 -0
- package/build/components/conversation/message.d.ts.map +1 -1
- package/build/components/conversation/message.js +5 -1
- package/build/components/conversation/message.js.map +1 -1
- package/build/components/conversation/message_attachments.d.ts +2 -0
- package/build/components/conversation/message_attachments.d.ts.map +1 -1
- package/build/components/conversation/message_attachments.js +4 -4
- package/build/components/conversation/message_attachments.js.map +1 -1
- package/build/components/conversation/message_form.d.ts +3 -2
- package/build/components/conversation/message_form.d.ts.map +1 -1
- package/build/components/conversation/message_form.js +77 -19
- package/build/components/conversation/message_form.js.map +1 -1
- package/build/components/display/blank_state.d.ts +13 -0
- package/build/components/display/blank_state.d.ts.map +1 -0
- package/build/components/display/blank_state.js +46 -0
- package/build/components/display/blank_state.js.map +1 -0
- package/build/components/display/image.d.ts +11 -2
- package/build/components/display/image.d.ts.map +1 -1
- package/build/components/display/image.js +5 -3
- package/build/components/display/image.js.map +1 -1
- package/build/components/display/keyboard_view.d.ts.map +1 -1
- package/build/components/display/keyboard_view.js +23 -22
- package/build/components/display/keyboard_view.js.map +1 -1
- package/build/contexts/chat_context.d.ts +7 -6
- package/build/contexts/chat_context.d.ts.map +1 -1
- package/build/contexts/chat_context.js +2 -2
- package/build/contexts/chat_context.js.map +1 -1
- package/build/hooks/use_conversation.js +1 -1
- package/build/hooks/use_conversation.js.map +1 -1
- package/build/hooks/{use_message_create.d.ts → use_message_create_or_update.d.ts} +3 -2
- package/build/hooks/use_message_create_or_update.d.ts.map +1 -0
- package/build/hooks/{use_message_create.js → use_message_create_or_update.js} +21 -11
- package/build/hooks/use_message_create_or_update.js.map +1 -0
- package/build/navigation/index.d.ts +22 -0
- package/build/navigation/index.d.ts.map +1 -1
- package/build/navigation/index.js +10 -0
- package/build/navigation/index.js.map +1 -1
- package/build/screens/conversation_screen.d.ts +1 -0
- package/build/screens/conversation_screen.d.ts.map +1 -1
- package/build/screens/conversation_screen.js +21 -13
- package/build/screens/conversation_screen.js.map +1 -1
- package/build/screens/conversation_select_recipients/components/groups_recipient_row.d.ts +8 -0
- package/build/screens/conversation_select_recipients/components/groups_recipient_row.d.ts.map +1 -0
- package/build/screens/conversation_select_recipients/components/groups_recipient_row.js +7 -0
- package/build/screens/conversation_select_recipients/components/groups_recipient_row.js.map +1 -0
- package/build/screens/conversation_select_recipients/components/team_recipient_row.d.ts +8 -0
- package/build/screens/conversation_select_recipients/components/team_recipient_row.d.ts.map +1 -0
- package/build/screens/conversation_select_recipients/components/team_recipient_row.js +8 -0
- package/build/screens/conversation_select_recipients/components/team_recipient_row.js.map +1 -0
- package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.d.ts.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.js +2 -4
- package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.js.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.d.ts.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.js +37 -9
- package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.js.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.d.ts +4 -0
- package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.d.ts.map +1 -0
- package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.js +44 -0
- package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.js.map +1 -0
- package/build/screens/design_system_screen.d.ts.map +1 -1
- package/build/screens/design_system_screen.js +11 -0
- package/build/screens/design_system_screen.js.map +1 -1
- package/build/screens/message_actions_screen.d.ts +1 -0
- package/build/screens/message_actions_screen.d.ts.map +1 -1
- package/build/screens/message_actions_screen.js +15 -5
- package/build/screens/message_actions_screen.js.map +1 -1
- package/build/screens/send_giphy_screen.d.ts.map +1 -1
- package/build/screens/send_giphy_screen.js +4 -2
- package/build/screens/send_giphy_screen.js.map +1 -1
- package/build/types/resources/member_ability.d.ts +1 -0
- package/build/types/resources/member_ability.d.ts.map +1 -1
- package/build/types/resources/member_ability.js.map +1 -1
- package/package.json +2 -2
- package/src/components/conversation/attachments/image_attachment.tsx +229 -14
- package/src/components/conversation/disabled_replies_banners.tsx +58 -0
- package/src/components/conversation/empty_conversation_blank_state.tsx +11 -0
- package/src/components/conversation/message.tsx +6 -1
- package/src/components/conversation/message_attachments.tsx +15 -6
- package/src/components/conversation/message_form.tsx +101 -19
- package/src/components/display/blank_state.tsx +61 -0
- package/src/components/display/image.tsx +17 -2
- package/src/components/display/keyboard_view.tsx +31 -25
- package/src/contexts/chat_context.tsx +12 -8
- package/src/hooks/use_conversation.ts +1 -1
- package/src/hooks/{use_message_create.ts → use_message_create_or_update.ts} +21 -11
- package/src/navigation/index.tsx +15 -0
- package/src/screens/conversation_screen.tsx +47 -22
- package/src/screens/conversation_select_recipients/components/groups_recipient_row.tsx +23 -0
- package/src/screens/conversation_select_recipients/components/team_recipient_row.tsx +23 -0
- package/src/screens/conversation_select_recipients/conversation_select_group_recipients_screen.tsx +4 -11
- package/src/screens/conversation_select_recipients/conversation_select_recipients_screen.tsx +57 -15
- package/src/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.tsx +70 -0
- package/src/screens/design_system_screen.tsx +19 -0
- package/src/screens/message_actions_screen.tsx +26 -9
- package/src/screens/send_giphy_screen.tsx +4 -2
- package/src/types/resources/member_ability.ts +1 -0
- package/build/hooks/use_message_create.d.ts.map +0 -1
- package/build/hooks/use_message_create.js.map +0 -1
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export
|
|
2
|
+
export type MetaProps = {
|
|
3
|
+
authorName: string;
|
|
4
|
+
createdAt: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function ImageAttachment({ attachment, metaProps, }: {
|
|
3
7
|
attachment: any;
|
|
8
|
+
metaProps: MetaProps;
|
|
4
9
|
}): React.JSX.Element;
|
|
5
10
|
//# sourceMappingURL=image_attachment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image_attachment.d.ts","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/image_attachment.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"image_attachment.d.ts","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/image_attachment.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAA;AA+B7D,MAAM,MAAM,SAAS,GAAG;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,wBAAgB,eAAe,CAAC,EAC9B,UAAU,EACV,SAAS,GACV,EAAE;IACD,UAAU,EAAE,GAAG,CAAA;IACf,SAAS,EAAE,SAAS,CAAA;CACrB,qBAuDA"}
|
|
@@ -1,23 +1,137 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { View,
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
2
|
+
import { StyleSheet, Modal, Pressable, useWindowDimensions, SafeAreaView, View, Linking, } from 'react-native';
|
|
3
|
+
import { Gesture, GestureDetector, GestureHandlerRootView, } from 'react-native-gesture-handler';
|
|
4
|
+
import { runOnJS, useAnimatedStyle, useSharedValue, withTiming, } from 'react-native-reanimated';
|
|
5
|
+
import { tokens } from '../../../vendor/tapestry/tokens';
|
|
6
|
+
import { IconButton, Image, Heading, Text } from '../../display';
|
|
7
|
+
import colorFunction from 'color';
|
|
8
|
+
import { formatDatePreview } from '../../../utils/date';
|
|
9
|
+
const PAN_THRESHOLD_PX = 300;
|
|
10
|
+
export function ImageAttachment({ attachment, metaProps, }) {
|
|
5
11
|
const { attributes } = attachment;
|
|
6
12
|
const { url, urlMedium, filename, metadata = {} } = attributes;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
const styles = useStyles({ imageWidth: metadata.width, imageHeight: metadata.height });
|
|
14
|
+
const [visible, setVisible] = useState(false);
|
|
15
|
+
// shared values run on the native UI thread and prevents clogging up the JS thread
|
|
16
|
+
const dismissY = useSharedValue(0);
|
|
17
|
+
const opacity = useSharedValue(1);
|
|
18
|
+
const resetAnimations = useCallback(() => {
|
|
19
|
+
dismissY.value = withTiming(0);
|
|
20
|
+
opacity.value = withTiming(1);
|
|
21
|
+
}, [dismissY, opacity]);
|
|
22
|
+
const handleCloseModal = useCallback(() => {
|
|
23
|
+
setVisible(false);
|
|
24
|
+
resetAnimations();
|
|
25
|
+
}, [setVisible, resetAnimations]);
|
|
26
|
+
const panGesture = Gesture.Pan()
|
|
27
|
+
.onUpdate(e => {
|
|
28
|
+
dismissY.value = e.translationY;
|
|
29
|
+
opacity.value = 1 - Math.abs(e.translationY) / PAN_THRESHOLD_PX;
|
|
30
|
+
})
|
|
31
|
+
.onEnd(() => {
|
|
32
|
+
runOnJS(handleCloseModal)(); // Ensures we can call a JS function
|
|
33
|
+
});
|
|
34
|
+
const animatedImageStyle = useAnimatedStyle(() => ({
|
|
35
|
+
transform: [{ translateY: dismissY.value }],
|
|
36
|
+
opacity: opacity.value,
|
|
37
|
+
}));
|
|
38
|
+
return (<>
|
|
39
|
+
<Pressable style={styles.container} onPress={() => setVisible(true)}>
|
|
40
|
+
<Image source={{ uri: urlMedium || url }} style={{ borderRadius: 8 }} wrapperStyle={styles.imageWrapper} alt={filename}/>
|
|
41
|
+
</Pressable>
|
|
42
|
+
<LightboxModal visible={visible} handleCloseModal={handleCloseModal} uri={urlMedium || url} metaProps={metaProps} panGesture={panGesture} animatedImageStyle={animatedImageStyle}/>
|
|
43
|
+
</>);
|
|
12
44
|
}
|
|
13
|
-
const
|
|
45
|
+
const LightboxModal = ({ uri, visible, handleCloseModal, metaProps, panGesture, animatedImageStyle, }) => {
|
|
46
|
+
const styles = useStyles();
|
|
47
|
+
const { authorName, createdAt } = metaProps;
|
|
48
|
+
const handleOpenInBrowser = () => {
|
|
49
|
+
Linking.openURL(uri);
|
|
50
|
+
};
|
|
51
|
+
return (<Modal visible={visible} transparent animationType="fade" onRequestClose={handleCloseModal}>
|
|
52
|
+
<SafeAreaView style={styles.modal}>
|
|
53
|
+
<GestureHandlerRootView>
|
|
54
|
+
<GestureDetector gesture={panGesture}>
|
|
55
|
+
<Image source={{ uri }} loadingBackgroundStyles={styles.lightboxImageLoading} style={styles.lightboxImage} animatedImageStyle={animatedImageStyle} resizeMode="contain" animated={true} alt=""/>
|
|
56
|
+
</GestureDetector>
|
|
57
|
+
<View style={styles.actionToolbar} accessibilityRole="toolbar">
|
|
58
|
+
<View style={styles.actionToolbarTextMeta}>
|
|
59
|
+
<Heading variant="h3" style={styles.actionToolbarTitle} numberOfLines={1}>
|
|
60
|
+
{authorName}
|
|
61
|
+
</Heading>
|
|
62
|
+
<Text variant="tertiary" style={styles.actionToolbarSubtitle}>
|
|
63
|
+
{formatDatePreview(createdAt)}
|
|
64
|
+
</Text>
|
|
65
|
+
</View>
|
|
66
|
+
<IconButton onPress={handleOpenInBrowser} name="general.newWindow" accessibilityRole="link" accessibilityLabel="Open image in browser" accessibilityHint="Image can be downloaded and shared through the browser." style={styles.actionButton} iconStyle={styles.actionButtonIcon} size="lg"/>
|
|
67
|
+
<IconButton onPress={handleCloseModal} name="general.x" accessibilityLabel="Close image" style={styles.actionButton} iconStyle={styles.actionButtonIcon}/>
|
|
68
|
+
</View>
|
|
69
|
+
</GestureHandlerRootView>
|
|
70
|
+
</SafeAreaView>
|
|
71
|
+
</Modal>);
|
|
72
|
+
};
|
|
73
|
+
const useStyles = ({ imageWidth = 100, imageHeight = 100 } = {}) => {
|
|
74
|
+
const { width: windowWidth } = useWindowDimensions();
|
|
75
|
+
const backgroundColor = tokens.colorNeutral7;
|
|
76
|
+
const transparentBackgroundColor = useMemo(() => colorFunction(backgroundColor).alpha(0.8).toString(), [backgroundColor]);
|
|
14
77
|
return StyleSheet.create({
|
|
15
78
|
container: {
|
|
16
79
|
maxWidth: '100%',
|
|
17
80
|
},
|
|
81
|
+
imageWrapper: {
|
|
82
|
+
minWidth: 200,
|
|
83
|
+
aspectRatio: imageWidth / imageHeight,
|
|
84
|
+
},
|
|
18
85
|
image: {
|
|
19
86
|
borderRadius: 8,
|
|
20
|
-
|
|
87
|
+
},
|
|
88
|
+
modal: {
|
|
89
|
+
flex: 1,
|
|
90
|
+
backgroundColor,
|
|
91
|
+
justifyContent: 'center',
|
|
92
|
+
alignItems: 'center',
|
|
93
|
+
},
|
|
94
|
+
lightboxImage: {
|
|
95
|
+
height: '100%',
|
|
96
|
+
width: windowWidth,
|
|
97
|
+
backgroundColor,
|
|
98
|
+
},
|
|
99
|
+
lightboxImageLoading: {
|
|
100
|
+
backgroundColor,
|
|
101
|
+
},
|
|
102
|
+
actionToolbar: {
|
|
103
|
+
width: '100%',
|
|
104
|
+
position: 'absolute',
|
|
105
|
+
top: 0,
|
|
106
|
+
flexDirection: 'row',
|
|
107
|
+
alignItems: 'center',
|
|
108
|
+
gap: 20,
|
|
109
|
+
paddingHorizontal: 16,
|
|
110
|
+
paddingTop: 16,
|
|
111
|
+
paddingBottom: 8,
|
|
112
|
+
backgroundColor: transparentBackgroundColor,
|
|
113
|
+
},
|
|
114
|
+
actionToolbarTextMeta: {
|
|
115
|
+
flex: 1,
|
|
116
|
+
},
|
|
117
|
+
actionToolbarTitle: {
|
|
118
|
+
marginRight: 'auto',
|
|
119
|
+
flexShrink: 1,
|
|
120
|
+
color: tokens.colorNeutral88,
|
|
121
|
+
},
|
|
122
|
+
actionToolbarSubtitle: {
|
|
123
|
+
color: tokens.colorNeutral68,
|
|
124
|
+
},
|
|
125
|
+
actionButton: {
|
|
126
|
+
backgroundColor,
|
|
127
|
+
height: 40,
|
|
128
|
+
width: 40,
|
|
129
|
+
borderRadius: 50,
|
|
130
|
+
borderWidth: 1,
|
|
131
|
+
borderColor: tokens.colorNeutral24,
|
|
132
|
+
},
|
|
133
|
+
actionButtonIcon: {
|
|
134
|
+
color: tokens.colorNeutral88,
|
|
21
135
|
},
|
|
22
136
|
});
|
|
23
137
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image_attachment.js","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/image_attachment.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEtD,MAAM,UAAU,eAAe,CAAC,EAAE,UAAU,EAAuB;IACjE,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,EAAE,UAAU,EAAE,GAAG,UAAU,CAAA;IACjC,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,GAAG,EAAE,EAAE,GAAG,UAAU,CAAA;IAC9D,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,IAAI,GAAG,CAAA;IACnC,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,IAAI,GAAG,CAAA;IACrC,OAAO,CACL,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAC5B;MAAA,CAAC,KAAK,CACJ,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,SAAS,IAAI,GAAG,EAAE,CAAC,CAClC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,WAAW,EAAE,KAAK,GAAG,MAAM,EAAE,CAAC,CAAC,CACvD,kBAAkB,CAAC,CAAC,QAAQ,CAAC,EAEjC;IAAA,EAAE,IAAI,CAAC,CACR,CAAA;AACH,CAAC;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE;YACT,QAAQ,EAAE,MAAM;SACjB;QACD,KAAK,EAAE;YACL,YAAY,EAAE,CAAC;YACf,QAAQ,EAAE,GAAG;SACd;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport { View, Image, StyleSheet } from 'react-native'\n\nexport function ImageAttachment({ attachment }: { attachment: any }) {\n const styles = useStyles()\n const { attributes } = attachment\n const { url, urlMedium, filename, metadata = {} } = attributes\n const width = metadata.width || 100\n const height = metadata.height || 100\n return (\n <View style={styles.container}>\n <Image\n source={{ uri: urlMedium || url }}\n style={[styles.image, { aspectRatio: width / height }]}\n accessibilityLabel={filename}\n />\n </View>\n )\n}\n\nconst useStyles = () => {\n return StyleSheet.create({\n container: {\n maxWidth: '100%',\n },\n image: {\n borderRadius: 8,\n minWidth: 200,\n },\n })\n}\n"]}
|
|
1
|
+
{"version":3,"file":"image_attachment.js","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/image_attachment.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC7D,OAAO,EACL,UAAU,EACV,KAAK,EACL,SAAS,EACT,mBAAmB,EACnB,YAAY,EACZ,IAAI,EACJ,OAAO,GAER,MAAM,cAAc,CAAA;AACr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,eAAe;YACf,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,EAAE;YACT,YAAY,EAAE,EAAE;YAChB,WAAW,EAAE,CAAC;YACd,WAAW,EAAE,MAAM,CAAC,cAAc;SACnC;QACD,gBAAgB,EAAE;YAChB,KAAK,EAAE,MAAM,CAAC,cAAc;SAC7B;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React, { useCallback, useMemo, useState } from 'react'\nimport {\n StyleSheet,\n Modal,\n Pressable,\n useWindowDimensions,\n SafeAreaView,\n View,\n Linking,\n ImageStyle,\n} from 'react-native'\nimport {\n Gesture,\n GestureDetector,\n GestureHandlerRootView,\n type PanGesture,\n} from 'react-native-gesture-handler'\nimport {\n runOnJS,\n useAnimatedStyle,\n useSharedValue,\n withTiming,\n type AnimatedStyle,\n} from 'react-native-reanimated'\nimport { tokens } from '../../../vendor/tapestry/tokens'\nimport { IconButton, Image, Heading, Text } from '../../display'\nimport colorFunction from 'color'\nimport { formatDatePreview } from '../../../utils/date'\n\nconst PAN_THRESHOLD_PX = 300\n\nexport type MetaProps = {\n authorName: string\n createdAt: string\n}\n\nexport function ImageAttachment({\n attachment,\n metaProps,\n}: {\n attachment: any\n metaProps: MetaProps\n}) {\n const { attributes } = attachment\n const { url, urlMedium, filename, metadata = {} } = attributes\n\n const styles = useStyles({ imageWidth: metadata.width, imageHeight: metadata.height })\n const [visible, setVisible] = useState(false)\n\n // shared values run on the native UI thread and prevents clogging up the JS thread\n const dismissY = useSharedValue(0)\n const opacity = useSharedValue(1)\n\n const resetAnimations = useCallback(() => {\n dismissY.value = withTiming(0)\n opacity.value = withTiming(1)\n }, [dismissY, opacity])\n\n const handleCloseModal = useCallback(() => {\n setVisible(false)\n resetAnimations()\n }, [setVisible, resetAnimations])\n\n const panGesture = Gesture.Pan()\n .onUpdate(e => {\n dismissY.value = e.translationY\n opacity.value = 1 - Math.abs(e.translationY) / PAN_THRESHOLD_PX\n })\n .onEnd(() => {\n runOnJS(handleCloseModal)() // Ensures we can call a JS function\n })\n\n const animatedImageStyle = useAnimatedStyle(() => ({\n transform: [{ translateY: dismissY.value }],\n opacity: opacity.value,\n }))\n\n return (\n <>\n <Pressable style={styles.container} onPress={() => setVisible(true)}>\n <Image\n source={{ uri: urlMedium || url }}\n style={{ borderRadius: 8 }}\n wrapperStyle={styles.imageWrapper}\n alt={filename}\n />\n </Pressable>\n <LightboxModal\n visible={visible}\n handleCloseModal={handleCloseModal}\n uri={urlMedium || url}\n metaProps={metaProps}\n panGesture={panGesture}\n animatedImageStyle={animatedImageStyle}\n />\n </>\n )\n}\n\ninterface LightboxModalProps {\n visible: boolean\n handleCloseModal: () => void\n uri: string\n metaProps: MetaProps\n panGesture: PanGesture\n animatedImageStyle: AnimatedStyle<ImageStyle>\n}\n\nconst LightboxModal = ({\n uri,\n visible,\n handleCloseModal,\n metaProps,\n panGesture,\n animatedImageStyle,\n}: LightboxModalProps) => {\n const styles = useStyles()\n\n const { authorName, createdAt } = metaProps\n\n const handleOpenInBrowser = () => {\n Linking.openURL(uri)\n }\n\n return (\n <Modal visible={visible} transparent animationType=\"fade\" onRequestClose={handleCloseModal}>\n <SafeAreaView style={styles.modal}>\n <GestureHandlerRootView>\n <GestureDetector gesture={panGesture}>\n <Image\n source={{ uri }}\n loadingBackgroundStyles={styles.lightboxImageLoading}\n style={styles.lightboxImage}\n animatedImageStyle={animatedImageStyle}\n resizeMode=\"contain\"\n animated={true}\n alt=\"\"\n />\n </GestureDetector>\n <View style={styles.actionToolbar} accessibilityRole=\"toolbar\">\n <View style={styles.actionToolbarTextMeta}>\n <Heading variant=\"h3\" style={styles.actionToolbarTitle} numberOfLines={1}>\n {authorName}\n </Heading>\n <Text variant=\"tertiary\" style={styles.actionToolbarSubtitle}>\n {formatDatePreview(createdAt)}\n </Text>\n </View>\n <IconButton\n onPress={handleOpenInBrowser}\n name=\"general.newWindow\"\n accessibilityRole=\"link\"\n accessibilityLabel=\"Open image in browser\"\n accessibilityHint=\"Image can be downloaded and shared through the browser.\"\n style={styles.actionButton}\n iconStyle={styles.actionButtonIcon}\n size=\"lg\"\n />\n <IconButton\n onPress={handleCloseModal}\n name=\"general.x\"\n accessibilityLabel=\"Close image\"\n style={styles.actionButton}\n iconStyle={styles.actionButtonIcon}\n />\n </View>\n </GestureHandlerRootView>\n </SafeAreaView>\n </Modal>\n )\n}\n\ninterface UseStylesProps {\n imageWidth?: number\n imageHeight?: number\n}\n\nconst useStyles = ({ imageWidth = 100, imageHeight = 100 }: UseStylesProps = {}) => {\n const { width: windowWidth } = useWindowDimensions()\n const backgroundColor = tokens.colorNeutral7\n const transparentBackgroundColor = useMemo(\n () => colorFunction(backgroundColor).alpha(0.8).toString(),\n [backgroundColor]\n )\n\n return StyleSheet.create({\n container: {\n maxWidth: '100%',\n },\n imageWrapper: {\n minWidth: 200,\n aspectRatio: imageWidth / imageHeight,\n },\n image: {\n borderRadius: 8,\n },\n modal: {\n flex: 1,\n backgroundColor,\n justifyContent: 'center',\n alignItems: 'center',\n },\n lightboxImage: {\n height: '100%',\n width: windowWidth,\n backgroundColor,\n },\n lightboxImageLoading: {\n backgroundColor,\n },\n actionToolbar: {\n width: '100%',\n position: 'absolute',\n top: 0,\n flexDirection: 'row',\n alignItems: 'center',\n gap: 20,\n paddingHorizontal: 16,\n paddingTop: 16,\n paddingBottom: 8,\n backgroundColor: transparentBackgroundColor,\n },\n actionToolbarTextMeta: {\n flex: 1,\n },\n actionToolbarTitle: {\n marginRight: 'auto',\n flexShrink: 1,\n color: tokens.colorNeutral88,\n },\n actionToolbarSubtitle: {\n color: tokens.colorNeutral68,\n },\n actionButton: {\n backgroundColor,\n height: 40,\n width: 40,\n borderRadius: 50,\n borderWidth: 1,\n borderColor: tokens.colorNeutral24,\n },\n actionButtonIcon: {\n color: tokens.colorNeutral88,\n },\n })\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disabled_replies_banners.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/disabled_replies_banners.tsx"],"names":[],"mappings":"AAKA,eAAO,MAAM,2BAA2B,mCAEvC,CAAA;AAED,eAAO,MAAM,2BAA2B,mCAQvC,CAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { StyleSheet, View } from 'react-native';
|
|
2
|
+
import { useTheme } from '../../hooks';
|
|
3
|
+
import { Text } from '../display';
|
|
4
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
5
|
+
export const LeaderDisabledRepliesBanner = () => {
|
|
6
|
+
return <DisabledRepliesBanner description="Replies are frozen for everyone else."/>;
|
|
7
|
+
};
|
|
8
|
+
export const MemberDisabledRepliesBanner = () => {
|
|
9
|
+
const styles = useStyles();
|
|
10
|
+
return (<DisabledRepliesBanner description="Replies have been disabled by a leader, but you can still add reactions." style={styles.memberBanner}/>);
|
|
11
|
+
};
|
|
12
|
+
const DisabledRepliesBanner = ({ description, style }) => {
|
|
13
|
+
const styles = useStyles();
|
|
14
|
+
return (<View style={[styles.baseBanner, style]}>
|
|
15
|
+
<Text style={styles.text} variant="tertiary">
|
|
16
|
+
{description}
|
|
17
|
+
</Text>
|
|
18
|
+
</View>);
|
|
19
|
+
};
|
|
20
|
+
const useStyles = () => {
|
|
21
|
+
const { colors } = useTheme();
|
|
22
|
+
const { bottom } = useSafeAreaInsets();
|
|
23
|
+
return StyleSheet.create({
|
|
24
|
+
baseBanner: {
|
|
25
|
+
paddingHorizontal: 16,
|
|
26
|
+
paddingVertical: 4,
|
|
27
|
+
backgroundColor: colors.statusNeutralBackground,
|
|
28
|
+
borderTopWidth: 1,
|
|
29
|
+
borderTopColor: colors.borderColorDefaultBase,
|
|
30
|
+
},
|
|
31
|
+
text: {
|
|
32
|
+
textAlign: 'center',
|
|
33
|
+
},
|
|
34
|
+
memberBanner: {
|
|
35
|
+
paddingTop: 16,
|
|
36
|
+
paddingBottom: 16 + bottom,
|
|
37
|
+
marginBottom: -bottom,
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=disabled_replies_banners.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disabled_replies_banners.js","sourceRoot":"","sources":["../../../src/components/conversation/disabled_replies_banners.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAkB,MAAM,cAAc,CAAA;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAElE,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,EAAE;IAC9C,OAAO,CAAC,qBAAqB,CAAC,WAAW,CAAC,uCAAuC,EAAG,CAAA;AACtF,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,EAAE;IAC9C,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,OAAO,CACL,CAAC,qBAAqB,CACpB,WAAW,CAAC,0EAA0E,CACtF,KAAK,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,EAC3B,CACH,CAAA;AACH,CAAC,CAAA;AAOD,MAAM,qBAAqB,GAAG,CAAC,EAAE,WAAW,EAAE,KAAK,EAA8B,EAAE,EAAE;IACnF,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAE1B,OAAO,CACL,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,CACtC;MAAA,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,UAAU,CAC1C;QAAA,CAAC,WAAW,CACd;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,IAAI,CAAC,CACR,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,UAAU,EAAE;YACV,iBAAiB,EAAE,EAAE;YACrB,eAAe,EAAE,CAAC;YAClB,eAAe,EAAE,MAAM,CAAC,uBAAuB;YAC/C,cAAc,EAAE,CAAC;YACjB,cAAc,EAAE,MAAM,CAAC,sBAAsB;SAC9C;QACD,IAAI,EAAE;YACJ,SAAS,EAAE,QAAQ;SACpB;QACD,YAAY,EAAE;YACZ,UAAU,EAAE,EAAE;YACd,aAAa,EAAE,EAAE,GAAG,MAAM;YAC1B,YAAY,EAAE,CAAC,MAAM;SACtB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { StyleSheet, View, type ViewStyle } from 'react-native'\nimport { useTheme } from '../../hooks'\nimport { Text } from '../display'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\n\nexport const LeaderDisabledRepliesBanner = () => {\n return <DisabledRepliesBanner description=\"Replies are frozen for everyone else.\" />\n}\n\nexport const MemberDisabledRepliesBanner = () => {\n const styles = useStyles()\n return (\n <DisabledRepliesBanner\n description=\"Replies have been disabled by a leader, but you can still add reactions.\"\n style={styles.memberBanner}\n />\n )\n}\n\ninterface DisabledRepliesBannerProps {\n description: string\n style?: ViewStyle\n}\n\nconst DisabledRepliesBanner = ({ description, style }: DisabledRepliesBannerProps) => {\n const styles = useStyles()\n\n return (\n <View style={[styles.baseBanner, style]}>\n <Text style={styles.text} variant=\"tertiary\">\n {description}\n </Text>\n </View>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n const { bottom } = useSafeAreaInsets()\n\n return StyleSheet.create({\n baseBanner: {\n paddingHorizontal: 16,\n paddingVertical: 4,\n backgroundColor: colors.statusNeutralBackground,\n borderTopWidth: 1,\n borderTopColor: colors.borderColorDefaultBase,\n },\n text: {\n textAlign: 'center',\n },\n memberBanner: {\n paddingTop: 16,\n paddingBottom: 16 + bottom,\n marginBottom: -bottom,\n },\n })\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"empty_conversation_blank_state.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/empty_conversation_blank_state.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,2BAA2B,mCAQvC,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { BlankState } from '../display/blank_state';
|
|
2
|
+
export const EmptyConversationBlankState = () => {
|
|
3
|
+
return (<BlankState iconName="general.outlinedTextMessage" title="No messages" subtitle="Conversation is hidden from everyone until you send a message."/>);
|
|
4
|
+
};
|
|
5
|
+
//# sourceMappingURL=empty_conversation_blank_state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"empty_conversation_blank_state.js","sourceRoot":"","sources":["../../../src/components/conversation/empty_conversation_blank_state.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAEnD,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,EAAE;IAC9C,OAAO,CACL,CAAC,UAAU,CACT,QAAQ,CAAC,6BAA6B,CACtC,KAAK,CAAC,aAAa,CACnB,QAAQ,CAAC,gEAAgE,EACzE,CACH,CAAA;AACH,CAAC,CAAA","sourcesContent":["import { BlankState } from '../display/blank_state'\n\nexport const EmptyConversationBlankState = () => {\n return (\n <BlankState\n iconName=\"general.outlinedTextMessage\"\n title=\"No messages\"\n subtitle=\"Conversation is hidden from everyone until you send a message.\"\n />\n )\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAM7C;;GAEG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,eAAe,GAAG;IAAE,eAAe,EAAE,MAAM,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAM7C;;GAEG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,eAAe,GAAG;IAAE,eAAe,EAAE,MAAM,CAAA;CAAE,qBAsD3E"}
|
|
@@ -29,6 +29,10 @@ export function Message(props) {
|
|
|
29
29
|
reaction_value: reaction.value,
|
|
30
30
|
});
|
|
31
31
|
};
|
|
32
|
+
const metaProps = {
|
|
33
|
+
authorName: props.author.name,
|
|
34
|
+
createdAt: props.createdAt,
|
|
35
|
+
};
|
|
32
36
|
return (<View style={styles.message}>
|
|
33
37
|
{!props.mine && (<View style={styles.messageAuthor}>
|
|
34
38
|
<Avatar size={'md'} sourceUri={props.author.avatar}/>
|
|
@@ -37,7 +41,7 @@ export function Message(props) {
|
|
|
37
41
|
{!props.mine && <Text variant="tertiary">{props.author.name}</Text>}
|
|
38
42
|
<PlatformPressable style={styles.messageBubble} onLongPress={handleMessagePress}>
|
|
39
43
|
<ErrorBoundary>
|
|
40
|
-
<MessageAttachments attachments={props.attachments}/>
|
|
44
|
+
<MessageAttachments attachments={props.attachments} metaProps={metaProps}/>
|
|
41
45
|
</ErrorBoundary>
|
|
42
46
|
{text && (<View style={styles.messageText}>
|
|
43
47
|
<MessageMarkdown text={text}/>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../../src/components/conversation/message.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,aAAa,MAAM,OAAO,CA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N,aAAa,EAAE,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK;SAC5C;QACD,cAAc,EAAE;YACd,GAAG,EAAE,CAAC;YACN,UAAU,EAAE,CAAC;SACd;QACD,aAAa,EAAE;YACb,aAAa,EAAE,KAAK;YACpB,GAAG,EAAE,CAAC;SACP;QACD,aAAa,EAAE;YACb,eAAe,EAAE,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,mBAAmB;YAChE,YAAY,EAAE,CAAC;YACf,QAAQ,EAAE,GAAG;SACd;QACD,WAAW,EAAE;YACX,eAAe,EAAE,CAAC;YAClB,iBAAiB,EAAE,CAAC;SACrB;QACD,gBAAgB,EAAE;YAChB,aAAa,EAAE,KAAK;YACpB,GAAG,EAAE,CAAC;YACN,cAAc,EAAE,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY;SACjD;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable } from '@react-navigation/elements'\nimport { useNavigation } from '@react-navigation/native'\nimport colorFunction from 'color'\nimport React from 'react'\nimport { StyleSheet, View } from 'react-native'\nimport { MessageReaction } from '../../components/conversation/message_reaction'\nimport { Avatar, Text } from '../../components/display'\nimport { useTheme } from '../../hooks'\nimport { MessageResource } from '../../types'\nimport { ReactionCountResource } from '../../types/resources/reaction'\nimport { MessageAttachments } from './message_attachments'\nimport ErrorBoundary from '../page/error_boundary'\nimport { MessageMarkdown } from './message_markdown'\n\n/** Message\n * Component for display of a message within a conversation list\n */\nexport function Message(props: MessageResource & { conversation_id: number }) {\n const { text, conversation_id, reactionCounts } = props\n const styles = useMessageStyles(props)\n const navigation = useNavigation()\n const handleMessagePress = () => {\n navigation.navigate('MessageActions', {\n message_id: props.id,\n conversation_id,\n })\n }\n const handleReactionPress = (reaction: ReactionCountResource) => {\n navigation.navigate('Reactions', {\n message_id: props.id,\n conversation_id,\n reaction_value: reaction.value,\n })\n }\n\n const metaProps = {\n authorName: props.author.name,\n createdAt: props.createdAt,\n }\n\n return (\n <View style={styles.message}>\n {!props.mine && (\n <View style={styles.messageAuthor}>\n <Avatar size={'md'} sourceUri={props.author.avatar} />\n </View>\n )}\n <View style={styles.messageContent}>\n {!props.mine && <Text variant=\"tertiary\">{props.author.name}</Text>}\n <PlatformPressable style={styles.messageBubble} onLongPress={handleMessagePress}>\n <ErrorBoundary>\n <MessageAttachments attachments={props.attachments} metaProps={metaProps} />\n </ErrorBoundary>\n {text && (\n <View style={styles.messageText}>\n <MessageMarkdown text={text} />\n </View>\n )}\n </PlatformPressable>\n <View style={styles.messageReactions}>\n {reactionCounts.map(reaction => (\n <MessageReaction\n key={reaction.value}\n reaction={reaction}\n onPress={handleReactionPress}\n />\n ))}\n </View>\n </View>\n </View>\n )\n}\n\nconst useMessageStyles = ({ mine }: MessageResource) => {\n const { colors } = useTheme()\n const activeColor = colorFunction(colors.interaction).alpha(0.2).string()\n\n return StyleSheet.create({\n message: {\n gap: 8,\n flexDirection: mine ? 'row-reverse' : 'row',\n },\n messageContent: {\n gap: 8,\n flexShrink: 1,\n },\n messageAuthor: {\n flexDirection: 'row',\n gap: 8,\n },\n messageBubble: {\n backgroundColor: mine ? activeColor : colors.fillColorNeutral070,\n borderRadius: 8,\n maxWidth: 232,\n },\n messageText: {\n paddingVertical: 6,\n paddingHorizontal: 8,\n },\n messageReactions: {\n flexDirection: 'row',\n gap: 4,\n justifyContent: mine ? 'flex-end' : 'flex-start',\n },\n })\n}\n"]}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DenormalizedAttachmentResource } from '../../types/resources/denormalized_attachment_resource';
|
|
3
|
+
import { type MetaProps } from './attachments/image_attachment';
|
|
3
4
|
export declare function MessageAttachments(props: {
|
|
4
5
|
attachments: DenormalizedAttachmentResource[];
|
|
6
|
+
metaProps: MetaProps;
|
|
5
7
|
}): React.JSX.Element | null;
|
|
6
8
|
//# sourceMappingURL=message_attachments.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message_attachments.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message_attachments.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,8BAA8B,EAAE,MAAM,wDAAwD,CAAA;
|
|
1
|
+
{"version":3,"file":"message_attachments.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message_attachments.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,8BAA8B,EAAE,MAAM,wDAAwD,CAAA;AAMvG,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,gCAAgC,CAAA;AAEhF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE;IACxC,WAAW,EAAE,8BAA8B,EAAE,CAAA;IAC7C,SAAS,EAAE,SAAS,CAAA;CACrB,4BA+BA"}
|
|
@@ -8,14 +8,14 @@ import { ExpandedLink } from './attachments/expanded_link';
|
|
|
8
8
|
import { ImageAttachment } from './attachments/image_attachment';
|
|
9
9
|
export function MessageAttachments(props) {
|
|
10
10
|
const styles = useStyles();
|
|
11
|
-
const { attachments } = props;
|
|
11
|
+
const { attachments, metaProps } = props;
|
|
12
12
|
if (!attachments || attachments.length === 0)
|
|
13
13
|
return null;
|
|
14
14
|
return (<View style={styles.attachmentsContainer}>
|
|
15
15
|
{attachments.map(attachment => {
|
|
16
16
|
switch (attachment.type) {
|
|
17
17
|
case 'MessageAttachment':
|
|
18
|
-
return <MessageAttachment key={attachment.id} attachment={attachment}
|
|
18
|
+
return (<MessageAttachment key={attachment.id} attachment={attachment} metaProps={metaProps}/>);
|
|
19
19
|
case 'giphy':
|
|
20
20
|
return (<GiphyAttachment key={attachment.id || attachment.titleLink} attachment={attachment}/>);
|
|
21
21
|
case 'ExpandedLink':
|
|
@@ -26,13 +26,13 @@ export function MessageAttachments(props) {
|
|
|
26
26
|
})}
|
|
27
27
|
</View>);
|
|
28
28
|
}
|
|
29
|
-
function MessageAttachment({ attachment }) {
|
|
29
|
+
function MessageAttachment({ attachment, metaProps }) {
|
|
30
30
|
const { attributes } = attachment;
|
|
31
31
|
const contentType = attributes?.contentType;
|
|
32
32
|
const basicType = contentType ? contentType.split('/')[0] : '';
|
|
33
33
|
switch (basicType) {
|
|
34
34
|
case 'image':
|
|
35
|
-
return <ImageAttachment attachment={attachment}/>;
|
|
35
|
+
return <ImageAttachment attachment={attachment} metaProps={metaProps}/>;
|
|
36
36
|
case 'video':
|
|
37
37
|
return <VideoAttachment attachment={attachment}/>;
|
|
38
38
|
case 'audio':
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message_attachments.js","sourceRoot":"","sources":["../../../src/components/conversation/message_attachments.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAA;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAC1D,OAAO,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"message_attachments.js","sourceRoot":"","sources":["../../../src/components/conversation/message_attachments.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,g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,EAAE,SAAS,EAA6C;IAC7F,MAAM,EAAE,UAAU,EAAE,GAAG,UAAU,CAAA;IACjC,MAAM,WAAW,GAAG,UAAU,EAAE,WAAW,CAAA;IAC3C,MAAM,SAAS,GAAG,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IAC9D,QAAQ,SAAS,EAAE,CAAC;QAClB,KAAK,OAAO;YACV,OAAO,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,EAAG,CAAA;QAC1E,KAAK,OAAO;YACV,OAAO,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,UAAU,CAAC,EAAG,CAAA;QACpD,KAAK,OAAO;YACV,OAAO,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,UAAU,CAAC,EAAG,CAAA;QACpD;YACE,OAAO,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC,UAAU,CAAC,EAAG,CAAA;IAC5D,CAAC;AACH,CAAC;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,oBAAoB,EAAE;YACpB,GAAG,EAAE,CAAC;YACN,OAAO,EAAE,CAAC;SACX;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport { View, StyleSheet } from 'react-native'\nimport { DenormalizedAttachmentResource } from '../../types/resources/denormalized_attachment_resource'\nimport { AudioAttachment } from './attachments/audio_attachment'\nimport { VideoAttachment } from './attachments/video_attachment'\nimport { GiphyAttachment } from './attachments/giphy_attachment'\nimport { GenericFileAttachment } from './attachments/generic_file_attachment'\nimport { ExpandedLink } from './attachments/expanded_link'\nimport { ImageAttachment, type MetaProps } from './attachments/image_attachment'\n\nexport function MessageAttachments(props: {\n attachments: DenormalizedAttachmentResource[]\n metaProps: MetaProps\n}) {\n const styles = useStyles()\n const { attachments, metaProps } = props\n if (!attachments || attachments.length === 0) return null\n return (\n <View style={styles.attachmentsContainer}>\n {attachments.map(attachment => {\n switch (attachment.type) {\n case 'MessageAttachment':\n return (\n <MessageAttachment\n key={attachment.id}\n attachment={attachment}\n metaProps={metaProps}\n />\n )\n case 'giphy':\n return (\n <GiphyAttachment\n key={attachment.id || attachment.titleLink}\n attachment={attachment}\n />\n )\n case 'ExpandedLink':\n return <ExpandedLink key={attachment.id} attachment={attachment} />\n default:\n return null\n }\n })}\n </View>\n )\n}\n\nfunction MessageAttachment({ attachment, metaProps }: { attachment: any; metaProps: MetaProps }) {\n const { attributes } = attachment\n const contentType = attributes?.contentType\n const basicType = contentType ? contentType.split('/')[0] : ''\n switch (basicType) {\n case 'image':\n return <ImageAttachment attachment={attachment} metaProps={metaProps} />\n case 'video':\n return <VideoAttachment attachment={attachment} />\n case 'audio':\n return <AudioAttachment attachment={attachment} />\n default:\n return <GenericFileAttachment attachment={attachment} />\n }\n}\n\nconst useStyles = () => {\n return StyleSheet.create({\n attachmentsContainer: {\n gap: 4,\n padding: 2,\n },\n })\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ViewProps } from 'react-native';
|
|
3
|
-
import { ConversationResource } from '../../types';
|
|
3
|
+
import { ConversationResource, MessageResource } from '../../types';
|
|
4
4
|
export declare const MessageForm: {
|
|
5
5
|
Root: typeof MessageFormRoot;
|
|
6
6
|
TextInput: typeof MessageFormInput;
|
|
@@ -10,8 +10,9 @@ export declare const MessageForm: {
|
|
|
10
10
|
};
|
|
11
11
|
interface MessagesFormRootProps extends ViewProps {
|
|
12
12
|
conversation: ConversationResource;
|
|
13
|
+
currentlyEditingMessage?: MessageResource | null;
|
|
13
14
|
}
|
|
14
|
-
declare function MessageFormRoot({ conversation, children }: MessagesFormRootProps): React.JSX.Element;
|
|
15
|
+
declare function MessageFormRoot({ conversation, currentlyEditingMessage, children, }: MessagesFormRootProps): React.JSX.Element;
|
|
15
16
|
declare function MessageFormInput(): React.JSX.Element;
|
|
16
17
|
declare function MessageFormSubmitBtn(): React.JSX.Element;
|
|
17
18
|
declare function MessageFormAttachmentPicker(): React.JSX.Element | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message_form.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message_form.tsx"],"names":[],"mappings":"AACA,OAAO,KAAuD,MAAM,OAAO,CAAA;AAC3E,OAAO,EAA+B,SAAS,EAAE,MAAM,cAAc,CAAA;AAGrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"message_form.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message_form.tsx"],"names":[],"mappings":"AACA,OAAO,KAAuD,MAAM,OAAO,CAAA;AAC3E,OAAO,EAA+B,SAAS,EAAE,MAAM,cAAc,CAAA;AAGrE,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAcnE,eAAO,MAAM,WAAW;;;;;;CAOvB,CAAA;AAED,UAAU,qBAAsB,SAAQ,SAAS;IAC/C,YAAY,EAAE,oBAAoB,CAAA;IAClC,uBAAuB,CAAC,EAAE,eAAe,GAAG,IAAI,CAAA;CACjD;AA0BD,iBAAS,eAAe,CAAC,EACvB,YAAY,EACZ,uBAAuB,EACvB,QAAQ,GACT,EAAE,qBAAqB,qBAoHvB;AAiCD,iBAAS,gBAAgB,sBA+BxB;AAED,iBAAS,oBAAoB,sBAe5B;AAED,iBAAS,2BAA2B,6BA+EnC;AAED,iBAAS,mBAAmB,6BA6B3B"}
|