@planningcenter/chat-react-native 3.1.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.
Files changed (84) hide show
  1. package/build/components/display/index.d.ts +1 -0
  2. package/build/components/display/index.d.ts.map +1 -1
  3. package/build/components/display/index.js +1 -0
  4. package/build/components/display/index.js.map +1 -1
  5. package/build/components/display/toggle_button.d.ts +42 -0
  6. package/build/components/display/toggle_button.d.ts.map +1 -0
  7. package/build/components/display/toggle_button.js +67 -0
  8. package/build/components/display/toggle_button.js.map +1 -0
  9. package/build/navigation/index.d.ts +2 -9
  10. package/build/navigation/index.d.ts.map +1 -1
  11. package/build/navigation/index.js +1 -1
  12. package/build/navigation/index.js.map +1 -1
  13. package/build/screens/conversation_filters/components/conversation_filters.d.ts +3 -0
  14. package/build/screens/conversation_filters/components/conversation_filters.d.ts.map +1 -0
  15. package/build/screens/conversation_filters/components/conversation_filters.js +173 -0
  16. package/build/screens/conversation_filters/components/conversation_filters.js.map +1 -0
  17. package/build/screens/conversation_filters/components/rows.d.ts +31 -0
  18. package/build/screens/conversation_filters/components/rows.d.ts.map +1 -0
  19. package/build/screens/conversation_filters/components/rows.js +111 -0
  20. package/build/screens/conversation_filters/components/rows.js.map +1 -0
  21. package/build/screens/conversation_filters/context/conversation_filter_context.d.ts +23 -0
  22. package/build/screens/conversation_filters/context/conversation_filter_context.d.ts.map +1 -0
  23. package/build/screens/conversation_filters/context/conversation_filter_context.js +51 -0
  24. package/build/screens/conversation_filters/context/conversation_filter_context.js.map +1 -0
  25. package/build/screens/conversation_filters/filter_types.d.ts +7 -0
  26. package/build/screens/conversation_filters/filter_types.d.ts.map +1 -0
  27. package/build/screens/conversation_filters/filter_types.js +8 -0
  28. package/build/screens/conversation_filters/filter_types.js.map +1 -0
  29. package/build/screens/conversation_filters/group_filters.d.ts +6 -0
  30. package/build/screens/conversation_filters/group_filters.d.ts.map +1 -0
  31. package/build/screens/conversation_filters/group_filters.js +15 -0
  32. package/build/screens/conversation_filters/group_filters.js.map +1 -0
  33. package/build/screens/conversation_filters/hooks/filters.d.ts +415 -0
  34. package/build/screens/conversation_filters/hooks/filters.d.ts.map +1 -0
  35. package/build/screens/conversation_filters/hooks/filters.js +41 -0
  36. package/build/screens/conversation_filters/hooks/filters.js.map +1 -0
  37. package/build/screens/conversation_filters/screen_props.d.ts +13 -0
  38. package/build/screens/conversation_filters/screen_props.d.ts.map +1 -0
  39. package/build/screens/conversation_filters/screen_props.js +2 -0
  40. package/build/screens/conversation_filters/screen_props.js.map +1 -0
  41. package/build/screens/conversation_filters/team_filters.d.ts +6 -0
  42. package/build/screens/conversation_filters/team_filters.d.ts.map +1 -0
  43. package/build/screens/conversation_filters/team_filters.js +15 -0
  44. package/build/screens/conversation_filters/team_filters.js.map +1 -0
  45. package/build/screens/conversation_filters_screen.d.ts +2 -9
  46. package/build/screens/conversation_filters_screen.d.ts.map +1 -1
  47. package/build/screens/conversation_filters_screen.js +81 -302
  48. package/build/screens/conversation_filters_screen.js.map +1 -1
  49. package/build/screens/conversations/components/chat_group_badge.d.ts +3 -0
  50. package/build/screens/conversations/components/chat_group_badge.d.ts.map +1 -0
  51. package/build/screens/conversations/components/chat_group_badge.js +40 -0
  52. package/build/screens/conversations/components/chat_group_badge.js.map +1 -0
  53. package/build/screens/conversations/components/list_header_component.d.ts +3 -0
  54. package/build/screens/conversations/components/list_header_component.d.ts.map +1 -0
  55. package/build/screens/conversations/components/list_header_component.js +88 -0
  56. package/build/screens/conversations/components/list_header_component.js.map +1 -0
  57. package/build/screens/{conversations_screen.d.ts → conversations/conversations_screen.d.ts} +1 -1
  58. package/build/screens/conversations/conversations_screen.d.ts.map +1 -0
  59. package/build/screens/conversations/conversations_screen.js +35 -0
  60. package/build/screens/conversations/conversations_screen.js.map +1 -0
  61. package/build/screens/design_system_screen.d.ts.map +1 -1
  62. package/build/screens/design_system_screen.js +9 -1
  63. package/build/screens/design_system_screen.js.map +1 -1
  64. package/package.json +2 -2
  65. package/src/components/display/index.ts +1 -0
  66. package/src/components/display/toggle_button.tsx +157 -0
  67. package/src/navigation/index.tsx +1 -1
  68. package/src/screens/conversation_filters/components/conversation_filters.tsx +233 -0
  69. package/src/screens/conversation_filters/components/rows.tsx +164 -0
  70. package/src/screens/conversation_filters/context/conversation_filter_context.tsx +65 -0
  71. package/src/screens/conversation_filters/filter_types.ts +6 -0
  72. package/src/screens/conversation_filters/group_filters.tsx +31 -0
  73. package/src/screens/conversation_filters/hooks/filters.ts +68 -0
  74. package/src/screens/conversation_filters/screen_props.ts +15 -0
  75. package/src/screens/conversation_filters/team_filters.tsx +31 -0
  76. package/src/screens/conversation_filters_screen.tsx +93 -429
  77. package/src/screens/conversations/components/chat_group_badge.tsx +47 -0
  78. package/src/screens/conversations/components/list_header_component.tsx +125 -0
  79. package/src/screens/conversations/conversations_screen.tsx +56 -0
  80. package/src/screens/design_system_screen.tsx +28 -0
  81. package/build/screens/conversations_screen.d.ts.map +0 -1
  82. package/build/screens/conversations_screen.js +0 -144
  83. package/build/screens/conversations_screen.js.map +0 -1
  84. package/src/screens/conversations_screen.tsx +0 -222
@@ -15,4 +15,5 @@ export * from './switch';
15
15
  export * from './text_button';
16
16
  export * from './text_inline_button';
17
17
  export * from './text';
18
+ export * from './toggle_button';
18
19
  //# sourceMappingURL=index.d.ts.map
@@ -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"}
@@ -15,4 +15,5 @@ export * from './switch';
15
15
  export * from './text_button';
16
16
  export * from './text_inline_button';
17
17
  export * from './text';
18
+ export * from './toggle_button';
18
19
  //# sourceMappingURL=index.js.map
@@ -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,EAA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AAO,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';
@@ -94,14 +94,7 @@ export declare const ChatStack: import("@react-navigation/native").TypedNavigato
94
94
  };
95
95
  };
96
96
  readonly ConversationFilters: {
97
- readonly screen: ({}: {
98
- route: {
99
- params: {
100
- chat_group_graph_id?: import("../types/resources/group_resource").GraphId;
101
- group_source_app_name?: string;
102
- };
103
- };
104
- }) => React.JSX.Element;
97
+ readonly screen: (_props: import("../screens/conversation_filters/screen_props").ConversationFiltersScreenProps) => React.JSX.Element;
105
98
  readonly options: import("@react-navigation/native-stack").NativeStackNavigationOptions;
106
99
  };
107
100
  readonly Conversation: {
@@ -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,iCAAiC,CAAA;AAOrE,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;;;;;;;;;uOAnBpC,mBAAkB;;;;;;;;;;;;;;;;;;;uBA4Hy1c,gBAAiB,KAAK;;;qCA9Fp2c,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;EAmBtD,CAA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AmBtD,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,OAAO,CAAA;AACzB,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACpC,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAA;AAClF,OAAO,EAAE,kBAAkB,EAAE,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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_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"]}
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,OAAO,CAAA;AACzB,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACpC,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAA;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAA;AACnF,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAA;AACvF,OAAO,EACL,0CAA0C,EAC1C,kCAAkC,GACnC,MAAM,yDAAyD,CAAA;AAChE,OAAO,EAAE,kCAAkC,EAAE,MAAM,yDAAyD,CAAA;AAC5G,OAAO,EACL,oBAAoB,EACpB,2BAA2B,GAC5B,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EACL,yBAAyB,EACzB,gCAAgC,GACjC,MAAM,wCAAwC,CAAA;AAE/C,MAAM,CAAC,MAAM,uBAAuB,GAAG,0BAA0B,CAAC;IAChE,gBAAgB,EAAE,8BAA8B;IAChD,aAAa,EAAE;QACb,2BAA2B,EAAE,SAAS;KACvC;IACD,YAAY,EAAE,YAAY;IAC1B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,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,3 @@
1
+ import React from 'react';
2
+ export declare const ConversationFilters: () => React.JSX.Element;
3
+ //# sourceMappingURL=conversation_filters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation_filters.d.ts","sourceRoot":"","sources":["../../../../src/screens/conversation_filters/components/conversation_filters.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAA;AAmDlD,eAAO,MAAM,mBAAmB,yBAgH/B,CAAA"}
@@ -0,0 +1,173 @@
1
+ import React, { useContext, useMemo } from 'react';
2
+ import { FlatList, StyleSheet, View } from 'react-native';
3
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
4
+ import { Heading } from '../../../components';
5
+ import { useTheme } from '../../../hooks';
6
+ import { FilterContext } from '../context/conversation_filter_context';
7
+ import { FilterTypes } from '../filter_types';
8
+ import { useGroupsToFilter, useTeamsToFilter } from '../hooks/filters';
9
+ import { FilterRow, GroupRow, TeamRow, ViewMore, } from './rows';
10
+ // =========================================
11
+ // ====== Factory Constants & Types ========
12
+ // =========================================
13
+ var SectionTypes;
14
+ (function (SectionTypes) {
15
+ SectionTypes[SectionTypes["filter"] = 0] = "filter";
16
+ SectionTypes[SectionTypes["groups"] = 1] = "groups";
17
+ SectionTypes[SectionTypes["header"] = 2] = "header";
18
+ SectionTypes[SectionTypes["hidden"] = 3] = "hidden";
19
+ SectionTypes[SectionTypes["more"] = 4] = "more";
20
+ SectionTypes[SectionTypes["teams"] = 5] = "teams";
21
+ })(SectionTypes || (SectionTypes = {}));
22
+ // =================================
23
+ // ====== Components ===============
24
+ // =================================
25
+ export const ConversationFilters = () => {
26
+ const styles = useStyles();
27
+ const { setScrollOffset, params } = useContext(FilterContext);
28
+ const { chat_group_graph_id, group_source_app_name = '' } = params;
29
+ const activeFilter = useMemo(() => {
30
+ if (chat_group_graph_id) {
31
+ return FilterTypes.More;
32
+ }
33
+ else if (/groups/i.test(group_source_app_name)) {
34
+ return FilterTypes.Groups;
35
+ }
36
+ else if (/services/i.test(group_source_app_name)) {
37
+ return FilterTypes.Teams;
38
+ }
39
+ return FilterTypes.All;
40
+ }, [chat_group_graph_id, group_source_app_name]);
41
+ const { groups = [] } = useGroupsToFilter();
42
+ const { teams = [] } = useTeamsToFilter();
43
+ const activeGroupId = chat_group_graph_id;
44
+ const isExactGroupFilter = activeFilter === FilterTypes.More;
45
+ const teamItems = teams.map(team => ({
46
+ type: SectionTypes.teams,
47
+ data: {
48
+ team,
49
+ isActive: isExactGroupFilter && team.id.toString() === activeGroupId,
50
+ },
51
+ }));
52
+ const groupItems = groups.map(group => ({
53
+ type: SectionTypes.groups,
54
+ data: {
55
+ group,
56
+ isActive: isExactGroupFilter && group?.id.toString() === activeGroupId,
57
+ },
58
+ }));
59
+ const groupItemData = selectActiveWithFirst(5)(groupItems);
60
+ const teamItemData = selectActiveWithFirst(5)(teamItems);
61
+ const hideAppFilters = groupItems.length < 1 || teamItems.length < 1;
62
+ const listData = [
63
+ {
64
+ type: hideAppFilters ? SectionTypes.hidden : SectionTypes.header,
65
+ data: { title: 'General Filters' },
66
+ },
67
+ {
68
+ type: hideAppFilters ? SectionTypes.hidden : SectionTypes.filter,
69
+ data: { filter: FilterTypes.All, isActive: activeFilter === FilterTypes.All },
70
+ },
71
+ {
72
+ type: hideAppFilters ? SectionTypes.hidden : SectionTypes.filter,
73
+ data: {
74
+ filter: FilterTypes.Groups,
75
+ group_source_app_name: 'groups',
76
+ isActive: activeFilter === FilterTypes.Groups,
77
+ },
78
+ },
79
+ {
80
+ type: hideAppFilters ? SectionTypes.hidden : SectionTypes.filter,
81
+ data: {
82
+ filter: FilterTypes.Teams,
83
+ group_source_app_name: 'services',
84
+ isActive: activeFilter === FilterTypes.Teams,
85
+ },
86
+ },
87
+ {
88
+ type: groupItems.length ? SectionTypes.header : SectionTypes.hidden,
89
+ data: { title: 'Groups' },
90
+ },
91
+ ...groupItemData,
92
+ {
93
+ type: groupItems.length > 5 ? SectionTypes.more : SectionTypes.hidden,
94
+ data: { routeName: 'GroupFilters' },
95
+ },
96
+ {
97
+ type: teamItems.length ? SectionTypes.header : SectionTypes.hidden,
98
+ data: { title: 'Teams' },
99
+ },
100
+ ...teamItemData,
101
+ {
102
+ type: teamItems.length > 5 ? SectionTypes.more : SectionTypes.hidden,
103
+ data: { routeName: 'TeamFilters' },
104
+ },
105
+ ];
106
+ return (<FlatList data={listData} contentContainerStyle={styles.flatlistContainer} nestedScrollEnabled={true} onScroll={e => setScrollOffset(e.nativeEvent.contentOffset.y)} renderItem={({ item }) => {
107
+ switch (item.type) {
108
+ case SectionTypes.header:
109
+ return <Header {...item.data}/>;
110
+ case SectionTypes.filter:
111
+ return <FilterRow {...item.data}/>;
112
+ case SectionTypes.groups:
113
+ return <GroupRow {...item.data}/>;
114
+ case SectionTypes.teams:
115
+ return <TeamRow {...item.data}/>;
116
+ case SectionTypes.more:
117
+ return <ViewMore {...item.data}/>;
118
+ default:
119
+ return null;
120
+ }
121
+ }}/>);
122
+ };
123
+ const useStyles = () => {
124
+ const { bottom } = useSafeAreaInsets();
125
+ const theme = useTheme();
126
+ return StyleSheet.create({
127
+ flatlistContainer: {
128
+ paddingBottom: 64 + bottom,
129
+ },
130
+ section: {},
131
+ sectionHeader: {
132
+ flexDirection: 'row',
133
+ justifyContent: 'space-between',
134
+ paddingTop: 24,
135
+ paddingBottom: 8,
136
+ paddingHorizontal: 16,
137
+ },
138
+ selectTeamsButton: {},
139
+ filterBar: {
140
+ backgroundColor: theme.colors.fillColorNeutral100Inverted,
141
+ flexDirection: 'row',
142
+ justifyContent: 'space-between',
143
+ alignItems: 'center',
144
+ paddingHorizontal: 16,
145
+ paddingVertical: 16,
146
+ gap: 8,
147
+ },
148
+ filterBarScroll: {
149
+ elevation: 4,
150
+ boxShadow: '0px 4px 4px rgba(0, 0, 0, 0.1)',
151
+ },
152
+ filterBarActions: {
153
+ flexDirection: 'row',
154
+ gap: 8,
155
+ alignItems: 'center',
156
+ },
157
+ });
158
+ };
159
+ const Header = ({ title }) => {
160
+ const styles = useStyles();
161
+ return (<View style={styles.sectionHeader}>
162
+ <Heading variant="h3">{title}</Heading>
163
+ </View>);
164
+ };
165
+ const selectActiveWithFirst = (number) => (groups) => {
166
+ const activeGroupIndex = groups.findIndex(group => group.data.isActive);
167
+ const activeGroup = groups[activeGroupIndex];
168
+ if (!activeGroup || activeGroupIndex <= number) {
169
+ return groups.slice(0, number);
170
+ }
171
+ return [activeGroup, ...groups].slice(0, number);
172
+ };
173
+ //# sourceMappingURL=conversation_filters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation_filters.js","sourceRoot":"","sources":["../../../../src/screens/conversation_filters/components/conversation_filters.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAClD,OAAO,EAAE,QAAQ,EAAkB,UAAU,EAAE,IAAI,EAAa,MAAM,cAAc,CAAA;AACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAA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AAM,qBAAqB,GACzB,CAAC,MAAc,EAAE,EAAE,CACnB,CAA6B,MAAW,EAAO,EAAE;IAC/C,MAAM,gBAAgB,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IACvE,MAAM,WAAW,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAA;IAE5C,IAAI,CAAC,WAAW,IAAI,gBAAgB,IAAI,MAAM,EAAE,CAAC;QAC/C,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAA;IAChC,CAAC;IAED,OAAO,CAAC,WAAW,EAAE,GAAG,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAA;AAClD,CAAC,CAAA","sourcesContent":["import React, { useContext, useMemo } from 'react'\nimport { FlatList, RefreshControl, StyleSheet, View, ViewStyle } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { Heading } from '../../../components'\nimport { useTheme } from '../../../hooks'\nimport { FilterContext } from '../context/conversation_filter_context'\nimport { FilterTypes } from '../filter_types'\nimport { useGroupsToFilter, useTeamsToFilter } from '../hooks/filters'\nimport {\n FilterProps,\n FilterRow,\n GroupRow,\n GroupRowProps,\n TeamRow,\n TeamRowProps,\n ViewMore,\n ViewMoreRowProps,\n} from './rows'\n\n// =========================================\n// ====== Factory Constants & Types ========\n// =========================================\n\nenum SectionTypes {\n filter,\n groups,\n header,\n hidden,\n more,\n teams,\n}\n\ntype SectionListData = Array<\n | DataItem<FilterProps, SectionTypes.filter>\n | DataItem<GroupRowProps, SectionTypes.groups>\n | DataItem<HeaderProps, SectionTypes.header>\n | DataItem<any, SectionTypes.hidden>\n | DataItem<ViewMoreRowProps, SectionTypes.more>\n | DataItem<TeamRowProps, SectionTypes.teams>\n>\n\ninterface DataItem<T, TName extends SectionTypes> {\n type: TName\n data: T\n sectionStyle?: ViewStyle\n}\n\n// =================================\n// ====== Components ===============\n// =================================\n\nexport const ConversationFilters = () => {\n const styles = useStyles()\n const { setScrollOffset, params } = useContext(FilterContext)\n const { chat_group_graph_id, group_source_app_name = '' } = params\n\n const activeFilter: 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 { groups = [] } = useGroupsToFilter()\n const { teams = [] } = useTeamsToFilter()\n\n const activeGroupId = chat_group_graph_id\n const isExactGroupFilter = activeFilter === FilterTypes.More\n\n const teamItems: DataItem<TeamRowProps, SectionTypes.teams>[] = teams.map(team => ({\n type: SectionTypes.teams,\n data: {\n team,\n isActive: isExactGroupFilter && team.id.toString() === activeGroupId,\n },\n }))\n\n const groupItems: DataItem<GroupRowProps, SectionTypes.groups>[] = groups.map(group => ({\n type: SectionTypes.groups,\n data: {\n group,\n isActive: isExactGroupFilter && group?.id.toString() === activeGroupId,\n },\n }))\n const groupItemData = selectActiveWithFirst(5)(groupItems)\n const teamItemData = selectActiveWithFirst(5)(teamItems)\n\n const hideAppFilters = groupItems.length < 1 || teamItems.length < 1\n\n const listData: SectionListData = [\n {\n type: hideAppFilters ? SectionTypes.hidden : SectionTypes.header,\n data: { title: 'General Filters' },\n },\n {\n type: hideAppFilters ? SectionTypes.hidden : SectionTypes.filter,\n data: { filter: FilterTypes.All, isActive: activeFilter === FilterTypes.All },\n },\n {\n type: hideAppFilters ? SectionTypes.hidden : SectionTypes.filter,\n data: {\n filter: FilterTypes.Groups,\n group_source_app_name: 'groups',\n isActive: activeFilter === FilterTypes.Groups,\n },\n },\n {\n type: hideAppFilters ? SectionTypes.hidden : SectionTypes.filter,\n data: {\n filter: FilterTypes.Teams,\n group_source_app_name: 'services',\n isActive: activeFilter === FilterTypes.Teams,\n },\n },\n {\n type: groupItems.length ? SectionTypes.header : SectionTypes.hidden,\n data: { title: 'Groups' },\n },\n ...groupItemData,\n {\n type: groupItems.length > 5 ? SectionTypes.more : SectionTypes.hidden,\n data: { routeName: 'GroupFilters' },\n },\n {\n type: teamItems.length ? SectionTypes.header : SectionTypes.hidden,\n data: { title: 'Teams' },\n },\n ...teamItemData,\n {\n type: teamItems.length > 5 ? SectionTypes.more : SectionTypes.hidden,\n data: { routeName: 'TeamFilters' },\n },\n ]\n\n return (\n <FlatList\n data={listData}\n contentContainerStyle={styles.flatlistContainer}\n nestedScrollEnabled={true}\n onScroll={e => setScrollOffset(e.nativeEvent.contentOffset.y)}\n renderItem={({ item }) => {\n switch (item.type) {\n case SectionTypes.header:\n return <Header {...item.data} />\n case SectionTypes.filter:\n return <FilterRow {...item.data} />\n case SectionTypes.groups:\n return <GroupRow {...item.data} />\n case SectionTypes.teams:\n return <TeamRow {...item.data} />\n case SectionTypes.more:\n return <ViewMore {...item.data} />\n default:\n return null\n }\n }}\n />\n )\n}\n\nconst useStyles = () => {\n const { bottom } = useSafeAreaInsets()\n const theme = useTheme()\n\n return StyleSheet.create({\n flatlistContainer: {\n paddingBottom: 64 + bottom,\n },\n section: {},\n sectionHeader: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n paddingTop: 24,\n paddingBottom: 8,\n paddingHorizontal: 16,\n },\n selectTeamsButton: {},\n filterBar: {\n backgroundColor: theme.colors.fillColorNeutral100Inverted,\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'center',\n paddingHorizontal: 16,\n paddingVertical: 16,\n gap: 8,\n },\n filterBarScroll: {\n elevation: 4,\n boxShadow: '0px 4px 4px rgba(0, 0, 0, 0.1)',\n },\n filterBarActions: {\n flexDirection: 'row',\n gap: 8,\n alignItems: 'center',\n },\n })\n}\n\ntype HeaderProps = {\n title: string\n}\n\nconst Header = ({ title }: HeaderProps) => {\n const styles = useStyles()\n\n return (\n <View style={styles.sectionHeader}>\n <Heading variant=\"h3\">{title}</Heading>\n </View>\n )\n}\n\ntype GroupSectionType =\n | DataItem<TeamRowProps, SectionTypes.teams>\n | DataItem<GroupRowProps, SectionTypes.groups>\n\nconst selectActiveWithFirst =\n (number: number) =>\n <T extends GroupSectionType>(groups: T[]): T[] => {\n const activeGroupIndex = groups.findIndex(group => group.data.isActive)\n const activeGroup = groups[activeGroupIndex]\n\n if (!activeGroup || activeGroupIndex <= number) {\n return groups.slice(0, number)\n }\n\n return [activeGroup, ...groups].slice(0, number)\n }\n"]}
@@ -0,0 +1,31 @@
1
+ import React, { PropsWithChildren } from 'react';
2
+ import { ViewStyle } from 'react-native';
3
+ import { GroupResource } from '../../../types/resources/group_resource';
4
+ import { FilterTypes } from '../filter_types';
5
+ import { FilteredGroup } from '../hooks/filters';
6
+ import { ConversationFilterStackParamList } from '../screen_props';
7
+ export type FilterProps = {
8
+ group_source_app_name?: string;
9
+ isActive: boolean;
10
+ filter: FilterTypes;
11
+ };
12
+ export declare const FilterRow: ({ group_source_app_name, isActive, filter }: FilterProps) => React.JSX.Element;
13
+ export type GroupRowProps = {
14
+ group: FilteredGroup;
15
+ isActive: boolean;
16
+ };
17
+ export declare const GroupRow: ({ group, isActive }: GroupRowProps) => React.JSX.Element;
18
+ export type TeamRowProps = {
19
+ team: GroupResource;
20
+ isActive: boolean;
21
+ };
22
+ export declare const TeamRow: ({ team }: TeamRowProps) => React.JSX.Element;
23
+ export type ViewMoreRowProps = {
24
+ routeName: keyof ConversationFilterStackParamList;
25
+ };
26
+ export declare const ViewMore: ({ routeName }: ViewMoreRowProps) => React.JSX.Element;
27
+ export declare const PressableRow: ({ children, onPress, style, }: PropsWithChildren<{
28
+ onPress: () => void;
29
+ style?: ViewStyle;
30
+ }>) => React.JSX.Element;
31
+ //# sourceMappingURL=rows.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rows.d.ts","sourceRoot":"","sources":["../../../../src/screens/conversation_filters/components/rows.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAc,MAAM,OAAO,CAAA;AAC5D,OAAO,EAAoB,SAAS,EAAE,MAAM,cAAc,CAAA;AAI1D,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAA;AAEvE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,gCAAgC,EAAE,MAAM,iBAAiB,CAAA;AAElE,MAAM,MAAM,WAAW,GAAG;IAAE,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,WAAW,CAAA;CAAE,CAAA;AAEpG,eAAO,MAAM,SAAS,gDAAiD,WAAW,sBAUjF,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,aAAa,CAAA;IACpB,QAAQ,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,eAAO,MAAM,QAAQ,wBAAyB,aAAa,sBA6B1D,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,aAAa,CAAA;IACnB,QAAQ,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,eAAO,MAAM,OAAO,aAAc,YAAY,sBA0B7C,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAAE,SAAS,EAAE,MAAM,gCAAgC,CAAA;CAAE,CAAA;AAEpF,eAAO,MAAM,QAAQ,kBAAmB,gBAAgB,sBASvD,CAAA;AAED,eAAO,MAAM,YAAY,kCAItB,iBAAiB,CAAC;IAAE,OAAO,EAAE,MAAM,IAAI,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAA;CAAE,CAAC,sBAO/D,CAAA"}
@@ -0,0 +1,111 @@
1
+ import { PlatformPressable } from '@react-navigation/elements';
2
+ import { useNavigation } from '@react-navigation/native';
3
+ import React, { useContext } from 'react';
4
+ import { StyleSheet, View } from 'react-native';
5
+ import { Heading, Icon, Image, Text, TextButton } from '../../../components';
6
+ import { useTheme } from '../../../hooks';
7
+ import { useServicesTeamsMap } from '../../../hooks/use_services_team';
8
+ import { FilterContext } from '../context/conversation_filter_context';
9
+ export const FilterRow = ({ group_source_app_name, isActive, filter }) => {
10
+ const styles = useRowStyles();
11
+ const { setAppFilter } = useContext(FilterContext);
12
+ return (<PressableRow style={styles.row} onPress={() => setAppFilter({ group_source_app_name })}>
13
+ <Text>{filter}</Text>
14
+ {isActive ? <Icon name="general.check" size={16} style={styles.rowIconRight}/> : null}
15
+ </PressableRow>);
16
+ };
17
+ export const GroupRow = ({ group, isActive }) => {
18
+ const styles = useRowStyles();
19
+ const { setGroupFilter } = useContext(FilterContext);
20
+ const handleFilterByGroup = () => {
21
+ setGroupFilter({ chat_group_graph_id: group.id });
22
+ };
23
+ const { headerImage, membershipsCount } = group;
24
+ return (<PressableRow style={styles.row} onPress={handleFilterByGroup}>
25
+ {headerImage?.thumbnail && (<Image source={{ uri: headerImage?.thumbnail }} resizeMode="cover" style={styles.rowImage} alt={`Image for ${group.name}`}/>)}
26
+ <View>
27
+ <Heading variant="h3" style={styles.rowTitle}>
28
+ {group.name}
29
+ </Heading>
30
+ {membershipsCount && <Text>{group.membershipsCount} members</Text>}
31
+ </View>
32
+ {isActive ? <Icon name="general.check" size={16} style={styles.rowIconRight}/> : null}
33
+ </PressableRow>);
34
+ };
35
+ export const TeamRow = ({ team }) => {
36
+ const styles = useRowStyles();
37
+ const { setGroupFilter } = useContext(FilterContext);
38
+ const servicesTeams = useServicesTeamsMap();
39
+ const { params } = useContext(FilterContext);
40
+ const { chat_group_graph_id } = params;
41
+ const isActive = chat_group_graph_id === team.id.toString();
42
+ const handleFilterByGroup = () => {
43
+ setGroupFilter({ chat_group_graph_id: team.id });
44
+ };
45
+ const servicesTeam = servicesTeams[team.id];
46
+ const serviceTypeName = servicesTeam?.serviceTypeName || servicesTeam?.group;
47
+ return (<PressableRow style={styles.row} onPress={handleFilterByGroup}>
48
+ <View>
49
+ <Heading variant="h3" style={styles.rowTitle}>
50
+ {team.name}
51
+ </Heading>
52
+ <Text>{serviceTypeName}</Text>
53
+ </View>
54
+ {isActive ? <Icon name="general.check" size={16} style={styles.rowIconRight}/> : null}
55
+ </PressableRow>);
56
+ };
57
+ export const ViewMore = ({ routeName }) => {
58
+ const styles = useRowStyles();
59
+ const navigation = useNavigation();
60
+ return (<View style={[styles.borderLessRow]}>
61
+ <TextButton onPress={() => navigation.navigate(routeName, {})}>View more</TextButton>
62
+ </View>);
63
+ };
64
+ export const PressableRow = ({ children, onPress, style, }) => {
65
+ const styles = useRowStyles();
66
+ return (<PlatformPressable style={styles.container} onPress={onPress}>
67
+ <View style={[styles.innerContainer, style]}>{children}</View>
68
+ </PlatformPressable>);
69
+ };
70
+ const ASPECT_RATIO = 16 / 9;
71
+ const THUMBNAIL_WIDTH = 80;
72
+ const THUMBNAIL_HEIGHT = THUMBNAIL_WIDTH / ASPECT_RATIO;
73
+ const useRowStyles = () => {
74
+ const theme = useTheme();
75
+ return StyleSheet.create({
76
+ container: {
77
+ paddingLeft: 16,
78
+ },
79
+ innerContainer: {
80
+ flexDirection: 'row',
81
+ alignItems: 'center',
82
+ gap: 12,
83
+ borderBottomWidth: 1,
84
+ borderBottomColor: theme.colors.fillColorNeutral050Base,
85
+ paddingVertical: 12,
86
+ paddingRight: 16,
87
+ },
88
+ borderLessRow: {
89
+ flexDirection: 'row',
90
+ alignItems: 'center',
91
+ gap: 12,
92
+ paddingVertical: 12,
93
+ paddingRight: 16,
94
+ paddingLeft: 16,
95
+ },
96
+ row: {},
97
+ rowImage: {
98
+ width: THUMBNAIL_WIDTH,
99
+ height: THUMBNAIL_HEIGHT,
100
+ borderRadius: 4,
101
+ },
102
+ rowIconRight: {
103
+ marginLeft: 'auto',
104
+ color: theme.colors.statusSuccessIcon,
105
+ },
106
+ rowTitle: {
107
+ fontSize: 16,
108
+ },
109
+ });
110
+ };
111
+ //# sourceMappingURL=rows.js.map