@planningcenter/chat-react-native 3.2.0-rc.0 → 3.2.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/display/index.d.ts +1 -0
- package/build/components/display/index.d.ts.map +1 -1
- package/build/components/display/index.js +1 -0
- package/build/components/display/index.js.map +1 -1
- package/build/components/display/toggle_button.d.ts +42 -0
- package/build/components/display/toggle_button.d.ts.map +1 -0
- package/build/components/display/toggle_button.js +67 -0
- package/build/components/display/toggle_button.js.map +1 -0
- package/build/navigation/index.d.ts +1 -1
- package/build/navigation/index.d.ts.map +1 -1
- package/build/navigation/index.js +1 -1
- package/build/navigation/index.js.map +1 -1
- package/build/screens/conversations/components/chat_group_badge.d.ts +3 -0
- package/build/screens/conversations/components/chat_group_badge.d.ts.map +1 -0
- package/build/screens/conversations/components/chat_group_badge.js +40 -0
- package/build/screens/conversations/components/chat_group_badge.js.map +1 -0
- package/build/screens/conversations/components/list_header_component.d.ts +3 -0
- package/build/screens/conversations/components/list_header_component.d.ts.map +1 -0
- package/build/screens/conversations/components/list_header_component.js +88 -0
- package/build/screens/conversations/components/list_header_component.js.map +1 -0
- package/build/screens/{conversations_screen.d.ts → conversations/conversations_screen.d.ts} +1 -1
- package/build/screens/conversations/conversations_screen.d.ts.map +1 -0
- package/build/screens/conversations/conversations_screen.js +35 -0
- package/build/screens/conversations/conversations_screen.js.map +1 -0
- package/build/screens/design_system_screen.d.ts.map +1 -1
- package/build/screens/design_system_screen.js +9 -1
- package/build/screens/design_system_screen.js.map +1 -1
- package/package.json +2 -2
- package/src/components/display/index.ts +1 -0
- package/src/components/display/toggle_button.tsx +157 -0
- package/src/navigation/index.tsx +1 -1
- package/src/screens/conversations/components/chat_group_badge.tsx +47 -0
- package/src/screens/conversations/components/list_header_component.tsx +125 -0
- package/src/screens/conversations/conversations_screen.tsx +56 -0
- package/src/screens/design_system_screen.tsx +28 -0
- package/build/screens/conversations_screen.d.ts.map +0 -1
- package/build/screens/conversations_screen.js +0 -144
- package/build/screens/conversations_screen.js.map +0 -1
- package/src/screens/conversations_screen.tsx +0 -222
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/display/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,sBAAsB,CAAA;AACpC,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,QAAQ,CAAA;AACtB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA;AAC7B,cAAc,sBAAsB,CAAA;AACpC,cAAc,QAAQ,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/display/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,sBAAsB,CAAA;AACpC,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,QAAQ,CAAA;AACtB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA;AAC7B,cAAc,sBAAsB,CAAA;AACpC,cAAc,QAAQ,CAAA;AACtB,cAAc,iBAAiB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/display/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,sBAAsB,CAAA;AACpC,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,QAAQ,CAAA;AACtB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA;AAC7B,cAAc,sBAAsB,CAAA;AACpC,cAAc,QAAQ,CAAA","sourcesContent":["export * from './avatar_group'\nexport * from './avatar'\nexport * from './badge'\nexport * from './banner_collapsible'\nexport * from './banner'\nexport * from './button'\nexport * from './child_notice'\nexport * from './heading'\nexport * from './icon_button'\nexport * from './icon'\nexport * from './image'\nexport * from './person'\nexport * from './spinner'\nexport * from './switch'\nexport * from './text_button'\nexport * from './text_inline_button'\nexport * from './text'\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/display/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,sBAAsB,CAAA;AACpC,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,QAAQ,CAAA;AACtB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA;AAC7B,cAAc,sBAAsB,CAAA;AACpC,cAAc,QAAQ,CAAA;AACtB,cAAc,iBAAiB,CAAA","sourcesContent":["export * from './avatar_group'\nexport * from './avatar'\nexport * from './badge'\nexport * from './banner_collapsible'\nexport * from './banner'\nexport * from './button'\nexport * from './child_notice'\nexport * from './heading'\nexport * from './icon_button'\nexport * from './icon'\nexport * from './image'\nexport * from './person'\nexport * from './spinner'\nexport * from './switch'\nexport * from './text_button'\nexport * from './text_inline_button'\nexport * from './text'\nexport * from './toggle_button'\n"]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { PressableProps } from 'react-native';
|
|
3
|
+
export interface ToggleButtonProps extends PressableProps {
|
|
4
|
+
/**
|
|
5
|
+
* Pressable container styles
|
|
6
|
+
*/
|
|
7
|
+
active: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Specifies whether fonts should be scaled down automatically to fit given style constraints.
|
|
10
|
+
*/
|
|
11
|
+
adjustsFontSizeToFit?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Specifies whether fonts should scale to respect the device's text size accessibility settings. The default is true.
|
|
14
|
+
*/
|
|
15
|
+
allowFontScaling?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Generates an icon to the left of the button text
|
|
18
|
+
*/
|
|
19
|
+
iconNameLeft?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Generates an icon to the right of the button text
|
|
22
|
+
*/
|
|
23
|
+
iconNameRight?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Specifies the maximum size a font can reach when allowFontScaling is enabled.
|
|
26
|
+
*/
|
|
27
|
+
maxFontSizeMultiplier?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Specifies smallest possible scale a font can reach when adjustsFontSizeToFit is enabled. (values 0.01-1.0).
|
|
30
|
+
*/
|
|
31
|
+
minimumFontScale?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Renders as text within the button
|
|
34
|
+
*/
|
|
35
|
+
title: string;
|
|
36
|
+
/**
|
|
37
|
+
* Pressable container styles
|
|
38
|
+
*/
|
|
39
|
+
style?: PressableProps['style'];
|
|
40
|
+
}
|
|
41
|
+
export declare function ToggleButton({ active, adjustsFontSizeToFit, allowFontScaling, iconNameLeft, iconNameRight, maxFontSizeMultiplier, minimumFontScale, title, style, ...props }: ToggleButtonProps): React.JSX.Element;
|
|
42
|
+
//# sourceMappingURL=toggle_button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toggle_button.d.ts","sourceRoot":"","sources":["../../../src/components/display/toggle_button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAYlD,MAAM,WAAW,iBAAkB,SAAQ,cAAc;IACvD;;OAEG;IACH,MAAM,EAAE,OAAO,CAAA;IACf;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;OAEG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,KAAK,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAA;CAChC;AAED,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,oBAA4B,EAC5B,gBAAuB,EACvB,YAAY,EACZ,aAAa,EACb,qBAAqB,EACrB,gBAAgB,EAChB,KAAK,EACL,KAAK,EACL,GAAG,KAAK,EACT,EAAE,iBAAiB,qBA+CnB"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { Pressable, StyleSheet } from 'react-native';
|
|
3
|
+
import { Text } from './text';
|
|
4
|
+
import { useTheme, useFontScale, useCreateAndroidRippleColor } from '../../hooks';
|
|
5
|
+
import { platformFontWeightBold, platformPressedOpacityStyle } from '../../utils';
|
|
6
|
+
import colorFunction from 'color';
|
|
7
|
+
import { Icon } from './icon';
|
|
8
|
+
import { tokens } from '../../vendor/tapestry/tokens';
|
|
9
|
+
export function ToggleButton({ active, adjustsFontSizeToFit = false, allowFontScaling = true, iconNameLeft, iconNameRight, maxFontSizeMultiplier, minimumFontScale, title, style, ...props }) {
|
|
10
|
+
const styles = useStyles({ active, maxFontSizeMultiplier });
|
|
11
|
+
const { colors } = useTheme();
|
|
12
|
+
const overrideStyles = StyleSheet.flatten(style); // Ensures the pressed styles still get applied
|
|
13
|
+
const baseRippleColor = active ? colors.interaction : colors.fillColorNeutral050Base;
|
|
14
|
+
const androidRippleColor = useCreateAndroidRippleColor({ color: baseRippleColor });
|
|
15
|
+
return (<Pressable style={({ pressed }) => ({
|
|
16
|
+
...styles.pressable,
|
|
17
|
+
...(pressed ? platformPressedOpacityStyle : null),
|
|
18
|
+
...overrideStyles,
|
|
19
|
+
})} accessibilityRole="togglebutton" accessibilityState={{ checked: active }} android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }} {...props}>
|
|
20
|
+
{iconNameLeft && (<Icon name={iconNameLeft} style={styles.icon} maxFontSizeMultiplier={maxFontSizeMultiplier}/>)}
|
|
21
|
+
<Text allowFontScaling={allowFontScaling} minimumFontScale={minimumFontScale} maxFontSizeMultiplier={maxFontSizeMultiplier} adjustsFontSizeToFit={adjustsFontSizeToFit} numberOfLines={1} style={styles.text} variant="tertiary">
|
|
22
|
+
{title}
|
|
23
|
+
</Text>
|
|
24
|
+
{iconNameRight && (<Icon name={iconNameRight} style={styles.icon} maxFontSizeMultiplier={maxFontSizeMultiplier}/>)}
|
|
25
|
+
</Pressable>);
|
|
26
|
+
}
|
|
27
|
+
// =================================
|
|
28
|
+
// ====== Styles ===================
|
|
29
|
+
// =================================
|
|
30
|
+
const useStyles = ({ active, maxFontSizeMultiplier }) => {
|
|
31
|
+
const { colors, button } = useTheme();
|
|
32
|
+
const fontScale = useFontScale({ maxFontSizeMultiplier });
|
|
33
|
+
const activeBackgroundColor = useMemo(() => {
|
|
34
|
+
return colorFunction(colors.interaction)
|
|
35
|
+
.hsl()
|
|
36
|
+
.lightness(colors.name === 'dark' ? 12 : 92)
|
|
37
|
+
.string();
|
|
38
|
+
}, [colors.interaction, colors.name]);
|
|
39
|
+
const color = active ? colors.interaction : colors.textColorDefaultSecondary;
|
|
40
|
+
return StyleSheet.create({
|
|
41
|
+
pressable: {
|
|
42
|
+
borderRadius: button.borderRadius * fontScale,
|
|
43
|
+
borderWidth: 1,
|
|
44
|
+
borderColor: active ? colors.interaction : colors.borderColorDefaultBase,
|
|
45
|
+
backgroundColor: active ? activeBackgroundColor : 'transparent',
|
|
46
|
+
paddingHorizontal: 16 * fontScale,
|
|
47
|
+
flexDirection: 'row',
|
|
48
|
+
alignItems: 'center',
|
|
49
|
+
justifyContent: 'center',
|
|
50
|
+
height: 32 * fontScale,
|
|
51
|
+
gap: 6 * fontScale,
|
|
52
|
+
overflow: 'hidden',
|
|
53
|
+
},
|
|
54
|
+
text: {
|
|
55
|
+
textAlign: 'center',
|
|
56
|
+
textAlignVertical: 'center',
|
|
57
|
+
includeFontPadding: false,
|
|
58
|
+
fontWeight: platformFontWeightBold,
|
|
59
|
+
color,
|
|
60
|
+
},
|
|
61
|
+
icon: {
|
|
62
|
+
fontSize: tokens.fontSizeSm * fontScale,
|
|
63
|
+
color,
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=toggle_button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toggle_button.js","sourceRoot":"","sources":["../../../src/components/display/toggle_button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEpD,OAAO,EA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OAAO,aAAa,CAAC,MAAM,CAAC,WAAW,CAAC;aACrC,GAAG,EAAE;aACL,SAAS,CAAC,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC3C,MAAM,EAAE,CAAA;IACb,CAAC,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAA;IAErC,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,yBAAyB,CAAA;IAE5E,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE;YACT,YAAY,EAAE,MAAM,CAAC,YAAY,GAAG,SAAS;YAC7C,WAAW,EAAE,CAAC;YACd,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,sBAAsB;YACxE,eAAe,EAAE,MAAM,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,aAAa;YAC/D,iBAAiB,EAAE,EAAE,GAAG,SAAS;YACjC,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,QAAQ;YACxB,MAAM,EAAE,EAAE,GAAG,SAAS;YACtB,GAAG,EAAE,CAAC,GAAG,SAAS;YAClB,QAAQ,EAAE,QAAQ;SACnB;QACD,IAAI,EAAE;YACJ,SAAS,EAAE,QAAQ;YACnB,iBAAiB,EAAE,QAAQ;YAC3B,kBAAkB,EAAE,KAAK;YACzB,UAAU,EAAE,sBAAsB;YAClC,KAAK;SACN;QACD,IAAI,EAAE;YACJ,QAAQ,EAAE,MAAM,CAAC,UAAU,GAAG,SAAS;YACvC,KAAK;SACN;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React, { useMemo } from 'react'\nimport { Pressable, StyleSheet } from 'react-native'\nimport type { PressableProps } from 'react-native'\nimport { Text } from './text'\nimport { useTheme, useFontScale, useCreateAndroidRippleColor } from '../../hooks'\nimport { platformFontWeightBold, platformPressedOpacityStyle } from '../../utils'\nimport colorFunction from 'color'\nimport { Icon } from './icon'\nimport { tokens } from '../../vendor/tapestry/tokens'\n\n// =================================\n// ====== Component ================\n// =================================\n\nexport interface ToggleButtonProps extends PressableProps {\n /**\n * Pressable container styles\n */\n active: boolean\n /**\n * Specifies whether fonts should be scaled down automatically to fit given style constraints.\n */\n adjustsFontSizeToFit?: boolean\n /**\n * Specifies whether fonts should scale to respect the device's text size accessibility settings. The default is true.\n */\n allowFontScaling?: boolean\n /**\n * Generates an icon to the left of the button text\n */\n iconNameLeft?: string\n /**\n * Generates an icon to the right of the button text\n */\n iconNameRight?: string\n /**\n * Specifies the maximum size a font can reach when allowFontScaling is enabled.\n */\n maxFontSizeMultiplier?: number\n /**\n * Specifies smallest possible scale a font can reach when adjustsFontSizeToFit is enabled. (values 0.01-1.0).\n */\n minimumFontScale?: number\n /**\n * Renders as text within the button\n */\n title: string\n /**\n * Pressable container styles\n */\n style?: PressableProps['style']\n}\n\nexport function ToggleButton({\n active,\n adjustsFontSizeToFit = false,\n allowFontScaling = true,\n iconNameLeft,\n iconNameRight,\n maxFontSizeMultiplier,\n minimumFontScale,\n title,\n style,\n ...props\n}: ToggleButtonProps) {\n const styles = useStyles({ active, maxFontSizeMultiplier })\n const { colors } = useTheme()\n const overrideStyles = StyleSheet.flatten(style) // Ensures the pressed styles still get applied\n\n const baseRippleColor = active ? colors.interaction : colors.fillColorNeutral050Base\n const androidRippleColor = useCreateAndroidRippleColor({ color: baseRippleColor })\n\n return (\n <Pressable\n style={({ pressed }) => ({\n ...styles.pressable,\n ...(pressed ? platformPressedOpacityStyle : null),\n ...overrideStyles,\n })}\n accessibilityRole=\"togglebutton\"\n accessibilityState={{ checked: active }}\n android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}\n {...props}\n >\n {iconNameLeft && (\n <Icon\n name={iconNameLeft}\n style={styles.icon}\n maxFontSizeMultiplier={maxFontSizeMultiplier}\n />\n )}\n <Text\n allowFontScaling={allowFontScaling}\n minimumFontScale={minimumFontScale}\n maxFontSizeMultiplier={maxFontSizeMultiplier}\n adjustsFontSizeToFit={adjustsFontSizeToFit}\n numberOfLines={1}\n style={styles.text}\n variant=\"tertiary\"\n >\n {title}\n </Text>\n {iconNameRight && (\n <Icon\n name={iconNameRight}\n style={styles.icon}\n maxFontSizeMultiplier={maxFontSizeMultiplier}\n />\n )}\n </Pressable>\n )\n}\n\n// =================================\n// ====== Styles ===================\n// =================================\n\nconst useStyles = ({ active, maxFontSizeMultiplier }: Partial<ToggleButtonProps>) => {\n const { colors, button } = useTheme()\n const fontScale = useFontScale({ maxFontSizeMultiplier })\n\n const activeBackgroundColor = useMemo(() => {\n return colorFunction(colors.interaction)\n .hsl()\n .lightness(colors.name === 'dark' ? 12 : 92)\n .string()\n }, [colors.interaction, colors.name])\n\n const color = active ? colors.interaction : colors.textColorDefaultSecondary\n\n return StyleSheet.create({\n pressable: {\n borderRadius: button.borderRadius * fontScale,\n borderWidth: 1,\n borderColor: active ? colors.interaction : colors.borderColorDefaultBase,\n backgroundColor: active ? activeBackgroundColor : 'transparent',\n paddingHorizontal: 16 * fontScale,\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'center',\n height: 32 * fontScale,\n gap: 6 * fontScale,\n overflow: 'hidden',\n },\n text: {\n textAlign: 'center',\n textAlignVertical: 'center',\n includeFontPadding: false,\n fontWeight: platformFontWeightBold,\n color,\n },\n icon: {\n fontSize: tokens.fontSizeSm * fontScale,\n color,\n },\n })\n}\n"]}
|
|
@@ -3,7 +3,7 @@ import { NativeStackHeaderRightProps } from '@react-navigation/native-stack';
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { ConversationDetailsScreen } from '../screens/conversation_details_screen';
|
|
5
5
|
import { ConversationScreen } from '../screens/conversation_screen';
|
|
6
|
-
import { ConversationsScreen } from '../screens/conversations_screen';
|
|
6
|
+
import { ConversationsScreen } from '../screens/conversations/conversations_screen';
|
|
7
7
|
import { MessageActionsScreen } from '../screens/message_actions_screen';
|
|
8
8
|
import { NotFound } from '../screens/not_found';
|
|
9
9
|
import { ReactionsScreen } from '../screens/reactions_screen';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/navigation/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,EAEL,2BAA2B,EAC5B,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAA;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/navigation/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,EAEL,2BAA2B,EAC5B,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAA;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAA;AAOnF,OAAO,EACL,oBAAoB,EAErB,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,eAAe,EAA0B,MAAM,6BAA6B,CAAA;AAErF,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAM7C,eAAO,MAAM,uBAAuB;;;;;;;;;uOApBiC,mBACjE;;;;;;;;;;;;;;;;;;;uBA4Hy1c,gBAAiB,KAAK;;;qCA9Ft1c,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;EAmBtD,CAAA;AAEF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;uBAyEu0c,gBAAiB,KAAK;;;qCA/Dt1c,2BAA2B;;;;;;;;;;;;;;;uBA+Dqyc,gBAAiB,KAAK;;;;qCA1Ct1c,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mDA0Cszc,KAAK;;;iDA9Ft1c,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqFtD,CAAA;AAEF,KAAK,kBAAkB,GAAG,eAAe,CAAC,OAAO,SAAS,CAAC,CAAA;AAE3D,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,eAAe,CAAC;QACxB,UAAU,aAAc,SAAQ,kBAAkB;SAAG;KACtD;CACF"}
|
|
@@ -4,7 +4,7 @@ import React from 'react';
|
|
|
4
4
|
import { Icon } from '../components';
|
|
5
5
|
import { ConversationDetailsScreen } from '../screens/conversation_details_screen';
|
|
6
6
|
import { ConversationScreen } from '../screens/conversation_screen';
|
|
7
|
-
import { ConversationsScreen } from '../screens/conversations_screen';
|
|
7
|
+
import { ConversationsScreen } from '../screens/conversations/conversations_screen';
|
|
8
8
|
import { ConversationCreateScreen } from '../screens/create/conversation_create_screen';
|
|
9
9
|
import { ConversationFilterReceipientsScreenOptions, ConversationFilterRecipientsScreen, } from '../screens/create/conversation_filter_recipients_screen';
|
|
10
10
|
import { ConversationSelectRecipientsScreen } from '../screens/create/conversation_select_recipients_screen';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/navigation/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAE7D,OAAO,EACL,0BAA0B,GAE3B,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,MAAM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,CAAC,SAAS,CAAC,EAAG,CAAC,CAC7E,OAAO,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAC3B,IAAI,KAAK,CAAC,EACV,CACH;aACF,CAAC;SACH;QACD,mBAAmB,EAAE;YACnB,MAAM,EAAE,yBAAyB;YACjC,OAAO,EAAE,gCAAgC;SAC1C;QACD,YAAY,EAAE;YACZ,MAAM,EAAE,kBAAkB;SAC3B;QACD,mBAAmB,EAAE;YACnB,MAAM,EAAE,yBAAyB;YACjC,OAAO,EAAE,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC;gBAC5B,YAAY,EAAE,OAAO;gBACrB,KAAK,EAAE,sBAAsB;gBAC7B,WAAW,EAAE,CAAC,KAAkC,EAAE,EAAE,CAAC,CACnD,CAAC,iBAAiB,CAAC,IAAI,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CACvD;;UACF,EAAE,iBAAiB,CAAC,CACrB;aACF,CAAC;SACH;QACD,MAAM,EAAE;YACN,MAAM,EAAE,uBAAuB;YAC/B,OAAO,EAAE;gBACP,WAAW,EAAE,KAAK;gBAClB,YAAY,EAAE,OAAO;aACtB;SACF;QACD,cAAc,EAAE;YACd,MAAM,EAAE,oBAAoB;YAC5B,gEAAgE;YAChE,OAAO,EAAE,2BAA2B;SACrC;QACD,SAAS,EAAE;YACT,MAAM,EAAE,eAAe;YACvB,OAAO,EAAE,sBAAsB;SAChC;QACD,QAAQ,EAAE;YACR,MAAM,EAAE,QAAQ;YAChB,OAAO,EAAE;gBACP,KAAK,EAAE,KAAK;aACb;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,GAAG;aACV;SACF;KACF;CACF,CAAC,CAAA","sourcesContent":["import { HeaderBackButton } from '@react-navigation/elements'\nimport { StaticParamList } from '@react-navigation/native'\nimport {\n createNativeStackNavigator,\n NativeStackHeaderRightProps,\n} from '@react-navigation/native-stack'\nimport React from 'react'\nimport { Icon } from '../components'\nimport { ConversationDetailsScreen } from '../screens/conversation_details_screen'\nimport { ConversationScreen } from '../screens/conversation_screen'\nimport { ConversationsScreen } from '../screens/conversations/conversations_screen'\nimport { ConversationCreateScreen } from '../screens/create/conversation_create_screen'\nimport {\n ConversationFilterReceipientsScreenOptions,\n ConversationFilterRecipientsScreen,\n} from '../screens/create/conversation_filter_recipients_screen'\nimport { ConversationSelectRecipientsScreen } from '../screens/create/conversation_select_recipients_screen'\nimport {\n MessageActionsScreen,\n MessageActionsScreenOptions,\n} from '../screens/message_actions_screen'\nimport { NotFound } from '../screens/not_found'\nimport { ReactionsScreen, ReactionsScreenOptions } from '../screens/reactions_screen'\nimport { HeaderRightButton } from './header'\nimport { ScreenLayout } from './screenLayout'\nimport {\n ConversationFiltersScreen,\n ConversationFiltersScreenOptions,\n} from '../screens/conversation_filters_screen'\n\nexport const CreateConversationStack = createNativeStackNavigator({\n initialRouteName: 'ConversationSelectRecipients',\n screenOptions: {\n headerBackButtonDisplayMode: 'minimal',\n },\n screenLayout: ScreenLayout,\n screens: {\n ConversationSelectRecipients: {\n screen: ConversationSelectRecipientsScreen,\n options: ({ navigation }) => ({\n title: 'New conversation',\n headerRight: (props: NativeStackHeaderRightProps) => (\n <HeaderRightButton {...props} onPress={navigation.goBack}>\n Cancel\n </HeaderRightButton>\n ),\n }),\n },\n ConversationFilterRecipients: {\n screen: ConversationFilterRecipientsScreen,\n options: ConversationFilterReceipientsScreenOptions,\n },\n ConversationCreate: {\n screen: ConversationCreateScreen,\n options: {\n title: 'New conversation',\n headerLeft: () => null,\n },\n },\n },\n})\n\nexport const ChatStack = createNativeStackNavigator({\n screenOptions: {\n headerBackButtonDisplayMode: 'minimal',\n },\n screenLayout: ScreenLayout,\n screens: {\n Conversations: {\n screen: ConversationsScreen,\n options: ({ route, navigation }) => ({\n headerTitle: (route.params as { title?: string })?.title ?? 'Chat',\n headerRight: (props: NativeStackHeaderRightProps) => (\n <HeaderBackButton\n backImage={() => <Icon name=\"general.x\" size={18} color={props.tintColor} />}\n onPress={navigation.goBack}\n {...props}\n />\n ),\n }),\n },\n ConversationFilters: {\n screen: ConversationFiltersScreen,\n options: ConversationFiltersScreenOptions,\n },\n Conversation: {\n screen: ConversationScreen,\n },\n ConversationDetails: {\n screen: ConversationDetailsScreen,\n options: ({ navigation }) => ({\n presentation: 'modal',\n title: 'Conversation details',\n headerRight: (props: NativeStackHeaderRightProps) => (\n <HeaderRightButton {...props} onPress={navigation.goBack}>\n Done\n </HeaderRightButton>\n ),\n }),\n },\n Create: {\n screen: CreateConversationStack,\n options: {\n headerShown: false,\n presentation: 'modal',\n },\n },\n MessageActions: {\n screen: MessageActionsScreen,\n // Something about sheetAllowedDetents declared inline breaks TS\n options: MessageActionsScreenOptions,\n },\n Reactions: {\n screen: ReactionsScreen,\n options: ReactionsScreenOptions,\n },\n NotFound: {\n screen: NotFound,\n options: {\n title: '404',\n },\n linking: {\n path: '*',\n },\n },\n },\n})\n\ntype ChatStackParamList = StaticParamList<typeof ChatStack>\n\ndeclare global {\n namespace ReactNavigation {\n interface RootParamList extends ChatStackParamList {}\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat_group_badge.d.ts","sourceRoot":"","sources":["../../../../src/screens/conversations/components/chat_group_badge.tsx"],"names":[],"mappings":"AACA,OAAO,KAAsB,MAAM,OAAO,CAAA;AAO1C,eAAO,MAAM,cAAc,gCA8B1B,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useNavigation, useRoute } from '@react-navigation/native';
|
|
2
|
+
import React, { useCallback } from 'react';
|
|
3
|
+
import { StyleSheet, View } from 'react-native';
|
|
4
|
+
import { Badge } from '../../../components';
|
|
5
|
+
import { useApiGet } from '../../../hooks/use_api';
|
|
6
|
+
export const ChatGroupBadge = () => {
|
|
7
|
+
const styles = useStyles();
|
|
8
|
+
const navigation = useNavigation();
|
|
9
|
+
const route = useRoute();
|
|
10
|
+
const { chat_group_graph_id } = route.params;
|
|
11
|
+
const { data: group } = useApiGet({
|
|
12
|
+
url: `/me/groups/${chat_group_graph_id}`,
|
|
13
|
+
data: {
|
|
14
|
+
fields: {
|
|
15
|
+
Group: [],
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
enabled: !!chat_group_graph_id,
|
|
19
|
+
app: 'chat',
|
|
20
|
+
});
|
|
21
|
+
const handleBadgePress = useCallback(() => {
|
|
22
|
+
navigation.setParams({
|
|
23
|
+
chat_group_graph_id: undefined,
|
|
24
|
+
group_source_app_name: undefined,
|
|
25
|
+
});
|
|
26
|
+
}, [navigation]);
|
|
27
|
+
if (!group)
|
|
28
|
+
return null;
|
|
29
|
+
return (<View style={styles.row}>
|
|
30
|
+
<Badge iconNameRight="general.x" label={group?.name || ''} onPress={handleBadgePress}/>
|
|
31
|
+
</View>);
|
|
32
|
+
};
|
|
33
|
+
const useStyles = () => {
|
|
34
|
+
return StyleSheet.create({
|
|
35
|
+
row: {
|
|
36
|
+
flexDirection: 'row',
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=chat_group_badge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat_group_badge.js","sourceRoot":"","sources":["../../../../src/screens/conversations/components/chat_group_badge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,aAAa,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAC7E,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAIlD,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,UAAU,GAAG,aAAa,EAAE,CAAA;IAClC,MAAM,KAAK,GAAG,QAAQ,EAA+C,CAAA;IACrE,MAAM,EAAE,mBAAmB,EAAE,GAAG,KAAK,CAAC,MAAM,CAAA;IAC5C,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,SAAS,CAAgB;QAC/C,GAAG,EAAE,cAAc,mBAAmB,EAAE;QACxC,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,KAAK,EAAE,EAAE;aACV;SACF;QACD,OAAO,EAAE,CAAC,CAAC,mBAAmB;QAC9B,GAAG,EAAE,MAAM;KACZ,CAAC,CAAA;IAEF,MAAM,gBAAgB,GAAG,WAAW,CAAC,GAAG,EAAE;QACxC,UAAU,CAAC,SAAS,CAAC;YACnB,mBAAmB,EAAE,SAAS;YAC9B,qBAAqB,EAAE,SAAS;SACjC,CAAC,CAAA;IACJ,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAA;IAEhB,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAA;IAEvB,OAAO,CACL,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CACtB;MAAA,CAAC,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,gBAAgB,CAAC,EACvF;IAAA,EAAE,IAAI,CAAC,CACR,CAAA;AACH,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,GAAG,EAAE;YACH,aAAa,EAAE,KAAK;SACrB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { RouteProp, useNavigation, useRoute } from '@react-navigation/native'\nimport React, { useCallback } from 'react'\nimport { StyleSheet, View } from 'react-native'\nimport { Badge } from '../../../components'\nimport { useApiGet } from '../../../hooks/use_api'\nimport { GroupResource } from '../../../types/resources/group_resource'\nimport { ConversationScreenProps } from '../conversations_screen'\n\nexport const ChatGroupBadge = () => {\n const styles = useStyles()\n const navigation = useNavigation()\n const route = useRoute<RouteProp<ConversationScreenProps['route']>>()\n const { chat_group_graph_id } = route.params\n const { data: group } = useApiGet<GroupResource>({\n url: `/me/groups/${chat_group_graph_id}`,\n data: {\n fields: {\n Group: [],\n },\n },\n enabled: !!chat_group_graph_id,\n app: 'chat',\n })\n\n const handleBadgePress = useCallback(() => {\n navigation.setParams({\n chat_group_graph_id: undefined,\n group_source_app_name: undefined,\n })\n }, [navigation])\n\n if (!group) return null\n\n return (\n <View style={styles.row}>\n <Badge iconNameRight=\"general.x\" label={group?.name || ''} onPress={handleBadgePress} />\n </View>\n )\n}\n\nconst useStyles = () => {\n return StyleSheet.create({\n row: {\n flexDirection: 'row',\n },\n })\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list_header_component.d.ts","sourceRoot":"","sources":["../../../../src/screens/conversations/components/list_header_component.tsx"],"names":[],"mappings":"AACA,OAAO,KAAkB,MAAM,OAAO,CAAA;AAetC,eAAO,MAAM,mBAAmB,yBAqF/B,CAAA"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { useNavigation, useRoute } from '@react-navigation/native';
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
3
|
+
import { StyleSheet, View } from 'react-native';
|
|
4
|
+
import { Heading, TextButton, ToggleButton } from '../../../components';
|
|
5
|
+
import { useTheme } from '../../../hooks';
|
|
6
|
+
import { useCanDisplayGroups } from '../../../hooks/use_groups';
|
|
7
|
+
import { ChatGroupBadge } from './chat_group_badge';
|
|
8
|
+
var FilterTypes;
|
|
9
|
+
(function (FilterTypes) {
|
|
10
|
+
FilterTypes["All"] = "All";
|
|
11
|
+
FilterTypes["Groups"] = "Groups";
|
|
12
|
+
FilterTypes["Teams"] = "Teams";
|
|
13
|
+
FilterTypes["More"] = "More";
|
|
14
|
+
})(FilterTypes || (FilterTypes = {}));
|
|
15
|
+
export const ListHeaderComponent = () => {
|
|
16
|
+
const styles = useStyles();
|
|
17
|
+
const navigation = useNavigation();
|
|
18
|
+
const canFilterByTeams = useCanDisplayGroups({ source_app_name: 'Services', source_type: 'Team' });
|
|
19
|
+
const canFilterByGroups = useCanDisplayGroups({ source_app_name: 'Groups', source_type: 'Group' });
|
|
20
|
+
const route = useRoute();
|
|
21
|
+
const { chat_group_graph_id, group_source_app_name = '' } = route.params;
|
|
22
|
+
const active = useMemo(() => {
|
|
23
|
+
if (chat_group_graph_id) {
|
|
24
|
+
return FilterTypes.More;
|
|
25
|
+
}
|
|
26
|
+
else if (/groups/i.test(group_source_app_name)) {
|
|
27
|
+
return FilterTypes.Groups;
|
|
28
|
+
}
|
|
29
|
+
else if (/services/i.test(group_source_app_name)) {
|
|
30
|
+
return FilterTypes.Teams;
|
|
31
|
+
}
|
|
32
|
+
return FilterTypes.All;
|
|
33
|
+
}, [chat_group_graph_id, group_source_app_name]);
|
|
34
|
+
const showAppFilters = canFilterByGroups && canFilterByTeams;
|
|
35
|
+
return (<View style={styles.listHeader}>
|
|
36
|
+
<View style={styles.titleRow}>
|
|
37
|
+
<Heading numberOfLines={1} variant="h2">
|
|
38
|
+
Conversations
|
|
39
|
+
</Heading>
|
|
40
|
+
<TextButton>Mark all read</TextButton>
|
|
41
|
+
</View>
|
|
42
|
+
<View style={styles.filterRow}>
|
|
43
|
+
{showAppFilters && (<>
|
|
44
|
+
<ToggleButton title={FilterTypes.All} active={active === FilterTypes.All} onPress={() => navigation.setParams({
|
|
45
|
+
chat_group_graph_id: undefined,
|
|
46
|
+
group_source_app_name: undefined,
|
|
47
|
+
})} accessibilityLabel="Show all conversations"/>
|
|
48
|
+
<ToggleButton title={FilterTypes.Groups} active={active === FilterTypes.Groups} onPress={() => navigation.setParams({
|
|
49
|
+
chat_group_graph_id: undefined,
|
|
50
|
+
group_source_app_name: 'Groups',
|
|
51
|
+
})} accessibilityLabel="Filter to group conversations"/>
|
|
52
|
+
|
|
53
|
+
<ToggleButton title={FilterTypes.Teams} active={active === FilterTypes.Teams} onPress={() => navigation.setParams({
|
|
54
|
+
chat_group_graph_id: undefined,
|
|
55
|
+
group_source_app_name: 'Services',
|
|
56
|
+
})} accessibilityLabel="Filter to team conversations"/>
|
|
57
|
+
</>)}
|
|
58
|
+
<ToggleButton title={showAppFilters ? FilterTypes.More : 'Filter'} onPress={() => navigation.navigate('ConversationFilters', {
|
|
59
|
+
chat_group_graph_id,
|
|
60
|
+
group_source_app_name,
|
|
61
|
+
})} active={active === FilterTypes.More} iconNameRight="general.threeReducingHorizontalBars" accessibilityLabel={showAppFilters ? 'View all filters' : 'View more filters'}/>
|
|
62
|
+
</View>
|
|
63
|
+
<ChatGroupBadge />
|
|
64
|
+
</View>);
|
|
65
|
+
};
|
|
66
|
+
const useStyles = () => {
|
|
67
|
+
const theme = useTheme();
|
|
68
|
+
return StyleSheet.create({
|
|
69
|
+
listHeader: {
|
|
70
|
+
borderBottomWidth: 1,
|
|
71
|
+
borderBottomColor: theme.colors.fillColorNeutral050Base,
|
|
72
|
+
paddingHorizontal: 16,
|
|
73
|
+
paddingBottom: 16,
|
|
74
|
+
gap: 12,
|
|
75
|
+
},
|
|
76
|
+
titleRow: {
|
|
77
|
+
flexDirection: 'row',
|
|
78
|
+
justifyContent: 'space-between',
|
|
79
|
+
paddingTop: 8,
|
|
80
|
+
},
|
|
81
|
+
filterRow: {
|
|
82
|
+
flexDirection: 'row',
|
|
83
|
+
justifyContent: 'flex-start',
|
|
84
|
+
gap: 8,
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
//# sourceMappingURL=list_header_component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list_header_component.js","sourceRoot":"","sources":["../../../../src/screens/conversations/components/list_header_component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,aAAa,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAC7E,OAAO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E;YACR,aAAa,EAAE,KAAK;YACpB,cAAc,EAAE,eAAe;YAC/B,UAAU,EAAE,CAAC;SACd;QACD,SAAS,EAAE;YACT,aAAa,EAAE,KAAK;YACpB,cAAc,EAAE,YAAY;YAC5B,GAAG,EAAE,CAAC;SACP;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { RouteProp, useNavigation, useRoute } from '@react-navigation/native'\nimport React, { useMemo } from 'react'\nimport { StyleSheet, View } from 'react-native'\nimport { Heading, TextButton, ToggleButton } from '../../../components'\nimport { useTheme } from '../../../hooks'\nimport { useCanDisplayGroups } from '../../../hooks/use_groups'\nimport { ConversationScreenProps } from '../conversations_screen'\nimport { ChatGroupBadge } from './chat_group_badge'\n\nenum FilterTypes {\n All = 'All',\n Groups = 'Groups',\n Teams = 'Teams',\n More = 'More',\n}\n\nexport const ListHeaderComponent = () => {\n const styles = useStyles()\n const navigation = useNavigation()\n const canFilterByTeams = useCanDisplayGroups({ source_app_name: 'Services', source_type: 'Team' })\n const canFilterByGroups = useCanDisplayGroups({ source_app_name: 'Groups', source_type: 'Group' })\n const route = useRoute<RouteProp<ConversationScreenProps['route']>>()\n const { chat_group_graph_id, group_source_app_name = '' } = route.params\n\n const active: FilterTypes = useMemo(() => {\n if (chat_group_graph_id) {\n return FilterTypes.More\n } else if (/groups/i.test(group_source_app_name)) {\n return FilterTypes.Groups\n } else if (/services/i.test(group_source_app_name)) {\n return FilterTypes.Teams\n }\n\n return FilterTypes.All\n }, [chat_group_graph_id, group_source_app_name])\n\n const showAppFilters = canFilterByGroups && canFilterByTeams\n\n return (\n <View style={styles.listHeader}>\n <View style={styles.titleRow}>\n <Heading numberOfLines={1} variant=\"h2\">\n Conversations\n </Heading>\n <TextButton>Mark all read</TextButton>\n </View>\n <View style={styles.filterRow}>\n {showAppFilters && (\n <>\n <ToggleButton\n title={FilterTypes.All}\n active={active === FilterTypes.All}\n onPress={() =>\n navigation.setParams({\n chat_group_graph_id: undefined,\n group_source_app_name: undefined,\n })\n }\n accessibilityLabel=\"Show all conversations\"\n />\n <ToggleButton\n title={FilterTypes.Groups}\n active={active === FilterTypes.Groups}\n onPress={() =>\n navigation.setParams({\n chat_group_graph_id: undefined,\n group_source_app_name: 'Groups',\n })\n }\n accessibilityLabel=\"Filter to group conversations\"\n />\n\n <ToggleButton\n title={FilterTypes.Teams}\n active={active === FilterTypes.Teams}\n onPress={() =>\n navigation.setParams({\n chat_group_graph_id: undefined,\n group_source_app_name: 'Services',\n })\n }\n accessibilityLabel=\"Filter to team conversations\"\n />\n </>\n )}\n <ToggleButton\n title={showAppFilters ? FilterTypes.More : 'Filter'}\n onPress={() =>\n navigation.navigate('ConversationFilters', {\n chat_group_graph_id,\n group_source_app_name,\n })\n }\n active={active === FilterTypes.More}\n iconNameRight=\"general.threeReducingHorizontalBars\"\n accessibilityLabel={showAppFilters ? 'View all filters' : 'View more filters'}\n />\n </View>\n <ChatGroupBadge />\n </View>\n )\n}\n\nconst useStyles = () => {\n const theme = useTheme()\n return StyleSheet.create({\n listHeader: {\n borderBottomWidth: 1,\n borderBottomColor: theme.colors.fillColorNeutral050Base,\n paddingHorizontal: 16,\n paddingBottom: 16,\n gap: 12,\n },\n titleRow: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n paddingTop: 8,\n },\n filterRow: {\n flexDirection: 'row',\n justifyContent: 'flex-start',\n gap: 8,\n },\n })\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StaticScreenProps } from '@react-navigation/native';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { GraphId } from '
|
|
3
|
+
import { GraphId } from '../../types/resources/group_resource';
|
|
4
4
|
export type ConversationScreenProps = StaticScreenProps<{
|
|
5
5
|
title?: string;
|
|
6
6
|
chat_group_graph_id?: GraphId;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversations_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/conversations/conversations_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAiB,MAAM,0BAA0B,CAAA;AAC3E,OAAO,KAAkB,MAAM,OAAO,CAAA;AAKtC,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAA;AAG9D,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,CAAC;IACtD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,qBAAqB,CAAC,EAAE,MAAM,CAAA;CAC/B,CAAC,CAAA;AAEF,wBAAgB,mBAAmB,CAAC,EAAE,KAAK,EAAE,EAAE,uBAAuB,qBA+BrE"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useNavigation } from '@react-navigation/native';
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
3
|
+
import { StyleSheet, View } from 'react-native';
|
|
4
|
+
import { Conversations } from '../../components';
|
|
5
|
+
import { ActionButton } from '../../components/display/action_button';
|
|
6
|
+
import { useCanCreateConversations } from '../../hooks';
|
|
7
|
+
import { ListHeaderComponent } from './components/list_header_component';
|
|
8
|
+
export function ConversationsScreen({ route }) {
|
|
9
|
+
const navigation = useNavigation();
|
|
10
|
+
const canCreateConversations = useCanCreateConversations();
|
|
11
|
+
const styles = useStyles();
|
|
12
|
+
const { chat_group_graph_id, group_source_app_name } = route.params;
|
|
13
|
+
const filter = useMemo(() => {
|
|
14
|
+
if (chat_group_graph_id) {
|
|
15
|
+
return 'group';
|
|
16
|
+
}
|
|
17
|
+
else if (group_source_app_name) {
|
|
18
|
+
return 'group_source_app_name';
|
|
19
|
+
}
|
|
20
|
+
return 'mine_or_not_empty';
|
|
21
|
+
}, [chat_group_graph_id, group_source_app_name]);
|
|
22
|
+
return (<View style={styles.container}>
|
|
23
|
+
<Conversations ListHeaderComponent={ListHeaderComponent} group={chat_group_graph_id} group_source_app_name={group_source_app_name} filter={filter}/>
|
|
24
|
+
<ActionButton visible={canCreateConversations} title="New conversation" onPress={() => navigation.navigate('Create')}/>
|
|
25
|
+
</View>);
|
|
26
|
+
}
|
|
27
|
+
const useStyles = () => {
|
|
28
|
+
return StyleSheet.create({
|
|
29
|
+
container: {
|
|
30
|
+
flex: 1,
|
|
31
|
+
justifyContent: 'center',
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=conversations_screen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversations_screen.js","sourceRoot":"","sources":["../../../src/screens/conversations/conversations_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAC3E,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAA;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AAEvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAA;AAQxE,MAAM,UAAU,mBAAmB,CAAC,EAAE,KAAK,EAA2B;IACpE,MAAM,UAAU,GAAG,aAAa,EAAE,CAAA;IAClC,MAAM,sBAAsB,GAAG,yBAAyB,EAAE,CAAA;IAC1D,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,GAAG,KAAK,CAAC,MAAM,CAAA;IAEnE,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE;QAC1B,IAAI,mBAAmB,EAAE,CAAC;YACxB,OAAO,OAAO,CAAA;QAChB,CAAC;aAAM,IAAI,qBAAqB,EAAE,CAAC;YACjC,OAAO,uBAAuB,CAAA;QAChC,CAAC;QAED,OAAO,mBAAmB,CAAA;IAC5B,CAAC,EAAE,CAAC,mBAAmB,EAAE,qBAAqB,CAAC,CAAC,CAAA;IAEhD,OAAO,CACL,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAC5B;MAAA,CAAC,aAAa,CACZ,mBAAmB,CAAC,CAAC,mBAAmB,CAAC,CACzC,KAAK,CAAC,CAAC,mBAAmB,CAAC,CAC3B,qBAAqB,CAAC,CAAC,qBAAqB,CAAC,CAC7C,MAAM,CAAC,CAAC,MAAM,CAAC,EAEjB;MAAA,CAAC,YAAY,CACX,OAAO,CAAC,CAAC,sBAAsB,CAAC,CAChC,KAAK,CAAC,kBAAkB,CACxB,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,EAEjD;IAAA,EAAE,IAAI,CAAC,CACR,CAAA;AACH,CAAC;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE;YACT,IAAI,EAAE,CAAC;YACP,cAAc,EAAE,QAAQ;SACzB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport React, { useMemo } from 'react'\nimport { StyleSheet, View } from 'react-native'\nimport { Conversations } from '../../components'\nimport { ActionButton } from '../../components/display/action_button'\nimport { useCanCreateConversations } from '../../hooks'\nimport { GraphId } from '../../types/resources/group_resource'\nimport { ListHeaderComponent } from './components/list_header_component'\n\nexport type ConversationScreenProps = StaticScreenProps<{\n title?: string\n chat_group_graph_id?: GraphId\n group_source_app_name?: string\n}>\n\nexport function ConversationsScreen({ route }: ConversationScreenProps) {\n const navigation = useNavigation()\n const canCreateConversations = useCanCreateConversations()\n const styles = useStyles()\n const { chat_group_graph_id, group_source_app_name } = route.params\n\n const filter = useMemo(() => {\n if (chat_group_graph_id) {\n return 'group'\n } else if (group_source_app_name) {\n return 'group_source_app_name'\n }\n\n return 'mine_or_not_empty'\n }, [chat_group_graph_id, group_source_app_name])\n\n return (\n <View style={styles.container}>\n <Conversations\n ListHeaderComponent={ListHeaderComponent}\n group={chat_group_graph_id}\n group_source_app_name={group_source_app_name}\n filter={filter}\n />\n <ActionButton\n visible={canCreateConversations}\n title=\"New conversation\"\n onPress={() => navigation.navigate('Create')}\n />\n </View>\n )\n}\n\nconst useStyles = () => {\n return StyleSheet.create({\n container: {\n flex: 1,\n justifyContent: 'center',\n },\n })\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"design_system_screen.d.ts","sourceRoot":"","sources":["../../src/screens/design_system_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"design_system_screen.d.ts","sourceRoot":"","sources":["../../src/screens/design_system_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAA;AA8EvC,wBAAgB,kBAAkB,sBAiBjC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { Alert, Pressable, ScrollView, StyleSheet, View } from 'react-native';
|
|
3
3
|
import { useTheme } from '../hooks';
|
|
4
|
-
import { Avatar, AvatarGroup, Badge, Banner, BannerCollapsible, Button, Heading, Icon, IconButton, Image, Person, Spinner, Switch, Text, TextButton, TextInlineButton, } from '../components/display';
|
|
4
|
+
import { Avatar, AvatarGroup, Badge, Banner, BannerCollapsible, Button, ToggleButton, Heading, Icon, IconButton, Image, Person, Spinner, Switch, Text, TextButton, TextInlineButton, } from '../components/display';
|
|
5
5
|
import { space, MAX_FONT_SIZE_MULTIPLIER, platformPressedOpacityStyle, platformFontWeightMedium, } from '../utils';
|
|
6
6
|
import BannerPrimitive from '../components/primitive/banner_primitive';
|
|
7
7
|
// =================================
|
|
@@ -193,6 +193,7 @@ function HeadingTextSection({ isLast }) {
|
|
|
193
193
|
}
|
|
194
194
|
function PressablesSection({ isLast }) {
|
|
195
195
|
const styles = useStyles();
|
|
196
|
+
const [filterSelected, setFilterSelected] = useState('Groups');
|
|
196
197
|
return (<CollapsableSection title="Pressables" isLast={isLast}>
|
|
197
198
|
<Group title="Button" description="Feature fill and outline variants for primary and danger usecases, along with disabled & loading states. Optionally shows icons to the left and right of the text.">
|
|
198
199
|
<Row>
|
|
@@ -236,6 +237,13 @@ function PressablesSection({ isLast }) {
|
|
|
236
237
|
<Button loading onPress={buttonPress} title="Danger" appearance="danger" size="lg" variant="outline" iconNameLeft="groups.cards" iconNameRight="general.downChevron" maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER}/>
|
|
237
238
|
</Row>
|
|
238
239
|
</Group>
|
|
240
|
+
<Group title="ToggleButton" description="Button with active and deactive states. Supports right & left icons, along with standard pressable props.">
|
|
241
|
+
<Row>
|
|
242
|
+
<ToggleButton onPress={() => setFilterSelected('Groups')} title="Groups" active={filterSelected === 'Groups'} accessibilityLabel="Filter to group conversations"/>
|
|
243
|
+
<ToggleButton onPress={() => setFilterSelected('Teams')} title="Teams" active={filterSelected === 'Teams'} accessibilityLabel="Filter to team conversations"/>
|
|
244
|
+
<ToggleButton onPress={() => setFilterSelected('More')} title="More" active={filterSelected === 'More'} iconNameRight="general.threeReducingHorizontalBars" accessibilityLabel="View more filters"/>
|
|
245
|
+
</Row>
|
|
246
|
+
</Group>
|
|
239
247
|
<Group title="IconButton" description="Supports different appearances, sizes, along with loading & disabled states. Use `iconStyle` for custom colors and font sizes. Requires `accessibilityLabel` as icon's don't provide context to screen readers.">
|
|
240
248
|
<Row>
|
|
241
249
|
<IconButton onPress={buttonPress} name="general.paperclip" accessibilityLabel="Add attachment" accessibilityHint="Opens your device's image gallary" size="md"/>
|