@planningcenter/chat-react-native 3.16.2-rc.0 → 3.17.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/conversation/reply_connectors.d.ts.map +1 -1
- package/build/components/conversation/reply_connectors.js +28 -13
- package/build/components/conversation/reply_connectors.js.map +1 -1
- package/build/screens/conversation_screen.d.ts +5 -1
- package/build/screens/conversation_screen.d.ts.map +1 -1
- package/build/screens/conversation_screen.js +22 -2
- package/build/screens/conversation_screen.js.map +1 -1
- package/build/types/resources/message.d.ts +3 -0
- package/build/types/resources/message.d.ts.map +1 -1
- package/build/types/resources/message.js.map +1 -1
- package/package.json +2 -2
- package/src/components/conversation/reply_connectors.tsx +26 -17
- package/src/screens/conversation_screen.tsx +29 -2
- package/src/types/resources/message.ts +3 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reply_connectors.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/reply_connectors.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAU7C,UAAU,mBAAmB;IAC3B,OAAO,EAAE,eAAe,CAAA;IACxB,mBAAmB,EAAE,MAAM,CAAA;CAC5B;AAED,wBAAgB,mBAAmB,CAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,EAAE,mBAAmB,sCA0BxF;
|
|
1
|
+
{"version":3,"file":"reply_connectors.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/reply_connectors.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAU7C,UAAU,mBAAmB;IAC3B,OAAO,EAAE,eAAe,CAAA;IACxB,mBAAmB,EAAE,MAAM,CAAA;CAC5B;AAED,wBAAgB,mBAAmB,CAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,EAAE,mBAAmB,sCA0BxF;AAED,wBAAgB,gBAAgB,CAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,EAAE,mBAAmB,sCAsCrF"}
|
|
@@ -9,17 +9,20 @@ export function TheirReplyConnector({ message, messageBubbleHeight }) {
|
|
|
9
9
|
const styles = useStyles();
|
|
10
10
|
if (!REPLIES_FEATURE_ENABLED)
|
|
11
11
|
return null;
|
|
12
|
-
// TODO: Need to remove, just adding this to remove the lint warning about message being unused
|
|
13
|
-
console.log('message', message);
|
|
14
12
|
const connectorMap = {
|
|
15
13
|
shortTailCurve: <ShortTailCurveConnector height={messageBubbleHeight / 2}/>,
|
|
14
|
+
shortHeadCurve: <ShortHeadCurveConnector height={messageBubbleHeight / 2}/>,
|
|
16
15
|
verticalLine: <VerticalLineConnector />,
|
|
17
16
|
default: null,
|
|
18
17
|
};
|
|
19
|
-
// TODO: Currently using fake message attributes. Will need to refactor once we have the message reply logic in place.
|
|
20
18
|
const getConnectorKey = () => {
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
const { threadPosition, renderAuthor } = message;
|
|
20
|
+
if (threadPosition === 'first' && !renderAuthor)
|
|
21
|
+
return 'shortHeadCurve';
|
|
22
|
+
if (threadPosition === 'last' && !renderAuthor)
|
|
23
|
+
return 'shortTailCurve';
|
|
24
|
+
if ((threadPosition === 'first' && renderAuthor) || threadPosition === 'center')
|
|
25
|
+
return 'verticalLine';
|
|
23
26
|
return 'default';
|
|
24
27
|
};
|
|
25
28
|
const ConnectorComponent = connectorMap[getConnectorKey()];
|
|
@@ -27,13 +30,10 @@ export function TheirReplyConnector({ message, messageBubbleHeight }) {
|
|
|
27
30
|
return null;
|
|
28
31
|
return <View style={styles.theirReplyConnectorContainer}>{ConnectorComponent}</View>;
|
|
29
32
|
}
|
|
30
|
-
// TODO: Refactor how we choose the correct connector once we have the logic in place
|
|
31
33
|
export function MyReplyConnector({ message, messageBubbleHeight }) {
|
|
32
34
|
const styles = useStyles();
|
|
33
35
|
if (!REPLIES_FEATURE_ENABLED)
|
|
34
36
|
return null;
|
|
35
|
-
// TODO: Need to remove, just adding this to remove the lint warning about message being unused
|
|
36
|
-
console.log('message', message);
|
|
37
37
|
const connectorMap = {
|
|
38
38
|
longTailCurve: (<LongTailCurveConnector height={messageBubbleHeight / 2} style={styles.myReplyConnectorPosition}/>),
|
|
39
39
|
longHeadCurve: (<LongHeadCurveConnector height={messageBubbleHeight / 2} style={styles.myReplyConnectorPosition}/>),
|
|
@@ -41,12 +41,16 @@ export function MyReplyConnector({ message, messageBubbleHeight }) {
|
|
|
41
41
|
swirl: <SwirlConnector style={styles.myReplyConnectorPosition}/>,
|
|
42
42
|
default: null,
|
|
43
43
|
};
|
|
44
|
-
// TODO: Currently using fake message attributes. Will need to refactor once we have the message reply logic in place.
|
|
45
44
|
const getConnectorKey = () => {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
const { threadPosition, prevIsMyReply, nextIsMyReply } = message;
|
|
46
|
+
if (threadPosition === 'first')
|
|
47
|
+
return 'longHeadCurve';
|
|
48
|
+
if (threadPosition === 'center' && prevIsMyReply && nextIsMyReply)
|
|
49
|
+
return 'verticalLine';
|
|
50
|
+
if (threadPosition === 'center' && (!prevIsMyReply || !nextIsMyReply))
|
|
51
|
+
return 'swirl';
|
|
52
|
+
if (threadPosition === 'last')
|
|
53
|
+
return 'longTailCurve';
|
|
50
54
|
return 'default';
|
|
51
55
|
};
|
|
52
56
|
const ConnectorComponent = connectorMap[getConnectorKey()];
|
|
@@ -66,6 +70,10 @@ function LongTailCurveConnector({ height, style }) {
|
|
|
66
70
|
const styles = useStyles();
|
|
67
71
|
return <View style={[styles.longTailCurveConnector, { height }, style]}/>;
|
|
68
72
|
}
|
|
73
|
+
function ShortHeadCurveConnector({ height }) {
|
|
74
|
+
const styles = useStyles();
|
|
75
|
+
return <View style={[styles.shortHeadCurveConnector, { marginTop: height }]}/>;
|
|
76
|
+
}
|
|
69
77
|
function ShortTailCurveConnector({ height }) {
|
|
70
78
|
const styles = useStyles();
|
|
71
79
|
return <View style={[styles.shortTailCurveConnector, { height }]}/>;
|
|
@@ -121,6 +129,13 @@ const useStyles = () => {
|
|
|
121
129
|
borderBottomWidth: CONNECTOR_BORDER_WIDTH,
|
|
122
130
|
borderBottomLeftRadius: 16,
|
|
123
131
|
},
|
|
132
|
+
shortHeadCurveConnector: {
|
|
133
|
+
borderColor: borderColor,
|
|
134
|
+
borderLeftWidth: CONNECTOR_BORDER_WIDTH,
|
|
135
|
+
borderTopWidth: CONNECTOR_BORDER_WIDTH,
|
|
136
|
+
borderTopLeftRadius: 16,
|
|
137
|
+
flex: 1,
|
|
138
|
+
},
|
|
124
139
|
shortTailCurveConnector: {
|
|
125
140
|
borderColor: borderColor,
|
|
126
141
|
borderLeftWidth: CONNECTOR_BORDER_WIDTH,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reply_connectors.js","sourceRoot":"","sources":["../../../src/components/conversation/reply_connectors.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAa,MAAM,cAAc,CAAA;AAC1D,OAAO,GAAG,EAAE,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,EACL,4CAA4C,EAC5C,kCAAkC,GACnC,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAErD,MAAM,wBAAwB,GAAG,EAAE,CAAA;AACnC,MAAM,sBAAsB,GAAG,CAAC,CAAA;AAOhC,MAAM,UAAU,mBAAmB,CAAC,EAAE,OAAO,EAAE,mBAAmB,EAAuB;IACvF,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAE1B,IAAI,CAAC,uBAAuB;QAAE,OAAO,IAAI,CAAA;IAEzC,+FAA+F;IAC/F,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;IAE/B,MAAM,YAAY,GAA2C;QAC3D,cAAc,EAAE,C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react-native-svg'\nimport { useTheme } from '../../hooks'\nimport { MessageResource } from '../../types'\nimport {\n CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL,\n MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH,\n} from '../../utils/styles'\nimport { REPLIES_FEATURE_ENABLED } from '../../utils'\n\nconst MY_REPLY_CONNECTOR_WIDTH = 38\nconst CONNECTOR_BORDER_WIDTH = 4\n\ninterface ReplyConnectorProps {\n message: MessageResource\n messageBubbleHeight: number\n}\n\nexport function TheirReplyConnector({ message, messageBubbleHeight }: ReplyConnectorProps) {\n const styles = useStyles()\n\n if (!REPLIES_FEATURE_ENABLED) return null\n\n // TODO: Need to remove, just adding this to remove the lint warning about message being unused\n console.log('message', message)\n\n const connectorMap: Record<string, React.ReactNode | null> = {\n shortTailCurve: <ShortTailCurveConnector height={messageBubbleHeight / 2} />,\n verticalLine: <VerticalLineConnector />,\n default: null,\n }\n\n // TODO: Currently using fake message attributes. Will need to refactor once we have the message reply logic in place.\n const getConnectorKey = () => {\n // TODO: if (message.previousMessageIsTheirReplyMessage && message.nextMessageIsSomeoneElseReplyMessage) return 'shortTailCurve'\n // TODO: if (message.isRootMessage || (message.isTheirReplyMessage && message.nextMessageIsTheirReplyMessage) || (message.isTheirReplyMessage && message.nextMessageIsSomeoneElseReplyMessage && !message.nextMessageIsMyMessage)) return 'verticalLine'\n return 'default'\n }\n\n const ConnectorComponent = connectorMap[getConnectorKey()]\n\n if (!ConnectorComponent) return null\n\n return <View style={styles.theirReplyConnectorContainer}>{ConnectorComponent}</View>\n}\n\n// TODO: Refactor how we choose the correct connector once we have the logic in place\nexport function MyReplyConnector({ message, messageBubbleHeight }: ReplyConnectorProps) {\n const styles = useStyles()\n\n if (!REPLIES_FEATURE_ENABLED) return null\n\n // TODO: Need to remove, just adding this to remove the lint warning about message being unused\n console.log('message', message)\n\n const connectorMap: Record<string, React.ReactNode | null> = {\n longTailCurve: (\n <LongTailCurveConnector\n height={messageBubbleHeight / 2}\n style={styles.myReplyConnectorPosition}\n />\n ),\n longHeadCurve: (\n <LongHeadCurveConnector\n height={messageBubbleHeight / 2}\n style={styles.myReplyConnectorPosition}\n />\n ),\n verticalLine: <VerticalLineConnector style={styles.myReplyConnectorPosition} />,\n swirl: <SwirlConnector style={styles.myReplyConnectorPosition} />,\n default: null,\n }\n\n // TODO: Currently using fake message attributes. Will need to refactor once we have the message reply logic in place.\n const getConnectorKey = () => {\n // TODO: if (message.currentMessageIsReply && (message.nextMessageIsNotReplyMessage || message.nextMessageIsDifferentReplyRootId)) return 'longTailCurve'\n // TODO: if (message.currentMessageIsReplyRoot && message.nextMessageIsMyReply) return 'longHeadCurve'\n // TODO: if (message.currentMessageIsReply && message.nextMessageIsReply) return 'verticalLine'\n // TODO: if (message.currentMessageIsReply && message.previousMessageSomeoneElseReply && (message.nextMessageIsSomeoneElseReply || message.nextMessageIsMyReply)) return 'swirl'\n return 'default'\n }\n\n const ConnectorComponent = connectorMap[getConnectorKey()]\n\n if (!ConnectorComponent) return null\n\n return <View style={styles.myReplyConnectorContainer}>{ConnectorComponent}</View>\n}\n\nfunction VerticalLineConnector({ style }: { style?: ViewStyle }) {\n const styles = useStyles()\n return <View style={[styles.verticalLineConnector, style]} />\n}\n\nfunction LongHeadCurveConnector({ height, style }: { height: number; style?: ViewStyle }) {\n const styles = useStyles()\n return <View style={[styles.longHeadCurveConnector, { height, marginTop: height }, style]} />\n}\n\nfunction LongTailCurveConnector({ height, style }: { height: number; style?: ViewStyle }) {\n const styles = useStyles()\n return <View style={[styles.longTailCurveConnector, { height }, style]} />\n}\n\nfunction ShortTailCurveConnector({ height }: { height: number }) {\n const styles = useStyles()\n return <View style={[styles.shortTailCurveConnector, { height }]} />\n}\n\nfunction SwirlConnector({ style }: { style?: ViewStyle }) {\n const styles = useStyles()\n const { colors } = useTheme()\n const borderColor = colors.borderColorDefaultBase\n\n return (\n <View style={[styles.swirlConnectorContainer, style]}>\n <View style={styles.swirlConnectorVerticalLineHead} />\n <Svg width={27} height={34} fill=\"none\">\n <Path\n stroke={borderColor}\n strokeWidth={CONNECTOR_BORDER_WIDTH}\n d=\"M2.07 34c0-6.142 1.201-12.283 3.343-17m0 0c2.305-5.075 5.699-8.5 9.857-8.5 4.86 0 8.8 3.806 8.8 8.5s-3.94 8.5-8.8 8.5c-4.158 0-7.552-3.425-9.857-8.5zm0 0C3.271 12.283 2.07 6.142 2.07 0\"\n />\n </Svg>\n <View style={styles.swirlConnectorVerticalLineTail} />\n </View>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n const borderColor = colors.borderColorDefaultBase\n\n return StyleSheet.create({\n theirReplyConnectorContainer: {\n width: '50%',\n alignSelf: 'flex-end',\n flex: 1,\n },\n myReplyConnectorContainer: {\n width: MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH,\n position: 'absolute',\n left: CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL,\n top: 0,\n bottom: 0,\n },\n myReplyConnectorPosition: {\n left: '50%',\n },\n verticalLineConnector: {\n flex: 1,\n borderLeftWidth: CONNECTOR_BORDER_WIDTH,\n borderLeftColor: borderColor,\n },\n longHeadCurveConnector: {\n width: MY_REPLY_CONNECTOR_WIDTH,\n borderColor: borderColor,\n borderLeftWidth: CONNECTOR_BORDER_WIDTH,\n borderTopWidth: CONNECTOR_BORDER_WIDTH,\n borderTopLeftRadius: 16,\n flex: 1,\n },\n longTailCurveConnector: {\n width: MY_REPLY_CONNECTOR_WIDTH,\n borderColor: borderColor,\n borderLeftWidth: CONNECTOR_BORDER_WIDTH,\n borderBottomWidth: CONNECTOR_BORDER_WIDTH,\n borderBottomLeftRadius: 16,\n },\n shortTailCurveConnector: {\n borderColor: borderColor,\n borderLeftWidth: CONNECTOR_BORDER_WIDTH,\n borderBottomWidth: CONNECTOR_BORDER_WIDTH,\n borderBottomLeftRadius: 16,\n },\n swirlConnectorContainer: {\n flex: 1,\n },\n swirlConnectorVerticalLineHead: {\n backgroundColor: borderColor,\n width: CONNECTOR_BORDER_WIDTH,\n flex: 1,\n marginBottom: -1, // Ensures there is no gap between the vertical line and the swirl connector\n },\n swirlConnectorVerticalLineTail: {\n backgroundColor: borderColor,\n width: CONNECTOR_BORDER_WIDTH,\n flex: 1,\n marginTop: -1, // Ensures there is no gap between the vertical line and the swirl connector\n },\n })\n}\n"]}
|
|
1
|
+
{"version":3,"file":"reply_connectors.js","sourceRoot":"","sources":["../../../src/components/conversation/reply_connectors.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAa,MAAM,cAAc,CAAA;AAC1D,OAAO,GAAG,EAAE,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,EACL,4CAA4C,EAC5C,kCAAkC,GACnC,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAErD,MAAM,wBAAwB,GAAG,EAAE,CAAA;AACnC,MAAM,sBAAsB,GAAG,CAAC,CAAA;AAOhC,MAAM,UAAU,mBAAmB,CAAC,EAAE,OAAO,EAAE,mBAAmB,EAAuB;IACvF,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAE1B,IAAI,CAAC,uBAAuB;QAAE,OAAO,IAAI,CAAA;IAEzC,MAAM,YAAY,GAA2C;QAC3D,cAAc,EAAE,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC,mBAAmB,GAAG,CAAC,CAAC,EAAG;QAC5E,cAAc,EAAE,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC,mBAAmB,GAAG,CAAC,CAAC,EAAG;QAC5E,YAAY,EAAE,CAAC,qBAAqB,CAAC,AAAD,EAAG;QACvC,OAAO,EAAE,IAAI;KACd,CAAA;IAED,MAAM,eAAe,GAAG,GAAG,EAAE;QAC3B,MAAM,EAAE,cAAc,EAAE,YAAY,EAAE,GAAG,OAAO,CAAA;QAEhD,IA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B,IAAI,EAAE,CAAC;SACR;QACD,uBAAuB,EAAE;YACvB,WAAW,EAAE,WAAW;YACxB,eAAe,EAAE,sBAAsB;YACvC,iBAAiB,EAAE,sBAAsB;YACzC,sBAAsB,EAAE,EAAE;SAC3B;QACD,uBAAuB,EAAE;YACvB,IAAI,EAAE,CAAC;SACR;QACD,8BAA8B,EAAE;YAC9B,eAAe,EAAE,WAAW;YAC5B,KAAK,EAAE,sBAAsB;YAC7B,IAAI,EAAE,CAAC;YACP,YAAY,EAAE,CAAC,CAAC,EAAE,4EAA4E;SAC/F;QACD,8BAA8B,EAAE;YAC9B,eAAe,EAAE,WAAW;YAC5B,KAAK,EAAE,sBAAsB;YAC7B,IAAI,EAAE,CAAC;YACP,SAAS,EAAE,CAAC,CAAC,EAAE,4EAA4E;SAC5F;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { StyleSheet, View, ViewStyle } from 'react-native'\nimport Svg, { Path } from 'react-native-svg'\nimport { useTheme } from '../../hooks'\nimport { MessageResource } from '../../types'\nimport {\n CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL,\n MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH,\n} from '../../utils/styles'\nimport { REPLIES_FEATURE_ENABLED } from '../../utils'\n\nconst MY_REPLY_CONNECTOR_WIDTH = 38\nconst CONNECTOR_BORDER_WIDTH = 4\n\ninterface ReplyConnectorProps {\n message: MessageResource\n messageBubbleHeight: number\n}\n\nexport function TheirReplyConnector({ message, messageBubbleHeight }: ReplyConnectorProps) {\n const styles = useStyles()\n\n if (!REPLIES_FEATURE_ENABLED) return null\n\n const connectorMap: Record<string, React.ReactNode | null> = {\n shortTailCurve: <ShortTailCurveConnector height={messageBubbleHeight / 2} />,\n shortHeadCurve: <ShortHeadCurveConnector height={messageBubbleHeight / 2} />,\n verticalLine: <VerticalLineConnector />,\n default: null,\n }\n\n const getConnectorKey = () => {\n const { threadPosition, renderAuthor } = message\n\n if (threadPosition === 'first' && !renderAuthor) return 'shortHeadCurve'\n if (threadPosition === 'last' && !renderAuthor) return 'shortTailCurve'\n if ((threadPosition === 'first' && renderAuthor) || threadPosition === 'center')\n return 'verticalLine'\n return 'default'\n }\n\n const ConnectorComponent = connectorMap[getConnectorKey()]\n if (!ConnectorComponent) return null\n\n return <View style={styles.theirReplyConnectorContainer}>{ConnectorComponent}</View>\n}\n\nexport function MyReplyConnector({ message, messageBubbleHeight }: ReplyConnectorProps) {\n const styles = useStyles()\n\n if (!REPLIES_FEATURE_ENABLED) return null\n\n const connectorMap: Record<string, React.ReactNode | null> = {\n longTailCurve: (\n <LongTailCurveConnector\n height={messageBubbleHeight / 2}\n style={styles.myReplyConnectorPosition}\n />\n ),\n longHeadCurve: (\n <LongHeadCurveConnector\n height={messageBubbleHeight / 2}\n style={styles.myReplyConnectorPosition}\n />\n ),\n verticalLine: <VerticalLineConnector style={styles.myReplyConnectorPosition} />,\n swirl: <SwirlConnector style={styles.myReplyConnectorPosition} />,\n default: null,\n }\n\n const getConnectorKey = () => {\n const { threadPosition, prevIsMyReply, nextIsMyReply } = message\n\n if (threadPosition === 'first') return 'longHeadCurve'\n if (threadPosition === 'center' && prevIsMyReply && nextIsMyReply) return 'verticalLine'\n if (threadPosition === 'center' && (!prevIsMyReply || !nextIsMyReply)) return 'swirl'\n if (threadPosition === 'last') return 'longTailCurve'\n\n return 'default'\n }\n\n const ConnectorComponent = connectorMap[getConnectorKey()]\n if (!ConnectorComponent) return null\n\n return <View style={styles.myReplyConnectorContainer}>{ConnectorComponent}</View>\n}\n\nfunction VerticalLineConnector({ style }: { style?: ViewStyle }) {\n const styles = useStyles()\n return <View style={[styles.verticalLineConnector, style]} />\n}\n\nfunction LongHeadCurveConnector({ height, style }: { height: number; style?: ViewStyle }) {\n const styles = useStyles()\n return <View style={[styles.longHeadCurveConnector, { height, marginTop: height }, style]} />\n}\n\nfunction LongTailCurveConnector({ height, style }: { height: number; style?: ViewStyle }) {\n const styles = useStyles()\n return <View style={[styles.longTailCurveConnector, { height }, style]} />\n}\n\nfunction ShortHeadCurveConnector({ height }: { height: number }) {\n const styles = useStyles()\n return <View style={[styles.shortHeadCurveConnector, { marginTop: height }]} />\n}\n\nfunction ShortTailCurveConnector({ height }: { height: number }) {\n const styles = useStyles()\n return <View style={[styles.shortTailCurveConnector, { height }]} />\n}\n\nfunction SwirlConnector({ style }: { style?: ViewStyle }) {\n const styles = useStyles()\n const { colors } = useTheme()\n const borderColor = colors.borderColorDefaultBase\n\n return (\n <View style={[styles.swirlConnectorContainer, style]}>\n <View style={styles.swirlConnectorVerticalLineHead} />\n <Svg width={27} height={34} fill=\"none\">\n <Path\n stroke={borderColor}\n strokeWidth={CONNECTOR_BORDER_WIDTH}\n d=\"M2.07 34c0-6.142 1.201-12.283 3.343-17m0 0c2.305-5.075 5.699-8.5 9.857-8.5 4.86 0 8.8 3.806 8.8 8.5s-3.94 8.5-8.8 8.5c-4.158 0-7.552-3.425-9.857-8.5zm0 0C3.271 12.283 2.07 6.142 2.07 0\"\n />\n </Svg>\n <View style={styles.swirlConnectorVerticalLineTail} />\n </View>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n const borderColor = colors.borderColorDefaultBase\n\n return StyleSheet.create({\n theirReplyConnectorContainer: {\n width: '50%',\n alignSelf: 'flex-end',\n flex: 1,\n },\n myReplyConnectorContainer: {\n width: MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH,\n position: 'absolute',\n left: CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL,\n top: 0,\n bottom: 0,\n },\n myReplyConnectorPosition: {\n left: '50%',\n },\n verticalLineConnector: {\n flex: 1,\n borderLeftWidth: CONNECTOR_BORDER_WIDTH,\n borderLeftColor: borderColor,\n },\n longHeadCurveConnector: {\n width: MY_REPLY_CONNECTOR_WIDTH,\n borderColor: borderColor,\n borderLeftWidth: CONNECTOR_BORDER_WIDTH,\n borderTopWidth: CONNECTOR_BORDER_WIDTH,\n borderTopLeftRadius: 16,\n flex: 1,\n },\n longTailCurveConnector: {\n width: MY_REPLY_CONNECTOR_WIDTH,\n borderColor: borderColor,\n borderLeftWidth: CONNECTOR_BORDER_WIDTH,\n borderBottomWidth: CONNECTOR_BORDER_WIDTH,\n borderBottomLeftRadius: 16,\n },\n shortHeadCurveConnector: {\n borderColor: borderColor,\n borderLeftWidth: CONNECTOR_BORDER_WIDTH,\n borderTopWidth: CONNECTOR_BORDER_WIDTH,\n borderTopLeftRadius: 16,\n flex: 1,\n },\n shortTailCurveConnector: {\n borderColor: borderColor,\n borderLeftWidth: CONNECTOR_BORDER_WIDTH,\n borderBottomWidth: CONNECTOR_BORDER_WIDTH,\n borderBottomLeftRadius: 16,\n },\n swirlConnectorContainer: {\n flex: 1,\n },\n swirlConnectorVerticalLineHead: {\n backgroundColor: borderColor,\n width: CONNECTOR_BORDER_WIDTH,\n flex: 1,\n marginBottom: -1, // Ensures there is no gap between the vertical line and the swirl connector\n },\n swirlConnectorVerticalLineTail: {\n backgroundColor: borderColor,\n width: CONNECTOR_BORDER_WIDTH,\n flex: 1,\n marginTop: -1, // Ensures there is no gap between the vertical line and the swirl connector\n },\n })\n}\n"]}
|
|
@@ -22,7 +22,11 @@ export type DateSeparator = {
|
|
|
22
22
|
id: string;
|
|
23
23
|
date: string;
|
|
24
24
|
};
|
|
25
|
-
|
|
25
|
+
interface GroupMessagesProps {
|
|
26
|
+
ms: MessageResource[];
|
|
27
|
+
inReplyScreen?: boolean;
|
|
28
|
+
}
|
|
29
|
+
export declare const groupMessages: ({ ms, inReplyScreen }: GroupMessagesProps) => (MessageResource | DateSeparator)[];
|
|
26
30
|
interface ConversationScreenTitleProps extends HeaderTitleProps {
|
|
27
31
|
conversation_id: number;
|
|
28
32
|
badge?: ConversationBadgeResource;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_screen.d.ts","sourceRoot":"","sources":["../../src/screens/conversation_screen.tsx"],"names":[],"mappings":"AACA,OAAO,EAAe,gBAAgB,EAAqB,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B,EAAE,MAAM,uCAAuC,CAAA;AAOjF,MAAM,MAAM,sBAAsB,GAAG;IACnC,eAAe,EAAE,MAAM,CAAA;IACvB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAClC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,yBAAyB,CAAA;IACjC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,CAAC,sBAAsB,CAAC,CAAA;AAE/E,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,EAAE,uBAAuB,qBA+HpE;AAED,MAAM,MAAM,aAAa,GAAG;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAwC/E,UAAU,kBAAkB;IAC1B,EAAE,EAAE,eAAe,EAAE,CAAA;IACrB,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED,eAAO,MAAM,aAAa,0BAA2B,kBAAkB,wCAwDtE,CAAA;AACD,UAAU,4BAA6B,SAAQ,gBAAgB;IAC7D,eAAe,EAAE,MAAM,CAAA;IACvB,KAAK,CAAC,EAAE,yBAAyB,CAAA;IACjC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,eAAO,MAAM,uBAAuB,0DAMjC,4BAA4B,sBAiC9B,CAAA"}
|
|
@@ -35,7 +35,7 @@ export function ConversationScreen({ route }) {
|
|
|
35
35
|
useConversationMessagesJoltEvents({ conversationId: conversation_id });
|
|
36
36
|
useEnsureConversationsRouteExists();
|
|
37
37
|
useMarkLatestMessageRead({ conversation, messages });
|
|
38
|
-
const messagesWithSeparators = groupMessages(messages);
|
|
38
|
+
const messagesWithSeparators = groupMessages({ ms: messages, inReplyScreen: !!reply_root_id });
|
|
39
39
|
const noMessages = messagesWithSeparators.length === 0;
|
|
40
40
|
const { repliesDisabled, memberAbility, badges, title } = conversation;
|
|
41
41
|
const canReply = memberAbility?.canReply;
|
|
@@ -131,19 +131,24 @@ const useDateSeparatorStyles = () => {
|
|
|
131
131
|
},
|
|
132
132
|
});
|
|
133
133
|
};
|
|
134
|
-
export const groupMessages = (ms) => {
|
|
134
|
+
export const groupMessages = ({ ms, inReplyScreen }) => {
|
|
135
135
|
let enrichedMessages = [];
|
|
136
136
|
let encounteredOneOfMyMessages = false;
|
|
137
137
|
ms.forEach((message, i) => {
|
|
138
138
|
const prevMessage = ms[i + 1];
|
|
139
139
|
const nextMessage = ms[i - 1];
|
|
140
140
|
const date = moment(message.createdAt).format('YYYY-MM-DD');
|
|
141
|
+
const inThread = message.replyRootId !== null;
|
|
142
|
+
const threadRoot = message.replyRootId === message.id;
|
|
143
|
+
const prevMessageDifferentThread = message.replyRootId !== prevMessage?.replyRootId;
|
|
144
|
+
const nextMessageDifferentThread = message.replyRootId !== nextMessage?.replyRootId;
|
|
141
145
|
const prevMessageDifferentAuthor = message.author?.id !== prevMessage?.author?.id;
|
|
142
146
|
const nextMessageDifferentAuthor = message.author?.id !== nextMessage?.author?.id;
|
|
143
147
|
const prevMessageMoreThan5Minutes = prevMessage &&
|
|
144
148
|
new Date(message.createdAt).getTime() - new Date(prevMessage.createdAt).getTime() > 60000 * 5;
|
|
145
149
|
const nextMessageMoreThan5Minutes = nextMessage &&
|
|
146
150
|
new Date(nextMessage.createdAt).getTime() - new Date(message.createdAt).getTime() > 60000 * 5;
|
|
151
|
+
const nextMessageIsDateSeparator = nextMessage && date !== moment(nextMessage.createdAt).format('YYYY-MM-DD');
|
|
147
152
|
if (message.mine && !encounteredOneOfMyMessages) {
|
|
148
153
|
encounteredOneOfMyMessages = true;
|
|
149
154
|
message.myLatestInConversation = true;
|
|
@@ -154,6 +159,21 @@ export const groupMessages = (ms) => {
|
|
|
154
159
|
message.lastInGroup = !nextMessage || nextMessageDifferentAuthor || nextMessageMoreThan5Minutes;
|
|
155
160
|
message.renderAuthor =
|
|
156
161
|
!message.mine && (!prevMessage || prevMessageDifferentAuthor || prevMessageMoreThan5Minutes);
|
|
162
|
+
message.threadPosition = null;
|
|
163
|
+
if (!inReplyScreen && inThread) {
|
|
164
|
+
message.prevIsMyReply = prevMessage?.mine;
|
|
165
|
+
message.nextIsMyReply = nextMessage?.mine;
|
|
166
|
+
const firstInThread = threadRoot;
|
|
167
|
+
const lastInThread = nextMessageDifferentThread || nextMessageIsDateSeparator;
|
|
168
|
+
if (firstInThread && lastInThread)
|
|
169
|
+
message.threadPosition = null; // ensures we don't render a connector for root replies that aren't immediately followed up a reply
|
|
170
|
+
else if (firstInThread)
|
|
171
|
+
message.threadPosition = 'first';
|
|
172
|
+
else if (lastInThread)
|
|
173
|
+
message.threadPosition = 'last';
|
|
174
|
+
else if (!prevMessageDifferentThread && !nextMessageDifferentThread)
|
|
175
|
+
message.threadPosition = 'center';
|
|
176
|
+
}
|
|
157
177
|
enrichedMessages.push(message);
|
|
158
178
|
if (!prevMessage || date !== moment(prevMessage.createdAt).format('YYYY-MM-DD')) {
|
|
159
179
|
enrichedMessages.push({ type: 'DateSeparator', id: `day-divider-${message.id}`, date });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_screen.js","sourceRoot":"","sources":["../../src/screens/conversation_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,8BAA8B,CAAA;AACjE,OAAO,EAAE,WAAW,EAAoB,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC7F,OAAO,EACL,aAAa,EAGb,aAAa,EACb,QAAQ,IAAI,kBAAkB,EAC9B,QAAQ,GACT,MAAM,0BAA0B,CAAA;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AC,CAAA","sourcesContent":["import { date as formatDate } from '@planningcenter/datetime-fmt'\nimport { HeaderTitle, HeaderTitleProps, PlatformPressable } from '@react-navigation/elements'\nimport {\n CommonActions,\n RouteProp,\n StaticScreenProps,\n useNavigation,\n useTheme as useNavigationTheme,\n useRoute,\n} from '@react-navigation/native'\nimport moment from 'moment'\nimport React, { useCallback, useEffect, useRef, useState } from 'react'\nimport { FlatList, Platform, StyleSheet, View } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { Badge, Icon, Text } from '../components'\nimport {\n LeaderDisabledRepliesBanner,\n MemberDisabledRepliesBanner,\n} from '../components/conversation/disabled_replies_banners'\nimport { EmptyConversationBlankState } from '../components/conversation/empty_conversation_blank_state'\nimport BlankState from '../components/primitive/blank_state_primitive'\nimport { Message } from '../components/conversation/message'\nimport { MessageForm } from '../components/conversation/message_form'\nimport { TypingIndicator } from '../components/conversation/typing_indicator'\nimport { KeyboardView } from '../components/display/keyboard_view'\nimport { useTheme } from '../hooks'\nimport { useConversation } from '../hooks/use_conversation'\nimport { useConversationMessages } from '../hooks/use_conversation_messages'\nimport { useConversationMessagesJoltEvents } from '../hooks/use_conversation_messages_jolt_events'\nimport { MessageResource } from '../types'\nimport { ConversationBadgeResource } from '../types/resources/conversation_badge'\nimport { getRelativeDateStatus } from '../utils/date'\nimport { useMarkLatestMessageRead } from '../hooks/use_mark_latest_message_read'\nimport { CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL } from '../utils/styles'\nimport { useConversationJoltEvents } from '../hooks/use_conversation_jolt_events'\nimport { JumpToBottomButton } from '../components/conversation/jump_to_bottom_button'\n\nexport type ConversationRouteProps = {\n conversation_id: number\n reply_root_id?: string\n replyRootAuthor?: string\n chat_group_graph_id?: string\n clear_input?: boolean\n editing_message_id?: number | null\n title?: string\n subtitle?: string\n badge?: ConversationBadgeResource\n deleted?: boolean\n}\n\nexport type ConversationScreenProps = StaticScreenProps<ConversationRouteProps>\n\nexport function ConversationScreen({ route }: ConversationScreenProps) {\n const styles = useStyles()\n const navigation = useNavigation()\n const { conversation_id, editing_message_id, reply_root_id } = route.params\n const { data: conversation } = useConversation(route.params)\n const { messages, refetch, isRefetching, fetchNextPage } = useConversationMessages({\n conversation_id,\n reply_root_id,\n })\n useConversationJoltEvents({ conversationId: conversation_id })\n useConversationMessagesJoltEvents({ conversationId: conversation_id })\n useEnsureConversationsRouteExists()\n useMarkLatestMessageRead({ conversation, messages })\n const messagesWithSeparators = groupMessages(messages)\n const noMessages = messagesWithSeparators.length === 0\n\n const { repliesDisabled, memberAbility, badges, title } = conversation\n const canReply = memberAbility?.canReply\n const showLeaderDisabledReplyBanner = canReply && repliesDisabled\n const canDeleteNonAuthoredMessages = memberAbility?.canDeleteNonAuthoredMessages ?? false\n const currentlyEditingMessage = messages.find(m => String(m.id) === String(editing_message_id))\n\n const listRef = useRef<FlatList>(null)\n const [showJumpToBottomButton, setShowJumpToBottomButton] = useState(false)\n\n const trackScroll = (event: any) => {\n const offsetY = event.nativeEvent.contentOffset.y\n setShowJumpToBottomButton(offsetY > 200)\n }\n\n const handleReturnToBottom = useCallback(() => {\n listRef.current?.scrollToOffset({\n offset: 0,\n })\n }, [])\n\n useEffect(() => {\n if (reply_root_id) return\n\n navigation.setParams({\n title: title,\n badge: badges?.[0],\n deleted: conversation?.deleted,\n })\n }, [navigation, title, badges, conversation?.deleted, reply_root_id])\n\n if (!conversation || conversation.deleted) {\n return (\n <View style={styles.container}>\n <BlankState.Root>\n <BlankState.Imagery name=\"general.outlinedTextMessage\" />\n <BlankState.Content>\n <BlankState.Heading>This conversation has been deleted</BlankState.Heading>\n </BlankState.Content>\n <BlankState.Button\n onPress={navigation.goBack}\n title=\"Back to conversations\"\n accessibilityHint=\"Navigates back to the conversations list\"\n accessibilityRole=\"link\"\n />\n </BlankState.Root>\n </View>\n )\n }\n\n return (\n <View style={styles.container}>\n <KeyboardView>\n {noMessages ? (\n <EmptyConversationBlankState />\n ) : (\n <FlatList\n inverted\n ref={listRef}\n contentContainerStyle={styles.listContainer}\n refreshing={isRefetching}\n onRefresh={refetch}\n data={messagesWithSeparators}\n keyExtractor={item => item.id}\n onScroll={trackScroll}\n scrollEventThrottle={10}\n renderItem={({ item }) => {\n if (item.type === 'DateSeparator') {\n return <InlineDateSeparator {...item} />\n }\n\n return (\n <Message\n {...item}\n canDeleteNonAuthoredMessages={canDeleteNonAuthoredMessages}\n conversation_id={conversation_id}\n latestReadMessageSortKey={conversation?.latestReadMessageSortKey}\n inReplyScreen={!!reply_root_id}\n />\n )\n }}\n onEndReached={() => fetchNextPage()}\n ListHeaderComponent={<View style={styles.listHeader} />}\n />\n )}\n <JumpToBottomButton onPress={handleReturnToBottom} visible={showJumpToBottomButton} />\n {!noMessages && <TypingIndicator conversationId={conversation_id} />}\n {showLeaderDisabledReplyBanner && <LeaderDisabledRepliesBanner />}\n {canReply ? (\n <MessageForm.Root\n conversation={conversation}\n replyRootId={reply_root_id}\n currentlyEditingMessage={currentlyEditingMessage}\n // We use a separate key so that it remounts component when switching between new\n // and edit message. This simplifies internal state handling.\n key={\n currentlyEditingMessage\n ? `edit-message-form-${currentlyEditingMessage.id}`\n : 'new-message-form'\n }\n >\n <MessageForm.AttachmentPicker />\n <MessageForm.Commands />\n <MessageForm.TextInput />\n <MessageForm.SubmitButton />\n </MessageForm.Root>\n ) : (\n <MemberDisabledRepliesBanner />\n )}\n </KeyboardView>\n </View>\n )\n}\n\nexport type DateSeparator = { type: 'DateSeparator'; id: string; date: string }\n\nfunction InlineDateSeparator({ date }: DateSeparator) {\n const styles = useDateSeparatorStyles()\n const { isThisYear } = getRelativeDateStatus(date)\n const showYear = !isThisYear\n const dateStamp = formatDate(date, { style: 'long', year: showYear })\n\n return (\n <View style={styles.container}>\n <View style={styles.separator} />\n <Text variant=\"footnote\" style={styles.dateText}>\n {dateStamp}\n </Text>\n <View style={styles.separator} />\n </View>\n )\n}\n\nconst useDateSeparatorStyles = () => {\n const theme = useTheme()\n return StyleSheet.create({\n container: {\n alignItems: 'center',\n flexDirection: 'row',\n paddingHorizontal: CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL,\n paddingVertical: 16,\n },\n separator: {\n flex: 1,\n height: 1,\n borderTopWidth: 1,\n borderTopColor: theme.colors.borderColorDefaultBase,\n },\n dateText: {\n paddingHorizontal: 8,\n },\n })\n}\n\nexport const groupMessages = (ms: MessageResource[]) => {\n let enrichedMessages: (MessageResource | DateSeparator)[] = []\n let encounteredOneOfMyMessages = false\n\n ms.forEach((message, i) => {\n const prevMessage = ms[i + 1]\n const nextMessage = ms[i - 1]\n const date = moment(message.createdAt).format('YYYY-MM-DD')\n const prevMessageDifferentAuthor = message.author?.id !== prevMessage?.author?.id\n const nextMessageDifferentAuthor = message.author?.id !== nextMessage?.author?.id\n const prevMessageMoreThan5Minutes =\n prevMessage &&\n new Date(message.createdAt).getTime() - new Date(prevMessage.createdAt).getTime() > 60000 * 5\n const nextMessageMoreThan5Minutes =\n nextMessage &&\n new Date(nextMessage.createdAt).getTime() - new Date(message.createdAt).getTime() > 60000 * 5\n\n if (message.mine && !encounteredOneOfMyMessages) {\n encounteredOneOfMyMessages = true\n message.myLatestInConversation = true\n } else {\n message.myLatestInConversation = false\n }\n message.lastInGroup = !nextMessage || nextMessageDifferentAuthor || nextMessageMoreThan5Minutes\n message.renderAuthor =\n !message.mine && (!prevMessage || prevMessageDifferentAuthor || prevMessageMoreThan5Minutes)\n\n enrichedMessages.push(message)\n if (!prevMessage || date !== moment(prevMessage.createdAt).format('YYYY-MM-DD')) {\n enrichedMessages.push({ type: 'DateSeparator', id: `day-divider-${message.id}`, date })\n }\n })\n\n return enrichedMessages\n}\ninterface ConversationScreenTitleProps extends HeaderTitleProps {\n conversation_id: number\n badge?: ConversationBadgeResource\n deleted?: boolean\n}\n\nexport const ConversationScreenTitle = ({\n conversation_id,\n badge,\n children,\n style,\n deleted,\n}: ConversationScreenTitleProps) => {\n const styles = usePressableHeaderStyle()\n const navigation = useNavigation()\n const resourceType = badge?.pcoResourceType || ''\n const productName = badge?.appName\n const name = badge?.text || undefined\n\n return (\n <PlatformPressable\n accessibilityHint=\"Opens details about members and settings\"\n style={styles.container}\n onPress={() => {\n if (deleted) return\n\n navigation.navigate('ConversationDetails', { conversation_id })\n }}\n >\n <View style={styles.titleWrapper}>\n <HeaderTitle maxFontSizeMultiplier={1} style={style}>\n {children}\n </HeaderTitle>\n {!deleted && <Icon name=\"general.downChevron\" size={12} />}\n </View>\n <Badge\n variant=\"metaSubtle\"\n productLogoName={productName}\n label={resourceType}\n metaLabel={name}\n style={styles.badge}\n maxFontSizeMultiplier={1}\n />\n </PlatformPressable>\n )\n}\n\nconst usePressableHeaderStyle = () => {\n return StyleSheet.create({\n container: {\n alignItems: Platform.select({ android: 'flex-start', default: 'center' }),\n marginRight: Platform.select({ ios: 20, default: 16 }),\n },\n titleWrapper: {\n alignItems: 'center',\n columnGap: 4,\n flexDirection: 'row',\n flexShrink: 1,\n },\n badge: {\n alignSelf: Platform.select({ android: 'flex-start', default: 'center' }),\n marginTop: 2,\n },\n })\n}\n\nconst useStyles = () => {\n const navigationTheme = useNavigationTheme()\n const { bottom } = useSafeAreaInsets()\n\n return StyleSheet.create({\n container: {\n flex: 1,\n justifyContent: 'center',\n backgroundColor: navigationTheme.colors.card,\n paddingBottom: bottom,\n },\n listContainer: {\n paddingVertical: 12,\n },\n listHeader: {\n // Just whitespace to provide space where the typing indicator can be\n height: 16,\n },\n })\n}\n\n/**\n * useEnsureConversationsRouteExists\n */\nconst useEnsureConversationsRouteExists = () => {\n const navigation = useNavigation()\n const { params } = useRoute<RouteProp<ConversationScreenProps['route']>>()\n\n useEffect(() => {\n const navigationState = navigation.getState()\n const routes = navigationState?.routes || []\n const conversationsRoute = routes.find(r => r.name === 'Conversations')\n\n if (conversationsRoute) return\n\n navigation.dispatch(state => {\n return CommonActions.reset({\n ...state,\n routes: [\n { name: 'Conversations', params: { chat_group_graph_id: params?.chat_group_graph_id } },\n ...routes,\n ],\n index: state.index + 1,\n })\n })\n }, [navigation, params?.chat_group_graph_id])\n}\n"]}
|
|
1
|
+
{"version":3,"file":"conversation_screen.js","sourceRoot":"","sources":["../../src/screens/conversation_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,8BAA8B,CAAA;AACjE,OAAO,EAAE,WAAW,EAAoB,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC7F,OAAO,EACL,aAAa,EAGb,aAAa,EACb,QAAQ,IAAI,kBAAkB,EAC9B,QAAQ,GACT,MAAM,0BAA0B,CAAA;AACjC,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACvE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,GAC5B,MAAM,qDAAqD,CAAA;AAC5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,2DAA2D,CAAA;AACvG,OAAO,UAAU,MAAM,+CAA+C,CAAA;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAA;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAA;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAA;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,o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,EAAE,mBAAmB,EAAE,MAAM,EAAE,mBAAmB,EAAE,EAAE;oBACvF,GAAG,MAAM;iBACV;gBACD,KAAK,EAAE,KAAK,CAAC,KAAK,GAAG,CAAC;aACvB,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAAA;AAC/C,CAAC,CAAA","sourcesContent":["import { date as formatDate } from '@planningcenter/datetime-fmt'\nimport { HeaderTitle, HeaderTitleProps, PlatformPressable } from '@react-navigation/elements'\nimport {\n CommonActions,\n RouteProp,\n StaticScreenProps,\n useNavigation,\n useTheme as useNavigationTheme,\n useRoute,\n} from '@react-navigation/native'\nimport moment from 'moment'\nimport React, { useCallback, useEffect, useRef, useState } from 'react'\nimport { FlatList, Platform, StyleSheet, View } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { Badge, Icon, Text } from '../components'\nimport {\n LeaderDisabledRepliesBanner,\n MemberDisabledRepliesBanner,\n} from '../components/conversation/disabled_replies_banners'\nimport { EmptyConversationBlankState } from '../components/conversation/empty_conversation_blank_state'\nimport BlankState from '../components/primitive/blank_state_primitive'\nimport { Message } from '../components/conversation/message'\nimport { MessageForm } from '../components/conversation/message_form'\nimport { TypingIndicator } from '../components/conversation/typing_indicator'\nimport { KeyboardView } from '../components/display/keyboard_view'\nimport { useTheme } from '../hooks'\nimport { useConversation } from '../hooks/use_conversation'\nimport { useConversationMessages } from '../hooks/use_conversation_messages'\nimport { useConversationMessagesJoltEvents } from '../hooks/use_conversation_messages_jolt_events'\nimport { MessageResource } from '../types'\nimport { ConversationBadgeResource } from '../types/resources/conversation_badge'\nimport { getRelativeDateStatus } from '../utils/date'\nimport { useMarkLatestMessageRead } from '../hooks/use_mark_latest_message_read'\nimport { CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL } from '../utils/styles'\nimport { useConversationJoltEvents } from '../hooks/use_conversation_jolt_events'\nimport { JumpToBottomButton } from '../components/conversation/jump_to_bottom_button'\n\nexport type ConversationRouteProps = {\n conversation_id: number\n reply_root_id?: string\n replyRootAuthor?: string\n chat_group_graph_id?: string\n clear_input?: boolean\n editing_message_id?: number | null\n title?: string\n subtitle?: string\n badge?: ConversationBadgeResource\n deleted?: boolean\n}\n\nexport type ConversationScreenProps = StaticScreenProps<ConversationRouteProps>\n\nexport function ConversationScreen({ route }: ConversationScreenProps) {\n const styles = useStyles()\n const navigation = useNavigation()\n const { conversation_id, editing_message_id, reply_root_id } = route.params\n const { data: conversation } = useConversation(route.params)\n const { messages, refetch, isRefetching, fetchNextPage } = useConversationMessages({\n conversation_id,\n reply_root_id,\n })\n useConversationJoltEvents({ conversationId: conversation_id })\n useConversationMessagesJoltEvents({ conversationId: conversation_id })\n useEnsureConversationsRouteExists()\n useMarkLatestMessageRead({ conversation, messages })\n const messagesWithSeparators = groupMessages({ ms: messages, inReplyScreen: !!reply_root_id })\n const noMessages = messagesWithSeparators.length === 0\n\n const { repliesDisabled, memberAbility, badges, title } = conversation\n const canReply = memberAbility?.canReply\n const showLeaderDisabledReplyBanner = canReply && repliesDisabled\n const canDeleteNonAuthoredMessages = memberAbility?.canDeleteNonAuthoredMessages ?? false\n const currentlyEditingMessage = messages.find(m => String(m.id) === String(editing_message_id))\n\n const listRef = useRef<FlatList>(null)\n const [showJumpToBottomButton, setShowJumpToBottomButton] = useState(false)\n\n const trackScroll = (event: any) => {\n const offsetY = event.nativeEvent.contentOffset.y\n setShowJumpToBottomButton(offsetY > 200)\n }\n\n const handleReturnToBottom = useCallback(() => {\n listRef.current?.scrollToOffset({\n offset: 0,\n })\n }, [])\n\n useEffect(() => {\n if (reply_root_id) return\n\n navigation.setParams({\n title: title,\n badge: badges?.[0],\n deleted: conversation?.deleted,\n })\n }, [navigation, title, badges, conversation?.deleted, reply_root_id])\n\n if (!conversation || conversation.deleted) {\n return (\n <View style={styles.container}>\n <BlankState.Root>\n <BlankState.Imagery name=\"general.outlinedTextMessage\" />\n <BlankState.Content>\n <BlankState.Heading>This conversation has been deleted</BlankState.Heading>\n </BlankState.Content>\n <BlankState.Button\n onPress={navigation.goBack}\n title=\"Back to conversations\"\n accessibilityHint=\"Navigates back to the conversations list\"\n accessibilityRole=\"link\"\n />\n </BlankState.Root>\n </View>\n )\n }\n\n return (\n <View style={styles.container}>\n <KeyboardView>\n {noMessages ? (\n <EmptyConversationBlankState />\n ) : (\n <FlatList\n inverted\n ref={listRef}\n contentContainerStyle={styles.listContainer}\n refreshing={isRefetching}\n onRefresh={refetch}\n data={messagesWithSeparators}\n keyExtractor={item => item.id}\n onScroll={trackScroll}\n scrollEventThrottle={10}\n renderItem={({ item }) => {\n if (item.type === 'DateSeparator') {\n return <InlineDateSeparator {...item} />\n }\n\n return (\n <Message\n {...item}\n canDeleteNonAuthoredMessages={canDeleteNonAuthoredMessages}\n conversation_id={conversation_id}\n latestReadMessageSortKey={conversation?.latestReadMessageSortKey}\n inReplyScreen={!!reply_root_id}\n />\n )\n }}\n onEndReached={() => fetchNextPage()}\n ListHeaderComponent={<View style={styles.listHeader} />}\n />\n )}\n <JumpToBottomButton onPress={handleReturnToBottom} visible={showJumpToBottomButton} />\n {!noMessages && <TypingIndicator conversationId={conversation_id} />}\n {showLeaderDisabledReplyBanner && <LeaderDisabledRepliesBanner />}\n {canReply ? (\n <MessageForm.Root\n conversation={conversation}\n replyRootId={reply_root_id}\n currentlyEditingMessage={currentlyEditingMessage}\n // We use a separate key so that it remounts component when switching between new\n // and edit message. This simplifies internal state handling.\n key={\n currentlyEditingMessage\n ? `edit-message-form-${currentlyEditingMessage.id}`\n : 'new-message-form'\n }\n >\n <MessageForm.AttachmentPicker />\n <MessageForm.Commands />\n <MessageForm.TextInput />\n <MessageForm.SubmitButton />\n </MessageForm.Root>\n ) : (\n <MemberDisabledRepliesBanner />\n )}\n </KeyboardView>\n </View>\n )\n}\n\nexport type DateSeparator = { type: 'DateSeparator'; id: string; date: string }\n\nfunction InlineDateSeparator({ date }: DateSeparator) {\n const styles = useDateSeparatorStyles()\n const { isThisYear } = getRelativeDateStatus(date)\n const showYear = !isThisYear\n const dateStamp = formatDate(date, { style: 'long', year: showYear })\n\n return (\n <View style={styles.container}>\n <View style={styles.separator} />\n <Text variant=\"footnote\" style={styles.dateText}>\n {dateStamp}\n </Text>\n <View style={styles.separator} />\n </View>\n )\n}\n\nconst useDateSeparatorStyles = () => {\n const theme = useTheme()\n return StyleSheet.create({\n container: {\n alignItems: 'center',\n flexDirection: 'row',\n paddingHorizontal: CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL,\n paddingVertical: 16,\n },\n separator: {\n flex: 1,\n height: 1,\n borderTopWidth: 1,\n borderTopColor: theme.colors.borderColorDefaultBase,\n },\n dateText: {\n paddingHorizontal: 8,\n },\n })\n}\n\ninterface GroupMessagesProps {\n ms: MessageResource[]\n inReplyScreen?: boolean\n}\n\nexport const groupMessages = ({ ms, inReplyScreen }: GroupMessagesProps) => {\n let enrichedMessages: (MessageResource | DateSeparator)[] = []\n let encounteredOneOfMyMessages = false\n\n ms.forEach((message, i) => {\n const prevMessage = ms[i + 1]\n const nextMessage = ms[i - 1]\n const date = moment(message.createdAt).format('YYYY-MM-DD')\n const inThread = message.replyRootId !== null\n const threadRoot = message.replyRootId === message.id\n const prevMessageDifferentThread = message.replyRootId !== prevMessage?.replyRootId\n const nextMessageDifferentThread = message.replyRootId !== nextMessage?.replyRootId\n const prevMessageDifferentAuthor = message.author?.id !== prevMessage?.author?.id\n const nextMessageDifferentAuthor = message.author?.id !== nextMessage?.author?.id\n const prevMessageMoreThan5Minutes =\n prevMessage &&\n new Date(message.createdAt).getTime() - new Date(prevMessage.createdAt).getTime() > 60000 * 5\n const nextMessageMoreThan5Minutes =\n nextMessage &&\n new Date(nextMessage.createdAt).getTime() - new Date(message.createdAt).getTime() > 60000 * 5\n const nextMessageIsDateSeparator =\n nextMessage && date !== moment(nextMessage.createdAt).format('YYYY-MM-DD')\n\n if (message.mine && !encounteredOneOfMyMessages) {\n encounteredOneOfMyMessages = true\n message.myLatestInConversation = true\n } else {\n message.myLatestInConversation = false\n }\n message.lastInGroup = !nextMessage || nextMessageDifferentAuthor || nextMessageMoreThan5Minutes\n message.renderAuthor =\n !message.mine && (!prevMessage || prevMessageDifferentAuthor || prevMessageMoreThan5Minutes)\n message.threadPosition = null\n\n if (!inReplyScreen && inThread) {\n message.prevIsMyReply = prevMessage?.mine\n message.nextIsMyReply = nextMessage?.mine\n\n const firstInThread = threadRoot\n const lastInThread = nextMessageDifferentThread || nextMessageIsDateSeparator\n\n if (firstInThread && lastInThread)\n message.threadPosition = null // ensures we don't render a connector for root replies that aren't immediately followed up a reply\n else if (firstInThread) message.threadPosition = 'first'\n else if (lastInThread) message.threadPosition = 'last'\n else if (!prevMessageDifferentThread && !nextMessageDifferentThread)\n message.threadPosition = 'center'\n }\n\n enrichedMessages.push(message)\n if (!prevMessage || date !== moment(prevMessage.createdAt).format('YYYY-MM-DD')) {\n enrichedMessages.push({ type: 'DateSeparator', id: `day-divider-${message.id}`, date })\n }\n })\n\n return enrichedMessages\n}\ninterface ConversationScreenTitleProps extends HeaderTitleProps {\n conversation_id: number\n badge?: ConversationBadgeResource\n deleted?: boolean\n}\n\nexport const ConversationScreenTitle = ({\n conversation_id,\n badge,\n children,\n style,\n deleted,\n}: ConversationScreenTitleProps) => {\n const styles = usePressableHeaderStyle()\n const navigation = useNavigation()\n const resourceType = badge?.pcoResourceType || ''\n const productName = badge?.appName\n const name = badge?.text || undefined\n\n return (\n <PlatformPressable\n accessibilityHint=\"Opens details about members and settings\"\n style={styles.container}\n onPress={() => {\n if (deleted) return\n\n navigation.navigate('ConversationDetails', { conversation_id })\n }}\n >\n <View style={styles.titleWrapper}>\n <HeaderTitle maxFontSizeMultiplier={1} style={style}>\n {children}\n </HeaderTitle>\n {!deleted && <Icon name=\"general.downChevron\" size={12} />}\n </View>\n <Badge\n variant=\"metaSubtle\"\n productLogoName={productName}\n label={resourceType}\n metaLabel={name}\n style={styles.badge}\n maxFontSizeMultiplier={1}\n />\n </PlatformPressable>\n )\n}\n\nconst usePressableHeaderStyle = () => {\n return StyleSheet.create({\n container: {\n alignItems: Platform.select({ android: 'flex-start', default: 'center' }),\n marginRight: Platform.select({ ios: 20, default: 16 }),\n },\n titleWrapper: {\n alignItems: 'center',\n columnGap: 4,\n flexDirection: 'row',\n flexShrink: 1,\n },\n badge: {\n alignSelf: Platform.select({ android: 'flex-start', default: 'center' }),\n marginTop: 2,\n },\n })\n}\n\nconst useStyles = () => {\n const navigationTheme = useNavigationTheme()\n const { bottom } = useSafeAreaInsets()\n\n return StyleSheet.create({\n container: {\n flex: 1,\n justifyContent: 'center',\n backgroundColor: navigationTheme.colors.card,\n paddingBottom: bottom,\n },\n listContainer: {\n paddingVertical: 12,\n },\n listHeader: {\n // Just whitespace to provide space where the typing indicator can be\n height: 16,\n },\n })\n}\n\n/**\n * useEnsureConversationsRouteExists\n */\nconst useEnsureConversationsRouteExists = () => {\n const navigation = useNavigation()\n const { params } = useRoute<RouteProp<ConversationScreenProps['route']>>()\n\n useEffect(() => {\n const navigationState = navigation.getState()\n const routes = navigationState?.routes || []\n const conversationsRoute = routes.find(r => r.name === 'Conversations')\n\n if (conversationsRoute) return\n\n navigation.dispatch(state => {\n return CommonActions.reset({\n ...state,\n routes: [\n { name: 'Conversations', params: { chat_group_graph_id: params?.chat_group_graph_id } },\n ...routes,\n ],\n index: state.index + 1,\n })\n })\n }, [navigation, params?.chat_group_graph_id])\n}\n"]}
|
|
@@ -20,6 +20,9 @@ export interface MessageResource {
|
|
|
20
20
|
renderTime?: boolean;
|
|
21
21
|
myLatestInConversation?: boolean;
|
|
22
22
|
lastInGroup?: boolean;
|
|
23
|
+
threadPosition?: 'first' | 'center' | 'last' | null;
|
|
24
|
+
prevIsMyReply?: boolean;
|
|
25
|
+
nextIsMyReply?: boolean;
|
|
23
26
|
pending?: boolean;
|
|
24
27
|
error?: string;
|
|
25
28
|
attachmentsForCreate?: DenormalizedAttachmentResourceForCreate[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/types/resources/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,oCAAoC,CAAA;AACnF,OAAO,EAAE,uCAAuC,EAAE,MAAM,+CAA+C,CAAA;AACvG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAEvD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,SAAS,CAAA;IACf,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,IAAI,EAAE,OAAO,CAAA;IACb,WAAW,EAAE,8BAA8B,EAAE,CAAA;IAC7C,MAAM,EAAE,cAAc,CAAA;IACtB,cAAc,EAAE,qBAAqB,EAAE,CAAA;IACvC,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAG3B,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC,WAAW,CAAC,EAAE,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/types/resources/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,oCAAoC,CAAA;AACnF,OAAO,EAAE,uCAAuC,EAAE,MAAM,+CAA+C,CAAA;AACvG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAEvD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,SAAS,CAAA;IACf,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,IAAI,EAAE,OAAO,CAAA;IACb,WAAW,EAAE,8BAA8B,EAAE,CAAA;IAC7C,MAAM,EAAE,cAAc,CAAA;IACtB,cAAc,EAAE,qBAAqB,EAAE,CAAA;IACvC,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAG3B,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,cAAc,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,IAAI,CAAA;IACnD,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,aAAa,CAAC,EAAE,OAAO,CAAA;IAGvB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,oBAAoB,CAAC,EAAE,uCAAuC,EAAE,CAAA;CACjE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../../src/types/resources/message.ts"],"names":[],"mappings":"","sourcesContent":["import { DenormalizedAttachmentResource } from './denormalized_attachment_resource'\nimport { DenormalizedAttachmentResourceForCreate } from './denormalized_attachment_resource_for_create'\nimport type { PersonResource } from './person'\nimport type { ReactionCountResource } from './reaction'\n\nexport interface MessageResource {\n type: 'Message'\n id: string\n text: string | null\n html: string\n createdAt: string\n deletedAt: string | null\n textEditedAt: string | null\n mine: boolean\n attachments: DenormalizedAttachmentResource[]\n author: PersonResource\n reactionCounts: ReactionCountResource[]\n replyCount: number\n replyRootId?: string | null\n\n // Custom Local Properties we set for rendering\n renderAuthor?: boolean\n renderTime?: boolean\n myLatestInConversation?: boolean\n lastInGroup?: boolean\n\n // Properties for mutation state\n pending?: boolean // Indicates if the message is optimistically created and pending server response\n error?: string // Error message if the message failed to send\n attachmentsForCreate?: DenormalizedAttachmentResourceForCreate[]\n}\n"]}
|
|
1
|
+
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../../src/types/resources/message.ts"],"names":[],"mappings":"","sourcesContent":["import { DenormalizedAttachmentResource } from './denormalized_attachment_resource'\nimport { DenormalizedAttachmentResourceForCreate } from './denormalized_attachment_resource_for_create'\nimport type { PersonResource } from './person'\nimport type { ReactionCountResource } from './reaction'\n\nexport interface MessageResource {\n type: 'Message'\n id: string\n text: string | null\n html: string\n createdAt: string\n deletedAt: string | null\n textEditedAt: string | null\n mine: boolean\n attachments: DenormalizedAttachmentResource[]\n author: PersonResource\n reactionCounts: ReactionCountResource[]\n replyCount: number\n replyRootId?: string | null\n\n // Custom Local Properties we set for rendering\n renderAuthor?: boolean\n renderTime?: boolean\n myLatestInConversation?: boolean\n lastInGroup?: boolean\n threadPosition?: 'first' | 'center' | 'last' | null\n prevIsMyReply?: boolean\n nextIsMyReply?: boolean\n\n // Properties for mutation state\n pending?: boolean // Indicates if the message is optimistically created and pending server response\n error?: string // Error message if the message failed to send\n attachmentsForCreate?: DenormalizedAttachmentResourceForCreate[]\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/chat-react-native",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.17.0-rc.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"react-native-url-polyfill": "^2.0.0",
|
|
57
57
|
"typescript": "<5.6.0"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "b5fc3670444218677c0c4cbcb92ca45877d0a71a"
|
|
60
60
|
}
|
|
@@ -21,38 +21,34 @@ export function TheirReplyConnector({ message, messageBubbleHeight }: ReplyConne
|
|
|
21
21
|
|
|
22
22
|
if (!REPLIES_FEATURE_ENABLED) return null
|
|
23
23
|
|
|
24
|
-
// TODO: Need to remove, just adding this to remove the lint warning about message being unused
|
|
25
|
-
console.log('message', message)
|
|
26
|
-
|
|
27
24
|
const connectorMap: Record<string, React.ReactNode | null> = {
|
|
28
25
|
shortTailCurve: <ShortTailCurveConnector height={messageBubbleHeight / 2} />,
|
|
26
|
+
shortHeadCurve: <ShortHeadCurveConnector height={messageBubbleHeight / 2} />,
|
|
29
27
|
verticalLine: <VerticalLineConnector />,
|
|
30
28
|
default: null,
|
|
31
29
|
}
|
|
32
30
|
|
|
33
|
-
// TODO: Currently using fake message attributes. Will need to refactor once we have the message reply logic in place.
|
|
34
31
|
const getConnectorKey = () => {
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
const { threadPosition, renderAuthor } = message
|
|
33
|
+
|
|
34
|
+
if (threadPosition === 'first' && !renderAuthor) return 'shortHeadCurve'
|
|
35
|
+
if (threadPosition === 'last' && !renderAuthor) return 'shortTailCurve'
|
|
36
|
+
if ((threadPosition === 'first' && renderAuthor) || threadPosition === 'center')
|
|
37
|
+
return 'verticalLine'
|
|
37
38
|
return 'default'
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
const ConnectorComponent = connectorMap[getConnectorKey()]
|
|
41
|
-
|
|
42
42
|
if (!ConnectorComponent) return null
|
|
43
43
|
|
|
44
44
|
return <View style={styles.theirReplyConnectorContainer}>{ConnectorComponent}</View>
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
// TODO: Refactor how we choose the correct connector once we have the logic in place
|
|
48
47
|
export function MyReplyConnector({ message, messageBubbleHeight }: ReplyConnectorProps) {
|
|
49
48
|
const styles = useStyles()
|
|
50
49
|
|
|
51
50
|
if (!REPLIES_FEATURE_ENABLED) return null
|
|
52
51
|
|
|
53
|
-
// TODO: Need to remove, just adding this to remove the lint warning about message being unused
|
|
54
|
-
console.log('message', message)
|
|
55
|
-
|
|
56
52
|
const connectorMap: Record<string, React.ReactNode | null> = {
|
|
57
53
|
longTailCurve: (
|
|
58
54
|
<LongTailCurveConnector
|
|
@@ -71,17 +67,18 @@ export function MyReplyConnector({ message, messageBubbleHeight }: ReplyConnecto
|
|
|
71
67
|
default: null,
|
|
72
68
|
}
|
|
73
69
|
|
|
74
|
-
// TODO: Currently using fake message attributes. Will need to refactor once we have the message reply logic in place.
|
|
75
70
|
const getConnectorKey = () => {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
71
|
+
const { threadPosition, prevIsMyReply, nextIsMyReply } = message
|
|
72
|
+
|
|
73
|
+
if (threadPosition === 'first') return 'longHeadCurve'
|
|
74
|
+
if (threadPosition === 'center' && prevIsMyReply && nextIsMyReply) return 'verticalLine'
|
|
75
|
+
if (threadPosition === 'center' && (!prevIsMyReply || !nextIsMyReply)) return 'swirl'
|
|
76
|
+
if (threadPosition === 'last') return 'longTailCurve'
|
|
77
|
+
|
|
80
78
|
return 'default'
|
|
81
79
|
}
|
|
82
80
|
|
|
83
81
|
const ConnectorComponent = connectorMap[getConnectorKey()]
|
|
84
|
-
|
|
85
82
|
if (!ConnectorComponent) return null
|
|
86
83
|
|
|
87
84
|
return <View style={styles.myReplyConnectorContainer}>{ConnectorComponent}</View>
|
|
@@ -102,6 +99,11 @@ function LongTailCurveConnector({ height, style }: { height: number; style?: Vie
|
|
|
102
99
|
return <View style={[styles.longTailCurveConnector, { height }, style]} />
|
|
103
100
|
}
|
|
104
101
|
|
|
102
|
+
function ShortHeadCurveConnector({ height }: { height: number }) {
|
|
103
|
+
const styles = useStyles()
|
|
104
|
+
return <View style={[styles.shortHeadCurveConnector, { marginTop: height }]} />
|
|
105
|
+
}
|
|
106
|
+
|
|
105
107
|
function ShortTailCurveConnector({ height }: { height: number }) {
|
|
106
108
|
const styles = useStyles()
|
|
107
109
|
return <View style={[styles.shortTailCurveConnector, { height }]} />
|
|
@@ -167,6 +169,13 @@ const useStyles = () => {
|
|
|
167
169
|
borderBottomWidth: CONNECTOR_BORDER_WIDTH,
|
|
168
170
|
borderBottomLeftRadius: 16,
|
|
169
171
|
},
|
|
172
|
+
shortHeadCurveConnector: {
|
|
173
|
+
borderColor: borderColor,
|
|
174
|
+
borderLeftWidth: CONNECTOR_BORDER_WIDTH,
|
|
175
|
+
borderTopWidth: CONNECTOR_BORDER_WIDTH,
|
|
176
|
+
borderTopLeftRadius: 16,
|
|
177
|
+
flex: 1,
|
|
178
|
+
},
|
|
170
179
|
shortTailCurveConnector: {
|
|
171
180
|
borderColor: borderColor,
|
|
172
181
|
borderLeftWidth: CONNECTOR_BORDER_WIDTH,
|
|
@@ -63,7 +63,7 @@ export function ConversationScreen({ route }: ConversationScreenProps) {
|
|
|
63
63
|
useConversationMessagesJoltEvents({ conversationId: conversation_id })
|
|
64
64
|
useEnsureConversationsRouteExists()
|
|
65
65
|
useMarkLatestMessageRead({ conversation, messages })
|
|
66
|
-
const messagesWithSeparators = groupMessages(messages)
|
|
66
|
+
const messagesWithSeparators = groupMessages({ ms: messages, inReplyScreen: !!reply_root_id })
|
|
67
67
|
const noMessages = messagesWithSeparators.length === 0
|
|
68
68
|
|
|
69
69
|
const { repliesDisabled, memberAbility, badges, title } = conversation
|
|
@@ -219,7 +219,12 @@ const useDateSeparatorStyles = () => {
|
|
|
219
219
|
})
|
|
220
220
|
}
|
|
221
221
|
|
|
222
|
-
|
|
222
|
+
interface GroupMessagesProps {
|
|
223
|
+
ms: MessageResource[]
|
|
224
|
+
inReplyScreen?: boolean
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export const groupMessages = ({ ms, inReplyScreen }: GroupMessagesProps) => {
|
|
223
228
|
let enrichedMessages: (MessageResource | DateSeparator)[] = []
|
|
224
229
|
let encounteredOneOfMyMessages = false
|
|
225
230
|
|
|
@@ -227,6 +232,10 @@ export const groupMessages = (ms: MessageResource[]) => {
|
|
|
227
232
|
const prevMessage = ms[i + 1]
|
|
228
233
|
const nextMessage = ms[i - 1]
|
|
229
234
|
const date = moment(message.createdAt).format('YYYY-MM-DD')
|
|
235
|
+
const inThread = message.replyRootId !== null
|
|
236
|
+
const threadRoot = message.replyRootId === message.id
|
|
237
|
+
const prevMessageDifferentThread = message.replyRootId !== prevMessage?.replyRootId
|
|
238
|
+
const nextMessageDifferentThread = message.replyRootId !== nextMessage?.replyRootId
|
|
230
239
|
const prevMessageDifferentAuthor = message.author?.id !== prevMessage?.author?.id
|
|
231
240
|
const nextMessageDifferentAuthor = message.author?.id !== nextMessage?.author?.id
|
|
232
241
|
const prevMessageMoreThan5Minutes =
|
|
@@ -235,6 +244,8 @@ export const groupMessages = (ms: MessageResource[]) => {
|
|
|
235
244
|
const nextMessageMoreThan5Minutes =
|
|
236
245
|
nextMessage &&
|
|
237
246
|
new Date(nextMessage.createdAt).getTime() - new Date(message.createdAt).getTime() > 60000 * 5
|
|
247
|
+
const nextMessageIsDateSeparator =
|
|
248
|
+
nextMessage && date !== moment(nextMessage.createdAt).format('YYYY-MM-DD')
|
|
238
249
|
|
|
239
250
|
if (message.mine && !encounteredOneOfMyMessages) {
|
|
240
251
|
encounteredOneOfMyMessages = true
|
|
@@ -245,6 +256,22 @@ export const groupMessages = (ms: MessageResource[]) => {
|
|
|
245
256
|
message.lastInGroup = !nextMessage || nextMessageDifferentAuthor || nextMessageMoreThan5Minutes
|
|
246
257
|
message.renderAuthor =
|
|
247
258
|
!message.mine && (!prevMessage || prevMessageDifferentAuthor || prevMessageMoreThan5Minutes)
|
|
259
|
+
message.threadPosition = null
|
|
260
|
+
|
|
261
|
+
if (!inReplyScreen && inThread) {
|
|
262
|
+
message.prevIsMyReply = prevMessage?.mine
|
|
263
|
+
message.nextIsMyReply = nextMessage?.mine
|
|
264
|
+
|
|
265
|
+
const firstInThread = threadRoot
|
|
266
|
+
const lastInThread = nextMessageDifferentThread || nextMessageIsDateSeparator
|
|
267
|
+
|
|
268
|
+
if (firstInThread && lastInThread)
|
|
269
|
+
message.threadPosition = null // ensures we don't render a connector for root replies that aren't immediately followed up a reply
|
|
270
|
+
else if (firstInThread) message.threadPosition = 'first'
|
|
271
|
+
else if (lastInThread) message.threadPosition = 'last'
|
|
272
|
+
else if (!prevMessageDifferentThread && !nextMessageDifferentThread)
|
|
273
|
+
message.threadPosition = 'center'
|
|
274
|
+
}
|
|
248
275
|
|
|
249
276
|
enrichedMessages.push(message)
|
|
250
277
|
if (!prevMessage || date !== moment(prevMessage.createdAt).format('YYYY-MM-DD')) {
|
|
@@ -23,6 +23,9 @@ export interface MessageResource {
|
|
|
23
23
|
renderTime?: boolean
|
|
24
24
|
myLatestInConversation?: boolean
|
|
25
25
|
lastInGroup?: boolean
|
|
26
|
+
threadPosition?: 'first' | 'center' | 'last' | null
|
|
27
|
+
prevIsMyReply?: boolean
|
|
28
|
+
nextIsMyReply?: boolean
|
|
26
29
|
|
|
27
30
|
// Properties for mutation state
|
|
28
31
|
pending?: boolean // Indicates if the message is optimistically created and pending server response
|