@planningcenter/chat-react-native 3.2.0-rc.1 → 3.2.0-rc.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (329) hide show
  1. package/build/components/conversation/message_form.d.ts +2 -2
  2. package/build/components/conversation/message_form.d.ts.map +1 -1
  3. package/build/components/conversation/message_form.js +95 -41
  4. package/build/components/conversation/message_form.js.map +1 -1
  5. package/build/components/conversation/message_reaction.d.ts +2 -2
  6. package/build/components/conversations/action_toggle_button.d.ts +21 -0
  7. package/build/components/conversations/action_toggle_button.d.ts.map +1 -0
  8. package/build/components/conversations/action_toggle_button.js +48 -0
  9. package/build/components/conversations/action_toggle_button.js.map +1 -0
  10. package/build/components/conversations/conversation_actions.d.ts +10 -0
  11. package/build/components/conversations/conversation_actions.d.ts.map +1 -0
  12. package/build/components/conversations/conversation_actions.js +84 -0
  13. package/build/components/conversations/conversation_actions.js.map +1 -0
  14. package/build/components/conversations/conversation_preview.d.ts +2 -1
  15. package/build/components/conversations/conversation_preview.d.ts.map +1 -1
  16. package/build/components/conversations/conversation_preview.js +27 -9
  17. package/build/components/conversations/conversation_preview.js.map +1 -1
  18. package/build/components/conversations/conversations.d.ts +2 -3
  19. package/build/components/conversations/conversations.d.ts.map +1 -1
  20. package/build/components/conversations/conversations.js +5 -11
  21. package/build/components/conversations/conversations.js.map +1 -1
  22. package/build/components/conversations/mute_indicator.d.ts +5 -0
  23. package/build/components/conversations/mute_indicator.d.ts.map +1 -0
  24. package/build/components/conversations/mute_indicator.js +19 -0
  25. package/build/components/conversations/mute_indicator.js.map +1 -0
  26. package/build/components/conversations/unread_count_badge.d.ts +2 -1
  27. package/build/components/conversations/unread_count_badge.d.ts.map +1 -1
  28. package/build/components/conversations/unread_count_badge.js +9 -1
  29. package/build/components/conversations/unread_count_badge.js.map +1 -1
  30. package/build/components/display/action_button.d.ts +2 -1
  31. package/build/components/display/action_button.d.ts.map +1 -1
  32. package/build/components/display/action_button.js +3 -4
  33. package/build/components/display/action_button.js.map +1 -1
  34. package/build/components/display/badge.d.ts +5 -4
  35. package/build/components/display/badge.d.ts.map +1 -1
  36. package/build/components/display/badge.js +5 -2
  37. package/build/components/display/badge.js.map +1 -1
  38. package/build/components/display/button.d.ts +3 -2
  39. package/build/components/display/button.d.ts.map +1 -1
  40. package/build/components/display/button.js.map +1 -1
  41. package/build/components/display/icon.d.ts +14 -1
  42. package/build/components/display/icon.d.ts.map +1 -1
  43. package/build/components/display/icon.js +9 -0
  44. package/build/components/display/icon.js.map +1 -1
  45. package/build/components/display/icon_button.d.ts +2 -2
  46. package/build/components/display/icon_button.d.ts.map +1 -1
  47. package/build/components/display/icon_button.js.map +1 -1
  48. package/build/components/display/person.d.ts +3 -1
  49. package/build/components/display/person.d.ts.map +1 -1
  50. package/build/components/display/person.js +2 -2
  51. package/build/components/display/person.js.map +1 -1
  52. package/build/components/display/text.js.map +1 -1
  53. package/build/components/display/toggle_button.d.ts +3 -2
  54. package/build/components/display/toggle_button.d.ts.map +1 -1
  55. package/build/components/display/toggle_button.js.map +1 -1
  56. package/build/components/display/utils/button_colors.d.ts +3 -3
  57. package/build/components/display/utils/button_colors.d.ts.map +1 -1
  58. package/build/components/display/utils/button_colors.js +1 -1
  59. package/build/components/display/utils/button_colors.js.map +1 -1
  60. package/build/components/page/error_boundary.d.ts +1 -1
  61. package/build/components/primitive/avatar_primitive.d.ts.map +1 -1
  62. package/build/components/primitive/avatar_primitive.js +3 -2
  63. package/build/components/primitive/avatar_primitive.js.map +1 -1
  64. package/build/components/primitive/banner_primitive.d.ts +2 -1
  65. package/build/components/primitive/banner_primitive.d.ts.map +1 -1
  66. package/build/components/primitive/banner_primitive.js +0 -1
  67. package/build/components/primitive/banner_primitive.js.map +1 -1
  68. package/build/contexts/api_provider.js.map +1 -1
  69. package/build/contexts/chat_context.d.ts +2 -0
  70. package/build/contexts/chat_context.d.ts.map +1 -1
  71. package/build/contexts/chat_context.js +6 -1
  72. package/build/contexts/chat_context.js.map +1 -1
  73. package/build/contexts/conversations_context.d.ts +14 -0
  74. package/build/contexts/conversations_context.d.ts.map +1 -0
  75. package/build/contexts/conversations_context.js +38 -0
  76. package/build/contexts/conversations_context.js.map +1 -0
  77. package/build/hooks/groups/use_group_members_for_new_conversation.d.ts +214 -0
  78. package/build/hooks/groups/use_group_members_for_new_conversation.d.ts.map +1 -0
  79. package/build/hooks/groups/use_group_members_for_new_conversation.js +50 -0
  80. package/build/hooks/groups/use_group_members_for_new_conversation.js.map +1 -0
  81. package/build/hooks/groups/use_groups_conversation_create.d.ts +9 -0
  82. package/build/hooks/groups/use_groups_conversation_create.d.ts.map +1 -0
  83. package/build/hooks/groups/use_groups_conversation_create.js +36 -0
  84. package/build/hooks/groups/use_groups_conversation_create.js.map +1 -0
  85. package/build/hooks/use_conversation.d.ts +1 -1
  86. package/build/hooks/use_conversation.d.ts.map +1 -1
  87. package/build/hooks/use_conversation.js +1 -1
  88. package/build/hooks/use_conversation.js.map +1 -1
  89. package/build/hooks/use_conversations.d.ts +6 -32
  90. package/build/hooks/use_conversations.d.ts.map +1 -1
  91. package/build/hooks/use_conversations.js +15 -14
  92. package/build/hooks/use_conversations.js.map +1 -1
  93. package/build/hooks/use_conversations_actions.d.ts +221 -0
  94. package/build/hooks/use_conversations_actions.d.ts.map +1 -0
  95. package/build/hooks/use_conversations_actions.js +93 -0
  96. package/build/hooks/use_conversations_actions.js.map +1 -0
  97. package/build/hooks/use_conversations_cache.d.ts +18 -0
  98. package/build/hooks/use_conversations_cache.d.ts.map +1 -0
  99. package/build/hooks/{use_conversation_jolt_events.js → use_conversations_cache.js} +27 -17
  100. package/build/hooks/use_conversations_cache.js.map +1 -0
  101. package/build/hooks/use_conversations_jolt_events.d.ts +3 -0
  102. package/build/hooks/use_conversations_jolt_events.d.ts.map +1 -0
  103. package/build/hooks/use_conversations_jolt_events.js +12 -0
  104. package/build/hooks/use_conversations_jolt_events.js.map +1 -0
  105. package/build/hooks/use_create_android_ripple_color.d.ts +1 -1
  106. package/build/hooks/use_create_android_ripple_color.d.ts.map +1 -1
  107. package/build/hooks/use_giphy.d.ts +9 -0
  108. package/build/hooks/use_giphy.d.ts.map +1 -0
  109. package/build/hooks/use_giphy.js +63 -0
  110. package/build/hooks/use_giphy.js.map +1 -0
  111. package/build/hooks/use_jolt.d.ts.map +1 -1
  112. package/build/hooks/use_jolt.js +39 -10
  113. package/build/hooks/use_jolt.js.map +1 -1
  114. package/build/hooks/use_message_create.d.ts +11 -0
  115. package/build/hooks/use_message_create.d.ts.map +1 -0
  116. package/build/hooks/use_message_create.js +35 -0
  117. package/build/hooks/use_message_create.js.map +1 -0
  118. package/build/navigation/index.d.ts +23 -6
  119. package/build/navigation/index.d.ts.map +1 -1
  120. package/build/navigation/index.js +25 -8
  121. package/build/navigation/index.js.map +1 -1
  122. package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.d.ts.map +1 -0
  123. package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js.map +1 -0
  124. package/build/screens/conversation_filters/components/conversation_filters.js.map +1 -1
  125. package/build/screens/conversation_filters/components/rows.d.ts +2 -1
  126. package/build/screens/conversation_filters/components/rows.d.ts.map +1 -1
  127. package/build/screens/conversation_filters/components/rows.js +19 -14
  128. package/build/screens/conversation_filters/components/rows.js.map +1 -1
  129. package/build/screens/conversation_filters/hooks/filters.js +1 -1
  130. package/build/screens/conversation_filters/hooks/filters.js.map +1 -1
  131. package/build/screens/conversation_new/components/form_list.d.ts +12 -0
  132. package/build/screens/conversation_new/components/form_list.d.ts.map +1 -0
  133. package/build/screens/conversation_new/components/form_list.js +42 -0
  134. package/build/screens/conversation_new/components/form_list.js.map +1 -0
  135. package/build/screens/conversation_new/components/groups_form.d.ts +7 -0
  136. package/build/screens/conversation_new/components/groups_form.d.ts.map +1 -0
  137. package/build/screens/conversation_new/components/groups_form.js +101 -0
  138. package/build/screens/conversation_new/components/groups_form.js.map +1 -0
  139. package/build/screens/conversation_new/components/member_error_card.d.ts +5 -0
  140. package/build/screens/conversation_new/components/member_error_card.d.ts.map +1 -0
  141. package/build/screens/conversation_new/components/member_error_card.js +17 -0
  142. package/build/screens/conversation_new/components/member_error_card.js.map +1 -0
  143. package/build/screens/conversation_new/components/source_app_error_card.d.ts +2 -0
  144. package/build/screens/conversation_new/components/source_app_error_card.d.ts.map +1 -0
  145. package/build/screens/conversation_new/components/source_app_error_card.js +16 -0
  146. package/build/screens/conversation_new/components/source_app_error_card.js.map +1 -0
  147. package/build/screens/conversation_new/components/team_form.d.ts +8 -0
  148. package/build/screens/conversation_new/components/team_form.d.ts.map +1 -0
  149. package/build/screens/conversation_new/components/team_form.js +11 -0
  150. package/build/screens/conversation_new/components/team_form.js.map +1 -0
  151. package/build/screens/conversation_new/conversation_new_screen.d.ts +12 -0
  152. package/build/screens/conversation_new/conversation_new_screen.d.ts.map +1 -0
  153. package/build/screens/conversation_new/conversation_new_screen.js +16 -0
  154. package/build/screens/conversation_new/conversation_new_screen.js.map +1 -0
  155. package/build/screens/conversation_new/utils/fake_member_data.d.ts +3 -0
  156. package/build/screens/conversation_new/utils/fake_member_data.d.ts.map +1 -0
  157. package/build/screens/conversation_new/utils/fake_member_data.js +129 -0
  158. package/build/screens/conversation_new/utils/fake_member_data.js.map +1 -0
  159. package/build/screens/conversation_screen.d.ts +1 -0
  160. package/build/screens/conversation_screen.d.ts.map +1 -1
  161. package/build/screens/conversation_screen.js +1 -1
  162. package/build/screens/conversation_screen.js.map +1 -1
  163. package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.d.ts.map +1 -0
  164. package/build/screens/{create → conversation_select_recipients}/conversation_select_recipients_screen.js +6 -5
  165. package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.js.map +1 -0
  166. package/build/screens/conversations/components/chat_group_badge.js +1 -1
  167. package/build/screens/conversations/components/chat_group_badge.js.map +1 -1
  168. package/build/screens/conversations/components/list_header_component.d.ts.map +1 -1
  169. package/build/screens/conversations/components/list_header_component.js +6 -2
  170. package/build/screens/conversations/components/list_header_component.js.map +1 -1
  171. package/build/screens/conversations/conversations_screen.d.ts.map +1 -1
  172. package/build/screens/conversations/conversations_screen.js +6 -13
  173. package/build/screens/conversations/conversations_screen.js.map +1 -1
  174. package/build/screens/design_system_screen.js +1 -0
  175. package/build/screens/design_system_screen.js.map +1 -1
  176. package/build/screens/message_actions_screen.d.ts +2 -2
  177. package/build/screens/message_actions_screen.d.ts.map +1 -1
  178. package/build/screens/message_actions_screen.js +1 -1
  179. package/build/screens/message_actions_screen.js.map +1 -1
  180. package/build/screens/send_giphy_screen.d.ts +10 -0
  181. package/build/screens/send_giphy_screen.d.ts.map +1 -0
  182. package/build/screens/send_giphy_screen.js +98 -0
  183. package/build/screens/send_giphy_screen.js.map +1 -0
  184. package/build/types/resources/groups/groups_group_resource.d.ts +1 -1
  185. package/build/types/resources/groups/groups_group_resource.js.map +1 -1
  186. package/build/types/resources/groups/groups_member_resource_with_person.d.ts +14 -0
  187. package/build/types/resources/groups/groups_member_resource_with_person.d.ts.map +1 -0
  188. package/build/types/resources/groups/groups_member_resource_with_person.js +2 -0
  189. package/build/types/resources/groups/groups_member_resource_with_person.js.map +1 -0
  190. package/build/types/resources/member.d.ts +0 -10
  191. package/build/types/resources/member.d.ts.map +1 -1
  192. package/build/types/resources/member.js.map +1 -1
  193. package/build/utils/cache/page_mutations.d.ts +18 -0
  194. package/build/utils/cache/page_mutations.d.ts.map +1 -1
  195. package/build/utils/cache/page_mutations.js +13 -0
  196. package/build/utils/cache/page_mutations.js.map +1 -1
  197. package/build/utils/client/client.d.ts +2 -2
  198. package/build/utils/client/client.d.ts.map +1 -1
  199. package/build/utils/client/client.js +12 -4
  200. package/build/utils/client/client.js.map +1 -1
  201. package/build/utils/client/request_helpers.d.ts +15 -8
  202. package/build/utils/client/request_helpers.d.ts.map +1 -1
  203. package/build/utils/client/request_helpers.js +2 -1
  204. package/build/utils/client/request_helpers.js.map +1 -1
  205. package/build/utils/client/transform_request_data.d.ts +11 -6
  206. package/build/utils/client/transform_request_data.d.ts.map +1 -1
  207. package/build/utils/client/transform_request_data.js +1 -1
  208. package/build/utils/client/transform_request_data.js.map +1 -1
  209. package/build/utils/client/transform_response.d.ts +1 -1
  210. package/build/utils/client/transform_response.d.ts.map +1 -1
  211. package/build/utils/client/transform_response.js +2 -0
  212. package/build/utils/client/transform_response.js.map +1 -1
  213. package/build/utils/client/utils.d.ts +3 -3
  214. package/build/utils/client/utils.d.ts.map +1 -1
  215. package/build/utils/client/utils.js +6 -6
  216. package/build/utils/client/utils.js.map +1 -1
  217. package/build/utils/date.d.ts.map +1 -1
  218. package/build/utils/date.js +1 -0
  219. package/build/utils/date.js.map +1 -1
  220. package/build/utils/deepCamelCaseKeys.d.ts.map +1 -1
  221. package/build/utils/deepCamelCaseKeys.js +3 -1
  222. package/build/utils/deepCamelCaseKeys.js.map +1 -1
  223. package/build/utils/parse_simple_markdown.d.ts +1 -1
  224. package/build/utils/parse_simple_markdown.d.ts.map +1 -1
  225. package/build/utils/parse_simple_markdown.js +2 -1
  226. package/build/utils/parse_simple_markdown.js.map +1 -1
  227. package/build/utils/request/conversation.d.ts +1 -3
  228. package/build/utils/request/conversation.d.ts.map +1 -1
  229. package/build/utils/request/conversation.js +37 -30
  230. package/build/utils/request/conversation.js.map +1 -1
  231. package/build/utils/space.js.map +1 -1
  232. package/build/utils/uri.d.ts +2 -2
  233. package/build/utils/uri.d.ts.map +1 -1
  234. package/build/utils/uri.js +2 -2
  235. package/build/utils/uri.js.map +1 -1
  236. package/build/vendor/tapestry/alias_tokens_color_map.d.ts +8 -0
  237. package/build/vendor/tapestry/alias_tokens_color_map.d.ts.map +1 -1
  238. package/build/vendor/tapestry/alias_tokens_color_map.js +8 -0
  239. package/build/vendor/tapestry/alias_tokens_color_map.js.map +1 -1
  240. package/build/vendor/tapestry/tokens.d.ts +2 -0
  241. package/build/vendor/tapestry/tokens.d.ts.map +1 -1
  242. package/build/vendor/tapestry/tokens.js +2 -0
  243. package/build/vendor/tapestry/tokens.js.map +1 -1
  244. package/package.json +8 -6
  245. package/src/__tests__/utils/cache/page_mutations.ts +49 -15
  246. package/src/components/conversation/message_form.tsx +127 -58
  247. package/src/components/conversations/action_toggle_button.tsx +84 -0
  248. package/src/components/conversations/conversation_actions.tsx +146 -0
  249. package/src/components/conversations/conversation_preview.tsx +46 -16
  250. package/src/components/conversations/conversations.tsx +13 -18
  251. package/src/components/conversations/mute_indicator.tsx +21 -0
  252. package/src/components/conversations/unread_count_badge.tsx +8 -1
  253. package/src/components/display/action_button.tsx +4 -3
  254. package/src/components/display/badge.tsx +12 -8
  255. package/src/components/display/button.tsx +3 -3
  256. package/src/components/display/icon.tsx +16 -3
  257. package/src/components/display/icon_button.tsx +2 -2
  258. package/src/components/display/person.tsx +4 -3
  259. package/src/components/display/text.tsx +1 -1
  260. package/src/components/display/toggle_button.tsx +3 -3
  261. package/src/components/display/utils/button_colors.ts +8 -3
  262. package/src/components/primitive/avatar_primitive.tsx +5 -3
  263. package/src/components/primitive/banner_primitive.tsx +2 -3
  264. package/src/contexts/api_provider.tsx +1 -1
  265. package/src/contexts/chat_context.tsx +8 -1
  266. package/src/contexts/conversations_context.tsx +69 -0
  267. package/src/hooks/groups/use_group_members_for_new_conversation.ts +57 -0
  268. package/src/hooks/groups/use_groups_conversation_create.ts +50 -0
  269. package/src/hooks/use_conversation.ts +5 -5
  270. package/src/hooks/use_conversations.ts +34 -16
  271. package/src/hooks/use_conversations_actions.ts +108 -0
  272. package/src/hooks/{use_conversation_jolt_events.ts → use_conversations_cache.ts} +35 -20
  273. package/src/hooks/use_conversations_jolt_events.ts +21 -0
  274. package/src/hooks/use_giphy.ts +97 -0
  275. package/src/hooks/use_jolt.ts +53 -12
  276. package/src/hooks/use_message_create.ts +55 -0
  277. package/src/navigation/index.tsx +31 -8
  278. package/src/screens/conversation_filters/components/conversation_filters.tsx +1 -1
  279. package/src/screens/conversation_filters/components/rows.tsx +44 -14
  280. package/src/screens/conversation_filters/hooks/filters.ts +1 -1
  281. package/src/screens/conversation_new/components/form_list.tsx +67 -0
  282. package/src/screens/conversation_new/components/groups_form.tsx +153 -0
  283. package/src/screens/conversation_new/components/member_error_card.tsx +20 -0
  284. package/src/screens/conversation_new/components/source_app_error_card.tsx +24 -0
  285. package/src/screens/conversation_new/components/team_form.tsx +18 -0
  286. package/src/screens/conversation_new/conversation_new_screen.tsx +26 -0
  287. package/src/screens/conversation_new/utils/fake_member_data.ts +130 -0
  288. package/src/screens/conversation_screen.tsx +2 -1
  289. package/src/screens/{create → conversation_select_recipients}/conversation_select_recipients_screen.tsx +6 -5
  290. package/src/screens/conversations/components/chat_group_badge.tsx +1 -1
  291. package/src/screens/conversations/components/list_header_component.tsx +7 -2
  292. package/src/screens/conversations/conversations_screen.tsx +6 -19
  293. package/src/screens/design_system_screen.tsx +1 -0
  294. package/src/screens/message_actions_screen.tsx +4 -4
  295. package/src/screens/send_giphy_screen.tsx +155 -0
  296. package/src/types/resources/groups/groups_group_resource.ts +1 -1
  297. package/src/types/resources/groups/groups_member_resource_with_person.ts +13 -0
  298. package/src/types/resources/member.ts +0 -11
  299. package/src/utils/cache/page_mutations.ts +22 -0
  300. package/src/utils/client/client.ts +15 -7
  301. package/src/utils/client/request_helpers.ts +15 -6
  302. package/src/utils/client/transform_request_data.ts +13 -4
  303. package/src/utils/client/transform_response.ts +3 -0
  304. package/src/utils/client/types.d.ts +2 -1
  305. package/src/utils/client/utils.ts +13 -12
  306. package/src/utils/date.ts +1 -0
  307. package/src/utils/deepCamelCaseKeys.ts +3 -2
  308. package/src/utils/parse_simple_markdown.ts +3 -1
  309. package/src/utils/request/conversation.ts +39 -34
  310. package/src/utils/space.ts +1 -1
  311. package/src/utils/uri.ts +2 -2
  312. package/src/vendor/tapestry/alias_tokens_color_map.ts +12 -0
  313. package/src/vendor/tapestry/tokens.ts +2 -0
  314. package/build/hooks/use_conversation_jolt_events.d.ts +0 -2
  315. package/build/hooks/use_conversation_jolt_events.d.ts.map +0 -1
  316. package/build/hooks/use_conversation_jolt_events.js.map +0 -1
  317. package/build/screens/create/conversation_create_screen.d.ts +0 -9
  318. package/build/screens/create/conversation_create_screen.d.ts.map +0 -1
  319. package/build/screens/create/conversation_create_screen.js +0 -123
  320. package/build/screens/create/conversation_create_screen.js.map +0 -1
  321. package/build/screens/create/conversation_filter_recipients_screen.d.ts.map +0 -1
  322. package/build/screens/create/conversation_filter_recipients_screen.js.map +0 -1
  323. package/build/screens/create/conversation_select_recipients_screen.d.ts.map +0 -1
  324. package/build/screens/create/conversation_select_recipients_screen.js.map +0 -1
  325. package/src/screens/create/conversation_create_screen.tsx +0 -148
  326. /package/build/screens/{create → conversation_filter_recipients}/conversation_filter_recipients_screen.d.ts +0 -0
  327. /package/build/screens/{create → conversation_filter_recipients}/conversation_filter_recipients_screen.js +0 -0
  328. /package/build/screens/{create → conversation_select_recipients}/conversation_select_recipients_screen.d.ts +0 -0
  329. /package/src/screens/{create → conversation_filter_recipients}/conversation_filter_recipients_screen.tsx +0 -0
@@ -1,148 +0,0 @@
1
- import { StackActions, StaticScreenProps, useNavigation } from '@react-navigation/native'
2
- import React, { useCallback, useState } from 'react'
3
- import { StyleSheet, TextInput, View } from 'react-native'
4
- import { useSafeAreaInsets } from 'react-native-safe-area-context'
5
- import { Text } from '../../components'
6
- import { ActionButton } from '../../components/display/action_button'
7
- import { useSuspenseGet, useTheme } from '../../hooks'
8
- import { useApiClient } from '../../hooks/use_api_client'
9
- import { useMutation } from '@tanstack/react-query'
10
- import { GroupsGroupResource } from '../../types'
11
-
12
- type ConversationCreateScreenProps = StaticScreenProps<{
13
- group_id?: string
14
- team_ids?: string[]
15
- }>
16
-
17
- export const ConversationCreateScreen = ({ route }: ConversationCreateScreenProps) => {
18
- const styles = useStyles()
19
- const navigation = useNavigation()
20
- const [title, setTitle] = useState<string>()
21
- const apiClient = useApiClient()
22
- const { data: group } = useSuspenseGet<GroupsGroupResource>({
23
- url: `/me/groups/${route.params.group_id}`,
24
- data: {
25
- fields: {
26
- Group: [],
27
- },
28
- include: ['location'],
29
- },
30
- app: 'groups',
31
- })
32
- const { mutate: handleSave } = useMutation({
33
- throwOnError: true,
34
- onSuccess: result => {
35
- handleRedirectToConversation({ conversation_id: result.data.id })
36
- },
37
- mutationFn: () =>
38
- apiClient.groups
39
- .post({
40
- url: `/me/groups/${route.params.group_id}/chat_conversation_payload`,
41
- data: {
42
- data: {
43
- type: '',
44
- attributes: {
45
- title,
46
- },
47
- },
48
- },
49
- })
50
- .then(res => res.data.value)
51
- .then(payload =>
52
- apiClient.chat.post({
53
- url: '/me/conversations',
54
- data: {
55
- data: {
56
- type: 'Conversation',
57
- attributes: {
58
- payload,
59
- },
60
- },
61
- },
62
- })
63
- ),
64
- })
65
-
66
- const handleRedirectToConversation = useCallback(
67
- ({ conversation_id }: { conversation_id: number }) => {
68
- // exit from the create stack
69
- navigation.getParent()?.goBack()
70
- // navigate to the conversation screen
71
- navigation.dispatch(
72
- StackActions.push('Conversation', {
73
- conversation_id,
74
- })
75
- )
76
- },
77
- [navigation]
78
- )
79
-
80
- return (
81
- <View style={styles.container}>
82
- <View style={styles.section}>
83
- <View style={styles.to}>
84
- <Text>To:</Text>
85
- <View>
86
- <Text>{group.name}</Text>
87
- <Text>{group.membershipsCount} members</Text>
88
- </View>
89
- </View>
90
- <View style={styles.titleContainer}>
91
- <Text style={styles.titleLabel}>Title</Text>
92
- <TextInput
93
- placeholder="Topic of conversation (required)"
94
- value={title}
95
- onChangeText={setTitle}
96
- style={styles.titleInput}
97
- />
98
- </View>
99
- </View>
100
- <ActionButton title="Start Conversation" onPress={() => handleSave()} />
101
- </View>
102
- )
103
- }
104
-
105
- const useStyles = () => {
106
- const { bottom } = useSafeAreaInsets()
107
- const theme = useTheme()
108
-
109
- return StyleSheet.create({
110
- container: {
111
- flex: 1,
112
- gap: 8,
113
- },
114
- section: {
115
- padding: 16,
116
- flex: 1,
117
- },
118
- sectionHeader: {
119
- flexDirection: 'row',
120
- justifyContent: 'space-between',
121
- },
122
- selectTeamsButton: {},
123
- routeDebug: {
124
- alignContent: 'center',
125
- padding: 16,
126
- paddingBottom: bottom,
127
- borderTopWidth: 1,
128
- borderTopColor: theme.colors.fillColorNeutral050Base,
129
- },
130
- titleContainer: {
131
- paddingVertical: 12,
132
- borderBottomWidth: 1,
133
- borderBottomColor: theme.colors.fillColorNeutral050Base,
134
- gap: 8,
135
- },
136
- titleInput: {
137
- fontSize: 18,
138
- },
139
- titleLabel: {},
140
- to: {
141
- flexDirection: 'row',
142
- gap: 8,
143
- paddingVertical: 12,
144
- borderBottomWidth: 1,
145
- borderBottomColor: theme.colors.fillColorNeutral050Base,
146
- },
147
- })
148
- }