@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,5 +1,5 @@
|
|
|
1
1
|
import { useNavigation, useTheme as useNavigationTheme, useRoute } from '@react-navigation/native'
|
|
2
|
-
import React, { useContext, useEffect, useState } from 'react'
|
|
2
|
+
import React, { useCallback, useContext, useEffect, useState } from 'react'
|
|
3
3
|
import { StyleSheet, TextInput, View, ViewProps } from 'react-native'
|
|
4
4
|
import { IconButton, Text } from '../../components'
|
|
5
5
|
import { useTheme } from '../../hooks'
|
|
@@ -7,6 +7,13 @@ import { ConversationResource } from '../../types'
|
|
|
7
7
|
import { useMessageCreate } from '../../hooks/use_message_create'
|
|
8
8
|
import { ConversationScreenProps } from '../../screens/conversation_screen'
|
|
9
9
|
import { ChatContext } from '../../contexts/chat_context'
|
|
10
|
+
import { ImagePicker, ImagePickerResult } from '../../utils/native_adapters'
|
|
11
|
+
import { useAttachmentUploader } from '../../hooks/use_attachment_uploader'
|
|
12
|
+
import {
|
|
13
|
+
DenormalizedAttachmentResourceForCreate,
|
|
14
|
+
DenormalizedMessageAttachmentResourceForCreate,
|
|
15
|
+
} from '../../types/resources/denormalized_attachment_resource'
|
|
16
|
+
import { MessageFormAttachmentImage } from './message_form/message_form_attachment_image'
|
|
10
17
|
|
|
11
18
|
export const MessageForm = {
|
|
12
19
|
Root: MessageFormRoot,
|
|
@@ -20,7 +27,16 @@ interface MessagesFormRootProps extends ViewProps {
|
|
|
20
27
|
conversation: ConversationResource
|
|
21
28
|
}
|
|
22
29
|
|
|
23
|
-
const MessageFormContext = React.createContext
|
|
30
|
+
const MessageFormContext = React.createContext<{
|
|
31
|
+
text: string
|
|
32
|
+
setText: (text: string) => void
|
|
33
|
+
onSubmit: () => void
|
|
34
|
+
disabled: boolean
|
|
35
|
+
canGiphy: boolean
|
|
36
|
+
usingGiphy: boolean
|
|
37
|
+
setUsingGiphy: (usingGiphy: boolean) => void
|
|
38
|
+
attachmentUploader?: ReturnType<typeof useAttachmentUploader>
|
|
39
|
+
}>({
|
|
24
40
|
text: '',
|
|
25
41
|
setText: (_text: string) => {},
|
|
26
42
|
onSubmit: () => {},
|
|
@@ -38,7 +54,25 @@ function MessageFormRoot({ conversation, children }: MessagesFormRootProps) {
|
|
|
38
54
|
const [usingGiphy, setUsingGiphy] = useState(false)
|
|
39
55
|
const navigation = useNavigation()
|
|
40
56
|
const route = useRoute() as ConversationScreenProps['route']
|
|
41
|
-
const {
|
|
57
|
+
const {
|
|
58
|
+
status,
|
|
59
|
+
isPending,
|
|
60
|
+
reset: resetMutation,
|
|
61
|
+
mutate,
|
|
62
|
+
} = useMessageCreate({
|
|
63
|
+
conversationId: conversation.id,
|
|
64
|
+
})
|
|
65
|
+
const attachmentUploader = useAttachmentUploader({
|
|
66
|
+
conversationId: conversation.id,
|
|
67
|
+
})
|
|
68
|
+
const resetAttachmentUploader = attachmentUploader.reset
|
|
69
|
+
|
|
70
|
+
const reset = useCallback(() => {
|
|
71
|
+
resetAttachmentUploader()
|
|
72
|
+
resetMutation()
|
|
73
|
+
setText('')
|
|
74
|
+
setUsingGiphy(false)
|
|
75
|
+
}, [resetAttachmentUploader, resetMutation])
|
|
42
76
|
|
|
43
77
|
useEffect(() => {
|
|
44
78
|
if (canGiphy && !usingGiphy && text.startsWith('/giphy ')) {
|
|
@@ -50,7 +84,6 @@ function MessageFormRoot({ conversation, children }: MessagesFormRootProps) {
|
|
|
50
84
|
useEffect(() => {
|
|
51
85
|
switch (status) {
|
|
52
86
|
case 'success':
|
|
53
|
-
setText('')
|
|
54
87
|
reset()
|
|
55
88
|
break
|
|
56
89
|
}
|
|
@@ -58,15 +91,16 @@ function MessageFormRoot({ conversation, children }: MessagesFormRootProps) {
|
|
|
58
91
|
|
|
59
92
|
useEffect(() => {
|
|
60
93
|
if (route.params.clear_input) {
|
|
61
|
-
|
|
62
|
-
setUsingGiphy(false)
|
|
94
|
+
reset()
|
|
63
95
|
navigation.setParams({ ...route.params, clear_input: false })
|
|
64
96
|
}
|
|
65
|
-
}, [navigation, route.params])
|
|
97
|
+
}, [reset, navigation, route.params])
|
|
66
98
|
|
|
67
99
|
const canSubmit = (() => {
|
|
68
100
|
if (isPending) return false
|
|
101
|
+
if (attachmentUploader?.pendingUploads) return false
|
|
69
102
|
if (text.length > 0) return true
|
|
103
|
+
if (attachmentUploader?.attachments?.length) return true
|
|
70
104
|
return false
|
|
71
105
|
})()
|
|
72
106
|
const disabled = !canSubmit
|
|
@@ -81,7 +115,16 @@ function MessageFormRoot({ conversation, children }: MessagesFormRootProps) {
|
|
|
81
115
|
search_term: text,
|
|
82
116
|
})
|
|
83
117
|
} else {
|
|
84
|
-
|
|
118
|
+
let attachmentsForSubmit: DenormalizedAttachmentResourceForCreate[] = []
|
|
119
|
+
if (attachmentUploader?.attachmentIds) {
|
|
120
|
+
attachmentsForSubmit = attachmentUploader.attachmentIds.map(
|
|
121
|
+
(id: string): DenormalizedMessageAttachmentResourceForCreate => ({
|
|
122
|
+
type: 'MessageAttachment',
|
|
123
|
+
id,
|
|
124
|
+
})
|
|
125
|
+
)
|
|
126
|
+
}
|
|
127
|
+
mutate({ text, attachments: attachmentsForSubmit })
|
|
85
128
|
}
|
|
86
129
|
}
|
|
87
130
|
|
|
@@ -95,6 +138,7 @@ function MessageFormRoot({ conversation, children }: MessagesFormRootProps) {
|
|
|
95
138
|
canGiphy,
|
|
96
139
|
usingGiphy,
|
|
97
140
|
setUsingGiphy,
|
|
141
|
+
attachmentUploader,
|
|
98
142
|
}}
|
|
99
143
|
>
|
|
100
144
|
<View style={styles.textInputContainer}>{children}</View>
|
|
@@ -102,25 +146,63 @@ function MessageFormRoot({ conversation, children }: MessagesFormRootProps) {
|
|
|
102
146
|
)
|
|
103
147
|
}
|
|
104
148
|
|
|
149
|
+
function MessageFormAttachments() {
|
|
150
|
+
const styles = useMessageFormStyles()
|
|
151
|
+
const { attachmentUploader } = React.useContext(MessageFormContext)
|
|
152
|
+
const numberOfAttachments = attachmentUploader?.attachments?.length || 0
|
|
153
|
+
const attachments = attachmentUploader?.attachments || []
|
|
154
|
+
|
|
155
|
+
if (numberOfAttachments === 0) {
|
|
156
|
+
return null
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return (
|
|
160
|
+
<View style={styles.messageFormAttachments}>
|
|
161
|
+
{attachments.map(attachment => {
|
|
162
|
+
return (
|
|
163
|
+
<MessageFormAttachmentImage
|
|
164
|
+
key={attachment.file.uri}
|
|
165
|
+
uri={attachment.file.uri}
|
|
166
|
+
alt={attachment.file.name}
|
|
167
|
+
status={attachment.status}
|
|
168
|
+
width={attachment.file.width}
|
|
169
|
+
height={attachment.file.height}
|
|
170
|
+
removeAttachment={() => {
|
|
171
|
+
attachmentUploader?.removeAttachment(attachment)
|
|
172
|
+
}}
|
|
173
|
+
/>
|
|
174
|
+
)
|
|
175
|
+
})}
|
|
176
|
+
</View>
|
|
177
|
+
)
|
|
178
|
+
}
|
|
179
|
+
|
|
105
180
|
function MessageFormInput() {
|
|
106
181
|
const styles = useMessageFormStyles()
|
|
107
|
-
const { text, setText, onSubmit, usingGiphy } =
|
|
182
|
+
const { text, setText, onSubmit, usingGiphy, attachmentUploader } =
|
|
183
|
+
React.useContext(MessageFormContext)
|
|
184
|
+
const attachmentError = attachmentUploader?.errorMessage
|
|
108
185
|
|
|
109
186
|
return (
|
|
110
|
-
<View style={styles.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
187
|
+
<View style={styles.textInputBoundary}>
|
|
188
|
+
<MessageFormAttachments />
|
|
189
|
+
<View style={styles.textInput}>
|
|
190
|
+
{usingGiphy ? (
|
|
191
|
+
<View style={styles.giphyBadge}>
|
|
192
|
+
<Text>/Giphy</Text>
|
|
193
|
+
</View>
|
|
194
|
+
) : null}
|
|
195
|
+
|
|
196
|
+
<TextInput
|
|
197
|
+
aria-disabled={true}
|
|
198
|
+
placeholder="Send a message"
|
|
199
|
+
onChangeText={setText}
|
|
200
|
+
value={text}
|
|
201
|
+
onSubmitEditing={onSubmit}
|
|
202
|
+
/>
|
|
203
|
+
</View>
|
|
204
|
+
|
|
205
|
+
{attachmentError ? <Text style={styles.inputErrorMessage}>{attachmentError}</Text> : null}
|
|
124
206
|
</View>
|
|
125
207
|
)
|
|
126
208
|
}
|
|
@@ -143,19 +225,82 @@ function MessageFormSubmitBtn() {
|
|
|
143
225
|
}
|
|
144
226
|
|
|
145
227
|
function MessageFormAttachmentPicker() {
|
|
146
|
-
const
|
|
228
|
+
const styles = useMessageFormStyles()
|
|
229
|
+
const { usingGiphy, attachmentUploader } = React.useContext(MessageFormContext)
|
|
230
|
+
const [isOpen, setIsOpen] = useState(false)
|
|
231
|
+
|
|
232
|
+
function uploadImagePickerResult(result: ImagePickerResult) {
|
|
233
|
+
if (result.canceled) {
|
|
234
|
+
return
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
const filteredAssets = result.assets
|
|
238
|
+
.filter(asset => {
|
|
239
|
+
return asset.fileSize && asset.fileName && asset.mimeType
|
|
240
|
+
})
|
|
241
|
+
.map(asset => {
|
|
242
|
+
return {
|
|
243
|
+
uri: asset.uri,
|
|
244
|
+
name: asset.fileName as string,
|
|
245
|
+
type: asset.mimeType as string,
|
|
246
|
+
size: asset.fileSize as number,
|
|
247
|
+
height: asset.height,
|
|
248
|
+
width: asset.width,
|
|
249
|
+
}
|
|
250
|
+
})
|
|
251
|
+
|
|
252
|
+
attachmentUploader?.handleFilesAttached(filteredAssets)
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
const openCamera = async () => {
|
|
256
|
+
setIsOpen(false)
|
|
257
|
+
let result = await ImagePicker.openCameraAsync()
|
|
258
|
+
if (!result.canceled) {
|
|
259
|
+
uploadImagePickerResult(result)
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
const pickImage = async () => {
|
|
264
|
+
setIsOpen(false)
|
|
265
|
+
let result = await ImagePicker.openImageLibraryAsync()
|
|
266
|
+
if (!result.canceled) {
|
|
267
|
+
uploadImagePickerResult(result)
|
|
268
|
+
}
|
|
269
|
+
}
|
|
147
270
|
|
|
148
271
|
if (usingGiphy) {
|
|
149
272
|
return null
|
|
150
273
|
}
|
|
151
274
|
|
|
152
275
|
return (
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
276
|
+
// TODO: Design Pass
|
|
277
|
+
<View style={styles.attachmentPicker}>
|
|
278
|
+
{isOpen && (
|
|
279
|
+
<View style={styles.attachmentPickerButtons}>
|
|
280
|
+
<IconButton
|
|
281
|
+
accessibilityLabel="Take a photo"
|
|
282
|
+
size="md"
|
|
283
|
+
appearance="neutral"
|
|
284
|
+
name={'general.videoCamera'}
|
|
285
|
+
onPress={openCamera}
|
|
286
|
+
/>
|
|
287
|
+
<IconButton
|
|
288
|
+
accessibilityLabel="Choose a photo"
|
|
289
|
+
size="md"
|
|
290
|
+
appearance="neutral"
|
|
291
|
+
name={'churchCenter.photosIos'}
|
|
292
|
+
onPress={pickImage}
|
|
293
|
+
/>
|
|
294
|
+
</View>
|
|
295
|
+
)}
|
|
296
|
+
<IconButton
|
|
297
|
+
accessibilityLabel="File Menu"
|
|
298
|
+
size="md"
|
|
299
|
+
appearance="neutral"
|
|
300
|
+
name={'general.outlinedPlusCircle'}
|
|
301
|
+
onPress={() => setIsOpen(!isOpen)}
|
|
302
|
+
/>
|
|
303
|
+
</View>
|
|
159
304
|
)
|
|
160
305
|
}
|
|
161
306
|
|
|
@@ -203,13 +348,16 @@ const useMessageFormStyles = () => {
|
|
|
203
348
|
alignItems: 'center',
|
|
204
349
|
gap: 12,
|
|
205
350
|
},
|
|
206
|
-
|
|
351
|
+
textInputBoundary: {
|
|
207
352
|
borderRadius: 24,
|
|
208
353
|
borderWidth: 1,
|
|
209
354
|
padding: 12,
|
|
210
355
|
paddingHorizontal: 20,
|
|
211
356
|
borderColor: theme.colors.fillColorNeutral050Base,
|
|
212
357
|
flex: 1,
|
|
358
|
+
gap: 12,
|
|
359
|
+
},
|
|
360
|
+
textInput: {
|
|
213
361
|
flexDirection: 'row',
|
|
214
362
|
gap: 12,
|
|
215
363
|
},
|
|
@@ -224,5 +372,23 @@ const useMessageFormStyles = () => {
|
|
|
224
372
|
height: 36,
|
|
225
373
|
width: 36,
|
|
226
374
|
},
|
|
375
|
+
attachmentPicker: {
|
|
376
|
+
position: 'relative',
|
|
377
|
+
},
|
|
378
|
+
attachmentPickerButtons: {
|
|
379
|
+
position: 'absolute',
|
|
380
|
+
left: 0,
|
|
381
|
+
bottom: 40,
|
|
382
|
+
zIndex: 10,
|
|
383
|
+
gap: 16,
|
|
384
|
+
},
|
|
385
|
+
messageFormAttachments: {
|
|
386
|
+
flexDirection: 'row',
|
|
387
|
+
gap: 8,
|
|
388
|
+
},
|
|
389
|
+
inputErrorMessage: {
|
|
390
|
+
color: theme.colors.statusErrorText,
|
|
391
|
+
fontSize: 14,
|
|
392
|
+
},
|
|
227
393
|
})
|
|
228
394
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { ReactNode, useCallback, useEffect, useRef, useState } from 'react'
|
|
2
|
-
import { Platform, Pressable, StyleSheet, View, ViewStyle } from 'react-native'
|
|
2
|
+
import { Platform, Pressable, StyleProp, StyleSheet, View, ViewStyle } from 'react-native'
|
|
3
3
|
import ReanimatedSwipeable, {
|
|
4
4
|
SwipeableMethods,
|
|
5
5
|
} from 'react-native-gesture-handler/ReanimatedSwipeable'
|
|
@@ -22,7 +22,7 @@ export function ConversationActions({
|
|
|
22
22
|
children: ReactNode
|
|
23
23
|
conversation: ConversationResource
|
|
24
24
|
onPress: () => void
|
|
25
|
-
style?: ViewStyle
|
|
25
|
+
style?: StyleProp<ViewStyle>
|
|
26
26
|
}) {
|
|
27
27
|
const swipeableRef = useRef<SwipeableMethods>(null)
|
|
28
28
|
const styles = useStyles()
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { StyleSheet, View } from 'react-native'
|
|
2
|
+
import { StyleSheet, View, ViewStyle } from 'react-native'
|
|
3
3
|
import { ConversationResource } from '../../types'
|
|
4
4
|
import { AvatarGroup, Heading, Text, Badge } from '../display'
|
|
5
5
|
import { formatDatePreview } from '../../utils/date'
|
|
@@ -12,12 +12,14 @@ interface ConversationPreviewProps {
|
|
|
12
12
|
conversation: ConversationResource
|
|
13
13
|
onPress: () => void
|
|
14
14
|
showBadges?: boolean
|
|
15
|
+
style?: ViewStyle
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
export const ConversationPreview = ({
|
|
18
19
|
conversation,
|
|
19
20
|
onPress,
|
|
20
21
|
showBadges = true,
|
|
22
|
+
style,
|
|
21
23
|
}: ConversationPreviewProps) => {
|
|
22
24
|
const styles = useStyles()
|
|
23
25
|
const {
|
|
@@ -32,7 +34,11 @@ export const ConversationPreview = ({
|
|
|
32
34
|
} = conversation
|
|
33
35
|
|
|
34
36
|
return (
|
|
35
|
-
<ConversationActions
|
|
37
|
+
<ConversationActions
|
|
38
|
+
conversation={conversation}
|
|
39
|
+
style={[styles.previewRow, style]}
|
|
40
|
+
onPress={onPress}
|
|
41
|
+
>
|
|
36
42
|
<AvatarGroup size="lg" sourceUris={previewAvatarUrls || []} />
|
|
37
43
|
<View style={styles.conversationBody}>
|
|
38
44
|
<Heading numberOfLines={1} variant="h3" style={styles.title}>
|
|
@@ -8,11 +8,13 @@ import { Text } from './text'
|
|
|
8
8
|
|
|
9
9
|
export const ActionButton = ({
|
|
10
10
|
visible = true,
|
|
11
|
+
disabled = false,
|
|
11
12
|
onPress,
|
|
12
13
|
title,
|
|
13
14
|
infoText,
|
|
14
15
|
}: {
|
|
15
16
|
visible?: boolean
|
|
17
|
+
disabled?: boolean
|
|
16
18
|
onPress: () => void
|
|
17
19
|
title: string
|
|
18
20
|
infoText?: string
|
|
@@ -32,11 +34,11 @@ export const ActionButton = ({
|
|
|
32
34
|
return (
|
|
33
35
|
<Animated.View style={styles.container}>
|
|
34
36
|
{Boolean(infoText) && (
|
|
35
|
-
<Text style={styles.infoText} variant="
|
|
37
|
+
<Text style={styles.infoText} variant="footnote">
|
|
36
38
|
{infoText}
|
|
37
39
|
</Text>
|
|
38
40
|
)}
|
|
39
|
-
<Button variant="fill" size="lg" onPress={onPress} title={title} />
|
|
41
|
+
<Button variant="fill" size="lg" onPress={onPress} title={title} disabled={disabled} />
|
|
40
42
|
</Animated.View>
|
|
41
43
|
)
|
|
42
44
|
}
|
|
@@ -56,7 +58,6 @@ const useStyles = () => {
|
|
|
56
58
|
},
|
|
57
59
|
infoText: {
|
|
58
60
|
textAlign: 'center',
|
|
59
|
-
color: colors.textColorDefaultSecondary,
|
|
60
61
|
},
|
|
61
62
|
})
|
|
62
63
|
}
|
|
@@ -3,6 +3,7 @@ import BannerPrimitive, {
|
|
|
3
3
|
type BannerStatusIconProps,
|
|
4
4
|
type BannerRootProps,
|
|
5
5
|
} from '../primitive/banner_primitive'
|
|
6
|
+
import { ViewStyle } from 'react-native'
|
|
6
7
|
|
|
7
8
|
type descriptionUnion = string | ReactElement | undefined
|
|
8
9
|
|
|
@@ -29,6 +30,10 @@ export interface BannerProps {
|
|
|
29
30
|
* Hides the status icon. By default, the status icon is shown.
|
|
30
31
|
*/
|
|
31
32
|
showIcon?: boolean
|
|
33
|
+
/**
|
|
34
|
+
* Adds a style to the banner.
|
|
35
|
+
*/
|
|
36
|
+
style?: ViewStyle
|
|
32
37
|
}
|
|
33
38
|
|
|
34
39
|
export function Banner({
|
|
@@ -37,12 +42,13 @@ export function Banner({
|
|
|
37
42
|
heading,
|
|
38
43
|
iconName,
|
|
39
44
|
showIcon = true,
|
|
45
|
+
style,
|
|
40
46
|
}: BannerProps) {
|
|
41
47
|
if (!description && !heading) return null
|
|
42
48
|
|
|
43
49
|
return (
|
|
44
50
|
<BannerPrimitive.Root appearance={appearance}>
|
|
45
|
-
<BannerPrimitive.StaticLayout>
|
|
51
|
+
<BannerPrimitive.StaticLayout style={style}>
|
|
46
52
|
{showIcon && <BannerPrimitive.StatusIcon iconName={iconName} />}
|
|
47
53
|
<BannerPrimitive.Content>
|
|
48
54
|
{Boolean(heading) && <BannerPrimitive.Heading>{heading}</BannerPrimitive.Heading>}
|
|
@@ -20,6 +20,7 @@ export function BannerCollapsible({
|
|
|
20
20
|
heading,
|
|
21
21
|
iconName,
|
|
22
22
|
showIcon = true,
|
|
23
|
+
style,
|
|
23
24
|
}: BannerCollapsibleProps) {
|
|
24
25
|
const [expanded, setExpanded] = React.useState(false)
|
|
25
26
|
|
|
@@ -31,7 +32,11 @@ export function BannerCollapsible({
|
|
|
31
32
|
|
|
32
33
|
return (
|
|
33
34
|
<BannerPrimitive.Root appearance={appearance}>
|
|
34
|
-
<BannerPrimitive.CollapsibleLayout
|
|
35
|
+
<BannerPrimitive.CollapsibleLayout
|
|
36
|
+
onPress={toggleCollapsible}
|
|
37
|
+
expanded={expanded}
|
|
38
|
+
style={style}
|
|
39
|
+
>
|
|
35
40
|
{showIcon && <BannerPrimitive.StatusIcon iconName={iconName} />}
|
|
36
41
|
<BannerPrimitive.Content>
|
|
37
42
|
{Boolean(heading) && <BannerPrimitive.Heading>{heading}</BannerPrimitive.Heading>}
|
|
@@ -2,7 +2,7 @@ import React from 'react'
|
|
|
2
2
|
import { MemberResource } from '../../types'
|
|
3
3
|
import { BannerCollapsible } from './banner_collapsible'
|
|
4
4
|
import BannerPrimitive from '../primitive/banner_primitive'
|
|
5
|
-
import { View, StyleSheet } from 'react-native'
|
|
5
|
+
import { View, StyleSheet, type ViewStyle } from 'react-native'
|
|
6
6
|
import { Avatar } from './avatar'
|
|
7
7
|
import { platformFontWeightMedium, pluralize } from '../../utils'
|
|
8
8
|
import { Text } from './text'
|
|
@@ -13,14 +13,20 @@ import { Text } from './text'
|
|
|
13
13
|
|
|
14
14
|
interface ChildNoticeProps {
|
|
15
15
|
childMembers: MemberResource[]
|
|
16
|
+
style?: ViewStyle
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
export function ChildNotice({ childMembers }: ChildNoticeProps) {
|
|
19
|
+
export function ChildNotice({ childMembers, style }: ChildNoticeProps) {
|
|
19
20
|
const styles = useStyles()
|
|
20
21
|
const heading = `${pluralize(childMembers.length, 'member')} under age 13`
|
|
21
22
|
|
|
22
23
|
return (
|
|
23
|
-
<BannerCollapsible
|
|
24
|
+
<BannerCollapsible
|
|
25
|
+
appearance="warning"
|
|
26
|
+
iconName="general.shieldExclamation"
|
|
27
|
+
heading={heading}
|
|
28
|
+
style={style}
|
|
29
|
+
>
|
|
24
30
|
<BannerPrimitive.Text>
|
|
25
31
|
Under age members cannot chat. They won't see conversations or notifications.
|
|
26
32
|
</BannerPrimitive.Text>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { StyleSheet, View, ViewStyle } from 'react-native'
|
|
3
|
+
import { useConversations } from '../hooks/use_conversations'
|
|
4
|
+
import { ConversationPreview } from './conversations/conversation_preview'
|
|
5
|
+
import { ConversationRequestArgs } from '../utils/request/conversation'
|
|
6
|
+
import { useTheme } from '../hooks'
|
|
7
|
+
import { Icon, Text } from './display'
|
|
8
|
+
|
|
9
|
+
interface GroupConversationsProps extends Partial<ConversationRequestArgs> {
|
|
10
|
+
limit?: number
|
|
11
|
+
onConversationPress: (conversation: any) => void
|
|
12
|
+
style?: ViewStyle
|
|
13
|
+
ListHeaderComponent?:
|
|
14
|
+
| React.ComponentType<any>
|
|
15
|
+
| React.ReactElement<any, string | React.JSXElementConstructor<any>>
|
|
16
|
+
ListOverflowFooterComponent?:
|
|
17
|
+
| React.ComponentType<any>
|
|
18
|
+
| React.ReactElement<any, string | React.JSXElementConstructor<any>>
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* GroupConversations is a component that displays a list of conversations
|
|
23
|
+
* for a specific group.
|
|
24
|
+
*
|
|
25
|
+
* Originally designed for use in CCA.
|
|
26
|
+
*/
|
|
27
|
+
export const GroupConversations = ({
|
|
28
|
+
limit,
|
|
29
|
+
onConversationPress,
|
|
30
|
+
style,
|
|
31
|
+
ListHeaderComponent,
|
|
32
|
+
ListOverflowFooterComponent,
|
|
33
|
+
chat_group_graph_id,
|
|
34
|
+
}: GroupConversationsProps) => {
|
|
35
|
+
const styles = useStyles()
|
|
36
|
+
const { conversations = [] } = useConversations({
|
|
37
|
+
chat_group_graph_id,
|
|
38
|
+
group_source_app_name: undefined,
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<View style={style}>
|
|
43
|
+
<>{ListHeaderComponent}</>
|
|
44
|
+
{conversations.length === 0 && (
|
|
45
|
+
<View style={styles.listEmpty}>
|
|
46
|
+
<Icon size={24} name="general.textMessage" style={styles.listEmptyIcon} />
|
|
47
|
+
<Text variant="secondary">No conversations found</Text>
|
|
48
|
+
</View>
|
|
49
|
+
)}
|
|
50
|
+
{conversations.slice(0, limit).map(conversation => (
|
|
51
|
+
<ConversationPreview
|
|
52
|
+
style={styles.conversation}
|
|
53
|
+
key={conversation.id}
|
|
54
|
+
showBadges={false}
|
|
55
|
+
conversation={conversation}
|
|
56
|
+
onPress={() => onConversationPress(conversation)}
|
|
57
|
+
/>
|
|
58
|
+
))}
|
|
59
|
+
{conversations.length > (limit || 0) && <>{ListOverflowFooterComponent}</>}
|
|
60
|
+
</View>
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const useStyles = () => {
|
|
65
|
+
const { colors } = useTheme()
|
|
66
|
+
return StyleSheet.create({
|
|
67
|
+
constainer: {},
|
|
68
|
+
conversation: {
|
|
69
|
+
borderBottomWidth: 0,
|
|
70
|
+
},
|
|
71
|
+
listItem: { color: colors.fillColorNeutral020 },
|
|
72
|
+
listEmpty: {
|
|
73
|
+
justifyContent: 'center',
|
|
74
|
+
alignItems: 'center',
|
|
75
|
+
paddingVertical: 16,
|
|
76
|
+
gap: 8,
|
|
77
|
+
},
|
|
78
|
+
listEmptyIcon: {
|
|
79
|
+
color: colors.fillColorNeutral020,
|
|
80
|
+
},
|
|
81
|
+
})
|
|
82
|
+
}
|
package/src/components/index.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { createContext, FC, ReactNode, useContext } from 'react'
|
|
2
|
-
import { Pressable, StyleSheet, View } from 'react-native'
|
|
2
|
+
import { Pressable, StyleSheet, View, ViewStyle } from 'react-native'
|
|
3
3
|
import {
|
|
4
4
|
useStatusColorAppearanceMap,
|
|
5
5
|
type StatusAppearanceUnion,
|
|
@@ -94,13 +94,14 @@ BannerRoot.displayName = 'Banner.Root'
|
|
|
94
94
|
|
|
95
95
|
interface BannerStaticLayoutProps {
|
|
96
96
|
children: ReactNode
|
|
97
|
+
style?: ViewStyle
|
|
97
98
|
}
|
|
98
99
|
|
|
99
|
-
function BannerStaticLayout({ children }: BannerStaticLayoutProps) {
|
|
100
|
+
function BannerStaticLayout({ children, style }: BannerStaticLayoutProps) {
|
|
100
101
|
const { appearance } = useBannerContext()
|
|
101
102
|
const styles = useStyles({ appearance })
|
|
102
103
|
|
|
103
|
-
return <View style={styles.staticLayout}>{children}</View>
|
|
104
|
+
return <View style={[styles.staticLayout, style]}>{children}</View>
|
|
104
105
|
}
|
|
105
106
|
|
|
106
107
|
BannerStaticLayout.displayName = 'Banner.StaticLayout'
|
|
@@ -113,9 +114,15 @@ interface BannerCollapsibleLayoutProps {
|
|
|
113
114
|
children: ReactNode
|
|
114
115
|
expanded?: boolean
|
|
115
116
|
onPress?: () => void
|
|
117
|
+
style?: ViewStyle
|
|
116
118
|
}
|
|
117
119
|
|
|
118
|
-
function BannerCollapsibleLayout({
|
|
120
|
+
function BannerCollapsibleLayout({
|
|
121
|
+
children,
|
|
122
|
+
expanded,
|
|
123
|
+
onPress,
|
|
124
|
+
style,
|
|
125
|
+
}: BannerCollapsibleLayoutProps) {
|
|
119
126
|
const { appearance = 'neutral' } = useBannerContext()
|
|
120
127
|
const styles = useStyles({ appearance })
|
|
121
128
|
const iconName = expanded ? 'general.upCaret' : 'general.downCaret'
|
|
@@ -127,7 +134,7 @@ function BannerCollapsibleLayout({ children, expanded, onPress }: BannerCollapsi
|
|
|
127
134
|
return (
|
|
128
135
|
<Pressable
|
|
129
136
|
onPress={onPress}
|
|
130
|
-
style={({ pressed }) => [styles.staticLayout, pressed && platformPressedOpacityStyle]}
|
|
137
|
+
style={({ pressed }) => [styles.staticLayout, pressed && platformPressedOpacityStyle, style]}
|
|
131
138
|
android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}
|
|
132
139
|
accessibilityState={{ expanded }}
|
|
133
140
|
accessibilityRole="button"
|
|
@@ -17,7 +17,7 @@ const defaultQueryFn = ({ queryKey }: { queryKey: QueryKey }) => {
|
|
|
17
17
|
return apiClient[app].get({ url, data, headers })
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export const
|
|
20
|
+
export const chatQueryClient = new QueryClient({
|
|
21
21
|
defaultOptions: {
|
|
22
22
|
queries: {
|
|
23
23
|
queryFn: defaultQueryFn,
|
|
@@ -35,10 +35,10 @@ export function ApiProvider({ children }: ViewProps) {
|
|
|
35
35
|
useEffect(() => {
|
|
36
36
|
if (!sessionChanged) return
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
chatQueryClient.clear()
|
|
39
39
|
}, [sessionChanged])
|
|
40
40
|
|
|
41
|
-
return <QueryClientProvider client={
|
|
41
|
+
return <QueryClientProvider client={chatQueryClient}>{children}</QueryClientProvider>
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
function useSessionChanged(value: Pick<ChatContextValue, 'token' | 'env'>): boolean {
|