@planningcenter/chat-react-native 3.2.0-rc.9 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/conversation/message_form/message_form_attachment_image.d.ts +13 -0
- package/build/components/conversation/message_form/message_form_attachment_image.d.ts.map +1 -0
- package/build/components/conversation/message_form/message_form_attachment_image.js +78 -0
- package/build/components/conversation/message_form/message_form_attachment_image.js.map +1 -0
- package/build/components/conversation/message_form.d.ts.map +1 -1
- package/build/components/conversation/message_form.js +128 -16
- package/build/components/conversation/message_form.js.map +1 -1
- package/build/components/conversations/conversation_actions.d.ts +2 -2
- package/build/components/conversations/conversation_actions.d.ts.map +1 -1
- package/build/components/conversations/conversation_actions.js.map +1 -1
- package/build/components/conversations/conversation_preview.d.ts +3 -1
- package/build/components/conversations/conversation_preview.d.ts.map +1 -1
- package/build/components/conversations/conversation_preview.js +2 -2
- package/build/components/conversations/conversation_preview.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/group_conversation_list.d.ts +19 -0
- package/build/components/group_conversation_list.d.ts.map +1 -0
- package/build/components/group_conversation_list.js +48 -0
- package/build/components/group_conversation_list.js.map +1 -0
- package/build/components/index.d.ts +1 -0
- package/build/components/index.d.ts.map +1 -1
- package/build/components/index.js +1 -0
- package/build/components/index.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 -4
- 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 +4 -4
- package/build/contexts/chat_context.d.ts.map +1 -1
- package/build/contexts/chat_context.js +3 -3
- package/build/contexts/chat_context.js.map +1 -1
- package/build/contexts/conversations_context.js +1 -1
- package/build/contexts/conversations_context.js.map +1 -1
- package/build/hooks/attachments/supported_extensions.d.ts +2 -0
- package/build/hooks/attachments/supported_extensions.d.ts.map +1 -0
- package/build/hooks/attachments/supported_extensions.js +48 -0
- package/build/hooks/attachments/supported_extensions.js.map +1 -0
- package/build/hooks/groups/use_group_members_for_new_conversation.d.ts +235 -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 +55 -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/index.d.ts +4 -0
- package/build/hooks/index.d.ts.map +1 -1
- package/build/hooks/index.js +4 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/use_api.d.ts +43 -43
- 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_attachment_uploader.d.ts +26 -0
- package/build/hooks/use_attachment_uploader.d.ts.map +1 -0
- package/build/hooks/use_attachment_uploader.js +111 -0
- package/build/hooks/use_attachment_uploader.js.map +1 -0
- package/build/hooks/use_chat_permissions.d.ts +14 -14
- package/build/hooks/use_conversation.d.ts.map +1 -1
- package/build/hooks/use_conversation.js +1 -0
- package/build/hooks/use_conversation.js.map +1 -1
- package/build/hooks/use_conversations_actions.d.ts.map +1 -1
- package/build/hooks/use_conversations_actions.js +10 -0
- package/build/hooks/use_conversations_actions.js.map +1 -1
- package/build/hooks/use_conversations_jolt_events.d.ts.map +1 -1
- package/build/hooks/use_conversations_jolt_events.js +4 -1
- package/build/hooks/use_conversations_jolt_events.js.map +1 -1
- 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_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 +15 -22
- package/build/hooks/use_jolt.js.map +1 -1
- package/build/hooks/use_message_create.js +2 -2
- package/build/hooks/use_message_create.js.map +1 -1
- 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/hooks/use_upload_client.d.ts +28 -0
- package/build/hooks/use_upload_client.d.ts.map +1 -0
- package/build/hooks/use_upload_client.js +32 -0
- package/build/hooks/use_upload_client.js.map +1 -0
- package/build/index.d.ts +3 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3 -2
- package/build/index.js.map +1 -1
- package/build/navigation/index.d.ts +52 -34
- package/build/navigation/index.d.ts.map +1 -1
- package/build/navigation/index.js +16 -2
- 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/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 -1
- package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js +67 -32
- package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js.map +1 -1
- 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/components/conversation_filters.js +5 -2
- package/build/screens/conversation_filters/components/conversation_filters.js.map +1 -1
- package/build/screens/conversation_filters/components/rows.d.ts.map +1 -1
- package/build/screens/conversation_filters/components/rows.js +6 -1
- package/build/screens/conversation_filters/components/rows.js.map +1 -1
- package/build/screens/conversation_filters/group_filters.d.ts.map +1 -1
- package/build/screens/conversation_filters/group_filters.js +12 -4
- package/build/screens/conversation_filters/group_filters.js.map +1 -1
- 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_filters/team_filters.d.ts.map +1 -1
- package/build/screens/conversation_filters/team_filters.js +12 -4
- package/build/screens/conversation_filters/team_filters.js.map +1 -1
- package/build/screens/conversation_filters_screen.js +1 -0
- package/build/screens/conversation_filters_screen.js.map +1 -1
- package/build/screens/conversation_new/components/groups_form.d.ts +4 -2
- package/build/screens/conversation_new/components/groups_form.d.ts.map +1 -1
- package/build/screens/conversation_new/components/groups_form.js +40 -55
- package/build/screens/conversation_new/components/groups_form.js.map +1 -1
- package/build/screens/conversation_new/components/team_form.d.ts +1 -1
- package/build/screens/conversation_new/components/team_form.js.map +1 -1
- package/build/screens/conversation_new/conversation_new_screen.d.ts +5 -2
- package/build/screens/conversation_new/conversation_new_screen.d.ts.map +1 -1
- package/build/screens/conversation_new/conversation_new_screen.js +2 -2
- package/build/screens/conversation_new/conversation_new_screen.js.map +1 -1
- package/build/screens/conversation_screen.d.ts +7 -0
- package/build/screens/conversation_screen.d.ts.map +1 -1
- package/build/screens/conversation_screen.js +103 -4
- 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 +2 -6
- package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.d.ts.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.js +37 -49
- package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.js.map +1 -1
- 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 +18 -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 +32 -1
- package/build/screens/conversations/conversations_screen.js.map +1 -1
- package/build/screens/send_giphy_screen.js +29 -1
- package/build/screens/send_giphy_screen.js.map +1 -1
- 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/message.d.ts +2 -0
- package/build/types/resources/message.d.ts.map +1 -1
- package/build/types/resources/message.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/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/date.d.ts +5 -0
- package/build/utils/date.d.ts.map +1 -1
- package/build/utils/date.js +8 -1
- package/build/utils/date.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/native_adapters/configuration.d.ts +4 -1
- package/build/utils/native_adapters/configuration.d.ts.map +1 -1
- package/build/utils/native_adapters/configuration.js +13 -1
- package/build/utils/native_adapters/configuration.js.map +1 -1
- package/build/utils/native_adapters/image_picker.d.ts +25 -0
- package/build/utils/native_adapters/image_picker.d.ts.map +1 -0
- package/build/utils/native_adapters/image_picker.js +9 -0
- package/build/utils/native_adapters/image_picker.js.map +1 -0
- package/build/utils/native_adapters/index.d.ts +1 -0
- package/build/utils/native_adapters/index.d.ts.map +1 -1
- package/build/utils/native_adapters/index.js +1 -0
- package/build/utils/native_adapters/index.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/upload_uri.d.ts +23 -0
- package/build/utils/upload_uri.d.ts.map +1 -0
- package/build/utils/upload_uri.js +60 -0
- package/build/utils/upload_uri.js.map +1 -0
- 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__/{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/message_form_attachment_image.tsx +121 -0
- package/src/components/conversation/message_form.tsx +197 -31
- package/src/components/conversations/conversation_actions.tsx +2 -2
- package/src/components/conversations/conversation_preview.tsx +8 -2
- 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/group_conversation_list.tsx +82 -0
- package/src/components/index.tsx +1 -0
- package/src/components/primitive/banner_primitive.tsx +12 -5
- package/src/contexts/api_provider.tsx +3 -3
- package/src/contexts/chat_context.tsx +7 -7
- package/src/contexts/conversations_context.tsx +1 -1
- package/src/hooks/attachments/supported_extensions.ts +47 -0
- package/src/hooks/groups/use_group_members_for_new_conversation.ts +74 -0
- package/src/hooks/groups/use_groups_conversation_create.ts +50 -0
- package/src/hooks/index.ts +4 -0
- package/src/hooks/use_api.ts +13 -7
- package/src/hooks/use_api_client.ts +7 -3
- package/src/hooks/use_attachment_uploader.ts +179 -0
- package/src/hooks/use_conversation.ts +1 -0
- package/src/hooks/use_conversations_actions.ts +11 -0
- package/src/hooks/use_conversations_jolt_events.ts +5 -1
- package/src/hooks/use_current_person.ts +37 -9
- package/src/hooks/use_jolt.ts +18 -23
- package/src/hooks/use_message_create.ts +2 -2
- package/src/hooks/use_suspense_api.ts +6 -0
- package/src/hooks/use_upload_client.ts +67 -0
- package/src/index.tsx +3 -1
- package/src/navigation/index.tsx +23 -2
- 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 +90 -49
- 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/components/conversation_filters.tsx +5 -2
- package/src/screens/conversation_filters/components/rows.tsx +6 -1
- package/src/screens/conversation_filters/group_filters.tsx +23 -14
- package/src/screens/conversation_filters/hooks/filters.ts +1 -1
- package/src/screens/conversation_filters/team_filters.tsx +23 -14
- package/src/screens/conversation_filters_screen.tsx +1 -0
- package/src/screens/conversation_new/components/groups_form.tsx +66 -72
- package/src/screens/conversation_new/components/team_form.tsx +1 -1
- package/src/screens/conversation_new/conversation_new_screen.tsx +11 -4
- package/src/screens/conversation_screen.tsx +123 -4
- 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 +57 -65
- package/src/screens/conversation_select_recipients/types/screen_props.tsx +11 -0
- package/src/screens/conversations/components/list_header_component.tsx +20 -4
- package/src/screens/conversations/conversations_screen.tsx +37 -2
- package/src/screens/send_giphy_screen.tsx +30 -1
- 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/message.ts +2 -0
- package/src/types/resources/oauth_token.ts +4 -4
- package/src/utils/client/client.ts +13 -13
- package/src/utils/date.ts +11 -1
- package/src/utils/destructure_chat_group_graph_id.ts +25 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/native_adapters/configuration.ts +15 -1
- package/src/utils/native_adapters/image_picker.ts +31 -0
- package/src/utils/native_adapters/index.ts +1 -0
- package/src/utils/session.ts +10 -4
- package/src/utils/upload_uri.ts +69 -0
- package/src/utils/uri.ts +30 -6
- package/src/vendor/tapestry/alias_tokens_color_map.ts +3 -0
- package/build/screens/conversation_new/components/member_error_card.d.ts +0 -5
- package/build/screens/conversation_new/components/member_error_card.d.ts.map +0 -1
- package/build/screens/conversation_new/components/member_error_card.js +0 -17
- package/build/screens/conversation_new/components/member_error_card.js.map +0 -1
- package/build/screens/conversation_new/utils/fake_member_data.d.ts +0 -3
- package/build/screens/conversation_new/utils/fake_member_data.d.ts.map +0 -1
- package/build/screens/conversation_new/utils/fake_member_data.js +0 -129
- package/build/screens/conversation_new/utils/fake_member_data.js.map +0 -1
- package/src/screens/conversation_new/components/member_error_card.tsx +0 -20
- package/src/screens/conversation_new/utils/fake_member_data.ts +0 -130
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { FlatList, RefreshControl,
|
|
2
|
+
import { FlatList, RefreshControl, StyleSheet } from 'react-native';
|
|
3
3
|
import { Text } from '../../components/display';
|
|
4
4
|
import { TeamRow } from './components/rows';
|
|
5
5
|
import { useFilterContext } from './context/conversation_filter_context';
|
|
6
6
|
import { useTeamsToFilter } from './hooks/filters';
|
|
7
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
7
8
|
export const TeamFilters = () => {
|
|
9
|
+
const styles = useStyles();
|
|
8
10
|
const { teams, fetchNextPage, isRefetching, refetch } = useTeamsToFilter();
|
|
9
11
|
const { params } = useFilterContext();
|
|
10
12
|
const { chat_group_graph_id } = params;
|
|
11
|
-
return (<
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
return (<FlatList data={teams} renderItem={({ item }) => (<TeamRow team={item} isActive={item?.id.toString() === chat_group_graph_id}/>)} refreshing={isRefetching} refreshControl={<RefreshControl refreshing={isRefetching} onRefresh={refetch}/>} ListEmptyComponent={<Text>No teams available</Text>} onEndReached={() => fetchNextPage()} contentContainerStyle={styles.container}/>);
|
|
14
|
+
};
|
|
15
|
+
const useStyles = () => {
|
|
16
|
+
const { bottom } = useSafeAreaInsets();
|
|
17
|
+
return StyleSheet.create({
|
|
18
|
+
container: {
|
|
19
|
+
paddingBottom: bottom + 12,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
14
22
|
};
|
|
15
23
|
//# sourceMappingURL=team_filters.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"team_filters.js","sourceRoot":"","sources":["../../../src/screens/conversation_filters/team_filters.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"team_filters.js","sourceRoot":"","sources":["../../../src/screens/conversation_filters/team_filters.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAA;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAElD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAIlE,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,EAAE;IAC9B,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,gBAAgB,EAAE,CAAA;IAC1E,MAAM,EAAE,MAAM,EAAE,GAAG,gBAAgB,EAAE,CAAA;IACrC,MAAM,EAAE,mBAAmB,EAAE,GAAG,MAAM,CAAA;IACtC,OAAO,CACL,CAAC,QAAQ,CACP,IAAI,CAAC,CAAC,KAAK,CAAC,CACZ,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CACxB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,EAAE,KAAK,mBAAmB,CAAC,EAAG,CAC/E,CAAC,CACF,UAAU,CAAC,CAAC,YAAY,CAAC,CACzB,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,YAAY,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,EAAG,CAAC,CACjF,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC,CACpD,YAAY,CAAC,CAAC,GAAG,EAAE,CAAC,aAAa,EAAE,CAAC,CACpC,qBAAqB,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,EACxC,CACH,CAAA;AACH,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,iBAAiB,EAAE,CAAA;IACtC,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE;YACT,aAAa,EAAE,MAAM,GAAG,EAAE;SAC3B;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { StaticScreenProps } from '@react-navigation/native'\nimport React from 'react'\nimport { FlatList, RefreshControl, StyleSheet } from 'react-native'\nimport { Text } from '../../components/display'\nimport { TeamRow } from './components/rows'\nimport { useFilterContext } from './context/conversation_filter_context'\nimport { useTeamsToFilter } from './hooks/filters'\nimport { ConversationFiltersParams } from './screen_props'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\n\nexport type GroupFiltersScreenProps = StaticScreenProps<ConversationFiltersParams>\n\nexport const TeamFilters = () => {\n const styles = useStyles()\n const { teams, fetchNextPage, isRefetching, refetch } = useTeamsToFilter()\n const { params } = useFilterContext()\n const { chat_group_graph_id } = params\n return (\n <FlatList\n data={teams}\n renderItem={({ item }) => (\n <TeamRow team={item} isActive={item?.id.toString() === chat_group_graph_id} />\n )}\n refreshing={isRefetching}\n refreshControl={<RefreshControl refreshing={isRefetching} onRefresh={refetch} />}\n ListEmptyComponent={<Text>No teams available</Text>}\n onEndReached={() => fetchNextPage()}\n contentContainerStyle={styles.container}\n />\n )\n}\n\nconst useStyles = () => {\n const { bottom } = useSafeAreaInsets()\n return StyleSheet.create({\n container: {\n paddingBottom: bottom + 12,\n },\n })\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_filters_screen.js","sourceRoot":"","sources":["../../src/screens/conversation_filters_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAoB,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC3F,OAAO,EAAE,kCAAkC,EAAa,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAClG,OAAO,EACL,0BAA0B,GAE3B,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EACL,aAAa,EACb,cAAc,GACf,MAAM,4DAA4D,CAAA;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wDAAwD,CAAA;AAC5F,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAA;AAKnE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAA;AAEjE,MAAM,iBAAiB,GAAG,CAAC,EAAE,SAAS,EAAoB,EAAE,EAAE;IAC5D,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,WAAW,CAAC,CAAA;AAC9F,CAAC,CAAA;AAED,MAA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,EAAE,MAAM,GAAG,GAAG,GAAG,YAAY;KACjC,CAAC,CAAA;IAEF,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE;YACT,MAAM,EAAE,eAAe;YACvB,IAAI,EAAE,CAAC;SACR;QACD,WAAW,EAAE;YACX,SAAS,EAAE,MAAM;YACjB,IAAI,EAAE,CAAC;SACR;QACD,SAAS,EAAE;YACT,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,2BAA2B;YACzD,aAAa,EAAE,KAAK;YACpB,cAAc,EAAE,eAAe;YAC/B,UAAU,EAAE,QAAQ;YACpB,iBAAiB,EAAE,EAAE;YACrB,eAAe,EAAE,EAAE;YACnB,GAAG,EAAE,CAAC;SACP;QACD,eAAe,EAAE;YACf,SAAS,EAAE,CAAC;YACZ,SAAS,EAAE,gCAAgC;SAC5C;QACD,gBAAgB,EAAE;YAChB,aAAa,EAAE,KAAK;YACpB,GAAG,EAAE,CAAC;YACN,UAAU,EAAE,QAAQ;SACrB;QACD,WAAW,EAAE;YACX,aAAa,EAAE,KAAK;YACpB,GAAG,EAAE,CAAC;YACN,UAAU,EAAE,QAAQ;SACrB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { HeaderTitle, HeaderTitleProps, useHeaderHeight } from '@react-navigation/elements'\nimport { createComponentForStaticNavigation, RouteProp, useRoute } from '@react-navigation/native'\nimport {\n createNativeStackNavigator,\n NativeStackNavigationOptions,\n} from '@react-navigation/native-stack'\nimport React from 'react'\nimport { Platform, StyleSheet, useWindowDimensions, View } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { Button, TextButton } from '../components'\nimport {\n FilterContext,\n FilterProvider,\n} from './conversation_filters/context/conversation_filter_context'\nimport { ConversationFilters } from './conversation_filters/components/conversation_filters'\nimport { GroupFilters } from './conversation_filters/group_filters'\nimport {\n ConversationFiltersScreenProps,\n ConversationFilterStackParamList,\n} from './conversation_filters/screen_props'\nimport { useTheme } from '../hooks'\nimport { TeamFilters } from './conversation_filters/team_filters'\n\nconst FilterHeaderTitle = ({ tintColor }: HeaderTitleProps) => {\n const styles = useStyles()\n return <HeaderTitle style={[styles.headerTitle, { color: tintColor }]}>Filters</HeaderTitle>\n}\n\nconst HeaderRight = () => {\n const { resetFilter, applyFilters } = React.useContext(FilterContext)\n const route = useRoute<RouteProp<ConversationFiltersScreenProps['route']>>()\n const styles = useStyles()\n\n return (\n <View style={styles.headerRight}>\n <TextButton onPress={resetFilter}>Reset</TextButton>\n <Button title=\"Apply\" onPress={() => applyFilters(route.params)} />\n </View>\n )\n}\n\nconst HeaderRightWithContext = () => {\n return (\n <FilterProvider>\n <HeaderRight />\n </FilterProvider>\n )\n}\n\nexport const ConversationFiltersScreenOptions: NativeStackNavigationOptions = {\n presentation: Platform.select({ android: 'modal', ios: 'formSheet' }),\n sheetAllowedDetents: Platform.select({\n android: [0.75, 0.94],\n default: [0.75, 1],\n }),\n sheetGrabberVisible: true,\n headerBackVisible: false,\n headerRight: HeaderRightWithContext,\n headerTitle: FilterHeaderTitle,\n headerTitleAlign: 'left',\n}\n\nconst FilterNavigator = createNativeStackNavigator<ConversationFilterStackParamList>({\n initialRouteName: 'Filters',\n screens: {\n Filters: {\n screen: ConversationFilters,\n options: {\n headerShown: false,\n },\n },\n GroupFilters: {\n screen: GroupFilters,\n options: {\n headerTitle: Platform.select({\n android: 'Groups',\n ios: '',\n }),\n headerBackTitle: 'Groups',\n },\n },\n TeamFilters: {\n screen: TeamFilters,\n options: {\n headerTitle: Platform.select({\n android: 'Teams',\n ios: '',\n }),\n headerBackTitle: 'Teams',\n },\n },\n },\n})\n\nconst Filters = createComponentForStaticNavigation(FilterNavigator, 'Filters')\n\nexport const ConversationFiltersScreen = (_props: ConversationFiltersScreenProps) => {\n const styles = useStyles()\n\n return (\n <FilterProvider>\n <View style={styles.container}>\n <Filters />\n </View>\n </FilterProvider>\n )\n}\n\nconst useStyles = () => {\n const { top } = useSafeAreaInsets()\n const { height } = useWindowDimensions()\n const headerHeight = useHeaderHeight()\n const theme = useTheme()\n\n const containerHeight = Platform.select({\n android: height,\n ios: height - top - headerHeight,\n })\n\n return StyleSheet.create({\n container: {\n height: containerHeight,\n flex: 1,\n },\n headerTitle: {\n textAlign: 'left',\n flex: 1,\n },\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 headerRight: {\n flexDirection: 'row',\n gap: 8,\n alignItems: 'center',\n },\n })\n}\n"]}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { GraphId } from '../../../types/resources/group_resource';
|
|
2
3
|
type GroupsFormProps = {
|
|
3
|
-
groupId
|
|
4
|
+
groupId: number;
|
|
5
|
+
chat_group_graph_id?: GraphId;
|
|
4
6
|
};
|
|
5
|
-
export declare const GroupsForm: ({ groupId }: GroupsFormProps) => React.JSX.Element;
|
|
7
|
+
export declare const GroupsForm: ({ groupId, chat_group_graph_id }: GroupsFormProps) => React.JSX.Element;
|
|
6
8
|
export {};
|
|
7
9
|
//# sourceMappingURL=groups_form.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"groups_form.d.ts","sourceRoot":"","sources":["../../../../src/screens/conversation_new/components/groups_form.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"groups_form.d.ts","sourceRoot":"","sources":["../../../../src/screens/conversation_new/components/groups_form.tsx"],"names":[],"mappings":"AACA,OAAO,KAAyC,MAAM,OAAO,CAAA;AAY7D,OAAO,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAA;AAIjE,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,MAAM,CAAA;IACf,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAC9B,CAAA;AAED,eAAO,MAAM,UAAU,qCAAsC,eAAe,sBAuD3E,CAAA"}
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import { StackActions, useNavigation } from '@react-navigation/native';
|
|
2
|
-
import React, { useCallback, useState } from 'react';
|
|
2
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
3
3
|
import { Platform, StyleSheet, TextInput, View } from 'react-native';
|
|
4
|
-
import { Heading, Text } from '../../../components';
|
|
4
|
+
import { Banner, ChildNotice, Heading, Text } from '../../../components';
|
|
5
5
|
import { ActionButton } from '../../../components/display/action_button';
|
|
6
|
-
import { useSuspenseGet } from '../../../hooks';
|
|
7
|
-
import { useApiClient } from '../../../hooks/use_api_client';
|
|
8
|
-
import { useMutation } from '@tanstack/react-query';
|
|
9
|
-
import { FAKE_MEMBER_DATA } from '../utils/fake_member_data';
|
|
10
|
-
import { Divider, FormList } from './form_list';
|
|
11
|
-
import { pluralize } from '../../../utils';
|
|
12
6
|
import { KeyboardView } from '../../../components/display/keyboard_view';
|
|
13
|
-
import {
|
|
14
|
-
|
|
7
|
+
import { useCurrentPerson, useSuspenseGet, useTheme } from '../../../hooks';
|
|
8
|
+
import { useGroupMembersForNewConversation, } from '../../../hooks/groups/use_group_members_for_new_conversation';
|
|
9
|
+
import { useGroupsConversationCreate } from '../../../hooks/groups/use_groups_conversation_create';
|
|
10
|
+
import { pluralize } from '../../../utils';
|
|
11
|
+
import { Divider, FormList } from './form_list';
|
|
12
|
+
export const GroupsForm = ({ groupId, chat_group_graph_id }) => {
|
|
15
13
|
const navigation = useNavigation();
|
|
16
14
|
const [title, setTitle] = useState();
|
|
17
|
-
const apiClient = useApiClient();
|
|
18
15
|
const { data: group } = useSuspenseGet({
|
|
19
16
|
url: `/me/groups/${groupId}`,
|
|
20
17
|
data: {
|
|
@@ -24,55 +21,37 @@ export const GroupsForm = ({ groupId }) => {
|
|
|
24
21
|
},
|
|
25
22
|
app: 'groups',
|
|
26
23
|
});
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
throwOnError: true,
|
|
30
|
-
onSuccess: result => {
|
|
31
|
-
handleRedirectToConversation({ conversation_id: result.data.id });
|
|
32
|
-
},
|
|
33
|
-
mutationFn: () => apiClient.groups
|
|
34
|
-
.post({
|
|
35
|
-
url: `/me/groups/${groupId}/chat_conversation_payload`,
|
|
36
|
-
data: {
|
|
37
|
-
data: {
|
|
38
|
-
type: '',
|
|
39
|
-
attributes: {
|
|
40
|
-
title,
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
})
|
|
45
|
-
.then(res => res.data.value)
|
|
46
|
-
.then(payload => apiClient.chat.post({
|
|
47
|
-
url: '/me/conversations',
|
|
48
|
-
data: {
|
|
49
|
-
data: {
|
|
50
|
-
type: 'Conversation',
|
|
51
|
-
attributes: {
|
|
52
|
-
payload,
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
})),
|
|
57
|
-
});
|
|
58
|
-
const handleRedirectToConversation = useCallback(({ conversation_id }) => {
|
|
59
|
-
// exit from the create stack
|
|
60
|
-
navigation.getParent()?.goBack();
|
|
24
|
+
const groupMemberships = useGroupMembersForNewConversation({ id: groupId });
|
|
25
|
+
const redirectToConversation = useCallback((conversationId) => {
|
|
61
26
|
// navigate to the conversation screen
|
|
62
|
-
navigation.dispatch(StackActions.
|
|
63
|
-
conversation_id,
|
|
27
|
+
navigation.dispatch(StackActions.popTo('Conversation', {
|
|
28
|
+
conversation_id: conversationId,
|
|
29
|
+
chat_group_graph_id,
|
|
64
30
|
}));
|
|
65
|
-
}, [navigation]);
|
|
31
|
+
}, [chat_group_graph_id, navigation]);
|
|
32
|
+
const { mutate: handleSave } = useGroupsConversationCreate({
|
|
33
|
+
groupId,
|
|
34
|
+
title,
|
|
35
|
+
onSuccess: redirectToConversation,
|
|
36
|
+
});
|
|
66
37
|
return (<KeyboardView>
|
|
67
|
-
<FormList memberData={
|
|
68
|
-
|
|
69
|
-
<ActionButton title="Start Conversation" onPress={() => handleSave()}/>
|
|
38
|
+
<FormList memberData={groupMemberships.adultMembers} FormContent={<FormContent group={group} title={title} setTitle={setTitle} groupMemberships={groupMemberships}/>}/>
|
|
39
|
+
<ActionButton disabled={!title} title="Start Conversation" onPress={() => handleSave()} infoText="Conversation will be automatically updated if any members are added or removed from this group."/>
|
|
70
40
|
</KeyboardView>);
|
|
71
41
|
};
|
|
72
|
-
function FormContent({ group, title, setTitle,
|
|
42
|
+
function FormContent({ group, title, setTitle, groupMemberships }) {
|
|
73
43
|
const styles = useStyles();
|
|
44
|
+
const currentPerson = useCurrentPerson();
|
|
74
45
|
const { name, membershipsCount } = group;
|
|
75
|
-
const
|
|
46
|
+
const myGroupsMembership = useMemo(() => groupMemberships.data.find(m => m.id === currentPerson.id), [groupMemberships.data, currentPerson.id]);
|
|
47
|
+
const isLeader = myGroupsMembership?.role === 'leader';
|
|
48
|
+
const childMembers = groupMemberships.childMembers;
|
|
49
|
+
const hasChildren = childMembers.length > 0;
|
|
50
|
+
const adultCount = groupMemberships.adultMembers.length;
|
|
51
|
+
const memberCount = isLeader ? membershipsCount : adultCount;
|
|
52
|
+
const memberHeaderLabel = `${pluralize(memberCount, 'member')} selected`;
|
|
53
|
+
const showMemberError = groupMemberships.isError;
|
|
54
|
+
const showChildNotice = hasChildren && isLeader;
|
|
76
55
|
return (<View style={styles.formContent}>
|
|
77
56
|
<View style={styles.toSection}>
|
|
78
57
|
<Heading variant="h3">To:</Heading>
|
|
@@ -85,12 +64,14 @@ function FormContent({ group, title, setTitle, isMemberError }) {
|
|
|
85
64
|
</View>
|
|
86
65
|
<Divider />
|
|
87
66
|
<View style={styles.memberSection}>
|
|
88
|
-
<Heading variant="h3">{
|
|
89
|
-
{
|
|
67
|
+
<Heading variant="h3">{memberHeaderLabel}</Heading>
|
|
68
|
+
{showChildNotice && <ChildNotice childMembers={childMembers} style={styles.banner}/>}
|
|
69
|
+
{showMemberError && (<Banner appearance="error" description="There was an issue loading group members, please refresh and try again." style={styles.banner}/>)}
|
|
90
70
|
</View>
|
|
91
71
|
</View>);
|
|
92
72
|
}
|
|
93
73
|
const useStyles = () => {
|
|
74
|
+
const { colors } = useTheme();
|
|
94
75
|
const sectionPadding = 16;
|
|
95
76
|
const inputPadding = 8;
|
|
96
77
|
return StyleSheet.create({
|
|
@@ -119,11 +100,15 @@ const useStyles = () => {
|
|
|
119
100
|
},
|
|
120
101
|
titleInput: {
|
|
121
102
|
fontSize: 18,
|
|
103
|
+
color: colors.textColorDefaultPrimary,
|
|
122
104
|
},
|
|
123
105
|
memberSection: {
|
|
124
106
|
padding: sectionPadding,
|
|
125
107
|
paddingBottom: 0,
|
|
126
108
|
},
|
|
109
|
+
banner: {
|
|
110
|
+
marginTop: 16,
|
|
111
|
+
},
|
|
127
112
|
});
|
|
128
113
|
};
|
|
129
114
|
//# sourceMappingURL=groups_form.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"groups_form.js","sourceRoot":"","sources":["../../../../src/screens/conversation_new/components/groups_form.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACtE,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACpD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACpE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAA;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AA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MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,cAAc,GAAG,EAAE,CAAA;IACzB,MAAM,YAAY,GAAG,CAAC,CAAA;IAEtB,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,WAAW,EAAE;YACX,eAAe,EAAE,cAAc;YAC/B,IAAI,EAAE,CAAC;SACR;QACD,SAAS,EAAE;YACT,OAAO,EAAE,cAAc;YACvB,aAAa,EAAE,KAAK;YACpB,GAAG,EAAE,CAAC;SACP;QACD,SAAS,EAAE;YACT,QAAQ,EAAE,EAAE;SACb;QACD,YAAY,EAAE;YACZ,OAAO,EAAE,cAAc;YACvB,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC;gBAC7B,GAAG,EAAE,cAAc;gBACnB,OAAO,EAAE,cAAc,GAAG,YAAY;aACvC,CAAC;YACF,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC;gBACnB,GAAG,EAAE,CAAC;gBACN,OAAO,EAAE,CAAC;aACX,CAAC;SACH;QACD,UAAU,EAAE;YACV,QAAQ,EAAE,EAAE;SACb;QACD,aAAa,EAAE;YACb,OAAO,EAAE,cAAc;YACvB,aAAa,EAAE,CAAC;SACjB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { StackActions, useNavigation } from '@react-navigation/native'\nimport React, { useCallback, useState } from 'react'\nimport { Platform, StyleSheet, TextInput, View } from 'react-native'\nimport { Heading, Text } from '../../../components'\nimport { ActionButton } from '../../../components/display/action_button'\nimport { useSuspenseGet } from '../../../hooks'\nimport { useApiClient } from '../../../hooks/use_api_client'\nimport { useMutation } from '@tanstack/react-query'\nimport {\n ApiResource,\n ConversationResource,\n GroupsGroupResource,\n ResourceObject,\n} from '../../../types'\nimport { FAKE_MEMBER_DATA } from '../utils/fake_member_data'\nimport { Divider, FormList } from './form_list'\nimport { pluralize } from '../../../utils'\nimport { KeyboardView } from '../../../components/display/keyboard_view'\nimport { MemberErrorCard } from './member_error_card'\n\ntype GroupsFormProps = {\n groupId?: string\n}\n\ninterface ChatConversationPayload extends ResourceObject {\n value: string\n}\n\nexport const GroupsForm = ({ groupId }: GroupsFormProps) => {\n const navigation = useNavigation()\n const [title, setTitle] = useState<string>()\n const apiClient = useApiClient()\n const { data: group } = useSuspenseGet<GroupsGroupResource>({\n url: `/me/groups/${groupId}`,\n data: {\n fields: {\n Group: [],\n },\n },\n app: 'groups',\n })\n\n const isMemberError = false // TODO: Replace with error from a future useGroupsMember hook\n\n const { mutate: handleSave } = useMutation({\n throwOnError: true,\n onSuccess: result => {\n handleRedirectToConversation({ conversation_id: result.data.id })\n },\n mutationFn: () =>\n apiClient.groups\n .post<ApiResource<ChatConversationPayload>>({\n url: `/me/groups/${groupId}/chat_conversation_payload`,\n data: {\n data: {\n type: '',\n attributes: {\n title,\n },\n },\n },\n })\n .then(res => res.data.value)\n .then(payload =>\n apiClient.chat.post<ApiResource<ConversationResource>>({\n url: '/me/conversations',\n data: {\n data: {\n type: 'Conversation',\n attributes: {\n payload,\n },\n },\n },\n })\n ),\n })\n\n const handleRedirectToConversation = useCallback(\n ({ conversation_id }: { conversation_id: number }) => {\n // exit from the create stack\n navigation.getParent()?.goBack()\n // navigate to the conversation screen\n navigation.dispatch(\n StackActions.push('Conversation', {\n conversation_id,\n })\n )\n },\n [navigation]\n )\n\n return (\n <KeyboardView>\n <FormList\n memberData={FAKE_MEMBER_DATA} // TODO: Replace with actual group members\n FormContent={\n <FormContent\n group={group}\n title={title}\n setTitle={setTitle}\n isMemberError={isMemberError}\n />\n }\n />\n <ActionButton title=\"Start Conversation\" onPress={() => handleSave()} />\n </KeyboardView>\n )\n}\n\ninterface FormContentProps {\n group: GroupsGroupResource\n title?: string\n setTitle: (title: string) => void\n isMemberError: boolean\n}\n\nfunction FormContent({ group, title, setTitle, isMemberError }: FormContentProps) {\n const styles = useStyles()\n const { name, membershipsCount } = group\n const memberHeader = pluralize(membershipsCount, 'member')\n\n return (\n <View style={styles.formContent}>\n <View style={styles.toSection}>\n <Heading variant=\"h3\">To:</Heading>\n <Text style={styles.groupName}>{name}</Text>\n </View>\n <Divider />\n <View style={styles.titleSection}>\n <Heading variant=\"h3\">Title</Heading>\n <TextInput\n placeholder=\"Topic of conversation (required)\"\n value={title}\n onChangeText={setTitle}\n style={styles.titleInput}\n autoFocus={true}\n />\n </View>\n <Divider />\n <View style={styles.memberSection}>\n <Heading variant=\"h3\">{memberHeader} selected</Heading>\n {isMemberError && (\n <MemberErrorCard description=\"There was an issue loading group members, please refresh and try again.\" />\n )}\n </View>\n </View>\n )\n}\n\nconst useStyles = () => {\n const sectionPadding = 16\n const inputPadding = 8\n\n return StyleSheet.create({\n formContent: {\n paddingVertical: sectionPadding,\n flex: 1,\n },\n toSection: {\n padding: sectionPadding,\n flexDirection: 'row',\n gap: 8,\n },\n groupName: {\n fontSize: 18,\n },\n titleSection: {\n padding: sectionPadding,\n paddingBottom: Platform.select({\n ios: sectionPadding,\n android: sectionPadding - inputPadding,\n }),\n gap: Platform.select({\n ios: 8,\n android: 0,\n }),\n },\n titleInput: {\n fontSize: 18,\n },\n memberSection: {\n padding: sectionPadding,\n paddingBottom: 0,\n },\n })\n}\n"]}
|
|
1
|
+
{"version":3,"file":"groups_form.js","sourceRoot":"","sources":["../../../../src/screens/conversation_new/components/groups_form.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACtE,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC7D,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACpE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAA;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAA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CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { StackActions, useNavigation } from '@react-navigation/native'\nimport React, { useCallback, useMemo, useState } from 'react'\nimport { Platform, StyleSheet, TextInput, View } from 'react-native'\nimport { Banner, ChildNotice, Heading, Text } from '../../../components'\nimport { ActionButton } from '../../../components/display/action_button'\nimport { KeyboardView } from '../../../components/display/keyboard_view'\nimport { useCurrentPerson, useSuspenseGet, useTheme } from '../../../hooks'\nimport {\n GroupMembersForNewConversationResult,\n useGroupMembersForNewConversation,\n} from '../../../hooks/groups/use_group_members_for_new_conversation'\nimport { useGroupsConversationCreate } from '../../../hooks/groups/use_groups_conversation_create'\nimport { GroupsGroupResource } from '../../../types'\nimport { GraphId } from '../../../types/resources/group_resource'\nimport { pluralize } from '../../../utils'\nimport { Divider, FormList } from './form_list'\n\ntype GroupsFormProps = {\n groupId: number\n chat_group_graph_id?: GraphId\n}\n\nexport const GroupsForm = ({ groupId, chat_group_graph_id }: GroupsFormProps) => {\n const navigation = useNavigation()\n const [title, setTitle] = useState<string>()\n const { data: group } = useSuspenseGet<GroupsGroupResource>({\n url: `/me/groups/${groupId}`,\n data: {\n fields: {\n Group: [],\n },\n },\n app: 'groups',\n })\n\n const groupMemberships = useGroupMembersForNewConversation({ id: groupId })\n\n const redirectToConversation = useCallback(\n (conversationId: number) => {\n // navigate to the conversation screen\n navigation.dispatch(\n StackActions.popTo('Conversation', {\n conversation_id: conversationId,\n chat_group_graph_id,\n })\n )\n },\n [chat_group_graph_id, navigation]\n )\n\n const { mutate: handleSave } = useGroupsConversationCreate({\n groupId,\n title,\n onSuccess: redirectToConversation,\n })\n\n return (\n <KeyboardView>\n <FormList\n memberData={groupMemberships.adultMembers}\n FormContent={\n <FormContent\n group={group}\n title={title}\n setTitle={setTitle}\n groupMemberships={groupMemberships}\n />\n }\n />\n <ActionButton\n disabled={!title}\n title=\"Start Conversation\"\n onPress={() => handleSave()}\n infoText=\"Conversation will be automatically updated if any members are added or removed from this group.\"\n />\n </KeyboardView>\n )\n}\n\ninterface FormContentProps {\n group: GroupsGroupResource\n title?: string\n setTitle: (title: string) => void\n groupMemberships: GroupMembersForNewConversationResult\n}\n\nfunction FormContent({ group, title, setTitle, groupMemberships }: FormContentProps) {\n const styles = useStyles()\n const currentPerson = useCurrentPerson()\n const { name, membershipsCount } = group\n\n const myGroupsMembership = useMemo(\n () => groupMemberships.data.find(m => m.id === currentPerson.id),\n [groupMemberships.data, currentPerson.id]\n )\n const isLeader = myGroupsMembership?.role === 'leader'\n\n const childMembers = groupMemberships.childMembers\n const hasChildren = childMembers.length > 0\n const adultCount = groupMemberships.adultMembers.length\n const memberCount = isLeader ? membershipsCount : adultCount\n const memberHeaderLabel = `${pluralize(memberCount, 'member')} selected`\n\n const showMemberError = groupMemberships.isError\n const showChildNotice = hasChildren && isLeader\n\n return (\n <View style={styles.formContent}>\n <View style={styles.toSection}>\n <Heading variant=\"h3\">To:</Heading>\n <Text style={styles.groupName}>{name}</Text>\n </View>\n <Divider />\n <View style={styles.titleSection}>\n <Heading variant=\"h3\">Title</Heading>\n <TextInput\n placeholder=\"Topic of conversation (required)\"\n value={title}\n onChangeText={setTitle}\n style={styles.titleInput}\n autoFocus={true}\n />\n </View>\n <Divider />\n <View style={styles.memberSection}>\n <Heading variant=\"h3\">{memberHeaderLabel}</Heading>\n {showChildNotice && <ChildNotice childMembers={childMembers} style={styles.banner} />}\n {showMemberError && (\n <Banner\n appearance=\"error\"\n description=\"There was an issue loading group members, please refresh and try again.\"\n style={styles.banner}\n />\n )}\n </View>\n </View>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n const sectionPadding = 16\n const inputPadding = 8\n\n return StyleSheet.create({\n formContent: {\n paddingVertical: sectionPadding,\n flex: 1,\n },\n toSection: {\n padding: sectionPadding,\n flexDirection: 'row',\n gap: 8,\n },\n groupName: {\n fontSize: 18,\n },\n titleSection: {\n padding: sectionPadding,\n paddingBottom: Platform.select({\n ios: sectionPadding,\n android: sectionPadding - inputPadding,\n }),\n gap: Platform.select({\n ios: 8,\n android: 0,\n }),\n },\n titleInput: {\n fontSize: 18,\n color: colors.textColorDefaultPrimary,\n },\n memberSection: {\n padding: sectionPadding,\n paddingBottom: 0,\n },\n banner: {\n marginTop: 16,\n },\n })\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"team_form.js","sourceRoot":"","sources":["../../../../src/screens/conversation_new/components/team_form.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAO1C,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EAAE,cAAc,EAAE,aAAa,EAAiB,EAAE,EAAE;IAC5E,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAA;IAC7C,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,aAAa,CAAC,CAAA;IAC3C,OAAO,CACL,CAAC,IAAI,CACH;MAAA,CAAC,IAAI,CAAC,8BAA8B,EAAE,IAAI,CAC5C;IAAA,EAAE,IAAI,CAAC,CACR,CAAA;AACH,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport { View } from 'react-native'\nimport { Text } from '../../../components'\n\ntype TeamFormProps = {\n initialTeamIds?:
|
|
1
|
+
{"version":3,"file":"team_form.js","sourceRoot":"","sources":["../../../../src/screens/conversation_new/components/team_form.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAO1C,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EAAE,cAAc,EAAE,aAAa,EAAiB,EAAE,EAAE;IAC5E,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAA;IAC7C,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,aAAa,CAAC,CAAA;IAC3C,OAAO,CACL,CAAC,IAAI,CACH;MAAA,CAAC,IAAI,CAAC,8BAA8B,EAAE,IAAI,CAC5C;IAAA,EAAE,IAAI,CAAC,CACR,CAAA;AACH,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport { View } from 'react-native'\nimport { Text } from '../../../components'\n\ntype TeamFormProps = {\n initialTeamIds?: number[]\n initialPlanId?: number\n}\n\nexport const TeamsForm = ({ initialTeamIds, initialPlanId }: TeamFormProps) => {\n console.log('initialTeamIds', initialTeamIds)\n console.log('initialPlanId', initialPlanId)\n return (\n <View>\n <Text>Services team form coming soon</Text>\n </View>\n )\n}\n"]}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { StaticScreenProps } from '@react-navigation/native';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { AppName } from '../../types/resources/app_name';
|
|
4
|
+
import { GraphId } from '../../types/resources/group_resource';
|
|
4
5
|
type ConversationNewScreenProps = StaticScreenProps<{
|
|
5
|
-
group_id?:
|
|
6
|
-
team_ids?:
|
|
6
|
+
group_id?: number;
|
|
7
|
+
team_ids?: number[];
|
|
7
8
|
plan_id?: number;
|
|
8
9
|
source_app_name: AppName;
|
|
10
|
+
chat_group_graph_id?: GraphId;
|
|
11
|
+
group_source_app_name?: AppName;
|
|
9
12
|
}>;
|
|
10
13
|
export declare const ConversationNewScreen: ({ route }: ConversationNewScreenProps) => React.JSX.Element;
|
|
11
14
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_new_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/conversation_new/conversation_new_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAA;
|
|
1
|
+
{"version":3,"file":"conversation_new_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/conversation_new/conversation_new_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAA;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAA;AAE9D,KAAK,0BAA0B,GAAG,iBAAiB,CAAC;IAClD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,eAAe,EAAE,OAAO,CAAA;IACxB,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAChC,CAAC,CAAA;AAEF,eAAO,MAAM,qBAAqB,cAAe,0BAA0B,sBAe1E,CAAA"}
|
|
@@ -3,10 +3,10 @@ import { GroupsForm } from './components/groups_form';
|
|
|
3
3
|
import { TeamsForm } from './components/team_form';
|
|
4
4
|
import { SourceAppErrorCard } from './components/source_app_error_card';
|
|
5
5
|
export const ConversationNewScreen = ({ route }) => {
|
|
6
|
-
const { group_id, team_ids, source_app_name, plan_id } = route.params;
|
|
6
|
+
const { group_id, team_ids, source_app_name, plan_id, chat_group_graph_id } = route.params;
|
|
7
7
|
switch (source_app_name) {
|
|
8
8
|
case 'Groups':
|
|
9
|
-
return <GroupsForm groupId={group_id}
|
|
9
|
+
return group_id ? (<GroupsForm groupId={group_id} chat_group_graph_id={chat_group_graph_id}/>) : (<SourceAppErrorCard />);
|
|
10
10
|
case 'Services':
|
|
11
11
|
return <TeamsForm initialTeamIds={team_ids} initialPlanId={plan_id}/>;
|
|
12
12
|
default:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_new_screen.js","sourceRoot":"","sources":["../../../src/screens/conversation_new/conversation_new_screen.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAA;
|
|
1
|
+
{"version":3,"file":"conversation_new_screen.js","sourceRoot":"","sources":["../../../src/screens/conversation_new/conversation_new_screen.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAA;AAavE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,EAAE,KAAK,EAA8B,EAAE,EAAE;IAC7E,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,eAAe,EAAE,OAAO,EAAE,mBAAmB,EAAE,GAAG,KAAK,CAAC,MAAM,CAAA;IAE1F,QAAQ,eAAe,EAAE,CAAC;QACxB,KAAK,QAAQ;YACX,OAAO,QAAQ,CAAC,CAAC,CAAC,CAChB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,mBAAmB,CAAC,CAAC,mBAAmB,CAAC,EAAG,CAC5E,CAAC,CAAC,CAAC,CACF,CAAC,kBAAkB,CAAC,AAAD,EAAG,CACvB,CAAA;QACH,KAAK,UAAU;YACb,OAAO,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,QAAQ,CAAC,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,EAAG,CAAA;QACxE;YACE,OAAO,CAAC,kBAAkB,CAAC,AAAD,EAAG,CAAA;IACjC,CAAC;AACH,CAAC,CAAA","sourcesContent":["import { StaticScreenProps } from '@react-navigation/native'\nimport React from 'react'\nimport { GroupsForm } from './components/groups_form'\nimport { TeamsForm } from './components/team_form'\nimport { SourceAppErrorCard } from './components/source_app_error_card'\nimport { AppName } from '../../types/resources/app_name'\nimport { GraphId } from '../../types/resources/group_resource'\n\ntype ConversationNewScreenProps = StaticScreenProps<{\n group_id?: number\n team_ids?: number[]\n plan_id?: number\n source_app_name: AppName\n chat_group_graph_id?: GraphId\n group_source_app_name?: AppName\n}>\n\nexport const ConversationNewScreen = ({ route }: ConversationNewScreenProps) => {\n const { group_id, team_ids, source_app_name, plan_id, chat_group_graph_id } = route.params\n\n switch (source_app_name) {\n case 'Groups':\n return group_id ? (\n <GroupsForm groupId={group_id} chat_group_graph_id={chat_group_graph_id} />\n ) : (\n <SourceAppErrorCard />\n )\n case 'Services':\n return <TeamsForm initialTeamIds={team_ids} initialPlanId={plan_id} />\n default:\n return <SourceAppErrorCard />\n }\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { StaticScreenProps } from '@react-navigation/native';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { MessageResource } from '../types';
|
|
3
4
|
type ConversationRouteProps = {
|
|
4
5
|
conversation_id: number;
|
|
5
6
|
chat_group_graph_id?: string;
|
|
@@ -7,5 +8,11 @@ type ConversationRouteProps = {
|
|
|
7
8
|
};
|
|
8
9
|
export type ConversationScreenProps = StaticScreenProps<ConversationRouteProps>;
|
|
9
10
|
export declare function ConversationScreen({ route }: ConversationScreenProps): React.JSX.Element;
|
|
11
|
+
export type DateSeparator = {
|
|
12
|
+
type: 'DateSeparator';
|
|
13
|
+
id: string;
|
|
14
|
+
date: string;
|
|
15
|
+
};
|
|
16
|
+
export declare const groupMessages: (ms: MessageResource[]) => (MessageResource | DateSeparator)[];
|
|
10
17
|
export {};
|
|
11
18
|
//# sourceMappingURL=conversation_screen.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_screen.d.ts","sourceRoot":"","sources":["../../src/screens/conversation_screen.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"conversation_screen.d.ts","sourceRoot":"","sources":["../../src/screens/conversation_screen.tsx"],"names":[],"mappings":"AAGA,OAAO,EAGL,iBAAiB,EAIlB,MAAM,0BAA0B,CAAA;AAEjC,OAAO,KAAiC,MAAM,OAAO,CAAA;AAUrD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAG1C,KAAK,sBAAsB,GAAG;IAC5B,eAAe,EAAE,MAAM,CAAA;IACvB,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,CAAC,sBAAsB,CAAC,CAAA;AAE/E,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,EAAE,uBAAuB,qBAkDpE;AAED,MAAM,MAAM,aAAa,GAAG;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAwC/E,eAAO,MAAM,aAAa,OAAQ,eAAe,EAAE,wCAkClD,CAAA"}
|
|
@@ -1,14 +1,19 @@
|
|
|
1
|
+
// @ts-expect-error
|
|
2
|
+
import { date as formatDate } from '@planningcenter/datetime-fmt';
|
|
1
3
|
import { HeaderTitle, PlatformPressable } from '@react-navigation/elements';
|
|
2
|
-
import { useNavigation, useTheme as useNavigationTheme, useRoute, } from '@react-navigation/native';
|
|
4
|
+
import { CommonActions, useNavigation, useTheme as useNavigationTheme, useRoute, } from '@react-navigation/native';
|
|
5
|
+
import moment from 'moment';
|
|
3
6
|
import React, { useCallback, useEffect } from 'react';
|
|
4
7
|
import { FlatList, Platform, StyleSheet, View } from 'react-native';
|
|
5
8
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
6
|
-
import { Badge, Icon } from '../components';
|
|
9
|
+
import { Badge, Icon, Text } from '../components';
|
|
7
10
|
import { Message } from '../components/conversation/message';
|
|
8
11
|
import { MessageForm } from '../components/conversation/message_form';
|
|
9
12
|
import { KeyboardView } from '../components/display/keyboard_view';
|
|
13
|
+
import { useTheme } from '../hooks';
|
|
10
14
|
import { useConversation } from '../hooks/use_conversation';
|
|
11
15
|
import { useConversationMessages } from '../hooks/use_conversation_messages';
|
|
16
|
+
import { getRelativeDateStatus } from '../utils/date';
|
|
12
17
|
export function ConversationScreen({ route }) {
|
|
13
18
|
const styles = useStyles();
|
|
14
19
|
const navigation = useNavigation();
|
|
@@ -17,6 +22,8 @@ export function ConversationScreen({ route }) {
|
|
|
17
22
|
const { messages, refetch, isRefetching, fetchNextPage } = useConversationMessages({
|
|
18
23
|
conversation_id,
|
|
19
24
|
});
|
|
25
|
+
useEnsureConversationsRouteExists();
|
|
26
|
+
const messagesWithSeparators = groupMessages(messages);
|
|
20
27
|
// Seems to be necessary to define this way so we get the route picked up
|
|
21
28
|
const headerTitle = useCallback((props) => <PressableHeaderTitle {...props}/>, []);
|
|
22
29
|
useEffect(() => {
|
|
@@ -24,9 +31,14 @@ export function ConversationScreen({ route }) {
|
|
|
24
31
|
}, [conversation, conversation_id, navigation, headerTitle, conversation?.title]);
|
|
25
32
|
return (<View style={styles.container}>
|
|
26
33
|
<KeyboardView style={styles.keyboardView}>
|
|
27
|
-
<FlatList inverted contentContainerStyle={styles.listContainer} refreshing={isRefetching} onRefresh={refetch} data={
|
|
34
|
+
<FlatList inverted contentContainerStyle={styles.listContainer} refreshing={isRefetching} onRefresh={refetch} data={messagesWithSeparators} keyExtractor={item => item.id} renderItem={({ item }) => {
|
|
35
|
+
if (item.type === 'DateSeparator') {
|
|
36
|
+
return <InlineDateSeparator {...item}/>;
|
|
37
|
+
}
|
|
38
|
+
return <Message {...item} conversation_id={conversation_id}/>;
|
|
39
|
+
}} onEndReached={() => fetchNextPage()}/>
|
|
28
40
|
<MessageForm.Root conversation={conversation}>
|
|
29
|
-
|
|
41
|
+
<MessageForm.AttachmentPicker />
|
|
30
42
|
<MessageForm.Commands />
|
|
31
43
|
<MessageForm.TextInput />
|
|
32
44
|
<MessageForm.SubmitButton />
|
|
@@ -34,6 +46,69 @@ export function ConversationScreen({ route }) {
|
|
|
34
46
|
</KeyboardView>
|
|
35
47
|
</View>);
|
|
36
48
|
}
|
|
49
|
+
function InlineDateSeparator({ date }) {
|
|
50
|
+
const styles = useDateSeparatorStyles();
|
|
51
|
+
const { isThisYear } = getRelativeDateStatus(date);
|
|
52
|
+
const showYear = !isThisYear;
|
|
53
|
+
const dateStamp = formatDate(date, { style: 'long', year: showYear });
|
|
54
|
+
return (<View style={styles.container}>
|
|
55
|
+
<View style={styles.separator}/>
|
|
56
|
+
<Text variant="footnote" style={styles.dateText}>
|
|
57
|
+
{dateStamp}
|
|
58
|
+
</Text>
|
|
59
|
+
<View style={styles.separator}/>
|
|
60
|
+
</View>);
|
|
61
|
+
}
|
|
62
|
+
const useDateSeparatorStyles = () => {
|
|
63
|
+
const theme = useTheme();
|
|
64
|
+
return StyleSheet.create({
|
|
65
|
+
container: {
|
|
66
|
+
alignItems: 'center',
|
|
67
|
+
flexDirection: 'row',
|
|
68
|
+
paddingHorizontal: 16,
|
|
69
|
+
paddingVertical: 16,
|
|
70
|
+
},
|
|
71
|
+
separator: {
|
|
72
|
+
flex: 1,
|
|
73
|
+
height: 1,
|
|
74
|
+
borderTopWidth: 1,
|
|
75
|
+
borderTopColor: theme.colors.borderColorDefaultBase,
|
|
76
|
+
},
|
|
77
|
+
dateText: {
|
|
78
|
+
paddingHorizontal: 8,
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
export const groupMessages = (ms) => {
|
|
83
|
+
let enrichedMessages = [];
|
|
84
|
+
let encounteredOneOfMyMessages = false;
|
|
85
|
+
ms.forEach((message, i) => {
|
|
86
|
+
const prevMessage = ms[i + 1];
|
|
87
|
+
const nextMessage = ms[i - 1];
|
|
88
|
+
const date = moment(message.createdAt).format('YYYY-MM-DD');
|
|
89
|
+
const prevMessageDifferentAuthor = message.author?.id !== prevMessage?.author?.id;
|
|
90
|
+
const nextMessageDifferentAuthor = message.author?.id !== nextMessage?.author?.id;
|
|
91
|
+
const prevMessageMoreThan5Minutes = prevMessage &&
|
|
92
|
+
new Date(message.createdAt).getTime() - new Date(prevMessage.createdAt).getTime() > 60000 * 5;
|
|
93
|
+
const nextMessageMoreThan5Minutes = nextMessage &&
|
|
94
|
+
new Date(nextMessage.createdAt).getTime() - new Date(message.createdAt).getTime() > 60000 * 5;
|
|
95
|
+
if (message.mine && !encounteredOneOfMyMessages) {
|
|
96
|
+
encounteredOneOfMyMessages = true;
|
|
97
|
+
message.myLatestInConversation = true;
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
message.myLatestInConversation = false;
|
|
101
|
+
}
|
|
102
|
+
message.lastInGroup = !nextMessage || nextMessageDifferentAuthor || nextMessageMoreThan5Minutes;
|
|
103
|
+
message.renderAuthor =
|
|
104
|
+
!message.mine && (!prevMessage || prevMessageDifferentAuthor || prevMessageMoreThan5Minutes);
|
|
105
|
+
enrichedMessages.push(message);
|
|
106
|
+
if (!prevMessage || date !== moment(prevMessage.createdAt).format('YYYY-MM-DD')) {
|
|
107
|
+
enrichedMessages.push({ type: 'DateSeparator', id: `day-divider-${message.id}`, date });
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
return enrichedMessages;
|
|
111
|
+
};
|
|
37
112
|
const PressableHeaderTitle = ({ style, children }) => {
|
|
38
113
|
const styles = usePressableHeaderStyle();
|
|
39
114
|
const navigation = useNavigation();
|
|
@@ -91,4 +166,28 @@ const useStyles = () => {
|
|
|
91
166
|
},
|
|
92
167
|
});
|
|
93
168
|
};
|
|
169
|
+
/**
|
|
170
|
+
* useEnsureConversationsRouteExists
|
|
171
|
+
*/
|
|
172
|
+
const useEnsureConversationsRouteExists = () => {
|
|
173
|
+
const navigation = useNavigation();
|
|
174
|
+
const { params } = useRoute();
|
|
175
|
+
useEffect(() => {
|
|
176
|
+
const navigationState = navigation.getState();
|
|
177
|
+
const routes = navigationState?.routes || [];
|
|
178
|
+
const conversationsRoute = routes.find(r => r.name === 'Conversations');
|
|
179
|
+
if (conversationsRoute)
|
|
180
|
+
return;
|
|
181
|
+
navigation.dispatch(state => {
|
|
182
|
+
return CommonActions.reset({
|
|
183
|
+
...state,
|
|
184
|
+
routes: [
|
|
185
|
+
{ name: 'Conversations', params: { chat_group_graph_id: params?.chat_group_graph_id } },
|
|
186
|
+
...routes,
|
|
187
|
+
],
|
|
188
|
+
index: state.index + 1,
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
}, [navigation, params?.chat_group_graph_id]);
|
|
192
|
+
};
|
|
94
193
|
//# sourceMappingURL=conversation_screen.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_screen.js","sourceRoot":"","sources":["../../src/screens/conversation_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAoB,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC7F,OAAO,EAEL,aAAa,EACb,QAAQ,IAAI,kBAAkB,EAC9B,QAAQ,GACT,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACrD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAA;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAA;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAA;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,E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,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,eAAe,GAAG,kBAAkB,EAAE,CAAA;IAC5C,MAAM,EAAE,MAAM,EAAE,GAAG,iBAAiB,EAAE,CAAA;IAEtC,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE;YACT,IAAI,EAAE,CAAC;YACP,cAAc,EAAE,QAAQ;YACxB,eAAe,EAAE,eAAe,CAAC,MAAM,CAAC,IAAI;YAC5C,aAAa,EAAE,MAAM;SACtB;QACD,YAAY,EAAE;YACZ,IAAI,EAAE,CAAC;SACR;QACD,aAAa,EAAE;YACb,GAAG,EAAE,EAAE;YACP,iBAAiB,EAAE,EAAE;YACrB,eAAe,EAAE,EAAE;SACpB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { HeaderTitle, HeaderTitleProps, PlatformPressable } from '@react-navigation/elements'\nimport {\n StaticScreenProps,\n useNavigation,\n useTheme as useNavigationTheme,\n useRoute,\n} from '@react-navigation/native'\nimport React, { useCallback, useEffect } from 'react'\nimport { FlatList, Platform, StyleSheet, View } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { Badge, Icon } from '../components'\nimport { Message } from '../components/conversation/message'\nimport { MessageForm } from '../components/conversation/message_form'\nimport { KeyboardView } from '../components/display/keyboard_view'\nimport { useConversation } from '../hooks/use_conversation'\nimport { useConversationMessages } from '../hooks/use_conversation_messages'\n\ntype ConversationRouteProps = {\n conversation_id: number\n chat_group_graph_id?: string\n clear_input?: boolean\n}\n\nexport type ConversationScreenProps = StaticScreenProps<ConversationRouteProps>\n\nexport function ConversationScreen({ route }: ConversationScreenProps) {\n const styles = useStyles()\n const navigation = useNavigation()\n\n const { conversation_id } = route.params\n const { data: conversation } = useConversation(route.params)\n const { messages, refetch, isRefetching, fetchNextPage } = useConversationMessages({\n conversation_id,\n })\n\n // Seems to be necessary to define this way so we get the route picked up\n const headerTitle = useCallback(\n (props: HeaderTitleProps) => <PressableHeaderTitle {...props} />,\n []\n )\n\n useEffect(() => {\n navigation.setOptions({ headerTitle, title: conversation?.title })\n }, [conversation, conversation_id, navigation, headerTitle, conversation?.title])\n\n return (\n <View style={styles.container}>\n <KeyboardView style={styles.keyboardView}>\n <FlatList\n inverted\n contentContainerStyle={styles.listContainer}\n refreshing={isRefetching}\n onRefresh={refetch}\n data={messages}\n keyExtractor={item => item.id}\n renderItem={({ item }) => <Message {...item} conversation_id={conversation_id} />}\n onEndReached={() => fetchNextPage()}\n />\n <MessageForm.Root conversation={conversation}>\n {/* <MessageForm.AttachmentPicker /> */}\n <MessageForm.Commands />\n <MessageForm.TextInput />\n <MessageForm.SubmitButton />\n </MessageForm.Root>\n </KeyboardView>\n </View>\n )\n}\n\nconst PressableHeaderTitle = ({ style, children }: HeaderTitleProps) => {\n const styles = usePressableHeaderStyle()\n const navigation = useNavigation()\n\n const route = useRoute() as ConversationScreenProps['route']\n\n const { data: conversation } = useConversation(route.params)\n const badge = conversation.badges?.[0]\n const resourceType = badge?.pcoResourceType || ''\n const productName = badge?.appName\n const name = badge?.text || undefined\n\n return (\n <PlatformPressable\n style={styles.container}\n onPress={() =>\n navigation.navigate('ConversationDetails', { conversation_id: conversation?.id })\n }\n >\n <View style={styles.titleWrapper}>\n <HeaderTitle style={[styles.title, style]}>{children}</HeaderTitle>\n <Icon name=\"general.downChevron\" size={12} />\n </View>\n <Badge\n variant=\"metaSubtle\"\n productLogoName={productName}\n label={resourceType}\n metaLabel={name}\n style={styles.badge}\n />\n </PlatformPressable>\n )\n}\n\nconst usePressableHeaderStyle = () => {\n return StyleSheet.create({\n container: {\n alignItems: Platform.select({ android: 'flex-start', default: 'center' }),\n },\n titleWrapper: {\n alignItems: 'center',\n columnGap: 4,\n flexDirection: 'row',\n },\n title: {\n padding: 0,\n margin: 0,\n },\n badge: {\n alignSelf: Platform.select({ android: 'flex-start', default: 'center' }),\n marginTop: 2,\n },\n })\n}\n\nconst useStyles = () => {\n const navigationTheme = useNavigationTheme()\n const { bottom } = useSafeAreaInsets()\n\n return StyleSheet.create({\n container: {\n flex: 1,\n justifyContent: 'center',\n backgroundColor: navigationTheme.colors.card,\n paddingBottom: bottom,\n },\n keyboardView: {\n flex: 1,\n },\n listContainer: {\n gap: 12,\n paddingHorizontal: 16,\n paddingVertical: 12,\n },\n })\n}\n"]}
|
|
1
|
+
{"version":3,"file":"conversation_screen.js","sourceRoot":"","sources":["../../src/screens/conversation_screen.tsx"],"names":[],"mappings":"AAAA,mBAAmB;AACnB,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,8BAA8B,CAAA;AACjE,OAAO,EAAE,WAAW,EAAoB,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC7F,OAAO,EACL,aAAa,EAGb,aAAa,EACb,QAAQ,IAAI,kBAAkB,EAC9B,QAAQ,GACT,MAAM,0BAA0B,CAAA;AACjC,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACrD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAA;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAA;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAA;AAE5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAA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AAiB,EAAE,EAAE;YACrB,eAAe,EAAE,EAAE;SACpB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,iCAAiC,GAAG,GAAG,EAAE;IAC7C,MAAM,UAAU,GAAG,aAAa,EAAE,CAAA;IAClC,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAA+C,CAAA;IAE1E,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,eAAe,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAA;QAC7C,MAAM,MAAM,GAAG,eAAe,EAAE,MAAM,IAAI,EAAE,CAAA;QAC5C,MAAM,kBAAkB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,eAAe,CAAC,CAAA;QAEvE,IAAI,kBAAkB;YAAE,OAAM;QAE9B,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;YAC1B,OAAO,aAAa,CAAC,KAAK,CAAC;gBACzB,GAAG,KAAK;gBACR,MAAM,EAAE;oBACN,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,EAAE,mBAAmB,EAAE,MAAM,EAAE,mBAAmB,EAAE,EAAE;oBACvF,GAAG,MAAM;iBACV;gBACD,KAAK,EAAE,KAAK,CAAC,KAAK,GAAG,CAAC;aACvB,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAAA;AAC/C,CAAC,CAAA","sourcesContent":["// @ts-expect-error\nimport { date as formatDate } from '@planningcenter/datetime-fmt'\nimport { HeaderTitle, HeaderTitleProps, PlatformPressable } from '@react-navigation/elements'\nimport {\n CommonActions,\n RouteProp,\n StaticScreenProps,\n useNavigation,\n useTheme as useNavigationTheme,\n useRoute,\n} from '@react-navigation/native'\nimport moment from 'moment'\nimport React, { useCallback, useEffect } from 'react'\nimport { FlatList, Platform, StyleSheet, View } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { Badge, Icon, Text } from '../components'\nimport { Message } from '../components/conversation/message'\nimport { MessageForm } from '../components/conversation/message_form'\nimport { KeyboardView } from '../components/display/keyboard_view'\nimport { useTheme } from '../hooks'\nimport { useConversation } from '../hooks/use_conversation'\nimport { useConversationMessages } from '../hooks/use_conversation_messages'\nimport { MessageResource } from '../types'\nimport { getRelativeDateStatus } from '../utils/date'\n\ntype ConversationRouteProps = {\n conversation_id: number\n chat_group_graph_id?: string\n clear_input?: boolean\n}\n\nexport type ConversationScreenProps = StaticScreenProps<ConversationRouteProps>\n\nexport function ConversationScreen({ route }: ConversationScreenProps) {\n const styles = useStyles()\n const navigation = useNavigation()\n\n const { conversation_id } = route.params\n const { data: conversation } = useConversation(route.params)\n const { messages, refetch, isRefetching, fetchNextPage } = useConversationMessages({\n conversation_id,\n })\n useEnsureConversationsRouteExists()\n const messagesWithSeparators = groupMessages(messages)\n\n // Seems to be necessary to define this way so we get the route picked up\n const headerTitle = useCallback(\n (props: HeaderTitleProps) => <PressableHeaderTitle {...props} />,\n []\n )\n\n useEffect(() => {\n navigation.setOptions({ headerTitle, title: conversation?.title })\n }, [conversation, conversation_id, navigation, headerTitle, conversation?.title])\n\n return (\n <View style={styles.container}>\n <KeyboardView style={styles.keyboardView}>\n <FlatList\n inverted\n contentContainerStyle={styles.listContainer}\n refreshing={isRefetching}\n onRefresh={refetch}\n data={messagesWithSeparators}\n keyExtractor={item => item.id}\n renderItem={({ item }) => {\n if (item.type === 'DateSeparator') {\n return <InlineDateSeparator {...item} />\n }\n\n return <Message {...item} conversation_id={conversation_id} />\n }}\n onEndReached={() => fetchNextPage()}\n />\n <MessageForm.Root conversation={conversation}>\n <MessageForm.AttachmentPicker />\n <MessageForm.Commands />\n <MessageForm.TextInput />\n <MessageForm.SubmitButton />\n </MessageForm.Root>\n </KeyboardView>\n </View>\n )\n}\n\nexport type DateSeparator = { type: 'DateSeparator'; id: string; date: string }\n\nfunction InlineDateSeparator({ date }: DateSeparator) {\n const styles = useDateSeparatorStyles()\n const { isThisYear } = getRelativeDateStatus(date)\n const showYear = !isThisYear\n const dateStamp = formatDate(date, { style: 'long', year: showYear })\n\n return (\n <View style={styles.container}>\n <View style={styles.separator} />\n <Text variant=\"footnote\" style={styles.dateText}>\n {dateStamp}\n </Text>\n <View style={styles.separator} />\n </View>\n )\n}\n\nconst useDateSeparatorStyles = () => {\n const theme = useTheme()\n return StyleSheet.create({\n container: {\n alignItems: 'center',\n flexDirection: 'row',\n paddingHorizontal: 16,\n paddingVertical: 16,\n },\n separator: {\n flex: 1,\n height: 1,\n borderTopWidth: 1,\n borderTopColor: theme.colors.borderColorDefaultBase,\n },\n dateText: {\n paddingHorizontal: 8,\n },\n })\n}\n\nexport const groupMessages = (ms: MessageResource[]) => {\n let enrichedMessages: (MessageResource | DateSeparator)[] = []\n let encounteredOneOfMyMessages = false\n\n ms.forEach((message, i) => {\n const prevMessage = ms[i + 1]\n const nextMessage = ms[i - 1]\n const date = moment(message.createdAt).format('YYYY-MM-DD')\n const prevMessageDifferentAuthor = message.author?.id !== prevMessage?.author?.id\n const nextMessageDifferentAuthor = message.author?.id !== nextMessage?.author?.id\n const prevMessageMoreThan5Minutes =\n prevMessage &&\n new Date(message.createdAt).getTime() - new Date(prevMessage.createdAt).getTime() > 60000 * 5\n const nextMessageMoreThan5Minutes =\n nextMessage &&\n new Date(nextMessage.createdAt).getTime() - new Date(message.createdAt).getTime() > 60000 * 5\n\n if (message.mine && !encounteredOneOfMyMessages) {\n encounteredOneOfMyMessages = true\n message.myLatestInConversation = true\n } else {\n message.myLatestInConversation = false\n }\n message.lastInGroup = !nextMessage || nextMessageDifferentAuthor || nextMessageMoreThan5Minutes\n message.renderAuthor =\n !message.mine && (!prevMessage || prevMessageDifferentAuthor || prevMessageMoreThan5Minutes)\n\n enrichedMessages.push(message)\n if (!prevMessage || date !== moment(prevMessage.createdAt).format('YYYY-MM-DD')) {\n enrichedMessages.push({ type: 'DateSeparator', id: `day-divider-${message.id}`, date })\n }\n })\n\n return enrichedMessages\n}\n\nconst PressableHeaderTitle = ({ style, children }: HeaderTitleProps) => {\n const styles = usePressableHeaderStyle()\n const navigation = useNavigation()\n\n const route = useRoute() as ConversationScreenProps['route']\n\n const { data: conversation } = useConversation(route.params)\n const badge = conversation.badges?.[0]\n const resourceType = badge?.pcoResourceType || ''\n const productName = badge?.appName\n const name = badge?.text || undefined\n\n return (\n <PlatformPressable\n style={styles.container}\n onPress={() =>\n navigation.navigate('ConversationDetails', { conversation_id: conversation?.id })\n }\n >\n <View style={styles.titleWrapper}>\n <HeaderTitle style={[styles.title, style]}>{children}</HeaderTitle>\n <Icon name=\"general.downChevron\" size={12} />\n </View>\n <Badge\n variant=\"metaSubtle\"\n productLogoName={productName}\n label={resourceType}\n metaLabel={name}\n style={styles.badge}\n />\n </PlatformPressable>\n )\n}\n\nconst usePressableHeaderStyle = () => {\n return StyleSheet.create({\n container: {\n alignItems: Platform.select({ android: 'flex-start', default: 'center' }),\n },\n titleWrapper: {\n alignItems: 'center',\n columnGap: 4,\n flexDirection: 'row',\n },\n title: {\n padding: 0,\n margin: 0,\n },\n badge: {\n alignSelf: Platform.select({ android: 'flex-start', default: 'center' }),\n marginTop: 2,\n },\n })\n}\n\nconst useStyles = () => {\n const navigationTheme = useNavigationTheme()\n const { bottom } = useSafeAreaInsets()\n\n return StyleSheet.create({\n container: {\n flex: 1,\n justifyContent: 'center',\n backgroundColor: navigationTheme.colors.card,\n paddingBottom: bottom,\n },\n keyboardView: {\n flex: 1,\n },\n listContainer: {\n gap: 12,\n paddingHorizontal: 16,\n paddingVertical: 12,\n },\n })\n}\n\n/**\n * useEnsureConversationsRouteExists\n */\nconst useEnsureConversationsRouteExists = () => {\n const navigation = useNavigation()\n const { params } = useRoute<RouteProp<ConversationScreenProps['route']>>()\n\n useEffect(() => {\n const navigationState = navigation.getState()\n const routes = navigationState?.routes || []\n const conversationsRoute = routes.find(r => r.name === 'Conversations')\n\n if (conversationsRoute) return\n\n navigation.dispatch(state => {\n return CommonActions.reset({\n ...state,\n routes: [\n { name: 'Conversations', params: { chat_group_graph_id: params?.chat_group_graph_id } },\n ...routes,\n ],\n index: state.index + 1,\n })\n })\n }, [navigation, params?.chat_group_graph_id])\n}\n"]}
|