@adminide-stack/clock-tik-mobile 0.0.0-stage → 12.0.37-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (378) hide show
  1. package/.claude-flow/data/pending-insights.jsonl +43 -0
  2. package/.claude-flow/sessions/session-1794323376548.json +14 -0
  3. package/CHANGELOG.md +41 -0
  4. package/jest.config.cjs +22 -0
  5. package/lib/assets/home/loop-day.jpg +0 -0
  6. package/lib/assets/home/loop-day.mp4 +0 -0
  7. package/lib/assets/home/loop-time-back.jpg +0 -0
  8. package/lib/assets/home/loop-time-back.mp4 +0 -0
  9. package/lib/assets/home/loop-where.jpg +0 -0
  10. package/lib/assets/home/loop-where.mp4 +0 -0
  11. package/lib/assets/home/reel-gym.jpg +0 -0
  12. package/lib/assets/home/reel-gym.mp4 +0 -0
  13. package/lib/assets/home/reel-internet.jpg +0 -0
  14. package/lib/assets/home/reel-internet.mp4 +0 -0
  15. package/lib/assets/icon.png +0 -0
  16. package/lib/assets/lottie/.claude-flow/data/pending-insights.jsonl +1 -0
  17. package/lib/assets/lottie/lucy-mark-calendar.json +1827 -0
  18. package/lib/assets/lottie/lucy-mark-call.json +1470 -0
  19. package/lib/assets/lottie/lucy-mark-connect.json +2552 -0
  20. package/lib/assets/lottie/lucy-mark-details.json +1735 -0
  21. package/lib/assets/lottie/lucy-mark-email.json +1363 -0
  22. package/lib/assets/lottie/lucy-mark-message.json +1154 -0
  23. package/lib/assets/lottie/lucy-mark-search.json +1067 -0
  24. package/lib/assets/lottie/lucy-mark-think.json +1253 -0
  25. package/lib/assets/lottie/lucy-mark-write.json +1532 -0
  26. package/lib/assets/lottie/time-back.json +16458 -0
  27. package/lib/assets/lottie/where-lucy-works-chat.json +6170 -0
  28. package/lib/assets/lottie/where-lucy-works-cloud.json +10066 -0
  29. package/lib/assets/lottie/where-lucy-works-mine-none.json +2478 -0
  30. package/lib/assets/lottie/where-lucy-works-mine-offline.json +2373 -0
  31. package/lib/assets/lottie/where-lucy-works-mine-online.json +7881 -0
  32. package/lib/assets/sounds/hours-back.m4a +0 -0
  33. package/lib/assets/sounds/meet-lucy.m4a +0 -0
  34. package/lib/assets/sounds/power-on.m4a +0 -0
  35. package/lib/assets/sounds/wind-back.m4a +0 -0
  36. package/lib/assets/sounds/youre-in.m4a +0 -0
  37. package/lib/chat/agent.js +358 -0
  38. package/lib/chat/agent.js.map +1 -0
  39. package/lib/chat/appFront.js +32 -0
  40. package/lib/chat/appFront.js.map +1 -0
  41. package/lib/chat/auth.js +370 -0
  42. package/lib/chat/auth.js.map +1 -0
  43. package/lib/chat/chores.js +360 -0
  44. package/lib/chat/chores.js.map +1 -0
  45. package/lib/chat/connectors.js +45 -0
  46. package/lib/chat/connectors.js.map +1 -0
  47. package/lib/chat/jobs.js +223 -0
  48. package/lib/chat/jobs.js.map +1 -0
  49. package/lib/chat/lucyMotion.js +6 -0
  50. package/lib/chat/lucyMotion.js.map +1 -0
  51. package/lib/chat/protocol.js +111 -0
  52. package/lib/chat/protocol.js.map +1 -0
  53. package/lib/chat/results.js +133 -0
  54. package/lib/chat/results.js.map +1 -0
  55. package/lib/chat/store.js +81 -0
  56. package/lib/chat/store.js.map +1 -0
  57. package/lib/chat/useDictation.js +168 -0
  58. package/lib/chat/useDictation.js.map +1 -0
  59. package/lib/chat/useLucyChat.js +451 -0
  60. package/lib/chat/useLucyChat.js.map +1 -0
  61. package/lib/chat/useMyComputer.js +32 -0
  62. package/lib/chat/useMyComputer.js.map +1 -0
  63. package/lib/chat/whereLucyWorks.js +52 -0
  64. package/lib/chat/whereLucyWorks.js.map +1 -0
  65. package/lib/chat/workspace.js +124 -0
  66. package/lib/chat/workspace.js.map +1 -0
  67. package/lib/components/AreaShot.js +289 -0
  68. package/lib/components/AreaShot.js.map +1 -0
  69. package/lib/components/Backdrops.js +262 -0
  70. package/lib/components/Backdrops.js.map +1 -0
  71. package/lib/components/BottomSheet.js +61 -0
  72. package/lib/components/BottomSheet.js.map +1 -0
  73. package/lib/components/ChatSheets.js +429 -0
  74. package/lib/components/ChatSheets.js.map +1 -0
  75. package/lib/components/ConnectorLogo.js +91 -0
  76. package/lib/components/ConnectorLogo.js.map +1 -0
  77. package/lib/components/CustomDrawer.js +534 -0
  78. package/lib/components/CustomDrawer.js.map +1 -0
  79. package/lib/components/IdeasPane.js +394 -0
  80. package/lib/components/IdeasPane.js.map +1 -0
  81. package/lib/components/ImessageSheet.js +261 -0
  82. package/lib/components/ImessageSheet.js.map +1 -0
  83. package/lib/components/KeyboardAvoider.js +29 -0
  84. package/lib/components/KeyboardAvoider.js.map +1 -0
  85. package/lib/components/Logo.js +81 -0
  86. package/lib/components/Logo.js.map +1 -0
  87. package/lib/components/LucyWorking.js +67 -0
  88. package/lib/components/LucyWorking.js.map +1 -0
  89. package/lib/components/Markdown.js +260 -0
  90. package/lib/components/Markdown.js.map +1 -0
  91. package/lib/components/Media.js +93 -0
  92. package/lib/components/Media.js.map +1 -0
  93. package/lib/components/MessagesAppIcon.js +23 -0
  94. package/lib/components/MessagesAppIcon.js.map +1 -0
  95. package/lib/components/MicButton.js +71 -0
  96. package/lib/components/MicButton.js.map +1 -0
  97. package/lib/components/ResultCards.js +974 -0
  98. package/lib/components/ResultCards.js.map +1 -0
  99. package/lib/components/SignInPrompt.js +148 -0
  100. package/lib/components/SignInPrompt.js.map +1 -0
  101. package/lib/components/SignedOut.js +38 -0
  102. package/lib/components/SignedOut.js.map +1 -0
  103. package/lib/components/TalkToLucyHero.js +487 -0
  104. package/lib/components/TalkToLucyHero.js.map +1 -0
  105. package/lib/components/TalkToLucySheet.js +182 -0
  106. package/lib/components/TalkToLucySheet.js.map +1 -0
  107. package/lib/components/WhereLucyWorks.js +277 -0
  108. package/lib/components/WhereLucyWorks.js.map +1 -0
  109. package/lib/components/WorkspaceSection.js +271 -0
  110. package/lib/components/WorkspaceSection.js.map +1 -0
  111. package/lib/components/YantraMark.js +13 -0
  112. package/lib/components/YantraMark.js.map +1 -0
  113. package/lib/components/drawerHeader.js +38 -0
  114. package/lib/components/drawerHeader.js.map +1 -0
  115. package/lib/components/lottieInstalled.js +6 -0
  116. package/lib/components/lottieInstalled.js.map +1 -0
  117. package/lib/components/ui.js +550 -0
  118. package/lib/components/ui.js.map +1 -0
  119. package/lib/components/useSignOut.js +7 -0
  120. package/lib/components/useSignOut.js.map +1 -0
  121. package/lib/components/viewport.js +121 -0
  122. package/lib/components/viewport.js.map +1 -0
  123. package/lib/components/voiceDial.js +10 -0
  124. package/lib/components/voiceDial.js.map +1 -0
  125. package/lib/compute.js +157 -0
  126. package/lib/compute.js.map +1 -0
  127. package/lib/config/env-config.js +27 -0
  128. package/lib/config/env-config.js.map +1 -0
  129. package/lib/config/routes.js +15 -0
  130. package/lib/config/routes.js.map +1 -0
  131. package/lib/content.js +25 -0
  132. package/lib/content.js.map +1 -0
  133. package/lib/hooks/keyboardCover.js +39 -0
  134. package/lib/hooks/keyboardCover.js.map +1 -0
  135. package/lib/hooks/useKeyboard.js +121 -0
  136. package/lib/hooks/useKeyboard.js.map +1 -0
  137. package/lib/hooks/useReducedMotion.js +13 -0
  138. package/lib/hooks/useReducedMotion.js.map +1 -0
  139. package/lib/imessage/openMessages.js +25 -0
  140. package/lib/imessage/openMessages.js.map +1 -0
  141. package/lib/imessage/platform.js +12 -0
  142. package/lib/imessage/platform.js.map +1 -0
  143. package/lib/imessage/textLink.js +262 -0
  144. package/lib/imessage/textLink.js.map +1 -0
  145. package/lib/index.js +1 -0
  146. package/lib/index.js.map +1 -0
  147. package/lib/live/card.js +28 -0
  148. package/lib/live/card.js.map +1 -0
  149. package/lib/live/liveActivity.js +144 -0
  150. package/lib/live/liveActivity.js.map +1 -0
  151. package/lib/module.js +3 -0
  152. package/lib/module.js.map +1 -0
  153. package/lib/offer/BlackFridayOffer.js +378 -0
  154. package/lib/offer/BlackFridayOffer.js.map +1 -0
  155. package/lib/offer/blackFriday.js +78 -0
  156. package/lib/offer/blackFriday.js.map +1 -0
  157. package/lib/offer/parts.js +624 -0
  158. package/lib/offer/parts.js.map +1 -0
  159. package/lib/offer/state.js +63 -0
  160. package/lib/offer/state.js.map +1 -0
  161. package/lib/push/push.js +142 -0
  162. package/lib/push/push.js.map +1 -0
  163. package/lib/push/usePushNotifications.js +39 -0
  164. package/lib/push/usePushNotifications.js.map +1 -0
  165. package/lib/routes.json +175 -0
  166. package/lib/screens/Account/index.js +209 -0
  167. package/lib/screens/Account/index.js.map +1 -0
  168. package/lib/screens/Chat/index.js +710 -0
  169. package/lib/screens/Chat/index.js.map +1 -0
  170. package/lib/screens/Chores/index.js +18 -0
  171. package/lib/screens/Chores/index.js.map +1 -0
  172. package/lib/screens/Connectors/index.js +17 -0
  173. package/lib/screens/Connectors/index.js.map +1 -0
  174. package/lib/screens/History/index.js +380 -0
  175. package/lib/screens/History/index.js.map +1 -0
  176. package/lib/screens/Home/index.js +2715 -0
  177. package/lib/screens/Home/index.js.map +1 -0
  178. package/lib/screens/Home/media.js +25 -0
  179. package/lib/screens/Home/media.js.map +1 -0
  180. package/lib/screens/Welcome/index.js +1066 -0
  181. package/lib/screens/Welcome/index.js.map +1 -0
  182. package/lib/talk/talkToLucy.js +139 -0
  183. package/lib/talk/talkToLucy.js.map +1 -0
  184. package/lib/theme/colors.js +29 -0
  185. package/lib/theme/colors.js.map +1 -0
  186. package/lib/theme/fonts.js +17 -0
  187. package/lib/theme/fonts.js.map +1 -0
  188. package/lib/theme/muse.js +134 -0
  189. package/lib/theme/muse.js.map +1 -0
  190. package/lib/utils/links.js +54 -0
  191. package/lib/utils/links.js.map +1 -0
  192. package/lib/utils/yantraLinks.js +68 -0
  193. package/lib/utils/yantraLinks.js.map +1 -0
  194. package/lib/welcome/flow.js +375 -0
  195. package/lib/welcome/flow.js.map +1 -0
  196. package/lib/welcome/haptics.js +125 -0
  197. package/lib/welcome/haptics.js.map +1 -0
  198. package/lib/welcome/parts.js +1996 -0
  199. package/lib/welcome/parts.js.map +1 -0
  200. package/lib/welcome/powerOn.js +29 -0
  201. package/lib/welcome/powerOn.js.map +1 -0
  202. package/lib/welcome/seen.js +41 -0
  203. package/lib/welcome/seen.js.map +1 -0
  204. package/lib/welcome/sound.js +110 -0
  205. package/lib/welcome/sound.js.map +1 -0
  206. package/package.json +66 -5
  207. package/rollup.config.mjs +42 -0
  208. package/src/.claude-flow/data/pending-insights.jsonl +19 -0
  209. package/src/.claude-flow/sessions/session-1795013028422.json +14 -0
  210. package/src/__tests__/auth.test.ts +94 -0
  211. package/src/__tests__/blackFriday.test.ts +75 -0
  212. package/src/__tests__/cardTokens.test.ts +77 -0
  213. package/src/__tests__/chores.test.ts +188 -0
  214. package/src/__tests__/choresList.test.ts +100 -0
  215. package/src/__tests__/connectLink.test.ts +21 -0
  216. package/src/__tests__/content.test.ts +54 -0
  217. package/src/__tests__/dictation.test.ts +186 -0
  218. package/src/__tests__/envConfig.test.ts +14 -0
  219. package/src/__tests__/haptics.test.ts +202 -0
  220. package/src/__tests__/jobs.test.ts +130 -0
  221. package/src/__tests__/keyboardCover.test.ts +84 -0
  222. package/src/__tests__/liveCard.test.ts +39 -0
  223. package/src/__tests__/lockedPhone.test.ts +355 -0
  224. package/src/__tests__/lucyMotion.test.ts +34 -0
  225. package/src/__tests__/platform.test.ts +32 -0
  226. package/src/__tests__/powerOn.test.ts +62 -0
  227. package/src/__tests__/protocol.test.ts +125 -0
  228. package/src/__tests__/push.test.ts +111 -0
  229. package/src/__tests__/results.test.ts +256 -0
  230. package/src/__tests__/sound.test.ts +248 -0
  231. package/src/__tests__/talkToLucy.test.ts +205 -0
  232. package/src/__tests__/textLink.test.ts +91 -0
  233. package/src/__tests__/voiceDial.test.ts +53 -0
  234. package/src/__tests__/welcomeFlow.test.ts +157 -0
  235. package/src/__tests__/whereLucyWorks.test.ts +81 -0
  236. package/src/__tests__/yantraLinks.test.ts +96 -0
  237. package/src/assets/home/loop-day.jpg +0 -0
  238. package/src/assets/home/loop-day.mp4 +0 -0
  239. package/src/assets/home/loop-time-back.jpg +0 -0
  240. package/src/assets/home/loop-time-back.mp4 +0 -0
  241. package/src/assets/home/loop-where.jpg +0 -0
  242. package/src/assets/home/loop-where.mp4 +0 -0
  243. package/src/assets/home/reel-gym.jpg +0 -0
  244. package/src/assets/home/reel-gym.mp4 +0 -0
  245. package/src/assets/home/reel-internet.jpg +0 -0
  246. package/src/assets/home/reel-internet.mp4 +0 -0
  247. package/src/assets/icon.png +0 -0
  248. package/src/assets/lottie/.claude-flow/data/pending-insights.jsonl +1 -0
  249. package/src/assets/lottie/lucy-mark-calendar.json +1827 -0
  250. package/src/assets/lottie/lucy-mark-call.json +1470 -0
  251. package/src/assets/lottie/lucy-mark-connect.json +2552 -0
  252. package/src/assets/lottie/lucy-mark-details.json +1735 -0
  253. package/src/assets/lottie/lucy-mark-email.json +1363 -0
  254. package/src/assets/lottie/lucy-mark-message.json +1154 -0
  255. package/src/assets/lottie/lucy-mark-search.json +1067 -0
  256. package/src/assets/lottie/lucy-mark-think.json +1253 -0
  257. package/src/assets/lottie/lucy-mark-write.json +1532 -0
  258. package/src/assets/lottie/time-back.json +16458 -0
  259. package/src/assets/lottie/where-lucy-works-chat.json +6170 -0
  260. package/src/assets/lottie/where-lucy-works-cloud.json +10066 -0
  261. package/src/assets/lottie/where-lucy-works-mine-none.json +2478 -0
  262. package/src/assets/lottie/where-lucy-works-mine-offline.json +2373 -0
  263. package/src/assets/lottie/where-lucy-works-mine-online.json +7881 -0
  264. package/src/assets/sounds/hours-back.m4a +0 -0
  265. package/src/assets/sounds/meet-lucy.m4a +0 -0
  266. package/src/assets/sounds/power-on.m4a +0 -0
  267. package/src/assets/sounds/wind-back.m4a +0 -0
  268. package/src/assets/sounds/youre-in.m4a +0 -0
  269. package/src/chat/.claude-flow/data/pending-insights.jsonl +1 -0
  270. package/src/chat/agent.ts +376 -0
  271. package/src/chat/appFront.ts +39 -0
  272. package/src/chat/auth.ts +433 -0
  273. package/src/chat/chores.ts +394 -0
  274. package/src/chat/connectors.ts +75 -0
  275. package/src/chat/jobs.ts +228 -0
  276. package/src/chat/lucyMotion.ts +33 -0
  277. package/src/chat/protocol.ts +192 -0
  278. package/src/chat/results.ts +224 -0
  279. package/src/chat/store.ts +87 -0
  280. package/src/chat/useDictation.ts +201 -0
  281. package/src/chat/useLucyChat.ts +458 -0
  282. package/src/chat/useMyComputer.ts +41 -0
  283. package/src/chat/whereLucyWorks.ts +97 -0
  284. package/src/chat/workspace.ts +127 -0
  285. package/src/components/.claude-flow/data/pending-insights.jsonl +3 -0
  286. package/src/components/AreaShot.tsx +239 -0
  287. package/src/components/Backdrops.tsx +323 -0
  288. package/src/components/BottomSheet.tsx +96 -0
  289. package/src/components/ChatSheets.tsx +565 -0
  290. package/src/components/ConnectorLogo.tsx +116 -0
  291. package/src/components/CustomDrawer.tsx +526 -0
  292. package/src/components/IdeasPane.tsx +318 -0
  293. package/src/components/ImessageSheet.tsx +280 -0
  294. package/src/components/KeyboardAvoider.tsx +45 -0
  295. package/src/components/Logo.tsx +97 -0
  296. package/src/components/LucyWorking.tsx +122 -0
  297. package/src/components/Markdown.tsx +219 -0
  298. package/src/components/Media.tsx +173 -0
  299. package/src/components/MessagesAppIcon.tsx +51 -0
  300. package/src/components/MicButton.tsx +92 -0
  301. package/src/components/ResultCards.tsx +1067 -0
  302. package/src/components/SignInPrompt.tsx +182 -0
  303. package/src/components/SignedOut.tsx +47 -0
  304. package/src/components/TalkToLucyHero.tsx +540 -0
  305. package/src/components/TalkToLucySheet.tsx +208 -0
  306. package/src/components/VoiceOrb.tsx +364 -0
  307. package/src/components/WhereLucyWorks.tsx +261 -0
  308. package/src/components/WorkspaceSection.tsx +307 -0
  309. package/src/components/YantraMark.tsx +30 -0
  310. package/src/components/drawerHeader.tsx +46 -0
  311. package/src/components/kit.tsx +309 -0
  312. package/src/components/lottieInstalled.ts +7 -0
  313. package/src/components/ui.tsx +700 -0
  314. package/src/components/useSignOut.ts +21 -0
  315. package/src/components/viewport.tsx +166 -0
  316. package/src/components/voiceDial.ts +45 -0
  317. package/src/compute.ts +168 -0
  318. package/src/config/env-config.ts +50 -0
  319. package/src/config/routes.ts +28 -0
  320. package/src/content.ts +217 -0
  321. package/src/hooks/keyboardCover.ts +70 -0
  322. package/src/hooks/useKeyboard.ts +135 -0
  323. package/src/hooks/useReducedMotion.ts +19 -0
  324. package/src/imessage/openMessages.ts +53 -0
  325. package/src/imessage/platform.ts +32 -0
  326. package/src/imessage/textLink.ts +307 -0
  327. package/src/index.ts +24 -0
  328. package/src/live/card.ts +62 -0
  329. package/src/live/liveActivity.ts +192 -0
  330. package/src/module.ts +8 -0
  331. package/src/offer/BlackFridayOffer.tsx +394 -0
  332. package/src/offer/blackFriday.ts +109 -0
  333. package/src/offer/parts.tsx +650 -0
  334. package/src/offer/state.ts +78 -0
  335. package/src/push/push.ts +171 -0
  336. package/src/push/usePushNotifications.ts +47 -0
  337. package/src/screens/Account/index.tsx +310 -0
  338. package/src/screens/Chat/.claude-flow/data/pending-insights.jsonl +4 -0
  339. package/src/screens/Chat/index.tsx +891 -0
  340. package/src/screens/Chores/index.tsx +35 -0
  341. package/src/screens/Connectors/index.tsx +35 -0
  342. package/src/screens/History/index.tsx +346 -0
  343. package/src/screens/Home/index.tsx +2776 -0
  344. package/src/screens/Home/media.ts +31 -0
  345. package/src/screens/Welcome/index.tsx +1182 -0
  346. package/src/talk/talkToLucy.ts +187 -0
  347. package/src/theme/colors.ts +38 -0
  348. package/src/theme/fonts.ts +30 -0
  349. package/src/theme/muse.ts +86 -0
  350. package/src/utils/links.ts +84 -0
  351. package/src/utils/yantraLinks.ts +94 -0
  352. package/src/welcome/flow.ts +418 -0
  353. package/src/welcome/haptics.ts +179 -0
  354. package/src/welcome/parts.tsx +2160 -0
  355. package/src/welcome/powerOn.ts +84 -0
  356. package/src/welcome/seen.ts +68 -0
  357. package/src/welcome/sound.ts +173 -0
  358. package/tools/lottie/chat.motion +0 -0
  359. package/tools/lottie/cloud.motion +0 -0
  360. package/tools/lottie/generate.mjs +1209 -0
  361. package/tools/lottie/inter-glyphs.json +4416 -0
  362. package/tools/lottie/lucy-mark-calendar.motion +0 -0
  363. package/tools/lottie/lucy-mark-call.motion +0 -0
  364. package/tools/lottie/lucy-mark-connect.motion +0 -0
  365. package/tools/lottie/lucy-mark-details.motion +0 -0
  366. package/tools/lottie/lucy-mark-email.motion +0 -0
  367. package/tools/lottie/lucy-mark-message.motion +0 -0
  368. package/tools/lottie/lucy-mark-search.motion +0 -0
  369. package/tools/lottie/lucy-mark-think.motion +0 -0
  370. package/tools/lottie/lucy-mark-write.motion +0 -0
  371. package/tools/lottie/mark.json +1 -0
  372. package/tools/lottie/mine-none.motion +0 -0
  373. package/tools/lottie/mine-offline.motion +0 -0
  374. package/tools/lottie/mine-online.motion +0 -0
  375. package/tools/lottie/time-back.mjs +604 -0
  376. package/tools/sounds/render.mjs +730 -0
  377. package/tsconfig.json +17 -0
  378. package/README.md +0 -3
@@ -0,0 +1,318 @@
1
+ /**
2
+ * The chat's Ideas tab, as Muse's: a search, category chips (All, Popular and every corner of home life from the web
3
+ * page's AREAS), a row of colourful featured cards, then each category as a tidy list. Tapping an idea hands it to
4
+ * Lucy straight away; the pencil puts it in the message box to change first. "Something else" opens an empty box.
5
+ */
6
+ import React, { useMemo, useState } from 'react';
7
+ import { Pressable, ScrollView, StyleSheet, Text, View } from 'react-native';
8
+ import { Ionicons } from '@expo/vector-icons';
9
+ import { AREAS, CHAT_STARTERS } from '@adminide-stack/clock-tik-browser/lib/pages/Home/content.js';
10
+ import { SearchPill } from './ui';
11
+ import { PAD, type, ui } from '../theme/muse';
12
+
13
+ interface Idea {
14
+ label: string;
15
+ prompt: string;
16
+ }
17
+ interface Area {
18
+ key: string;
19
+ title: string;
20
+ blurb: string;
21
+ chores: Idea[];
22
+ }
23
+
24
+ /** Each corner of home life: its emoji and a soft tint for its cards. */
25
+ const AREA_LOOK: Record<string, { emoji: string; tint: string; ink: string }> = {
26
+ bills: { emoji: '💸', tint: '#E3F4EA', ink: '#1F6B47' },
27
+ subscriptions: { emoji: '🔁', tint: '#EEE9FF', ink: '#5A3FC0' },
28
+ groceries: { emoji: '🛒', tint: '#FFF2D9', ink: '#8A5A00' },
29
+ family: { emoji: '👨‍👩‍👧', tint: '#FFE8EE', ink: '#A33A5B' },
30
+ home: { emoji: '🏠', tint: '#E5F0FF', ink: '#2457A6' },
31
+ travel: { emoji: '✈️', tint: '#E1F5F6', ink: '#17707A' },
32
+ };
33
+ const POPULAR_LOOK = { emoji: '⭐️', tint: '#FFEADC', ink: '#B23F00' };
34
+ const FEATURED_TINTS = ['#FFEADC', '#E5F0FF', '#E3F4EA', '#EEE9FF', '#FFF2D9', '#FFE8EE'];
35
+
36
+ function ideaEmoji(label: string, fallback: string): string {
37
+ const l = label.toLowerCase();
38
+ if (l.includes('reschedule') || l.includes('call')) return '📞';
39
+ if (l.includes('dentist') || l.includes('doctor')) return '🦷';
40
+ if (l.includes('schedule') || l.includes('book') || l.includes('appointment')) return '📅';
41
+ if (l.includes('remind')) return '⏰';
42
+ if (l.includes('refund') || l.includes('return')) return '↩️';
43
+ if (l.includes('flight') || l.includes('fare') || l.includes('hotel')) return '✈️';
44
+ if (l.includes('grocer') || l.includes('meal') || l.includes('dinner')) return '🛒';
45
+ if (l.includes('cancel') || l.includes('pause')) return '✂️';
46
+ if (l.includes('bill') || l.includes('fee') || l.includes('charge') || l.includes('paying')) return '💸';
47
+ if (l.includes('plumber') || l.includes('cleaner') || l.includes('repair')) return '🔧';
48
+ if (l.includes('school') || l.includes('form')) return '📝';
49
+ return fallback;
50
+ }
51
+
52
+ const ALL = 'all';
53
+ const POPULAR = 'popular';
54
+
55
+ export function IdeasPane({
56
+ onSend,
57
+ onEdit,
58
+ bottom,
59
+ }: {
60
+ /** Hand the idea to Lucy now. */
61
+ onSend: (prompt: string) => void;
62
+ /** Put it in the message box to change first ('' for an empty box). */
63
+ onEdit: (prompt: string) => void;
64
+ bottom: number;
65
+ }) {
66
+ const areas = AREAS as Area[];
67
+ const starters = CHAT_STARTERS as Idea[];
68
+ const [query, setQuery] = useState('');
69
+ const [category, setCategory] = useState<string>(ALL);
70
+ const q = query.trim().toLowerCase();
71
+
72
+ const chips = useMemo(
73
+ () => [
74
+ { key: ALL, label: 'All', emoji: '' },
75
+ { key: POPULAR, label: 'Popular', emoji: POPULAR_LOOK.emoji },
76
+ ...areas.map((a) => ({ key: a.key, label: a.title, emoji: AREA_LOOK[a.key]?.emoji ?? '✨' })),
77
+ ],
78
+ [areas],
79
+ );
80
+
81
+ const sections = useMemo(() => {
82
+ const popular = { key: POPULAR, title: 'Popular', blurb: 'What people hand Lucy first.', chores: starters };
83
+ const all = [popular, ...areas];
84
+ const shown = category === ALL ? all : all.filter((a) => a.key === category);
85
+ if (!q) return shown;
86
+ return all
87
+ .map((a) => ({
88
+ ...a,
89
+ chores: a.chores.filter((c) => c.label.toLowerCase().includes(q) || c.prompt.toLowerCase().includes(q)),
90
+ }))
91
+ .filter((a) => a.chores.length);
92
+ }, [areas, starters, category, q]);
93
+
94
+ return (
95
+ <ScrollView contentContainerStyle={{ paddingBottom: bottom }} keyboardShouldPersistTaps="handled">
96
+ <View style={s.head}>
97
+ <Text style={type.largeTitle} accessibilityRole="header">
98
+ Ideas
99
+ </Text>
100
+ <Text style={[type.callout, { marginTop: 2 }]}>Things Lucy can take off your plate.</Text>
101
+ </View>
102
+ <SearchPill value={query} onChangeText={setQuery} placeholder="Search ideas" />
103
+
104
+ {q ? null : (
105
+ <ScrollView
106
+ horizontal
107
+ showsHorizontalScrollIndicator={false}
108
+ contentContainerStyle={s.chips}
109
+ style={{ flexGrow: 0 }}
110
+ >
111
+ {chips.map((chip) => {
112
+ const on = chip.key === category;
113
+ return (
114
+ <Pressable
115
+ key={chip.key}
116
+ accessibilityRole="button"
117
+ accessibilityState={{ selected: on }}
118
+ onPress={() => setCategory(chip.key)}
119
+ style={[s.chip, on && s.chipOn]}
120
+ >
121
+ {chip.emoji ? <Text style={s.chipEmoji}>{chip.emoji}</Text> : null}
122
+ <Text style={[s.chipText, on && s.chipTextOn]}>{chip.label}</Text>
123
+ </Pressable>
124
+ );
125
+ })}
126
+ </ScrollView>
127
+ )}
128
+
129
+ {/* Featured: the first ideas people try, as colourful cards (All only). */}
130
+ {!q && category === ALL ? (
131
+ <ScrollView
132
+ horizontal
133
+ showsHorizontalScrollIndicator={false}
134
+ decelerationRate="fast"
135
+ snapToInterval={FEATURED_W + 12}
136
+ contentContainerStyle={s.featuredRow}
137
+ style={{ flexGrow: 0 }}
138
+ >
139
+ {starters.map((idea, i) => (
140
+ <Pressable
141
+ key={idea.label}
142
+ accessibilityRole="button"
143
+ accessibilityHint="Hands this to Lucy"
144
+ onPress={() => onSend(idea.prompt)}
145
+ style={({ pressed }) => [
146
+ s.featured,
147
+ { backgroundColor: FEATURED_TINTS[i % FEATURED_TINTS.length] },
148
+ pressed && { transform: [{ scale: 0.98 }] },
149
+ ]}
150
+ >
151
+ <Text style={s.featuredEmoji}>{ideaEmoji(idea.label, '✨')}</Text>
152
+ <Text style={s.featuredTitle} numberOfLines={2}>
153
+ {idea.label}
154
+ </Text>
155
+ <Text style={s.featuredBody} numberOfLines={3}>
156
+ {idea.prompt}
157
+ </Text>
158
+ <View style={s.featuredGo}>
159
+ <Text style={s.featuredGoText}>Ask Lucy</Text>
160
+ <Ionicons name="arrow-forward" size={14} color={ui.ink} />
161
+ </View>
162
+ </Pressable>
163
+ ))}
164
+ </ScrollView>
165
+ ) : null}
166
+
167
+ {sections.map((section) => {
168
+ const look = section.key === POPULAR ? POPULAR_LOOK : (AREA_LOOK[section.key] ?? POPULAR_LOOK);
169
+ // On All, the featured cards already show Popular.
170
+ if (!q && category === ALL && section.key === POPULAR) return null;
171
+ return (
172
+ <View key={section.key} style={{ marginTop: 22 }}>
173
+ <View style={s.sectionHead}>
174
+ <Text style={s.sectionTitle}>
175
+ {look.emoji} {section.title}
176
+ </Text>
177
+ {section.blurb && category !== ALL ? (
178
+ <Text style={[type.subhead, { marginTop: 2 }]}>{section.blurb}</Text>
179
+ ) : null}
180
+ </View>
181
+ <View style={s.group}>
182
+ {section.chores.map((idea, i) => (
183
+ <Pressable
184
+ key={idea.label}
185
+ accessibilityRole="button"
186
+ accessibilityLabel={idea.label}
187
+ accessibilityHint="Hands this to Lucy"
188
+ onPress={() => onSend(idea.prompt)}
189
+ style={({ pressed }) => [s.row, pressed && { backgroundColor: ui.fill }]}
190
+ >
191
+ <View style={[s.rowIcon, { backgroundColor: look.tint }]}>
192
+ <Text style={s.rowEmoji}>{ideaEmoji(idea.label, look.emoji)}</Text>
193
+ </View>
194
+ <View style={[s.rowBody, i < section.chores.length - 1 && s.rule]}>
195
+ <View style={{ flex: 1 }}>
196
+ <Text style={s.rowTitle} numberOfLines={1}>
197
+ {idea.label}
198
+ </Text>
199
+ <Text style={s.rowText} numberOfLines={2}>
200
+ {idea.prompt}
201
+ </Text>
202
+ </View>
203
+ <Pressable
204
+ accessibilityRole="button"
205
+ accessibilityLabel={`Edit “${idea.label}” before sending`}
206
+ onPress={() => onEdit(idea.prompt)}
207
+ hitSlop={8}
208
+ style={({ pressed }) => [s.edit, pressed && { backgroundColor: ui.fill }]}
209
+ >
210
+ <Ionicons name="create-outline" size={18} color={ui.muted} />
211
+ </Pressable>
212
+ </View>
213
+ </Pressable>
214
+ ))}
215
+ </View>
216
+ </View>
217
+ );
218
+ })}
219
+
220
+ {q && !sections.length ? (
221
+ <Text style={[type.callout, { textAlign: 'center', marginTop: 28, paddingHorizontal: 32 }]}>
222
+ No idea matches “{query.trim()}”. Ask Lucy anyway.
223
+ </Text>
224
+ ) : null}
225
+
226
+ {/* Anything else: an empty message box. */}
227
+ <Pressable
228
+ accessibilityRole="button"
229
+ onPress={() => onEdit(q ? query.trim() : '')}
230
+ style={({ pressed }) => [s.own, pressed && { opacity: 0.85 }]}
231
+ >
232
+ <View style={s.ownIcon}>
233
+ <Ionicons name="sparkles" size={18} color={ui.surface} />
234
+ </View>
235
+ <View style={{ flex: 1 }}>
236
+ <Text style={s.rowTitle}>Something else?</Text>
237
+ <Text style={s.rowText}>Tell Lucy in your own words.</Text>
238
+ </View>
239
+ <Ionicons name="chevron-forward" size={16} color={ui.faint} />
240
+ </Pressable>
241
+ </ScrollView>
242
+ );
243
+ }
244
+
245
+ const FEATURED_W = 220;
246
+
247
+ const s = StyleSheet.create({
248
+ head: { paddingHorizontal: PAD + 4, paddingTop: 4, marginBottom: 12 },
249
+ chips: { paddingHorizontal: PAD, gap: 8, paddingTop: 14, paddingBottom: 4 },
250
+ chip: {
251
+ flexDirection: 'row',
252
+ alignItems: 'center',
253
+ gap: 6,
254
+ height: 36,
255
+ paddingHorizontal: 14,
256
+ borderRadius: 18,
257
+ backgroundColor: ui.surface,
258
+ borderWidth: StyleSheet.hairlineWidth,
259
+ borderColor: ui.hairline,
260
+ },
261
+ chipOn: { backgroundColor: ui.ink, borderColor: ui.ink },
262
+ chipEmoji: { fontSize: 15 },
263
+ chipText: { fontSize: 14.5, fontWeight: '500', color: ui.ink },
264
+ chipTextOn: { color: ui.surface, fontWeight: '600' },
265
+
266
+ featuredRow: { paddingHorizontal: PAD, gap: 12, paddingTop: 16 },
267
+ featured: { width: FEATURED_W, minHeight: 184, borderRadius: 20, padding: 16 },
268
+ featuredEmoji: { fontSize: 30, lineHeight: 36 },
269
+ featuredTitle: {
270
+ fontSize: 17,
271
+ lineHeight: 22,
272
+ fontWeight: '700',
273
+ letterSpacing: -0.3,
274
+ color: ui.ink,
275
+ marginTop: 10,
276
+ },
277
+ featuredBody: { fontSize: 13.5, lineHeight: 18, color: ui.ink2, marginTop: 4 },
278
+ featuredGo: { flexDirection: 'row', alignItems: 'center', gap: 4, marginTop: 'auto', paddingTop: 10 },
279
+ featuredGoText: { fontSize: 13.5, fontWeight: '600', color: ui.ink },
280
+
281
+ sectionHead: { paddingHorizontal: PAD + 4, marginBottom: 8 },
282
+ sectionTitle: { fontSize: 19, fontWeight: '700', letterSpacing: -0.4, color: ui.ink },
283
+ group: { marginHorizontal: PAD, backgroundColor: ui.surface, borderRadius: 14, overflow: 'hidden' },
284
+ row: { flexDirection: 'row', alignItems: 'center', paddingLeft: 14 },
285
+ rowIcon: {
286
+ width: 38,
287
+ height: 38,
288
+ borderRadius: 11,
289
+ alignItems: 'center',
290
+ justifyContent: 'center',
291
+ marginRight: 12,
292
+ },
293
+ rowEmoji: { fontSize: 19 },
294
+ rowBody: { flex: 1, flexDirection: 'row', alignItems: 'center', gap: 6, paddingVertical: 11, paddingRight: 8 },
295
+ rule: { borderBottomWidth: StyleSheet.hairlineWidth, borderBottomColor: ui.hairline },
296
+ rowTitle: { fontSize: 15.5, fontWeight: '600', letterSpacing: -0.2, color: ui.ink },
297
+ rowText: { fontSize: 13.5, lineHeight: 18, color: ui.muted, marginTop: 1 },
298
+ edit: { width: 36, height: 36, borderRadius: 18, alignItems: 'center', justifyContent: 'center' },
299
+
300
+ own: {
301
+ flexDirection: 'row',
302
+ alignItems: 'center',
303
+ gap: 12,
304
+ marginHorizontal: PAD,
305
+ marginTop: 24,
306
+ padding: 14,
307
+ borderRadius: 14,
308
+ backgroundColor: ui.surface,
309
+ },
310
+ ownIcon: {
311
+ width: 38,
312
+ height: 38,
313
+ borderRadius: 11,
314
+ backgroundColor: ui.accent,
315
+ alignItems: 'center',
316
+ justifyContent: 'center',
317
+ },
318
+ });
@@ -0,0 +1,280 @@
1
+ /**
2
+ * "Text Lucy on iMessage" for someone signed in, as a Muse-style approval sheet rising from the bottom: the web home's dialog (browser src/pages/Home/imessage/
3
+ * ImessageDialog.tsx), on the phone: it gets this person's link (imessage/textLink.ts) and Open Messages opens
4
+ * Messages at Lucy's line with "Hi Lucy" ready, carrying the hidden one-time code that links this phone to their
5
+ * account. On a phone there is no QR code to scan: the phone in the hand is the one that texts.
6
+ */
7
+ import React, { useCallback, useEffect, useRef, useState } from 'react';
8
+ import { ActivityIndicator, AppState, Platform, Pressable, StyleSheet, Text, View } from 'react-native';
9
+ import { Ionicons } from '@expo/vector-icons';
10
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
11
+ import { Mark } from './Logo';
12
+ import { BottomSheet } from './BottomSheet';
13
+ import { MessagesAppIcon } from './MessagesAppIcon';
14
+ import { Button } from './ui';
15
+ import { MESSAGES_APP } from '../imessage/platform';
16
+ import { openMessages } from '../imessage/openMessages';
17
+ import { PAD, radius, type, ui } from '../theme/muse';
18
+ import { fetchTextLink, LUCY_GREETING, TextLinkError, type TextLink, type TextReach } from '../imessage/textLink';
19
+
20
+ type State =
21
+ | { status: 'loading' }
22
+ | { status: 'ready'; link: TextLink }
23
+ | { status: 'error'; message: string; signedOut?: boolean };
24
+
25
+ const RATE_LIMITED = 'That was a lot of tries in a minute. Give it a moment, then try again.';
26
+ const FAILED = `We couldn’t get your ${MESSAGES_APP} link just now. Try again in a moment.`;
27
+ const SIGNED_OUT = 'Your sign-in ran out. Sign in again, then try once more.';
28
+ /** Look again at most this often when the person comes back to the app (e.g. after sending from Messages). */
29
+ const RECHECK_MS = 15_000;
30
+ const GREETING_SHOWN = `“${LUCY_GREETING}”`;
31
+
32
+ /** An iPhone texts Lucy's iMessage handle; an Android phone texts the number that forwards to the same line. */
33
+ const REACH: TextReach = Platform.OS === 'android' ? 'sms' : 'imessage';
34
+
35
+ function messageFor(err: unknown): { message: string; signedOut?: boolean } {
36
+ if (err instanceof TextLinkError) {
37
+ if (err.kind === 'rate-limited') return { message: RATE_LIMITED };
38
+ if (err.kind === 'signed-out') return { message: SIGNED_OUT, signedOut: true };
39
+ }
40
+ return { message: FAILED };
41
+ }
42
+
43
+ function Steps() {
44
+ const steps = ['Tap Open Messages', `Send ${GREETING_SHOWN}`, 'Lucy texts back'];
45
+ return (
46
+ <View style={styles.steps} accessibilityRole="list" accessibilityLabel="How it works">
47
+ {steps.map((step, i) => (
48
+ <View key={step} style={styles.step}>
49
+ <View style={styles.stepN}>
50
+ <Text style={styles.stepNText}>{i + 1}</Text>
51
+ </View>
52
+ <Text style={styles.stepText}>{step}</Text>
53
+ </View>
54
+ ))}
55
+ </View>
56
+ );
57
+ }
58
+
59
+ export function ImessageSheet({
60
+ visible,
61
+ message,
62
+ onClose,
63
+ onChatHere,
64
+ onSignIn,
65
+ }: {
66
+ visible: boolean;
67
+ /** A chore to send as the first text instead of the greeting. */
68
+ message?: string;
69
+ onClose: () => void;
70
+ /** "Chat with Lucy here instead": the app's own chat. */
71
+ onChatHere: () => void;
72
+ /** The sign-in ran out: sign in again. */
73
+ onSignIn: () => void;
74
+ }) {
75
+ const insets = useSafeAreaInsets();
76
+ const [state, setState] = useState<State>({ status: 'loading' });
77
+ const abort = useRef<AbortController | null>(null);
78
+ const lastLoad = useRef(0);
79
+
80
+ const load = useCallback(() => {
81
+ abort.current?.abort();
82
+ const ctrl = new AbortController();
83
+ abort.current = ctrl;
84
+ lastLoad.current = Date.now();
85
+ setState((prev) => (prev.status === 'ready' ? prev : { status: 'loading' }));
86
+ fetchTextLink(REACH, { message, signal: ctrl.signal })
87
+ .then((link) => !ctrl.signal.aborted && setState({ status: 'ready', link }))
88
+ .catch((err) => !ctrl.signal.aborted && setState({ status: 'error', ...messageFor(err) }));
89
+ }, [message]);
90
+
91
+ useEffect(() => {
92
+ if (!visible) {
93
+ abort.current?.abort();
94
+ setState({ status: 'loading' });
95
+ return undefined;
96
+ }
97
+ load();
98
+ // Back from Messages: the phone may be linked now, and the code may have run out.
99
+ const sub = AppState.addEventListener('change', (s) => {
100
+ if (s === 'active' && Date.now() - lastLoad.current > RECHECK_MS) load();
101
+ });
102
+ return () => {
103
+ sub.remove();
104
+ abort.current?.abort();
105
+ };
106
+ }, [visible, load]);
107
+
108
+ const link = state.status === 'ready' ? state.link : null;
109
+ const href = link?.href ?? null;
110
+ const android = Platform.OS === 'android';
111
+ const title = android ? 'Text Lucy from Messages' : 'Text Lucy on iMessage';
112
+ const ready = message?.trim() ? 'your chore' : GREETING_SHOWN;
113
+
114
+ const onOpenMessages = async () => {
115
+ if (!href || !link?.to || link.body === null) return;
116
+ // The phone's own Messages, never whichever app claims `sms:` links (WhatsApp, when it is the default).
117
+ const ok = await openMessages({ to: link.to, body: link.body, href });
118
+ // Off to Messages: coming back should land on the app, not on this sheet again.
119
+ if (ok) onClose();
120
+ else
121
+ setState({
122
+ status: 'error',
123
+ message: 'Messages couldn’t open on this phone. Chat with Lucy here instead.',
124
+ });
125
+ };
126
+
127
+ return (
128
+ <BottomSheet
129
+ visible={visible}
130
+ onClose={onClose}
131
+ style={[styles.card, { paddingBottom: Math.max(insets.bottom, 14) + 8 }]}
132
+ >
133
+ <View style={styles.grabber} />
134
+ <Pressable
135
+ onPress={onClose}
136
+ hitSlop={10}
137
+ accessibilityRole="button"
138
+ accessibilityLabel="Close"
139
+ style={styles.close}
140
+ >
141
+ <Ionicons name="close" size={18} color={ui.ink2} />
142
+ </Pressable>
143
+
144
+ <View style={styles.badge} accessibilityElementsHidden importantForAccessibility="no">
145
+ <MessagesAppIcon size={56} />
146
+ <View style={styles.badgeMark}>
147
+ <Mark size={17} />
148
+ </View>
149
+ </View>
150
+
151
+ <Text accessibilityRole="header" style={[type.title, styles.center]}>
152
+ {title}
153
+ </Text>
154
+ <Text style={[type.callout, styles.center, styles.body]}>
155
+ Lucy answers in Messages, like any other text. Hand her a chore from wherever you are.
156
+ </Text>
157
+
158
+ <View style={styles.content} accessibilityLiveRegion="polite">
159
+ {state.status === 'error' ? (
160
+ <View style={styles.note}>
161
+ <Text style={[type.callout, styles.center]}>{state.message}</Text>
162
+ <Button
163
+ label={state.signedOut ? 'Sign in' : 'Try again'}
164
+ icon={state.signedOut ? 'log-in-outline' : 'refresh'}
165
+ variant="secondary"
166
+ onPress={state.signedOut ? onSignIn : load}
167
+ style={styles.small}
168
+ />
169
+ </View>
170
+ ) : state.status === 'loading' ? (
171
+ <View style={styles.loading}>
172
+ <ActivityIndicator color={ui.accent} />
173
+ <Text style={[type.footnote, styles.center]}>{`Getting your ${MESSAGES_APP} link…`}</Text>
174
+ </View>
175
+ ) : !href ? (
176
+ <View style={styles.note}>
177
+ <Text style={[type.callout, styles.center]}>
178
+ {link?.reach === 'sms' && !link.smsAvailable
179
+ ? 'Texting Lucy from an Android phone isn’t open yet. Chat with her here instead.'
180
+ : `Lucy’s ${MESSAGES_APP} line isn’t answering right now. Try again in a minute, or chat with her here.`}
181
+ </Text>
182
+ <Button
183
+ label="Try again"
184
+ icon="refresh"
185
+ variant="secondary"
186
+ onPress={load}
187
+ style={styles.small}
188
+ />
189
+ </View>
190
+ ) : (
191
+ <>
192
+ {link?.linked ? null : <Steps />}
193
+ <View accessibilityHint={`Opens Messages with ${ready} ready to send`}>
194
+ <Button label="Open Messages" icon="chatbubble" onPress={onOpenMessages} />
195
+ </View>
196
+ <Text style={[type.footnote, styles.center, styles.hint]}>
197
+ {link?.linked
198
+ ? 'Your phone already texts Lucy. Just tap send.'
199
+ : `Messages opens with ${ready} ready. Send it, and this phone is linked to your account.`}
200
+ </Text>
201
+ </>
202
+ )}
203
+ </View>
204
+
205
+ <Button
206
+ label="Chat with Lucy here instead"
207
+ icon="chatbox-ellipses-outline"
208
+ variant="secondary"
209
+ onPress={onChatHere}
210
+ style={styles.chatHere}
211
+ />
212
+ <Text style={[type.caption, styles.center, styles.fine]}>Message and data rates may apply.</Text>
213
+ </BottomSheet>
214
+ );
215
+ }
216
+
217
+ const styles = StyleSheet.create({
218
+ card: {
219
+ backgroundColor: ui.surface,
220
+ borderTopLeftRadius: 24,
221
+ borderTopRightRadius: 24,
222
+ paddingHorizontal: PAD + 4,
223
+ paddingTop: 10,
224
+ alignItems: 'stretch',
225
+ },
226
+ grabber: { alignSelf: 'center', width: 36, height: 5, borderRadius: 3, backgroundColor: ui.fill, marginBottom: 14 },
227
+ close: {
228
+ position: 'absolute',
229
+ top: 16,
230
+ right: 16,
231
+ width: 30,
232
+ height: 30,
233
+ borderRadius: 15,
234
+ backgroundColor: ui.fill,
235
+ alignItems: 'center',
236
+ justifyContent: 'center',
237
+ },
238
+ center: { textAlign: 'center' },
239
+ badge: { alignSelf: 'center', width: 62, height: 62, marginBottom: 14 },
240
+ badgeMark: {
241
+ position: 'absolute',
242
+ right: -2,
243
+ bottom: -2,
244
+ width: 26,
245
+ height: 26,
246
+ borderRadius: 13,
247
+ backgroundColor: ui.surface,
248
+ alignItems: 'center',
249
+ justifyContent: 'center',
250
+ },
251
+ body: { marginTop: 6, color: ui.muted },
252
+ content: { marginTop: 20, minHeight: 96, justifyContent: 'center' },
253
+ loading: { alignItems: 'center', gap: 10 },
254
+ note: { alignItems: 'center', gap: 14 },
255
+ small: { height: 42 },
256
+ hint: { marginTop: 10 },
257
+ steps: { flexDirection: 'row', justifyContent: 'center', flexWrap: 'wrap', gap: 8, marginBottom: 16 },
258
+ step: {
259
+ flexDirection: 'row',
260
+ alignItems: 'center',
261
+ gap: 6,
262
+ paddingVertical: 6,
263
+ paddingLeft: 6,
264
+ paddingRight: 11,
265
+ borderRadius: radius.pill,
266
+ backgroundColor: ui.fill,
267
+ },
268
+ stepN: {
269
+ width: 20,
270
+ height: 20,
271
+ borderRadius: 10,
272
+ backgroundColor: ui.accentSoft,
273
+ alignItems: 'center',
274
+ justifyContent: 'center',
275
+ },
276
+ stepNText: { fontSize: 11, fontWeight: '700', color: ui.accentText },
277
+ stepText: { fontSize: 13, fontWeight: '500', color: ui.ink2 },
278
+ chatHere: { marginTop: 16 },
279
+ fine: { marginTop: 12 },
280
+ });
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Keeps its bottom edge above the keyboard, on iOS and Android alike. It must run to the bottom of the screen (a
3
+ * screen's lower part, as the chat's composer area does): it pads its own bottom by exactly as much of it as the
4
+ * keyboard covers.
5
+ *
6
+ * React Native's KeyboardAvoidingView measures itself against its parent, not the screen, so under a header it fell
7
+ * short by the header's height. Android may also have made the room already by shrinking the window (phones where
8
+ * the app is not drawn edge to edge): `useKeyboardCover` counts only what is still covered.
9
+ */
10
+ import React, { useRef } from 'react';
11
+ import { LayoutAnimation, Platform, View, type StyleProp, type ViewStyle } from 'react-native';
12
+ import { useKeyboardCover } from '../hooks/useKeyboard';
13
+
14
+ export function KeyboardAvoider({
15
+ style,
16
+ children,
17
+ extra = 0,
18
+ }: {
19
+ style?: StyleProp<ViewStyle>;
20
+ children: React.ReactNode;
21
+ /** Room to leave between the content and the keyboard. */
22
+ extra?: number;
23
+ }) {
24
+ const view = useRef<View>(null);
25
+ const { keyboard, covers, onLayout } = useKeyboardCover(view);
26
+ const pad = keyboard.shown ? covers + extra : 0;
27
+
28
+ // iOS: the room opens with the keyboard's own curve. It has to be set up before the layout that changes it.
29
+ const last = useRef(pad);
30
+ if (last.current !== pad) {
31
+ last.current = pad;
32
+ if (Platform.OS === 'ios' && keyboard.duration > 10) {
33
+ LayoutAnimation.configureNext({
34
+ duration: keyboard.duration,
35
+ update: { duration: keyboard.duration, type: LayoutAnimation.Types.keyboard },
36
+ });
37
+ }
38
+ }
39
+
40
+ return (
41
+ <View ref={view} collapsable={false} style={[style, { paddingBottom: pad }]} onLayout={onLayout}>
42
+ {children}
43
+ </View>
44
+ );
45
+ }