@planningcenter/chat-react-native 3.2.0-rc.2 → 3.2.0-rc.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/conversation/message_form.d.ts +2 -2
- package/build/components/conversation/message_form.d.ts.map +1 -1
- package/build/components/conversation/message_form.js +95 -41
- package/build/components/conversation/message_form.js.map +1 -1
- package/build/components/conversations/action_toggle_button.d.ts +1 -1
- package/build/components/conversations/action_toggle_button.d.ts.map +1 -1
- package/build/components/conversations/action_toggle_button.js +2 -1
- package/build/components/conversations/action_toggle_button.js.map +1 -1
- package/build/components/conversations/conversation_actions.d.ts.map +1 -1
- package/build/components/conversations/conversation_actions.js +25 -11
- package/build/components/conversations/conversation_actions.js.map +1 -1
- package/build/components/conversations/conversations.d.ts +3 -6
- package/build/components/conversations/conversations.d.ts.map +1 -1
- package/build/components/conversations/conversations.js +8 -18
- package/build/components/conversations/conversations.js.map +1 -1
- package/build/components/display/action_button.d.ts +2 -1
- package/build/components/display/action_button.d.ts.map +1 -1
- package/build/components/display/action_button.js +3 -4
- package/build/components/display/action_button.js.map +1 -1
- package/build/components/display/banner.d.ts +6 -1
- package/build/components/display/banner.d.ts.map +1 -1
- package/build/components/display/banner.js +2 -2
- package/build/components/display/banner.js.map +1 -1
- package/build/components/display/banner_collapsible.d.ts +1 -1
- package/build/components/display/banner_collapsible.d.ts.map +1 -1
- package/build/components/display/banner_collapsible.js +2 -2
- package/build/components/display/banner_collapsible.js.map +1 -1
- package/build/components/display/child_notice.d.ts +3 -1
- package/build/components/display/child_notice.d.ts.map +1 -1
- package/build/components/display/child_notice.js +2 -2
- package/build/components/display/child_notice.js.map +1 -1
- package/build/components/display/person.d.ts +3 -1
- package/build/components/display/person.d.ts.map +1 -1
- package/build/components/display/person.js +2 -2
- package/build/components/display/person.js.map +1 -1
- package/build/components/primitive/banner_primitive.d.ts +3 -0
- package/build/components/primitive/banner_primitive.d.ts.map +1 -1
- package/build/components/primitive/banner_primitive.js +4 -5
- package/build/components/primitive/banner_primitive.js.map +1 -1
- package/build/contexts/api_provider.d.ts +1 -1
- package/build/contexts/api_provider.d.ts.map +1 -1
- package/build/contexts/api_provider.js +3 -3
- package/build/contexts/api_provider.js.map +1 -1
- package/build/contexts/chat_context.d.ts +5 -3
- package/build/contexts/chat_context.d.ts.map +1 -1
- package/build/contexts/chat_context.js +8 -3
- package/build/contexts/chat_context.js.map +1 -1
- package/build/contexts/conversations_context.d.ts +14 -0
- package/build/contexts/conversations_context.d.ts.map +1 -0
- package/build/contexts/conversations_context.js +38 -0
- package/build/contexts/conversations_context.js.map +1 -0
- package/build/hooks/groups/use_group_members_for_new_conversation.d.ts +226 -0
- package/build/hooks/groups/use_group_members_for_new_conversation.d.ts.map +1 -0
- package/build/hooks/groups/use_group_members_for_new_conversation.js +54 -0
- package/build/hooks/groups/use_group_members_for_new_conversation.js.map +1 -0
- package/build/hooks/groups/use_groups_conversation_create.d.ts +9 -0
- package/build/hooks/groups/use_groups_conversation_create.d.ts.map +1 -0
- package/build/hooks/groups/use_groups_conversation_create.js +36 -0
- package/build/hooks/groups/use_groups_conversation_create.js.map +1 -0
- package/build/hooks/use_api.d.ts +41 -41
- package/build/hooks/use_api.d.ts.map +1 -1
- package/build/hooks/use_api.js +5 -0
- package/build/hooks/use_api.js.map +1 -1
- package/build/hooks/use_api_client.d.ts.map +1 -1
- package/build/hooks/use_api_client.js +5 -3
- package/build/hooks/use_api_client.js.map +1 -1
- package/build/hooks/use_chat_permissions.d.ts +14 -14
- package/build/hooks/use_conversations.d.ts +6 -32
- package/build/hooks/use_conversations.d.ts.map +1 -1
- package/build/hooks/use_conversations.js +15 -14
- package/build/hooks/use_conversations.js.map +1 -1
- package/build/hooks/use_conversations_actions.d.ts +221 -0
- package/build/hooks/use_conversations_actions.d.ts.map +1 -0
- package/build/hooks/use_conversations_actions.js +103 -0
- package/build/hooks/use_conversations_actions.js.map +1 -0
- package/build/hooks/use_conversations_cache.d.ts +18 -0
- package/build/hooks/use_conversations_cache.d.ts.map +1 -0
- package/build/hooks/{use_conversation_jolt_events.js → use_conversations_cache.js} +27 -17
- package/build/hooks/use_conversations_cache.js.map +1 -0
- package/build/hooks/use_conversations_jolt_events.d.ts +3 -0
- package/build/hooks/use_conversations_jolt_events.d.ts.map +1 -0
- package/build/hooks/use_conversations_jolt_events.js +15 -0
- package/build/hooks/use_conversations_jolt_events.js.map +1 -0
- package/build/hooks/use_current_person.d.ts +15 -0
- package/build/hooks/use_current_person.d.ts.map +1 -1
- package/build/hooks/use_current_person.js +26 -9
- package/build/hooks/use_current_person.js.map +1 -1
- package/build/hooks/use_giphy.d.ts +9 -0
- package/build/hooks/use_giphy.d.ts.map +1 -0
- package/build/hooks/use_giphy.js +63 -0
- package/build/hooks/use_giphy.js.map +1 -0
- package/build/hooks/use_groups.d.ts +26 -26
- package/build/hooks/use_groups_groups.d.ts +26 -26
- package/build/hooks/use_jolt.d.ts.map +1 -1
- package/build/hooks/use_jolt.js +42 -20
- package/build/hooks/use_jolt.js.map +1 -1
- package/build/hooks/use_message_create.d.ts +11 -0
- package/build/hooks/use_message_create.d.ts.map +1 -0
- package/build/hooks/use_message_create.js +35 -0
- package/build/hooks/use_message_create.js.map +1 -0
- package/build/hooks/use_suspense_api.d.ts.map +1 -1
- package/build/hooks/use_suspense_api.js +5 -0
- package/build/hooks/use_suspense_api.js.map +1 -1
- package/build/hooks/use_teams.d.ts +26 -26
- package/build/index.d.ts +2 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -2
- package/build/index.js.map +1 -1
- package/build/navigation/index.d.ts +65 -38
- package/build/navigation/index.d.ts.map +1 -1
- package/build/navigation/index.js +29 -10
- package/build/navigation/index.js.map +1 -1
- package/build/screens/conversation_details_screen.js +2 -2
- package/build/screens/conversation_details_screen.js.map +1 -1
- package/build/screens/conversation_filter_recipients/components/checkbox_row.d.ts +10 -0
- package/build/screens/conversation_filter_recipients/components/checkbox_row.d.ts.map +1 -0
- package/build/screens/conversation_filter_recipients/components/checkbox_row.js +74 -0
- package/build/screens/conversation_filter_recipients/components/checkbox_row.js.map +1 -0
- package/build/screens/conversation_filter_recipients/components/header_row.d.ts +10 -0
- package/build/screens/conversation_filter_recipients/components/header_row.d.ts.map +1 -0
- package/build/screens/conversation_filter_recipients/components/header_row.js +69 -0
- package/build/screens/conversation_filter_recipients/components/header_row.js.map +1 -0
- package/build/screens/conversation_filter_recipients/components/navigation_header.d.ts +5 -0
- package/build/screens/conversation_filter_recipients/components/navigation_header.d.ts.map +1 -0
- package/build/screens/conversation_filter_recipients/components/navigation_header.js +46 -0
- package/build/screens/conversation_filter_recipients/components/navigation_header.js.map +1 -0
- package/build/screens/conversation_filter_recipients/context/conversation_filter_recipients_context.d.ts +17 -0
- package/build/screens/conversation_filter_recipients/context/conversation_filter_recipients_context.d.ts.map +1 -0
- package/build/screens/conversation_filter_recipients/context/conversation_filter_recipients_context.js +37 -0
- package/build/screens/conversation_filter_recipients/context/conversation_filter_recipients_context.js.map +1 -0
- package/build/screens/{create → conversation_filter_recipients}/conversation_filter_recipients_screen.d.ts +1 -3
- package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.d.ts.map +1 -0
- package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js +87 -0
- package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js.map +1 -0
- package/build/screens/conversation_filter_recipients/hooks/use_flattened_array_of_service_types_with_teams.d.ts +10 -0
- package/build/screens/conversation_filter_recipients/hooks/use_flattened_array_of_service_types_with_teams.d.ts.map +1 -0
- package/build/screens/conversation_filter_recipients/hooks/use_flattened_array_of_service_types_with_teams.js +32 -0
- package/build/screens/conversation_filter_recipients/hooks/use_flattened_array_of_service_types_with_teams.js.map +1 -0
- package/build/screens/conversation_filter_recipients/hooks/use_service_types_with_teams.d.ts +8 -0
- package/build/screens/conversation_filter_recipients/hooks/use_service_types_with_teams.d.ts.map +1 -0
- package/build/screens/conversation_filter_recipients/hooks/use_service_types_with_teams.js +65 -0
- package/build/screens/conversation_filter_recipients/hooks/use_service_types_with_teams.js.map +1 -0
- package/build/screens/conversation_filter_recipients/types.d.ts +38 -0
- package/build/screens/conversation_filter_recipients/types.d.ts.map +1 -0
- package/build/screens/conversation_filter_recipients/types.js +6 -0
- package/build/screens/conversation_filter_recipients/types.js.map +1 -0
- package/build/screens/conversation_filters/hooks/filters.d.ts +40 -40
- package/build/screens/conversation_filters/hooks/filters.js +1 -1
- package/build/screens/conversation_filters/hooks/filters.js.map +1 -1
- package/build/screens/conversation_new/components/form_list.d.ts +12 -0
- package/build/screens/conversation_new/components/form_list.d.ts.map +1 -0
- package/build/screens/conversation_new/components/form_list.js +42 -0
- package/build/screens/conversation_new/components/form_list.js.map +1 -0
- package/build/screens/conversation_new/components/groups_form.d.ts +7 -0
- package/build/screens/conversation_new/components/groups_form.d.ts.map +1 -0
- package/build/screens/conversation_new/components/groups_form.js +105 -0
- package/build/screens/conversation_new/components/groups_form.js.map +1 -0
- package/build/screens/conversation_new/components/source_app_error_card.d.ts +2 -0
- package/build/screens/conversation_new/components/source_app_error_card.d.ts.map +1 -0
- package/build/screens/conversation_new/components/source_app_error_card.js +16 -0
- package/build/screens/conversation_new/components/source_app_error_card.js.map +1 -0
- package/build/screens/conversation_new/components/team_form.d.ts +8 -0
- package/build/screens/conversation_new/components/team_form.d.ts.map +1 -0
- package/build/screens/conversation_new/components/team_form.js +11 -0
- package/build/screens/conversation_new/components/team_form.js.map +1 -0
- package/build/screens/conversation_new/conversation_new_screen.d.ts +15 -0
- package/build/screens/conversation_new/conversation_new_screen.d.ts.map +1 -0
- package/build/screens/conversation_new/conversation_new_screen.js +16 -0
- package/build/screens/conversation_new/conversation_new_screen.js.map +1 -0
- package/build/screens/conversation_screen.d.ts +1 -0
- package/build/screens/conversation_screen.d.ts.map +1 -1
- package/build/screens/conversation_screen.js +1 -1
- package/build/screens/conversation_screen.js.map +1 -1
- package/build/screens/conversation_select_recipients/components/groups_without_chat_disclaimer_row.d.ts +2 -0
- package/build/screens/conversation_select_recipients/components/groups_without_chat_disclaimer_row.d.ts.map +1 -0
- package/build/screens/conversation_select_recipients/components/groups_without_chat_disclaimer_row.js +17 -0
- package/build/screens/conversation_select_recipients/components/groups_without_chat_disclaimer_row.js.map +1 -0
- package/build/screens/conversation_select_recipients/components/recipient_link_row.d.ts +12 -0
- package/build/screens/conversation_select_recipients/components/recipient_link_row.d.ts.map +1 -0
- package/build/screens/conversation_select_recipients/components/recipient_link_row.js +61 -0
- package/build/screens/conversation_select_recipients/components/recipient_link_row.js.map +1 -0
- package/build/screens/conversation_select_recipients/components/view_more_link_row.d.ts +7 -0
- package/build/screens/conversation_select_recipients/components/view_more_link_row.d.ts.map +1 -0
- package/build/screens/conversation_select_recipients/components/view_more_link_row.js +21 -0
- package/build/screens/conversation_select_recipients/components/view_more_link_row.js.map +1 -0
- package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.d.ts +4 -0
- package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.d.ts.map +1 -0
- package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.js +48 -0
- package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.js.map +1 -0
- package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.d.ts +4 -0
- package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.d.ts.map +1 -0
- package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.js +86 -0
- package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.js.map +1 -0
- package/build/screens/conversation_select_recipients/types/screen_props.d.ts +9 -0
- package/build/screens/conversation_select_recipients/types/screen_props.d.ts.map +1 -0
- package/build/screens/conversation_select_recipients/types/screen_props.js +2 -0
- package/build/screens/conversation_select_recipients/types/screen_props.js.map +1 -0
- package/build/screens/conversations/components/list_header_component.d.ts.map +1 -1
- package/build/screens/conversations/components/list_header_component.js +22 -4
- package/build/screens/conversations/components/list_header_component.js.map +1 -1
- package/build/screens/conversations/conversations_screen.d.ts +2 -1
- package/build/screens/conversations/conversations_screen.d.ts.map +1 -1
- package/build/screens/conversations/conversations_screen.js +35 -11
- package/build/screens/conversations/conversations_screen.js.map +1 -1
- package/build/screens/message_actions_screen.d.ts +2 -2
- package/build/screens/message_actions_screen.d.ts.map +1 -1
- package/build/screens/message_actions_screen.js.map +1 -1
- package/build/screens/send_giphy_screen.d.ts +10 -0
- package/build/screens/send_giphy_screen.d.ts.map +1 -0
- package/build/screens/send_giphy_screen.js +126 -0
- package/build/screens/send_giphy_screen.js.map +1 -0
- package/build/types/resources/groups/groups_group_resource.d.ts +1 -1
- package/build/types/resources/groups/groups_group_resource.js.map +1 -1
- package/build/types/resources/groups/groups_member_resource_with_person.d.ts +14 -0
- package/build/types/resources/groups/groups_member_resource_with_person.d.ts.map +1 -0
- package/build/types/resources/groups/groups_member_resource_with_person.js +2 -0
- package/build/types/resources/groups/groups_member_resource_with_person.js.map +1 -0
- package/build/types/resources/member.d.ts +0 -10
- package/build/types/resources/member.d.ts.map +1 -1
- package/build/types/resources/member.js.map +1 -1
- package/build/types/resources/oauth_token.d.ts +4 -4
- package/build/types/resources/oauth_token.d.ts.map +1 -1
- package/build/types/resources/oauth_token.js.map +1 -1
- package/build/utils/cache/page_mutations.d.ts +18 -0
- package/build/utils/cache/page_mutations.d.ts.map +1 -1
- package/build/utils/cache/page_mutations.js +13 -0
- package/build/utils/cache/page_mutations.js.map +1 -1
- package/build/utils/client/client.d.ts +4 -8
- package/build/utils/client/client.d.ts.map +1 -1
- package/build/utils/client/client.js +10 -9
- package/build/utils/client/client.js.map +1 -1
- package/build/utils/destructure_chat_group_graph_id.d.ts +10 -0
- package/build/utils/destructure_chat_group_graph_id.d.ts.map +1 -0
- package/build/utils/destructure_chat_group_graph_id.js +8 -0
- package/build/utils/destructure_chat_group_graph_id.js.map +1 -0
- package/build/utils/index.d.ts +1 -0
- package/build/utils/index.d.ts.map +1 -1
- package/build/utils/index.js +1 -0
- package/build/utils/index.js.map +1 -1
- package/build/utils/request/conversation.d.ts +1 -3
- package/build/utils/request/conversation.d.ts.map +1 -1
- package/build/utils/request/conversation.js +37 -30
- package/build/utils/request/conversation.js.map +1 -1
- package/build/utils/session.d.ts +6 -2
- package/build/utils/session.d.ts.map +1 -1
- package/build/utils/session.js +6 -1
- package/build/utils/session.js.map +1 -1
- package/build/utils/uri.d.ts +10 -2
- package/build/utils/uri.d.ts.map +1 -1
- package/build/utils/uri.js +24 -6
- package/build/utils/uri.js.map +1 -1
- package/build/vendor/tapestry/alias_tokens_color_map.d.ts +2 -0
- package/build/vendor/tapestry/alias_tokens_color_map.d.ts.map +1 -1
- package/build/vendor/tapestry/alias_tokens_color_map.js +2 -0
- package/build/vendor/tapestry/alias_tokens_color_map.js.map +1 -1
- package/package.json +4 -3
- package/src/__tests__/hooks/useTheme.tsx +1 -1
- package/src/__tests__/utils/cache/page_mutations.ts +49 -15
- package/src/__tests__/{client.ts → utils/client.ts} +7 -115
- package/src/__tests__/{session.ts → utils/session.ts} +4 -4
- package/src/__tests__/utils/uri.ts +107 -0
- package/src/components/conversation/message_form.tsx +127 -58
- package/src/components/conversations/action_toggle_button.tsx +2 -1
- package/src/components/conversations/conversation_actions.tsx +41 -14
- package/src/components/conversations/conversations.tsx +39 -52
- package/src/components/display/action_button.tsx +4 -3
- package/src/components/display/banner.tsx +7 -1
- package/src/components/display/banner_collapsible.tsx +6 -1
- package/src/components/display/child_notice.tsx +9 -3
- package/src/components/display/person.tsx +4 -3
- package/src/components/primitive/banner_primitive.tsx +12 -6
- package/src/contexts/api_provider.tsx +3 -3
- package/src/contexts/chat_context.tsx +13 -6
- package/src/contexts/conversations_context.tsx +69 -0
- package/src/hooks/groups/use_group_members_for_new_conversation.ts +62 -0
- package/src/hooks/groups/use_groups_conversation_create.ts +50 -0
- package/src/hooks/use_api.ts +11 -5
- package/src/hooks/use_api_client.ts +7 -3
- package/src/hooks/use_conversations.ts +34 -16
- package/src/hooks/use_conversations_actions.ts +119 -0
- package/src/hooks/{use_conversation_jolt_events.ts → use_conversations_cache.ts} +35 -20
- package/src/hooks/use_conversations_jolt_events.ts +25 -0
- package/src/hooks/use_current_person.ts +37 -9
- package/src/hooks/use_giphy.ts +97 -0
- package/src/hooks/use_jolt.ts +56 -20
- package/src/hooks/use_message_create.ts +55 -0
- package/src/hooks/use_suspense_api.ts +6 -0
- package/src/index.tsx +2 -1
- package/src/navigation/index.tsx +39 -10
- package/src/screens/conversation_details_screen.tsx +2 -2
- package/src/screens/conversation_filter_recipients/components/checkbox_row.tsx +101 -0
- package/src/screens/conversation_filter_recipients/components/header_row.tsx +99 -0
- package/src/screens/conversation_filter_recipients/components/navigation_header.tsx +68 -0
- package/src/screens/conversation_filter_recipients/context/conversation_filter_recipients_context.tsx +53 -0
- package/src/screens/conversation_filter_recipients/conversation_filter_recipients_screen.tsx +120 -0
- package/src/screens/conversation_filter_recipients/hooks/use_flattened_array_of_service_types_with_teams.tsx +50 -0
- package/src/screens/conversation_filter_recipients/hooks/use_service_types_with_teams.ts +90 -0
- package/src/screens/conversation_filter_recipients/types.tsx +47 -0
- package/src/screens/conversation_filters/hooks/filters.ts +1 -1
- package/src/screens/conversation_new/components/form_list.tsx +67 -0
- package/src/screens/conversation_new/components/groups_form.tsx +163 -0
- package/src/screens/conversation_new/components/source_app_error_card.tsx +24 -0
- package/src/screens/conversation_new/components/team_form.tsx +18 -0
- package/src/screens/conversation_new/conversation_new_screen.tsx +29 -0
- package/src/screens/conversation_screen.tsx +2 -1
- package/src/screens/conversation_select_recipients/components/groups_without_chat_disclaimer_row.tsx +21 -0
- package/src/screens/conversation_select_recipients/components/recipient_link_row.tsx +91 -0
- package/src/screens/conversation_select_recipients/components/view_more_link_row.tsx +30 -0
- package/src/screens/conversation_select_recipients/conversation_select_group_recipients_screen.tsx +79 -0
- package/src/screens/conversation_select_recipients/conversation_select_recipients_screen.tsx +121 -0
- package/src/screens/conversation_select_recipients/types/screen_props.tsx +11 -0
- package/src/screens/conversations/components/list_header_component.tsx +25 -4
- package/src/screens/conversations/conversations_screen.tsx +39 -17
- package/src/screens/message_actions_screen.tsx +2 -2
- package/src/screens/send_giphy_screen.tsx +184 -0
- package/src/types/resources/groups/groups_group_resource.ts +1 -1
- package/src/types/resources/groups/groups_member_resource_with_person.ts +13 -0
- package/src/types/resources/member.ts +0 -11
- package/src/types/resources/oauth_token.ts +4 -4
- package/src/utils/cache/page_mutations.ts +22 -0
- package/src/utils/client/client.ts +13 -13
- package/src/utils/destructure_chat_group_graph_id.ts +25 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/request/conversation.ts +39 -34
- package/src/utils/session.ts +10 -4
- package/src/utils/uri.ts +30 -6
- package/src/vendor/tapestry/alias_tokens_color_map.ts +3 -0
- package/build/contexts/swipeable_active_conversation.d.ts +0 -11
- package/build/contexts/swipeable_active_conversation.d.ts.map +0 -1
- package/build/contexts/swipeable_active_conversation.js +0 -16
- package/build/contexts/swipeable_active_conversation.js.map +0 -1
- package/build/hooks/use_conversation_jolt_events.d.ts +0 -2
- package/build/hooks/use_conversation_jolt_events.d.ts.map +0 -1
- package/build/hooks/use_conversation_jolt_events.js.map +0 -1
- package/build/screens/create/conversation_create_screen.d.ts +0 -9
- package/build/screens/create/conversation_create_screen.d.ts.map +0 -1
- package/build/screens/create/conversation_create_screen.js +0 -122
- package/build/screens/create/conversation_create_screen.js.map +0 -1
- package/build/screens/create/conversation_filter_recipients_screen.d.ts.map +0 -1
- package/build/screens/create/conversation_filter_recipients_screen.js +0 -52
- package/build/screens/create/conversation_filter_recipients_screen.js.map +0 -1
- package/build/screens/create/conversation_select_recipients_screen.d.ts +0 -8
- package/build/screens/create/conversation_select_recipients_screen.d.ts.map +0 -1
- package/build/screens/create/conversation_select_recipients_screen.js +0 -97
- package/build/screens/create/conversation_select_recipients_screen.js.map +0 -1
- package/src/contexts/swipeable_active_conversation.tsx +0 -27
- package/src/screens/create/conversation_create_screen.tsx +0 -151
- package/src/screens/create/conversation_filter_recipients_screen.tsx +0 -79
- package/src/screens/create/conversation_select_recipients_screen.tsx +0 -128
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { useCallback, useMemo } from 'react'
|
|
2
|
+
import { useApiGet } from '../../../hooks/use_api'
|
|
3
|
+
import { ResourceObject } from '../../../types'
|
|
4
|
+
import { ServiceTypeWithTeams } from '../types'
|
|
5
|
+
import { uniqBy } from 'lodash'
|
|
6
|
+
|
|
7
|
+
export function useServiceTypesWithTeams() {
|
|
8
|
+
const response = useApiGet<ServicesChatResource>({
|
|
9
|
+
url: `/chat`,
|
|
10
|
+
data: {
|
|
11
|
+
fields: {
|
|
12
|
+
Chat: ['teams_i_lead'],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
app: 'services',
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
const { data, isFetching, isError, error } = response
|
|
19
|
+
|
|
20
|
+
const teamsILead = data?.teamsILead || stableEmptyTeamResponseArray
|
|
21
|
+
|
|
22
|
+
const decoratedResponse = useMemo(() => {
|
|
23
|
+
return decorateTeamResponseItems(teamsILead)
|
|
24
|
+
}, [teamsILead])
|
|
25
|
+
|
|
26
|
+
const hasNoServicesAccess = useCallback(() => {
|
|
27
|
+
if (isError && error) {
|
|
28
|
+
const errorArray = error
|
|
29
|
+
const allErrors = errorArray.errors.map(e => e.detail)
|
|
30
|
+
if (allErrors.some(e => e.includes(NOT_IN_APPLICATION_CODE))) {
|
|
31
|
+
return true
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return false
|
|
35
|
+
}, [isError, error])
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
serviceTypes: decoratedResponse,
|
|
39
|
+
isFetching,
|
|
40
|
+
isError,
|
|
41
|
+
noServicesAccess: hasNoServicesAccess(),
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function decorateTeamResponseItems(teamResponseItems: TeamResponseItem[]) {
|
|
46
|
+
return teamResponseItems
|
|
47
|
+
.map(({ value, serviceTypeName, teamName }) => ({
|
|
48
|
+
service_type: {
|
|
49
|
+
id: value.serviceTypeId,
|
|
50
|
+
name: serviceTypeName,
|
|
51
|
+
},
|
|
52
|
+
team: {
|
|
53
|
+
id: value.teamId,
|
|
54
|
+
name: teamName,
|
|
55
|
+
},
|
|
56
|
+
}))
|
|
57
|
+
.reduce((acc: ServiceTypeWithTeams[], { service_type, team }) => {
|
|
58
|
+
let serviceTypeEntry = acc.find(entry => entry.id === service_type.id)
|
|
59
|
+
|
|
60
|
+
if (!serviceTypeEntry) {
|
|
61
|
+
serviceTypeEntry = {
|
|
62
|
+
id: service_type.id,
|
|
63
|
+
name: service_type.name,
|
|
64
|
+
teams: [],
|
|
65
|
+
}
|
|
66
|
+
acc.push(serviceTypeEntry)
|
|
67
|
+
}
|
|
68
|
+
const initialTeams = serviceTypeEntry.teams
|
|
69
|
+
serviceTypeEntry.teams = uniqBy([...initialTeams, team], 'id')
|
|
70
|
+
return acc
|
|
71
|
+
}, [])
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
interface TeamResponseItem {
|
|
75
|
+
value: {
|
|
76
|
+
teamId: number
|
|
77
|
+
serviceTypeId: number
|
|
78
|
+
}
|
|
79
|
+
name: string
|
|
80
|
+
teamName: string
|
|
81
|
+
serviceTypeName: string
|
|
82
|
+
order: string[]
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
interface ServicesChatResource extends ResourceObject {
|
|
86
|
+
teamsILead: TeamResponseItem[]
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const stableEmptyTeamResponseArray: TeamResponseItem[] = []
|
|
90
|
+
const NOT_IN_APPLICATION_CODE = 'TRASH_PANDA'
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type ViewStyle } from 'react-native'
|
|
2
|
+
import { AppName } from '../../types/resources/app_name'
|
|
3
|
+
import { StaticScreenProps } from '@react-navigation/native'
|
|
4
|
+
|
|
5
|
+
export interface ServiceTypeWithTeams {
|
|
6
|
+
id: number
|
|
7
|
+
name: string
|
|
8
|
+
teams: {
|
|
9
|
+
id: number
|
|
10
|
+
name: string
|
|
11
|
+
}[]
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export enum SectionTypes {
|
|
15
|
+
header,
|
|
16
|
+
team,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface ServiceTypeProps {
|
|
20
|
+
serviceTypeName: string
|
|
21
|
+
serviceTypeId: number
|
|
22
|
+
teamIdsForServiceType: number[]
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface TeamProps {
|
|
26
|
+
teamName: string
|
|
27
|
+
teamId: number
|
|
28
|
+
serviceTypeId: number
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export type SectionListData = Array<
|
|
32
|
+
DataItem<ServiceTypeProps, SectionTypes.header> | DataItem<TeamProps, SectionTypes.team>
|
|
33
|
+
>
|
|
34
|
+
|
|
35
|
+
interface DataItem<T, TName extends SectionTypes> {
|
|
36
|
+
type: TName
|
|
37
|
+
data: T
|
|
38
|
+
sectionStyle?: ViewStyle
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export type ConversationFilterRecipientsParams = {
|
|
42
|
+
source_app_name?: AppName
|
|
43
|
+
team_ids?: number[]
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export type ConversationFilterRecipientsScreenProps =
|
|
47
|
+
StaticScreenProps<ConversationFilterRecipientsParams>
|
|
@@ -46,7 +46,7 @@ export const useGroupsToFilter = () => {
|
|
|
46
46
|
() =>
|
|
47
47
|
groups
|
|
48
48
|
.map(group => {
|
|
49
|
-
const groupsGroup = groupsData.find(g => group.id
|
|
49
|
+
const groupsGroup = groupsData.find(g => group.id === `Groups-Group-${g.id}`)
|
|
50
50
|
const { membershipsCount, headerImage } = groupsGroup || {}
|
|
51
51
|
|
|
52
52
|
return {
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { StyleSheet, View } from 'react-native'
|
|
3
|
+
import { FlashList, type FlashListProps } from '@shopify/flash-list'
|
|
4
|
+
import { MemberResource } from '../../../types'
|
|
5
|
+
import { Person, Text } from '../../../components/display'
|
|
6
|
+
import { useTheme } from '../../../hooks'
|
|
7
|
+
|
|
8
|
+
interface FormListProps {
|
|
9
|
+
memberData: MemberResource[]
|
|
10
|
+
FormContent?: FlashListProps<MemberResource>['ListHeaderComponent']
|
|
11
|
+
listEmptyText?: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const FormList = ({ memberData, FormContent, listEmptyText }: FormListProps) => {
|
|
15
|
+
const styles = useStyles()
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<FlashList
|
|
19
|
+
data={memberData}
|
|
20
|
+
ListHeaderComponent={FormContent}
|
|
21
|
+
renderItem={({ item }) => <Person person={item} style={styles.person} />}
|
|
22
|
+
keyExtractor={item => item.id.toString()}
|
|
23
|
+
estimatedItemSize={45}
|
|
24
|
+
ListEmptyComponent={<ListEmptyText text={listEmptyText || 'No members found'} />}
|
|
25
|
+
/>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const ListEmptyText = ({ text }: { text: string }) => {
|
|
30
|
+
const styles = useStyles()
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<View style={styles.emptyTextContainer}>
|
|
34
|
+
<Text style={styles.emptyText}>{text}</Text>
|
|
35
|
+
</View>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const Divider = () => {
|
|
40
|
+
const styles = useStyles()
|
|
41
|
+
|
|
42
|
+
return <View style={styles.divider} />
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const useStyles = () => {
|
|
46
|
+
const { colors } = useTheme()
|
|
47
|
+
|
|
48
|
+
return StyleSheet.create({
|
|
49
|
+
person: {
|
|
50
|
+
paddingHorizontal: 16,
|
|
51
|
+
paddingBottom: 12,
|
|
52
|
+
},
|
|
53
|
+
emptyTextContainer: {
|
|
54
|
+
alignItems: 'center',
|
|
55
|
+
justifyContent: 'center',
|
|
56
|
+
padding: 32,
|
|
57
|
+
},
|
|
58
|
+
emptyText: {
|
|
59
|
+
textAlign: 'center',
|
|
60
|
+
color: colors.textColorDefaultSecondary,
|
|
61
|
+
},
|
|
62
|
+
divider: {
|
|
63
|
+
borderBottomWidth: 1,
|
|
64
|
+
borderBottomColor: colors.fillColorNeutral050Base,
|
|
65
|
+
},
|
|
66
|
+
})
|
|
67
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { StackActions, useNavigation } from '@react-navigation/native'
|
|
2
|
+
import React, { useCallback, useState } from 'react'
|
|
3
|
+
import { Platform, StyleSheet, TextInput, View } from 'react-native'
|
|
4
|
+
import { Banner, ChildNotice, Heading, Text } from '../../../components'
|
|
5
|
+
import { ActionButton } from '../../../components/display/action_button'
|
|
6
|
+
import { useSuspenseGet } from '../../../hooks'
|
|
7
|
+
import { GroupsGroupResource, MemberResource } from '../../../types'
|
|
8
|
+
import { Divider, FormList } from './form_list'
|
|
9
|
+
import { pluralize } from '../../../utils'
|
|
10
|
+
import { KeyboardView } from '../../../components/display/keyboard_view'
|
|
11
|
+
import { useGroupMembersForNewConversation } from '../../../hooks/groups/use_group_members_for_new_conversation'
|
|
12
|
+
import { useGroupsConversationCreate } from '../../../hooks/groups/use_groups_conversation_create'
|
|
13
|
+
|
|
14
|
+
type GroupsFormProps = {
|
|
15
|
+
groupId: number
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const GroupsForm = ({ groupId }: GroupsFormProps) => {
|
|
19
|
+
const navigation = useNavigation()
|
|
20
|
+
const [title, setTitle] = useState<string>()
|
|
21
|
+
const { data: group } = useSuspenseGet<GroupsGroupResource>({
|
|
22
|
+
url: `/me/groups/${groupId}`,
|
|
23
|
+
data: {
|
|
24
|
+
fields: {
|
|
25
|
+
Group: [],
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
app: 'groups',
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
const redirectToConversation = useCallback(
|
|
32
|
+
(conversationId: number) => {
|
|
33
|
+
// exit from the create stack
|
|
34
|
+
navigation.getParent()?.goBack()
|
|
35
|
+
// navigate to the conversation screen
|
|
36
|
+
navigation.dispatch(
|
|
37
|
+
StackActions.push('Conversation', {
|
|
38
|
+
conversation_id: conversationId,
|
|
39
|
+
})
|
|
40
|
+
)
|
|
41
|
+
},
|
|
42
|
+
[navigation]
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
const groupMemberships = useGroupMembersForNewConversation({ id: groupId })
|
|
46
|
+
|
|
47
|
+
const { mutate: handleSave } = useGroupsConversationCreate({
|
|
48
|
+
groupId,
|
|
49
|
+
title,
|
|
50
|
+
onSuccess: redirectToConversation,
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<KeyboardView>
|
|
55
|
+
<FormList
|
|
56
|
+
memberData={groupMemberships.adultMembers}
|
|
57
|
+
FormContent={
|
|
58
|
+
<FormContent
|
|
59
|
+
group={group}
|
|
60
|
+
title={title}
|
|
61
|
+
setTitle={setTitle}
|
|
62
|
+
isMemberError={groupMemberships.isError}
|
|
63
|
+
childMembers={groupMemberships.childMembers}
|
|
64
|
+
/>
|
|
65
|
+
}
|
|
66
|
+
/>
|
|
67
|
+
<ActionButton
|
|
68
|
+
disabled={!title}
|
|
69
|
+
title="Start Conversation"
|
|
70
|
+
onPress={() => handleSave()}
|
|
71
|
+
infoText="Conversation will be automatically updated if any members are added or removed from this group."
|
|
72
|
+
/>
|
|
73
|
+
</KeyboardView>
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
interface FormContentProps {
|
|
78
|
+
group: GroupsGroupResource
|
|
79
|
+
title?: string
|
|
80
|
+
setTitle: (title: string) => void
|
|
81
|
+
isMemberError: boolean
|
|
82
|
+
childMembers: MemberResource[]
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function FormContent({ group, title, setTitle, isMemberError, childMembers }: FormContentProps) {
|
|
86
|
+
const styles = useStyles()
|
|
87
|
+
const { name, membershipsCount } = group
|
|
88
|
+
const memberHeader = pluralize(membershipsCount, 'member')
|
|
89
|
+
const hasChildren = childMembers.length > 0
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<View style={styles.formContent}>
|
|
93
|
+
<View style={styles.toSection}>
|
|
94
|
+
<Heading variant="h3">To:</Heading>
|
|
95
|
+
<Text style={styles.groupName}>{name}</Text>
|
|
96
|
+
</View>
|
|
97
|
+
<Divider />
|
|
98
|
+
<View style={styles.titleSection}>
|
|
99
|
+
<Heading variant="h3">Title</Heading>
|
|
100
|
+
<TextInput
|
|
101
|
+
placeholder="Topic of conversation (required)"
|
|
102
|
+
value={title}
|
|
103
|
+
onChangeText={setTitle}
|
|
104
|
+
style={styles.titleInput}
|
|
105
|
+
autoFocus={true}
|
|
106
|
+
/>
|
|
107
|
+
</View>
|
|
108
|
+
<Divider />
|
|
109
|
+
<View style={styles.memberSection}>
|
|
110
|
+
<Heading variant="h3">{memberHeader} selected</Heading>
|
|
111
|
+
{hasChildren && <ChildNotice childMembers={childMembers} style={styles.banner} />}
|
|
112
|
+
{isMemberError && (
|
|
113
|
+
<Banner
|
|
114
|
+
appearance="error"
|
|
115
|
+
description="There was an issue loading group members, please refresh and try again."
|
|
116
|
+
style={styles.banner}
|
|
117
|
+
/>
|
|
118
|
+
)}
|
|
119
|
+
</View>
|
|
120
|
+
</View>
|
|
121
|
+
)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const useStyles = () => {
|
|
125
|
+
const sectionPadding = 16
|
|
126
|
+
const inputPadding = 8
|
|
127
|
+
|
|
128
|
+
return StyleSheet.create({
|
|
129
|
+
formContent: {
|
|
130
|
+
paddingVertical: sectionPadding,
|
|
131
|
+
flex: 1,
|
|
132
|
+
},
|
|
133
|
+
toSection: {
|
|
134
|
+
padding: sectionPadding,
|
|
135
|
+
flexDirection: 'row',
|
|
136
|
+
gap: 8,
|
|
137
|
+
},
|
|
138
|
+
groupName: {
|
|
139
|
+
fontSize: 18,
|
|
140
|
+
},
|
|
141
|
+
titleSection: {
|
|
142
|
+
padding: sectionPadding,
|
|
143
|
+
paddingBottom: Platform.select({
|
|
144
|
+
ios: sectionPadding,
|
|
145
|
+
android: sectionPadding - inputPadding,
|
|
146
|
+
}),
|
|
147
|
+
gap: Platform.select({
|
|
148
|
+
ios: 8,
|
|
149
|
+
android: 0,
|
|
150
|
+
}),
|
|
151
|
+
},
|
|
152
|
+
titleInput: {
|
|
153
|
+
fontSize: 18,
|
|
154
|
+
},
|
|
155
|
+
memberSection: {
|
|
156
|
+
padding: sectionPadding,
|
|
157
|
+
paddingBottom: 0,
|
|
158
|
+
},
|
|
159
|
+
banner: {
|
|
160
|
+
marginTop: 16,
|
|
161
|
+
},
|
|
162
|
+
})
|
|
163
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { StyleSheet, View } from 'react-native'
|
|
2
|
+
import { Banner } from '../../../components'
|
|
3
|
+
|
|
4
|
+
export const SourceAppErrorCard = () => {
|
|
5
|
+
const styles = useStyles()
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<View style={styles.container}>
|
|
9
|
+
<Banner
|
|
10
|
+
appearance="error"
|
|
11
|
+
heading="Invalid Source App"
|
|
12
|
+
description="Something went wrong, try going back and selecting the recipient again."
|
|
13
|
+
/>
|
|
14
|
+
</View>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const useStyles = () => {
|
|
19
|
+
return StyleSheet.create({
|
|
20
|
+
container: {
|
|
21
|
+
padding: 16,
|
|
22
|
+
},
|
|
23
|
+
})
|
|
24
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { View } from 'react-native'
|
|
3
|
+
import { Text } from '../../../components'
|
|
4
|
+
|
|
5
|
+
type TeamFormProps = {
|
|
6
|
+
initialTeamIds?: number[]
|
|
7
|
+
initialPlanId?: number
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const TeamsForm = ({ initialTeamIds, initialPlanId }: TeamFormProps) => {
|
|
11
|
+
console.log('initialTeamIds', initialTeamIds)
|
|
12
|
+
console.log('initialPlanId', initialPlanId)
|
|
13
|
+
return (
|
|
14
|
+
<View>
|
|
15
|
+
<Text>Services team form coming soon</Text>
|
|
16
|
+
</View>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { StaticScreenProps } from '@react-navigation/native'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { GroupsForm } from './components/groups_form'
|
|
4
|
+
import { TeamsForm } from './components/team_form'
|
|
5
|
+
import { SourceAppErrorCard } from './components/source_app_error_card'
|
|
6
|
+
import { AppName } from '../../types/resources/app_name'
|
|
7
|
+
import { GraphId } from '../../types/resources/group_resource'
|
|
8
|
+
|
|
9
|
+
type ConversationNewScreenProps = StaticScreenProps<{
|
|
10
|
+
group_id?: number
|
|
11
|
+
team_ids?: number[]
|
|
12
|
+
plan_id?: number
|
|
13
|
+
source_app_name: AppName
|
|
14
|
+
chat_group_graph_id?: GraphId
|
|
15
|
+
group_source_app_name?: AppName
|
|
16
|
+
}>
|
|
17
|
+
|
|
18
|
+
export const ConversationNewScreen = ({ route }: ConversationNewScreenProps) => {
|
|
19
|
+
const { group_id, team_ids, source_app_name, plan_id } = route.params
|
|
20
|
+
|
|
21
|
+
switch (source_app_name) {
|
|
22
|
+
case 'Groups':
|
|
23
|
+
return group_id ? <GroupsForm groupId={group_id} /> : <SourceAppErrorCard />
|
|
24
|
+
case 'Services':
|
|
25
|
+
return <TeamsForm initialTeamIds={team_ids} initialPlanId={plan_id} />
|
|
26
|
+
default:
|
|
27
|
+
return <SourceAppErrorCard />
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -18,6 +18,7 @@ import { useConversationMessages } from '../hooks/use_conversation_messages'
|
|
|
18
18
|
type ConversationRouteProps = {
|
|
19
19
|
conversation_id: number
|
|
20
20
|
chat_group_graph_id?: string
|
|
21
|
+
clear_input?: boolean
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
export type ConversationScreenProps = StaticScreenProps<ConversationRouteProps>
|
|
@@ -57,7 +58,7 @@ export function ConversationScreen({ route }: ConversationScreenProps) {
|
|
|
57
58
|
/>
|
|
58
59
|
<MessageForm.Root conversation={conversation}>
|
|
59
60
|
{/* <MessageForm.AttachmentPicker /> */}
|
|
60
|
-
|
|
61
|
+
<MessageForm.Commands />
|
|
61
62
|
<MessageForm.TextInput />
|
|
62
63
|
<MessageForm.SubmitButton />
|
|
63
64
|
</MessageForm.Root>
|
package/src/screens/conversation_select_recipients/components/groups_without_chat_disclaimer_row.tsx
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Text } from '../../../components'
|
|
2
|
+
import { StyleSheet } from 'react-native'
|
|
3
|
+
|
|
4
|
+
export const GroupsWithoutChatDisclaimerRow = () => {
|
|
5
|
+
const styles = useStyles()
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<Text variant="footnote" style={styles.disclaimer}>
|
|
9
|
+
*You have additional groups without chat enabled or permissions to start a new conversation.
|
|
10
|
+
</Text>
|
|
11
|
+
)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const useStyles = () => {
|
|
15
|
+
return StyleSheet.create({
|
|
16
|
+
disclaimer: {
|
|
17
|
+
paddingHorizontal: 16,
|
|
18
|
+
paddingVertical: 12,
|
|
19
|
+
},
|
|
20
|
+
})
|
|
21
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { PlatformPressable } from '@react-navigation/elements'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { StyleSheet, View } from 'react-native'
|
|
4
|
+
import { Icon, Image, Text } from '../../../components'
|
|
5
|
+
import { useTheme } from '../../../hooks'
|
|
6
|
+
import { platformFontWeightMedium } from '../../../utils'
|
|
7
|
+
|
|
8
|
+
interface RecipientLinkRowProps {
|
|
9
|
+
onPress: () => void
|
|
10
|
+
accessibilityLabel: string
|
|
11
|
+
accessibilityHint: string
|
|
12
|
+
imageUri?: string
|
|
13
|
+
title: string
|
|
14
|
+
subtitle: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const RecipientLinkRow = ({
|
|
18
|
+
onPress,
|
|
19
|
+
accessibilityLabel,
|
|
20
|
+
accessibilityHint,
|
|
21
|
+
imageUri,
|
|
22
|
+
title,
|
|
23
|
+
subtitle,
|
|
24
|
+
}: RecipientLinkRowProps) => {
|
|
25
|
+
const styles = useStyles()
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<PlatformPressable
|
|
29
|
+
style={styles.row}
|
|
30
|
+
onPress={onPress}
|
|
31
|
+
accessibilityRole="link"
|
|
32
|
+
accessibilityLabel={accessibilityLabel}
|
|
33
|
+
accessibilityHint={accessibilityHint}
|
|
34
|
+
>
|
|
35
|
+
<View style={styles.innerContainer}>
|
|
36
|
+
{imageUri && (
|
|
37
|
+
<Image source={{ uri: imageUri }} resizeMode="cover" style={styles.image} alt="" />
|
|
38
|
+
)}
|
|
39
|
+
<View style={styles.content}>
|
|
40
|
+
<Text style={styles.title} numberOfLines={2}>
|
|
41
|
+
{title}
|
|
42
|
+
</Text>
|
|
43
|
+
<Text variant="tertiary" numberOfLines={1}>
|
|
44
|
+
{subtitle}
|
|
45
|
+
</Text>
|
|
46
|
+
</View>
|
|
47
|
+
<Icon name="general.rightChevron" size={16} style={styles.icon} />
|
|
48
|
+
</View>
|
|
49
|
+
</PlatformPressable>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const ASPECT_RATIO = 16 / 9
|
|
54
|
+
const THUMBNAIL_WIDTH = 80
|
|
55
|
+
const THUMBNAIL_HEIGHT = THUMBNAIL_WIDTH / ASPECT_RATIO
|
|
56
|
+
|
|
57
|
+
const useStyles = () => {
|
|
58
|
+
const theme = useTheme()
|
|
59
|
+
|
|
60
|
+
return StyleSheet.create({
|
|
61
|
+
row: {
|
|
62
|
+
paddingLeft: 16,
|
|
63
|
+
},
|
|
64
|
+
innerContainer: {
|
|
65
|
+
flexDirection: 'row',
|
|
66
|
+
alignItems: 'center',
|
|
67
|
+
gap: 12,
|
|
68
|
+
paddingVertical: 16,
|
|
69
|
+
paddingRight: 16,
|
|
70
|
+
borderBottomWidth: 1,
|
|
71
|
+
borderColor: theme.colors.fillColorNeutral050Base,
|
|
72
|
+
},
|
|
73
|
+
image: {
|
|
74
|
+
width: THUMBNAIL_WIDTH,
|
|
75
|
+
height: THUMBNAIL_HEIGHT,
|
|
76
|
+
borderRadius: 4,
|
|
77
|
+
},
|
|
78
|
+
title: {
|
|
79
|
+
fontWeight: platformFontWeightMedium,
|
|
80
|
+
flexShrink: 1,
|
|
81
|
+
},
|
|
82
|
+
content: {
|
|
83
|
+
flexShrink: 1,
|
|
84
|
+
gap: 2,
|
|
85
|
+
},
|
|
86
|
+
icon: {
|
|
87
|
+
marginLeft: 'auto',
|
|
88
|
+
color: theme.colors.fillColorNeutral030,
|
|
89
|
+
},
|
|
90
|
+
})
|
|
91
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { StyleSheet, View } from 'react-native'
|
|
2
|
+
import { TextButton } from '../../../components'
|
|
3
|
+
|
|
4
|
+
interface ViewMoreLinkRowProps {
|
|
5
|
+
onPress: () => void
|
|
6
|
+
accessibilityHint: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const ViewMoreLinkRow = ({ accessibilityHint, onPress }: ViewMoreLinkRowProps) => {
|
|
10
|
+
const styles = useRowStyles()
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<View style={[styles.row]}>
|
|
14
|
+
<TextButton onPress={onPress} accessibilityHint={accessibilityHint} accessibilityRole="link">
|
|
15
|
+
View more
|
|
16
|
+
</TextButton>
|
|
17
|
+
</View>
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const useRowStyles = () => {
|
|
22
|
+
return StyleSheet.create({
|
|
23
|
+
row: {
|
|
24
|
+
flexDirection: 'row',
|
|
25
|
+
alignItems: 'center',
|
|
26
|
+
paddingVertical: 12,
|
|
27
|
+
paddingHorizontal: 16,
|
|
28
|
+
},
|
|
29
|
+
})
|
|
30
|
+
}
|
package/src/screens/conversation_select_recipients/conversation_select_group_recipients_screen.tsx
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { useNavigation } from '@react-navigation/native'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { StyleSheet, View } from 'react-native'
|
|
4
|
+
import { FlashList } from '@shopify/flash-list'
|
|
5
|
+
import { Heading } from '../../components'
|
|
6
|
+
import { GroupsGroupResource } from '../../types'
|
|
7
|
+
import { useGroupsGroups } from '../../hooks/use_groups_groups'
|
|
8
|
+
import { pluralize } from '../../utils'
|
|
9
|
+
import { RecipientLinkRow } from './components/recipient_link_row'
|
|
10
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
11
|
+
import { ConversationSelectRecipientsScreenProps } from './types/screen_props'
|
|
12
|
+
import { GroupsWithoutChatDisclaimerRow } from './components/groups_without_chat_disclaimer_row'
|
|
13
|
+
|
|
14
|
+
export const ConversationSelectGroupRecipientsScreen = ({
|
|
15
|
+
route,
|
|
16
|
+
}: ConversationSelectRecipientsScreenProps) => {
|
|
17
|
+
const styles = useStyles()
|
|
18
|
+
const navigation = useNavigation()
|
|
19
|
+
const { data: groups = [] } = useGroupsGroups()
|
|
20
|
+
const groupsWithCreatePermission = groups.filter(g => g.canCreateConversation)
|
|
21
|
+
const showGroupsDisclaimer = groups.length > groupsWithCreatePermission.length
|
|
22
|
+
|
|
23
|
+
const handleNavigateToConversationNew = (group: GroupsGroupResource) => {
|
|
24
|
+
navigation.navigate('New', {
|
|
25
|
+
screen: 'ConversationNew',
|
|
26
|
+
params: {
|
|
27
|
+
group_id: group.id,
|
|
28
|
+
source_app_name: 'Groups',
|
|
29
|
+
...route.params,
|
|
30
|
+
},
|
|
31
|
+
})
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<FlashList
|
|
36
|
+
data={groupsWithCreatePermission}
|
|
37
|
+
keyExtractor={item => item.id.toString()}
|
|
38
|
+
estimatedItemSize={65}
|
|
39
|
+
contentContainerStyle={styles.contentContainer}
|
|
40
|
+
ListHeaderComponent={
|
|
41
|
+
<View style={styles.sectionHeader}>
|
|
42
|
+
<Heading variant="h3">All my groups</Heading>
|
|
43
|
+
</View>
|
|
44
|
+
}
|
|
45
|
+
renderItem={({ item: group }: { item: GroupsGroupResource }) => {
|
|
46
|
+
const groupAccessibilityLabel = `Select ${group.name} with ${pluralize(group.membershipsCount, 'member')}`
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<RecipientLinkRow
|
|
50
|
+
key={group.id}
|
|
51
|
+
imageUri={group.headerImage?.thumbnail}
|
|
52
|
+
title={group.name}
|
|
53
|
+
subtitle={`${group.membershipsCount} members`}
|
|
54
|
+
onPress={() => handleNavigateToConversationNew(group)}
|
|
55
|
+
accessibilityLabel={groupAccessibilityLabel}
|
|
56
|
+
accessibilityHint={`Selects group as recipient and navigates to the final screen to finish creating the conversation`}
|
|
57
|
+
/>
|
|
58
|
+
)
|
|
59
|
+
}}
|
|
60
|
+
ListFooterComponent={showGroupsDisclaimer ? <GroupsWithoutChatDisclaimerRow /> : null}
|
|
61
|
+
/>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const useStyles = () => {
|
|
66
|
+
const { bottom } = useSafeAreaInsets()
|
|
67
|
+
|
|
68
|
+
return StyleSheet.create({
|
|
69
|
+
contentContainer: {
|
|
70
|
+
paddingBottom: bottom,
|
|
71
|
+
},
|
|
72
|
+
sectionHeader: {
|
|
73
|
+
flexDirection: 'row',
|
|
74
|
+
justifyContent: 'space-between',
|
|
75
|
+
padding: 16,
|
|
76
|
+
paddingBottom: 4,
|
|
77
|
+
},
|
|
78
|
+
})
|
|
79
|
+
}
|