@adminide-stack/clock-tik-mobile 0.0.0-stage → 12.0.37-alpha.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/.claude-flow/data/pending-insights.jsonl +43 -0
- package/.claude-flow/sessions/session-1794323376548.json +14 -0
- package/CHANGELOG.md +31 -0
- package/jest.config.cjs +22 -0
- package/lib/assets/home/loop-day.jpg +0 -0
- package/lib/assets/home/loop-day.mp4 +0 -0
- package/lib/assets/home/loop-time-back.jpg +0 -0
- package/lib/assets/home/loop-time-back.mp4 +0 -0
- package/lib/assets/home/loop-where.jpg +0 -0
- package/lib/assets/home/loop-where.mp4 +0 -0
- package/lib/assets/home/reel-gym.jpg +0 -0
- package/lib/assets/home/reel-gym.mp4 +0 -0
- package/lib/assets/home/reel-internet.jpg +0 -0
- package/lib/assets/home/reel-internet.mp4 +0 -0
- package/lib/assets/icon.png +0 -0
- package/lib/assets/lottie/.claude-flow/data/pending-insights.jsonl +1 -0
- package/lib/assets/lottie/lucy-mark-calendar.json +1827 -0
- package/lib/assets/lottie/lucy-mark-call.json +1470 -0
- package/lib/assets/lottie/lucy-mark-connect.json +2552 -0
- package/lib/assets/lottie/lucy-mark-details.json +1735 -0
- package/lib/assets/lottie/lucy-mark-email.json +1363 -0
- package/lib/assets/lottie/lucy-mark-message.json +1154 -0
- package/lib/assets/lottie/lucy-mark-search.json +1067 -0
- package/lib/assets/lottie/lucy-mark-think.json +1253 -0
- package/lib/assets/lottie/lucy-mark-write.json +1532 -0
- package/lib/assets/lottie/time-back.json +16458 -0
- package/lib/assets/lottie/where-lucy-works-chat.json +6170 -0
- package/lib/assets/lottie/where-lucy-works-cloud.json +10066 -0
- package/lib/assets/lottie/where-lucy-works-mine-none.json +2478 -0
- package/lib/assets/lottie/where-lucy-works-mine-offline.json +2373 -0
- package/lib/assets/lottie/where-lucy-works-mine-online.json +7881 -0
- package/lib/assets/sounds/hours-back.m4a +0 -0
- package/lib/assets/sounds/meet-lucy.m4a +0 -0
- package/lib/assets/sounds/power-on.m4a +0 -0
- package/lib/assets/sounds/wind-back.m4a +0 -0
- package/lib/assets/sounds/youre-in.m4a +0 -0
- package/lib/chat/agent.js +358 -0
- package/lib/chat/agent.js.map +1 -0
- package/lib/chat/appFront.js +32 -0
- package/lib/chat/appFront.js.map +1 -0
- package/lib/chat/auth.js +370 -0
- package/lib/chat/auth.js.map +1 -0
- package/lib/chat/chores.js +360 -0
- package/lib/chat/chores.js.map +1 -0
- package/lib/chat/connectors.js +42 -0
- package/lib/chat/connectors.js.map +1 -0
- package/lib/chat/jobs.js +223 -0
- package/lib/chat/jobs.js.map +1 -0
- package/lib/chat/lucyMotion.js +6 -0
- package/lib/chat/lucyMotion.js.map +1 -0
- package/lib/chat/protocol.js +111 -0
- package/lib/chat/protocol.js.map +1 -0
- package/lib/chat/results.js +133 -0
- package/lib/chat/results.js.map +1 -0
- package/lib/chat/store.js +81 -0
- package/lib/chat/store.js.map +1 -0
- package/lib/chat/useDictation.js +168 -0
- package/lib/chat/useDictation.js.map +1 -0
- package/lib/chat/useLucyChat.js +451 -0
- package/lib/chat/useLucyChat.js.map +1 -0
- package/lib/chat/useMyComputer.js +32 -0
- package/lib/chat/useMyComputer.js.map +1 -0
- package/lib/chat/whereLucyWorks.js +52 -0
- package/lib/chat/whereLucyWorks.js.map +1 -0
- package/lib/chat/workspace.js +124 -0
- package/lib/chat/workspace.js.map +1 -0
- package/lib/components/AreaShot.js +289 -0
- package/lib/components/AreaShot.js.map +1 -0
- package/lib/components/Backdrops.js +262 -0
- package/lib/components/Backdrops.js.map +1 -0
- package/lib/components/BottomSheet.js +61 -0
- package/lib/components/BottomSheet.js.map +1 -0
- package/lib/components/ChatSheets.js +429 -0
- package/lib/components/ChatSheets.js.map +1 -0
- package/lib/components/ConnectorLogo.js +91 -0
- package/lib/components/ConnectorLogo.js.map +1 -0
- package/lib/components/CustomDrawer.js +534 -0
- package/lib/components/CustomDrawer.js.map +1 -0
- package/lib/components/IdeasPane.js +394 -0
- package/lib/components/IdeasPane.js.map +1 -0
- package/lib/components/ImessageSheet.js +261 -0
- package/lib/components/ImessageSheet.js.map +1 -0
- package/lib/components/KeyboardAvoider.js +29 -0
- package/lib/components/KeyboardAvoider.js.map +1 -0
- package/lib/components/Logo.js +81 -0
- package/lib/components/Logo.js.map +1 -0
- package/lib/components/LucyWorking.js +67 -0
- package/lib/components/LucyWorking.js.map +1 -0
- package/lib/components/Markdown.js +260 -0
- package/lib/components/Markdown.js.map +1 -0
- package/lib/components/Media.js +93 -0
- package/lib/components/Media.js.map +1 -0
- package/lib/components/MessagesAppIcon.js +23 -0
- package/lib/components/MessagesAppIcon.js.map +1 -0
- package/lib/components/MicButton.js +71 -0
- package/lib/components/MicButton.js.map +1 -0
- package/lib/components/ResultCards.js +974 -0
- package/lib/components/ResultCards.js.map +1 -0
- package/lib/components/SignInPrompt.js +148 -0
- package/lib/components/SignInPrompt.js.map +1 -0
- package/lib/components/SignedOut.js +38 -0
- package/lib/components/SignedOut.js.map +1 -0
- package/lib/components/TalkToLucyHero.js +487 -0
- package/lib/components/TalkToLucyHero.js.map +1 -0
- package/lib/components/TalkToLucySheet.js +182 -0
- package/lib/components/TalkToLucySheet.js.map +1 -0
- package/lib/components/WhereLucyWorks.js +277 -0
- package/lib/components/WhereLucyWorks.js.map +1 -0
- package/lib/components/WorkspaceSection.js +271 -0
- package/lib/components/WorkspaceSection.js.map +1 -0
- package/lib/components/YantraMark.js +13 -0
- package/lib/components/YantraMark.js.map +1 -0
- package/lib/components/drawerHeader.js +38 -0
- package/lib/components/drawerHeader.js.map +1 -0
- package/lib/components/lottieInstalled.js +6 -0
- package/lib/components/lottieInstalled.js.map +1 -0
- package/lib/components/ui.js +550 -0
- package/lib/components/ui.js.map +1 -0
- package/lib/components/useSignOut.js +7 -0
- package/lib/components/useSignOut.js.map +1 -0
- package/lib/components/viewport.js +121 -0
- package/lib/components/viewport.js.map +1 -0
- package/lib/components/voiceDial.js +10 -0
- package/lib/components/voiceDial.js.map +1 -0
- package/lib/compute.js +157 -0
- package/lib/compute.js.map +1 -0
- package/lib/config/env-config.js +21 -0
- package/lib/config/env-config.js.map +1 -0
- package/lib/config/routes.js +15 -0
- package/lib/config/routes.js.map +1 -0
- package/lib/content.js +25 -0
- package/lib/content.js.map +1 -0
- package/lib/hooks/keyboardCover.js +39 -0
- package/lib/hooks/keyboardCover.js.map +1 -0
- package/lib/hooks/useKeyboard.js +121 -0
- package/lib/hooks/useKeyboard.js.map +1 -0
- package/lib/hooks/useReducedMotion.js +13 -0
- package/lib/hooks/useReducedMotion.js.map +1 -0
- package/lib/imessage/openMessages.js +25 -0
- package/lib/imessage/openMessages.js.map +1 -0
- package/lib/imessage/platform.js +12 -0
- package/lib/imessage/platform.js.map +1 -0
- package/lib/imessage/textLink.js +262 -0
- package/lib/imessage/textLink.js.map +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -0
- package/lib/live/card.js +28 -0
- package/lib/live/card.js.map +1 -0
- package/lib/live/liveActivity.js +144 -0
- package/lib/live/liveActivity.js.map +1 -0
- package/lib/module.js +3 -0
- package/lib/module.js.map +1 -0
- package/lib/offer/BlackFridayOffer.js +378 -0
- package/lib/offer/BlackFridayOffer.js.map +1 -0
- package/lib/offer/blackFriday.js +78 -0
- package/lib/offer/blackFriday.js.map +1 -0
- package/lib/offer/parts.js +624 -0
- package/lib/offer/parts.js.map +1 -0
- package/lib/offer/state.js +63 -0
- package/lib/offer/state.js.map +1 -0
- package/lib/push/push.js +142 -0
- package/lib/push/push.js.map +1 -0
- package/lib/push/usePushNotifications.js +39 -0
- package/lib/push/usePushNotifications.js.map +1 -0
- package/lib/routes.json +175 -0
- package/lib/screens/Account/index.js +209 -0
- package/lib/screens/Account/index.js.map +1 -0
- package/lib/screens/Chat/index.js +710 -0
- package/lib/screens/Chat/index.js.map +1 -0
- package/lib/screens/Chores/index.js +18 -0
- package/lib/screens/Chores/index.js.map +1 -0
- package/lib/screens/Connectors/index.js +17 -0
- package/lib/screens/Connectors/index.js.map +1 -0
- package/lib/screens/History/index.js +380 -0
- package/lib/screens/History/index.js.map +1 -0
- package/lib/screens/Home/index.js +2711 -0
- package/lib/screens/Home/index.js.map +1 -0
- package/lib/screens/Home/media.js +25 -0
- package/lib/screens/Home/media.js.map +1 -0
- package/lib/screens/Welcome/index.js +1066 -0
- package/lib/screens/Welcome/index.js.map +1 -0
- package/lib/talk/talkToLucy.js +139 -0
- package/lib/talk/talkToLucy.js.map +1 -0
- package/lib/theme/colors.js +29 -0
- package/lib/theme/colors.js.map +1 -0
- package/lib/theme/fonts.js +17 -0
- package/lib/theme/fonts.js.map +1 -0
- package/lib/theme/muse.js +134 -0
- package/lib/theme/muse.js.map +1 -0
- package/lib/utils/links.js +54 -0
- package/lib/utils/links.js.map +1 -0
- package/lib/utils/yantraLinks.js +68 -0
- package/lib/utils/yantraLinks.js.map +1 -0
- package/lib/welcome/flow.js +375 -0
- package/lib/welcome/flow.js.map +1 -0
- package/lib/welcome/haptics.js +125 -0
- package/lib/welcome/haptics.js.map +1 -0
- package/lib/welcome/parts.js +1996 -0
- package/lib/welcome/parts.js.map +1 -0
- package/lib/welcome/powerOn.js +29 -0
- package/lib/welcome/powerOn.js.map +1 -0
- package/lib/welcome/seen.js +41 -0
- package/lib/welcome/seen.js.map +1 -0
- package/lib/welcome/sound.js +110 -0
- package/lib/welcome/sound.js.map +1 -0
- package/package.json +66 -5
- package/rollup.config.mjs +42 -0
- package/src/.claude-flow/data/pending-insights.jsonl +19 -0
- package/src/.claude-flow/sessions/session-1795013028422.json +14 -0
- package/src/__tests__/auth.test.ts +94 -0
- package/src/__tests__/blackFriday.test.ts +75 -0
- package/src/__tests__/cardTokens.test.ts +77 -0
- package/src/__tests__/chores.test.ts +179 -0
- package/src/__tests__/choresList.test.ts +100 -0
- package/src/__tests__/content.test.ts +54 -0
- package/src/__tests__/dictation.test.ts +186 -0
- package/src/__tests__/haptics.test.ts +202 -0
- package/src/__tests__/jobs.test.ts +130 -0
- package/src/__tests__/keyboardCover.test.ts +84 -0
- package/src/__tests__/liveCard.test.ts +39 -0
- package/src/__tests__/lockedPhone.test.ts +355 -0
- package/src/__tests__/lucyMotion.test.ts +34 -0
- package/src/__tests__/platform.test.ts +32 -0
- package/src/__tests__/powerOn.test.ts +62 -0
- package/src/__tests__/protocol.test.ts +125 -0
- package/src/__tests__/push.test.ts +111 -0
- package/src/__tests__/results.test.ts +256 -0
- package/src/__tests__/sound.test.ts +248 -0
- package/src/__tests__/talkToLucy.test.ts +205 -0
- package/src/__tests__/textLink.test.ts +91 -0
- package/src/__tests__/voiceDial.test.ts +53 -0
- package/src/__tests__/welcomeFlow.test.ts +157 -0
- package/src/__tests__/whereLucyWorks.test.ts +81 -0
- package/src/__tests__/yantraLinks.test.ts +96 -0
- package/src/assets/home/loop-day.jpg +0 -0
- package/src/assets/home/loop-day.mp4 +0 -0
- package/src/assets/home/loop-time-back.jpg +0 -0
- package/src/assets/home/loop-time-back.mp4 +0 -0
- package/src/assets/home/loop-where.jpg +0 -0
- package/src/assets/home/loop-where.mp4 +0 -0
- package/src/assets/home/reel-gym.jpg +0 -0
- package/src/assets/home/reel-gym.mp4 +0 -0
- package/src/assets/home/reel-internet.jpg +0 -0
- package/src/assets/home/reel-internet.mp4 +0 -0
- package/src/assets/icon.png +0 -0
- package/src/assets/lottie/.claude-flow/data/pending-insights.jsonl +1 -0
- package/src/assets/lottie/lucy-mark-calendar.json +1827 -0
- package/src/assets/lottie/lucy-mark-call.json +1470 -0
- package/src/assets/lottie/lucy-mark-connect.json +2552 -0
- package/src/assets/lottie/lucy-mark-details.json +1735 -0
- package/src/assets/lottie/lucy-mark-email.json +1363 -0
- package/src/assets/lottie/lucy-mark-message.json +1154 -0
- package/src/assets/lottie/lucy-mark-search.json +1067 -0
- package/src/assets/lottie/lucy-mark-think.json +1253 -0
- package/src/assets/lottie/lucy-mark-write.json +1532 -0
- package/src/assets/lottie/time-back.json +16458 -0
- package/src/assets/lottie/where-lucy-works-chat.json +6170 -0
- package/src/assets/lottie/where-lucy-works-cloud.json +10066 -0
- package/src/assets/lottie/where-lucy-works-mine-none.json +2478 -0
- package/src/assets/lottie/where-lucy-works-mine-offline.json +2373 -0
- package/src/assets/lottie/where-lucy-works-mine-online.json +7881 -0
- package/src/assets/sounds/hours-back.m4a +0 -0
- package/src/assets/sounds/meet-lucy.m4a +0 -0
- package/src/assets/sounds/power-on.m4a +0 -0
- package/src/assets/sounds/wind-back.m4a +0 -0
- package/src/assets/sounds/youre-in.m4a +0 -0
- package/src/chat/.claude-flow/data/pending-insights.jsonl +1 -0
- package/src/chat/agent.ts +376 -0
- package/src/chat/appFront.ts +39 -0
- package/src/chat/auth.ts +433 -0
- package/src/chat/chores.ts +394 -0
- package/src/chat/connectors.ts +65 -0
- package/src/chat/jobs.ts +228 -0
- package/src/chat/lucyMotion.ts +33 -0
- package/src/chat/protocol.ts +192 -0
- package/src/chat/results.ts +224 -0
- package/src/chat/store.ts +87 -0
- package/src/chat/useDictation.ts +201 -0
- package/src/chat/useLucyChat.ts +458 -0
- package/src/chat/useMyComputer.ts +41 -0
- package/src/chat/whereLucyWorks.ts +97 -0
- package/src/chat/workspace.ts +127 -0
- package/src/components/.claude-flow/data/pending-insights.jsonl +3 -0
- package/src/components/AreaShot.tsx +239 -0
- package/src/components/Backdrops.tsx +323 -0
- package/src/components/BottomSheet.tsx +96 -0
- package/src/components/ChatSheets.tsx +565 -0
- package/src/components/ConnectorLogo.tsx +116 -0
- package/src/components/CustomDrawer.tsx +526 -0
- package/src/components/IdeasPane.tsx +318 -0
- package/src/components/ImessageSheet.tsx +280 -0
- package/src/components/KeyboardAvoider.tsx +45 -0
- package/src/components/Logo.tsx +97 -0
- package/src/components/LucyWorking.tsx +122 -0
- package/src/components/Markdown.tsx +219 -0
- package/src/components/Media.tsx +173 -0
- package/src/components/MessagesAppIcon.tsx +51 -0
- package/src/components/MicButton.tsx +92 -0
- package/src/components/ResultCards.tsx +1067 -0
- package/src/components/SignInPrompt.tsx +182 -0
- package/src/components/SignedOut.tsx +47 -0
- package/src/components/TalkToLucyHero.tsx +540 -0
- package/src/components/TalkToLucySheet.tsx +208 -0
- package/src/components/VoiceOrb.tsx +364 -0
- package/src/components/WhereLucyWorks.tsx +261 -0
- package/src/components/WorkspaceSection.tsx +307 -0
- package/src/components/YantraMark.tsx +30 -0
- package/src/components/drawerHeader.tsx +46 -0
- package/src/components/kit.tsx +309 -0
- package/src/components/lottieInstalled.ts +7 -0
- package/src/components/ui.tsx +700 -0
- package/src/components/useSignOut.ts +21 -0
- package/src/components/viewport.tsx +166 -0
- package/src/components/voiceDial.ts +45 -0
- package/src/compute.ts +168 -0
- package/src/config/env-config.ts +37 -0
- package/src/config/routes.ts +28 -0
- package/src/content.ts +217 -0
- package/src/hooks/keyboardCover.ts +70 -0
- package/src/hooks/useKeyboard.ts +135 -0
- package/src/hooks/useReducedMotion.ts +19 -0
- package/src/imessage/openMessages.ts +53 -0
- package/src/imessage/platform.ts +32 -0
- package/src/imessage/textLink.ts +307 -0
- package/src/index.ts +24 -0
- package/src/live/card.ts +62 -0
- package/src/live/liveActivity.ts +192 -0
- package/src/module.ts +8 -0
- package/src/offer/BlackFridayOffer.tsx +394 -0
- package/src/offer/blackFriday.ts +109 -0
- package/src/offer/parts.tsx +650 -0
- package/src/offer/state.ts +78 -0
- package/src/push/push.ts +171 -0
- package/src/push/usePushNotifications.ts +47 -0
- package/src/screens/Account/index.tsx +310 -0
- package/src/screens/Chat/.claude-flow/data/pending-insights.jsonl +4 -0
- package/src/screens/Chat/index.tsx +891 -0
- package/src/screens/Chores/index.tsx +35 -0
- package/src/screens/Connectors/index.tsx +35 -0
- package/src/screens/History/index.tsx +346 -0
- package/src/screens/Home/index.tsx +2773 -0
- package/src/screens/Home/media.ts +31 -0
- package/src/screens/Welcome/index.tsx +1182 -0
- package/src/talk/talkToLucy.ts +187 -0
- package/src/theme/colors.ts +38 -0
- package/src/theme/fonts.ts +30 -0
- package/src/theme/muse.ts +86 -0
- package/src/utils/links.ts +84 -0
- package/src/utils/yantraLinks.ts +94 -0
- package/src/welcome/flow.ts +418 -0
- package/src/welcome/haptics.ts +179 -0
- package/src/welcome/parts.tsx +2160 -0
- package/src/welcome/powerOn.ts +84 -0
- package/src/welcome/seen.ts +68 -0
- package/src/welcome/sound.ts +173 -0
- package/tools/lottie/chat.motion +0 -0
- package/tools/lottie/cloud.motion +0 -0
- package/tools/lottie/generate.mjs +1209 -0
- package/tools/lottie/inter-glyphs.json +4416 -0
- package/tools/lottie/lucy-mark-calendar.motion +0 -0
- package/tools/lottie/lucy-mark-call.motion +0 -0
- package/tools/lottie/lucy-mark-connect.motion +0 -0
- package/tools/lottie/lucy-mark-details.motion +0 -0
- package/tools/lottie/lucy-mark-email.motion +0 -0
- package/tools/lottie/lucy-mark-message.motion +0 -0
- package/tools/lottie/lucy-mark-search.motion +0 -0
- package/tools/lottie/lucy-mark-think.motion +0 -0
- package/tools/lottie/lucy-mark-write.motion +0 -0
- package/tools/lottie/mark.json +1 -0
- package/tools/lottie/mine-none.motion +0 -0
- package/tools/lottie/mine-offline.motion +0 -0
- package/tools/lottie/mine-online.motion +0 -0
- package/tools/lottie/time-back.mjs +604 -0
- package/tools/sounds/render.mjs +730 -0
- package/tsconfig.json +17 -0
- package/README.md +0 -3
|
@@ -0,0 +1,2773 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clockbook home, native: clockbook.com (clock-tik-browser pages/Home/HomePage.tsx) laid out for a phone, in the
|
|
3
|
+
* app's Muse-style look (theme/muse.ts, components/ui.tsx) in the web's warm colours and backgrounds
|
|
4
|
+
* (components/Backdrops.tsx): system type, Lucy as the avatar, plain lists where the web has card grids. Same sections in the same order and the same copy, read from the web
|
|
5
|
+
* page's content (its built lib/, read-only). Every chore goes through the sign-in prompt when nobody is signed in,
|
|
6
|
+
* then opens Lucy's chat with that chore; nothing is sent from here.
|
|
7
|
+
*
|
|
8
|
+
* The drawer's section rows (content.ts NAV_SECTIONS) navigate here with `section`, and the screen scrolls to it.
|
|
9
|
+
* Talk to Lucy (the Action Button's control, talk/talkToLucy.ts) and Account's Try it now navigate here with `listen`:
|
|
10
|
+
* the screen scrolls to the top and the big mic starts listening.
|
|
11
|
+
*/
|
|
12
|
+
import React, { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
13
|
+
import {
|
|
14
|
+
Animated,
|
|
15
|
+
Easing,
|
|
16
|
+
LayoutAnimation,
|
|
17
|
+
Platform,
|
|
18
|
+
Pressable,
|
|
19
|
+
ScrollView,
|
|
20
|
+
StyleSheet,
|
|
21
|
+
Text,
|
|
22
|
+
TextInput,
|
|
23
|
+
UIManager,
|
|
24
|
+
View,
|
|
25
|
+
useWindowDimensions,
|
|
26
|
+
type LayoutChangeEvent,
|
|
27
|
+
type StyleProp,
|
|
28
|
+
type TextStyle,
|
|
29
|
+
type ViewProps,
|
|
30
|
+
type ViewStyle,
|
|
31
|
+
} from 'react-native';
|
|
32
|
+
import { DrawerActions, useIsFocused, useNavigation, useRoute } from '@react-navigation/native';
|
|
33
|
+
import { useHeaderHeight } from '@react-navigation/elements';
|
|
34
|
+
import Svg, { Circle, Defs, Line, LinearGradient, Path, RadialGradient, Rect, Stop } from 'react-native-svg';
|
|
35
|
+
import { Ionicons } from '@expo/vector-icons';
|
|
36
|
+
// The web home's own copy, read-only from the browser package's build (content.ts there has no imports).
|
|
37
|
+
import {
|
|
38
|
+
AREAS,
|
|
39
|
+
CALL_STEPS,
|
|
40
|
+
FAQS,
|
|
41
|
+
FOOTNOTE,
|
|
42
|
+
HERO_CHORES,
|
|
43
|
+
HOUSEWORK_MIN,
|
|
44
|
+
MINUTES,
|
|
45
|
+
TYPED_CHORES,
|
|
46
|
+
STEPS,
|
|
47
|
+
STRIP_CHORES,
|
|
48
|
+
TEXT_STEPS,
|
|
49
|
+
TEXT_THREAD,
|
|
50
|
+
VIDEO_NOTE,
|
|
51
|
+
} from '@adminide-stack/clock-tik-browser/lib/pages/Home/content.js';
|
|
52
|
+
import { Mark } from '../../components/Logo';
|
|
53
|
+
import LottieView, { type AnimationObject } from 'lottie-react-native';
|
|
54
|
+
import { LucyWorking } from '../../components/LucyWorking';
|
|
55
|
+
import { lottieInstalled } from '../../components/lottieInstalled';
|
|
56
|
+
import { motionFor } from '../../chat/lucyMotion';
|
|
57
|
+
import { AreaShot } from '../../components/AreaShot';
|
|
58
|
+
import { Aurora, DarkFill, FinalFill, SoftFill } from '../../components/Backdrops';
|
|
59
|
+
import { YantraMark } from '../../components/YantraMark';
|
|
60
|
+
import { Reel } from '../../components/Media';
|
|
61
|
+
import { useSignInGate } from '../../components/SignInPrompt';
|
|
62
|
+
import { ImessageSheet } from '../../components/ImessageSheet';
|
|
63
|
+
import { MessagesAppIcon } from '../../components/MessagesAppIcon';
|
|
64
|
+
import { Button, FloatingButton, Group, GroupRow, IdeaRow } from '../../components/ui';
|
|
65
|
+
import { MESSAGES_APP, TEXT_FROM, TEXT_LUCY, textSteps } from '../../imessage/platform';
|
|
66
|
+
import { AuthMobileNavigationRoutesEnum } from '@adminide-stack/user-auth0-client';
|
|
67
|
+
import { useReducedMotion } from '../../hooks/useReducedMotion';
|
|
68
|
+
import { useDictation } from '../../chat/useDictation';
|
|
69
|
+
import { useChoreCount } from '../../components/ChatSheets';
|
|
70
|
+
import { useIsUserAuthenticated } from '@adminide-stack/user-auth0-client';
|
|
71
|
+
import { dictationProblem, MicButton } from '../../components/MicButton';
|
|
72
|
+
import { useKeyboardCover } from '../../hooks/useKeyboard';
|
|
73
|
+
import type { SectionKey } from '../../content';
|
|
74
|
+
import { PROMPT_MAX, yantraAppUrl } from '../../utils/links';
|
|
75
|
+
import { openYantraUrl } from '../../utils/yantraLinks';
|
|
76
|
+
import { CLOCKBOOK_ROUTES, drawerRoute } from '../../config/routes';
|
|
77
|
+
import { listeningHome, watchTalkRequests } from '../../talk/talkToLucy';
|
|
78
|
+
import { usePushNotifications } from '../../push/usePushNotifications';
|
|
79
|
+
import { useWelcomeSeen } from '../../welcome/seen';
|
|
80
|
+
import { BLACK_FRIDAY, offerShows } from '../../offer/blackFriday';
|
|
81
|
+
import { markOffer, resetOffer, useOfferSeen } from '../../offer/state';
|
|
82
|
+
import { BlackFridayOffer, OfferSheet, type Point } from '../../offer/BlackFridayOffer';
|
|
83
|
+
import { OfferChip, useNow } from '../../offer/parts';
|
|
84
|
+
import { click, release, tap } from '../../welcome/haptics';
|
|
85
|
+
import { field, float, lift, PAD, radius, type, ui } from '../../theme/muse';
|
|
86
|
+
import { REELS } from './media';
|
|
87
|
+
import { useInView, useViewportController, ViewportProvider } from '../../components/viewport';
|
|
88
|
+
|
|
89
|
+
type IconName = React.ComponentProps<typeof Ionicons>['name'];
|
|
90
|
+
interface Chore {
|
|
91
|
+
label: string;
|
|
92
|
+
prompt: string;
|
|
93
|
+
icon?: string;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (Platform.OS === 'android' && UIManager.setLayoutAnimationEnabledExperimental) {
|
|
97
|
+
UIManager.setLayoutAnimationEnabledExperimental(true);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const STATS = [
|
|
101
|
+
{ to: 38, decimals: 0, unit: 'min', label: 'every day' },
|
|
102
|
+
{ to: 4.4, decimals: 1, unit: 'hrs', label: 'every week' },
|
|
103
|
+
{ to: 229, decimals: 0, unit: 'hrs', label: 'every year' },
|
|
104
|
+
];
|
|
105
|
+
const COUNT_MS = 1400;
|
|
106
|
+
|
|
107
|
+
/** How it works, as a timeline: a vector icon leads each step (text it, Lucy handles it, you approve). */
|
|
108
|
+
const STEP_ICONS: IconName[] = ['chatbubble-ellipses-outline', 'call-outline', 'checkmark-done-outline'];
|
|
109
|
+
|
|
110
|
+
const CHORE_ICONS: Record<string, IconName> = {
|
|
111
|
+
schedule: 'calendar-outline',
|
|
112
|
+
call: 'call-outline',
|
|
113
|
+
bill: 'receipt-outline',
|
|
114
|
+
meals: 'restaurant-outline',
|
|
115
|
+
dentist: 'happy-outline',
|
|
116
|
+
travel: 'airplane-outline',
|
|
117
|
+
bank: 'card-outline',
|
|
118
|
+
return: 'cube-outline',
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
function choreIcon(c: Chore): IconName {
|
|
122
|
+
if (c.icon && CHORE_ICONS[c.icon]) return CHORE_ICONS[c.icon];
|
|
123
|
+
const l = c.label.toLowerCase();
|
|
124
|
+
if (l.includes('gym') || l.includes('cancel')) return 'close-circle-outline';
|
|
125
|
+
if (l.includes('call')) return 'call-outline';
|
|
126
|
+
if (l.includes('bill') || l.includes('internet')) return 'receipt-outline';
|
|
127
|
+
if (l.includes('dinner') || l.includes('grocer')) return 'restaurant-outline';
|
|
128
|
+
return 'sparkles-outline';
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/* ------------------------------------------------------------------------------------------------ type */
|
|
132
|
+
|
|
133
|
+
/** A section's quiet label above its title (sentence case, muted, as Muse's list headers). */
|
|
134
|
+
function Eyebrow({
|
|
135
|
+
children,
|
|
136
|
+
icon,
|
|
137
|
+
center,
|
|
138
|
+
dark,
|
|
139
|
+
}: {
|
|
140
|
+
children: string;
|
|
141
|
+
icon?: React.ReactNode;
|
|
142
|
+
center?: boolean;
|
|
143
|
+
/** On the dark time-back card: the web's peach (.cbh-time-copy .cbh-eyebrow). */
|
|
144
|
+
dark?: boolean;
|
|
145
|
+
}) {
|
|
146
|
+
return (
|
|
147
|
+
<View style={[s.eyebrowRow, center && { justifyContent: 'center' }]}>
|
|
148
|
+
{icon}
|
|
149
|
+
<Text style={[s.eyebrow, dark && s.eyebrowDark]}>{children}</Text>
|
|
150
|
+
</View>
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/** A system-font title; `em` is the one word the web sets in orange italic, here in the accent colour. */
|
|
155
|
+
function Heading({
|
|
156
|
+
pre,
|
|
157
|
+
em,
|
|
158
|
+
post,
|
|
159
|
+
large,
|
|
160
|
+
center,
|
|
161
|
+
dark,
|
|
162
|
+
style,
|
|
163
|
+
}: {
|
|
164
|
+
pre: string;
|
|
165
|
+
em: string;
|
|
166
|
+
post?: string;
|
|
167
|
+
large?: boolean;
|
|
168
|
+
center?: boolean;
|
|
169
|
+
/** White on the dark time-back card, its orange word lighter to keep its contrast. */
|
|
170
|
+
dark?: boolean;
|
|
171
|
+
style?: StyleProp<TextStyle>;
|
|
172
|
+
}) {
|
|
173
|
+
return (
|
|
174
|
+
<Text
|
|
175
|
+
accessibilityRole="header"
|
|
176
|
+
style={[
|
|
177
|
+
large ? s.headingLarge : s.heading,
|
|
178
|
+
center && { textAlign: 'center' },
|
|
179
|
+
dark && s.headingDark,
|
|
180
|
+
style,
|
|
181
|
+
]}
|
|
182
|
+
>
|
|
183
|
+
{pre}
|
|
184
|
+
<Text style={[s.headingEm, dark && s.headingEmDark]}>{em}</Text>
|
|
185
|
+
{post ?? ''}
|
|
186
|
+
</Text>
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/* ------------------------------------------------------------------------------------------------ pieces */
|
|
191
|
+
|
|
192
|
+
/** Muse's suggestion cards: a tinted icon, the chore, and what Lucy will be asked. */
|
|
193
|
+
function IdeaCard({ chore, onPress }: { chore: Chore; onPress: (c: Chore) => void }) {
|
|
194
|
+
return (
|
|
195
|
+
<Pressable
|
|
196
|
+
accessibilityRole="button"
|
|
197
|
+
accessibilityLabel={chore.label}
|
|
198
|
+
accessibilityHint="Hands this chore to Lucy"
|
|
199
|
+
onPress={() => onPress(chore)}
|
|
200
|
+
style={({ pressed }) => [s.card, pressed && { transform: [{ scale: 0.97 }], backgroundColor: ui.fill }]}
|
|
201
|
+
>
|
|
202
|
+
<View style={s.cardHead}>
|
|
203
|
+
<View style={s.cardIcon}>
|
|
204
|
+
<Ionicons name={choreIcon(chore)} size={18} color={ui.accentText} />
|
|
205
|
+
</View>
|
|
206
|
+
<Text style={s.cardTitle} numberOfLines={1}>
|
|
207
|
+
{chore.label}
|
|
208
|
+
</Text>
|
|
209
|
+
<View style={s.cardGo}>
|
|
210
|
+
<Ionicons name="arrow-up" size={14} color={ui.accentText} />
|
|
211
|
+
</View>
|
|
212
|
+
</View>
|
|
213
|
+
<Text style={s.cardBody} numberOfLines={2}>
|
|
214
|
+
{chore.prompt}
|
|
215
|
+
</Text>
|
|
216
|
+
</Pressable>
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/** A soft fade at a scroller's edge, so cut-off chips melt into the page. */
|
|
221
|
+
function EdgeFade({ side }: { side: 'left' | 'right' }) {
|
|
222
|
+
const id = `fade-${side}`;
|
|
223
|
+
return (
|
|
224
|
+
<View pointerEvents="none" style={[s.fade, side === 'left' ? { left: 0 } : { right: 0 }]}>
|
|
225
|
+
<Svg width="100%" height="100%">
|
|
226
|
+
<Defs>
|
|
227
|
+
<LinearGradient id={id} x1="0" y1="0" x2="1" y2="0">
|
|
228
|
+
<Stop offset="0" stopColor={ui.bg} stopOpacity={side === 'left' ? 1 : 0} />
|
|
229
|
+
<Stop offset="1" stopColor={ui.bg} stopOpacity={side === 'left' ? 0 : 1} />
|
|
230
|
+
</LinearGradient>
|
|
231
|
+
</Defs>
|
|
232
|
+
<Rect width="100%" height="100%" fill={`url(#${id})`} />
|
|
233
|
+
</Svg>
|
|
234
|
+
</View>
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function ChoreChip({ chore, onPress, small }: { chore: Chore; onPress: (c: Chore) => void; small?: boolean }) {
|
|
239
|
+
return (
|
|
240
|
+
<Pressable
|
|
241
|
+
accessibilityRole="button"
|
|
242
|
+
accessibilityHint="Hands this chore to Lucy"
|
|
243
|
+
onPress={() => onPress(chore)}
|
|
244
|
+
style={({ pressed }) => [s.chip, small && s.chipSmall, pressed && s.chipPressed]}
|
|
245
|
+
>
|
|
246
|
+
<Ionicons name={choreIcon(chore)} size={small ? 13 : 15} color={ui.accentText} />
|
|
247
|
+
<Text style={[s.chipText, small && s.chipTextSmall]}>{chore.label}</Text>
|
|
248
|
+
</Pressable>
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/* The web composer's typewriter (HomePage.tsx useTypewriter): typed out, held, taken back, the next. */
|
|
253
|
+
const TYPE_START_MS = 700;
|
|
254
|
+
const TYPE_MS = 34;
|
|
255
|
+
const TYPE_JITTER_MS = 36;
|
|
256
|
+
const TYPE_HOLD_MS = 1800;
|
|
257
|
+
const TYPE_DELETE_MS = 16;
|
|
258
|
+
const TYPE_GAP_MS = 420;
|
|
259
|
+
|
|
260
|
+
function useTypewriter(phrases: readonly string[], active: boolean): string | null {
|
|
261
|
+
const [text, setText] = useState<string | null>(null);
|
|
262
|
+
const phraseRef = useRef(0);
|
|
263
|
+
useEffect(() => {
|
|
264
|
+
if (!active || !phrases.length) {
|
|
265
|
+
setText(null);
|
|
266
|
+
return undefined;
|
|
267
|
+
}
|
|
268
|
+
let shown = 0;
|
|
269
|
+
let deleting = false;
|
|
270
|
+
let timer: ReturnType<typeof setTimeout>;
|
|
271
|
+
const step = () => {
|
|
272
|
+
const full = phrases[phraseRef.current % phrases.length];
|
|
273
|
+
if (!deleting) {
|
|
274
|
+
shown += 1;
|
|
275
|
+
setText(full.slice(0, shown));
|
|
276
|
+
if (shown >= full.length) {
|
|
277
|
+
deleting = true;
|
|
278
|
+
timer = setTimeout(step, TYPE_HOLD_MS);
|
|
279
|
+
} else timer = setTimeout(step, TYPE_MS + Math.random() * TYPE_JITTER_MS);
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
shown = Math.max(0, shown - 2);
|
|
283
|
+
setText(full.slice(0, shown));
|
|
284
|
+
if (shown > 0) {
|
|
285
|
+
timer = setTimeout(step, TYPE_DELETE_MS);
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
deleting = false;
|
|
289
|
+
phraseRef.current += 1;
|
|
290
|
+
timer = setTimeout(step, TYPE_GAP_MS);
|
|
291
|
+
};
|
|
292
|
+
setText('');
|
|
293
|
+
timer = setTimeout(step, TYPE_START_MS);
|
|
294
|
+
return () => clearTimeout(timer);
|
|
295
|
+
}, [phrases, active]);
|
|
296
|
+
return text;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/** The web's blinking orange caret (.cbh-caret), inline at the end of the typed text. */
|
|
300
|
+
function Caret() {
|
|
301
|
+
const [on, setOn] = useState(true);
|
|
302
|
+
useEffect(() => {
|
|
303
|
+
const id = setInterval(() => setOn((v) => !v), 525);
|
|
304
|
+
return () => clearInterval(id);
|
|
305
|
+
}, []);
|
|
306
|
+
return <Text style={[s.caretText, !on && { color: 'transparent' }]}>|</Text>;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* The "time back" mark: the same Lottie logo as Lucy thinking in the chat (its minute hand rewinds), so the page
|
|
311
|
+
* and the chat move alike. Decorative, so hidden from screen readers.
|
|
312
|
+
*/
|
|
313
|
+
function TimeBackMark({ size }: { size: number }) {
|
|
314
|
+
return (
|
|
315
|
+
<View accessibilityElementsHidden importantForAccessibility="no-hide-descendants">
|
|
316
|
+
<LucyWorking size={size} motion="think" />
|
|
317
|
+
</View>
|
|
318
|
+
);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* The web's hero mark (.cbh-halo-mark): Lucy's clock on a white rounded tile, over a warm glow that slowly
|
|
323
|
+
* breathes (the web's blurred conic halo, as a soft radial one here).
|
|
324
|
+
*/
|
|
325
|
+
function HaloMark() {
|
|
326
|
+
const reduced = useReducedMotion();
|
|
327
|
+
const t = useRef(new Animated.Value(0)).current;
|
|
328
|
+
useEffect(() => {
|
|
329
|
+
if (reduced) return undefined;
|
|
330
|
+
const loop = Animated.loop(
|
|
331
|
+
Animated.sequence([
|
|
332
|
+
Animated.timing(t, {
|
|
333
|
+
toValue: 1,
|
|
334
|
+
duration: 7000,
|
|
335
|
+
easing: Easing.inOut(Easing.sin),
|
|
336
|
+
useNativeDriver: true,
|
|
337
|
+
}),
|
|
338
|
+
Animated.timing(t, {
|
|
339
|
+
toValue: 0,
|
|
340
|
+
duration: 7000,
|
|
341
|
+
easing: Easing.inOut(Easing.sin),
|
|
342
|
+
useNativeDriver: true,
|
|
343
|
+
}),
|
|
344
|
+
]),
|
|
345
|
+
);
|
|
346
|
+
loop.start();
|
|
347
|
+
return () => loop.stop();
|
|
348
|
+
}, [reduced, t]);
|
|
349
|
+
const scale = t.interpolate({ inputRange: [0, 1], outputRange: [0.94, 1.06] });
|
|
350
|
+
const rotate = t.interpolate({ inputRange: [0, 1], outputRange: ['0deg', '180deg'] });
|
|
351
|
+
return (
|
|
352
|
+
<View style={s.halo} accessibilityElementsHidden importantForAccessibility="no-hide-descendants">
|
|
353
|
+
<Animated.View pointerEvents="none" style={[s.haloGlow, { transform: [{ scale }, { rotate }] }]}>
|
|
354
|
+
<Svg width="100%" height="100%">
|
|
355
|
+
<Defs>
|
|
356
|
+
<RadialGradient id="halo" cx="45%" cy="40%" r="50%">
|
|
357
|
+
<Stop offset="0" stopColor="#FF7A2E" stopOpacity="0.5" />
|
|
358
|
+
<Stop offset="0.55" stopColor="#FFB36B" stopOpacity="0.28" />
|
|
359
|
+
<Stop offset="1" stopColor="#FF9A8A" stopOpacity="0" />
|
|
360
|
+
</RadialGradient>
|
|
361
|
+
</Defs>
|
|
362
|
+
<Circle cx="50%" cy="50%" r="50%" fill="url(#halo)" />
|
|
363
|
+
</Svg>
|
|
364
|
+
</Animated.View>
|
|
365
|
+
<View style={s.haloTile}>
|
|
366
|
+
<TimeBackMark size={38} />
|
|
367
|
+
</View>
|
|
368
|
+
</View>
|
|
369
|
+
);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/** The hero rising in on load, staggered (the web's .cbh-rise .cbh-d1..d3). */
|
|
373
|
+
function Rise({
|
|
374
|
+
children,
|
|
375
|
+
delay = 0,
|
|
376
|
+
style,
|
|
377
|
+
}: {
|
|
378
|
+
children: React.ReactNode;
|
|
379
|
+
delay?: number;
|
|
380
|
+
style?: StyleProp<ViewStyle>;
|
|
381
|
+
}) {
|
|
382
|
+
const reduced = useReducedMotion();
|
|
383
|
+
const t = useRef(new Animated.Value(reduced ? 1 : 0)).current;
|
|
384
|
+
useEffect(() => {
|
|
385
|
+
if (reduced) {
|
|
386
|
+
t.setValue(1);
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
Animated.timing(t, {
|
|
390
|
+
toValue: 1,
|
|
391
|
+
duration: 800,
|
|
392
|
+
delay,
|
|
393
|
+
easing: Easing.bezier(0.16, 1, 0.3, 1),
|
|
394
|
+
useNativeDriver: true,
|
|
395
|
+
}).start();
|
|
396
|
+
}, [reduced, delay, t]);
|
|
397
|
+
const translateY = t.interpolate({ inputRange: [0, 1], outputRange: [14, 0] });
|
|
398
|
+
return <Animated.View style={[style, { opacity: t, transform: [{ translateY }] }]}>{children}</Animated.View>;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* The chore box, as Muse's floating composer: one rounded field, the mic (speak the chore, as in the chat) and a send
|
|
403
|
+
* button. Empty, it cycles example chores (the web's typed placeholder).
|
|
404
|
+
*/
|
|
405
|
+
/** Space between a focused chore box and the keyboard it is docked on. */
|
|
406
|
+
const KEYBOARD_GAP = 12;
|
|
407
|
+
|
|
408
|
+
/** Plan A (chosen of the mic-first plans): a big mic above the hero's chore box, so speaking is the first thing to do. */
|
|
409
|
+
|
|
410
|
+
/** "Good morning" … "Working late": the hello over the hero's title. */
|
|
411
|
+
function greeting(now = new Date()): string {
|
|
412
|
+
const h = now.getHours();
|
|
413
|
+
if (h < 5) return 'Working late';
|
|
414
|
+
if (h < 12) return 'Good morning';
|
|
415
|
+
if (h < 17) return 'Good afternoon';
|
|
416
|
+
if (h < 21) return 'Good evening';
|
|
417
|
+
return 'Working late';
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/** The clock dial around the big mic: 60 ticks, every fifth longer and darker, as on Clockbook's clock. */
|
|
421
|
+
const DIAL = 184;
|
|
422
|
+
const DIAL_TICKS = Array.from({ length: 60 }, (_, i) => {
|
|
423
|
+
const major = i % 5 === 0;
|
|
424
|
+
const angle = (i / 60) * Math.PI * 2;
|
|
425
|
+
const r1 = DIAL / 2 - 2;
|
|
426
|
+
const r2 = r1 - (major ? 11 : 6);
|
|
427
|
+
const c = DIAL / 2;
|
|
428
|
+
return {
|
|
429
|
+
key: i,
|
|
430
|
+
x1: c + r1 * Math.sin(angle),
|
|
431
|
+
y1: c - r1 * Math.cos(angle),
|
|
432
|
+
x2: c + r2 * Math.sin(angle),
|
|
433
|
+
y2: c - r2 * Math.cos(angle),
|
|
434
|
+
major,
|
|
435
|
+
};
|
|
436
|
+
});
|
|
437
|
+
const SPHERE = 96;
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* The big mic: a glossy orange sphere in Clockbook's clock dial, an orange hand sweeping round it (slowly while it
|
|
441
|
+
* waits, quickly while it listens, still with Reduce Motion), and two lines saying what it does.
|
|
442
|
+
*/
|
|
443
|
+
function BigMic({ listening, onPress }: { listening: boolean; onPress: () => void }) {
|
|
444
|
+
const reduced = useReducedMotion();
|
|
445
|
+
const sweep = useRef(new Animated.Value(0)).current;
|
|
446
|
+
const pulse = useRef(new Animated.Value(0)).current;
|
|
447
|
+
useEffect(() => {
|
|
448
|
+
if (reduced) {
|
|
449
|
+
sweep.setValue(0.3);
|
|
450
|
+
return undefined;
|
|
451
|
+
}
|
|
452
|
+
sweep.setValue(0);
|
|
453
|
+
const loop = Animated.loop(
|
|
454
|
+
Animated.timing(sweep, {
|
|
455
|
+
toValue: 1,
|
|
456
|
+
duration: listening ? 3000 : 60000,
|
|
457
|
+
easing: Easing.linear,
|
|
458
|
+
useNativeDriver: true,
|
|
459
|
+
}),
|
|
460
|
+
);
|
|
461
|
+
loop.start();
|
|
462
|
+
return () => loop.stop();
|
|
463
|
+
}, [reduced, listening, sweep]);
|
|
464
|
+
useEffect(() => {
|
|
465
|
+
if (!listening || reduced) {
|
|
466
|
+
pulse.setValue(0);
|
|
467
|
+
return undefined;
|
|
468
|
+
}
|
|
469
|
+
const loop = Animated.loop(
|
|
470
|
+
Animated.timing(pulse, {
|
|
471
|
+
toValue: 1,
|
|
472
|
+
duration: 1200,
|
|
473
|
+
easing: Easing.out(Easing.quad),
|
|
474
|
+
useNativeDriver: true,
|
|
475
|
+
}),
|
|
476
|
+
);
|
|
477
|
+
loop.start();
|
|
478
|
+
return () => loop.stop();
|
|
479
|
+
}, [listening, reduced, pulse]);
|
|
480
|
+
return (
|
|
481
|
+
<View style={s.bigMic}>
|
|
482
|
+
<View style={s.dial}>
|
|
483
|
+
<Svg width={DIAL} height={DIAL} style={StyleSheet.absoluteFill} pointerEvents="none">
|
|
484
|
+
{DIAL_TICKS.map((t) => (
|
|
485
|
+
<Line
|
|
486
|
+
key={t.key}
|
|
487
|
+
x1={t.x1}
|
|
488
|
+
y1={t.y1}
|
|
489
|
+
x2={t.x2}
|
|
490
|
+
y2={t.y2}
|
|
491
|
+
stroke={t.major ? 'rgba(26,23,20,0.38)' : 'rgba(26,23,20,0.16)'}
|
|
492
|
+
strokeWidth={t.major ? 2 : 1.2}
|
|
493
|
+
strokeLinecap="round"
|
|
494
|
+
/>
|
|
495
|
+
))}
|
|
496
|
+
</Svg>
|
|
497
|
+
{/* The hand: one orange tick that sweeps the dial. */}
|
|
498
|
+
<Animated.View
|
|
499
|
+
pointerEvents="none"
|
|
500
|
+
style={[
|
|
501
|
+
StyleSheet.absoluteFill,
|
|
502
|
+
{
|
|
503
|
+
transform: [
|
|
504
|
+
{ rotate: sweep.interpolate({ inputRange: [0, 1], outputRange: ['0deg', '360deg'] }) },
|
|
505
|
+
],
|
|
506
|
+
},
|
|
507
|
+
]}
|
|
508
|
+
>
|
|
509
|
+
<Svg width={DIAL} height={DIAL}>
|
|
510
|
+
<Line
|
|
511
|
+
x1={DIAL / 2}
|
|
512
|
+
y1={2}
|
|
513
|
+
x2={DIAL / 2}
|
|
514
|
+
y2={16}
|
|
515
|
+
stroke={ui.accent}
|
|
516
|
+
strokeWidth={2.5}
|
|
517
|
+
strokeLinecap="round"
|
|
518
|
+
/>
|
|
519
|
+
</Svg>
|
|
520
|
+
</Animated.View>
|
|
521
|
+
{listening ? (
|
|
522
|
+
<Animated.View
|
|
523
|
+
pointerEvents="none"
|
|
524
|
+
style={[
|
|
525
|
+
s.sphereRing,
|
|
526
|
+
{
|
|
527
|
+
opacity: pulse.interpolate({ inputRange: [0, 1], outputRange: [0.4, 0] }),
|
|
528
|
+
transform: [
|
|
529
|
+
{ scale: pulse.interpolate({ inputRange: [0, 1], outputRange: [1, 1.5] }) },
|
|
530
|
+
],
|
|
531
|
+
},
|
|
532
|
+
]}
|
|
533
|
+
/>
|
|
534
|
+
) : null}
|
|
535
|
+
<Pressable
|
|
536
|
+
accessibilityRole="button"
|
|
537
|
+
accessibilityLabel={listening ? 'Stop listening' : 'Tell Lucy by voice'}
|
|
538
|
+
accessibilityState={{ selected: listening }}
|
|
539
|
+
onPress={() => {
|
|
540
|
+
// On with a crisp click, off with a soft one: the mic is a switch.
|
|
541
|
+
(listening ? release : click)();
|
|
542
|
+
onPress();
|
|
543
|
+
}}
|
|
544
|
+
style={({ pressed }) => [s.sphere, pressed && { transform: [{ scale: 0.96 }] }]}
|
|
545
|
+
>
|
|
546
|
+
{/* The sphere: a radial highlight up and to the left, deepening to the rim. */}
|
|
547
|
+
<Svg width={SPHERE} height={SPHERE} style={StyleSheet.absoluteFill}>
|
|
548
|
+
<Defs>
|
|
549
|
+
<RadialGradient id="micSphere" cx="38%" cy="30%" r="75%">
|
|
550
|
+
<Stop offset="0" stopColor="#FFB383" />
|
|
551
|
+
<Stop offset="0.45" stopColor="#FF6A1A" />
|
|
552
|
+
<Stop offset="1" stopColor="#D94600" />
|
|
553
|
+
</RadialGradient>
|
|
554
|
+
</Defs>
|
|
555
|
+
<Circle cx={SPHERE / 2} cy={SPHERE / 2} r={SPHERE / 2} fill="url(#micSphere)" />
|
|
556
|
+
</Svg>
|
|
557
|
+
<Ionicons name={listening ? 'stop' : 'mic-outline'} size={listening ? 30 : 36} color={ui.surface} />
|
|
558
|
+
</Pressable>
|
|
559
|
+
</View>
|
|
560
|
+
<Text style={[s.bigMicLabel, listening && { color: ui.accentText }]}>
|
|
561
|
+
{listening ? 'Listening… tap to stop' : 'Tap and tell Lucy'}
|
|
562
|
+
</Text>
|
|
563
|
+
<Text style={s.bigMicSub}>
|
|
564
|
+
{listening ? 'Your words land in the box below' : 'Or type it in the box below'}
|
|
565
|
+
</Text>
|
|
566
|
+
</View>
|
|
567
|
+
);
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
/** The ideas under the box: tap one and it goes to Lucy as written (selection over typing). */
|
|
571
|
+
function IdeaChips({ chores, onPress }: { chores: Chore[]; onPress: (c: Chore) => void }) {
|
|
572
|
+
return (
|
|
573
|
+
<ScrollView
|
|
574
|
+
horizontal
|
|
575
|
+
showsHorizontalScrollIndicator={false}
|
|
576
|
+
contentContainerStyle={s.ideaChips}
|
|
577
|
+
style={s.ideaChipsScroll}
|
|
578
|
+
>
|
|
579
|
+
{chores.map((c) => (
|
|
580
|
+
<Pressable
|
|
581
|
+
key={c.label}
|
|
582
|
+
accessibilityRole="button"
|
|
583
|
+
accessibilityHint="Hands this to Lucy"
|
|
584
|
+
onPress={() => {
|
|
585
|
+
tap();
|
|
586
|
+
onPress(c);
|
|
587
|
+
}}
|
|
588
|
+
style={({ pressed }) => [s.ideaChip, pressed && { backgroundColor: ui.accentSoft }]}
|
|
589
|
+
>
|
|
590
|
+
<Ionicons name={choreIcon(c)} size={16} color={ui.accentText} />
|
|
591
|
+
<Text style={s.ideaChipText} numberOfLines={1}>
|
|
592
|
+
{c.label}
|
|
593
|
+
</Text>
|
|
594
|
+
</Pressable>
|
|
595
|
+
))}
|
|
596
|
+
</ScrollView>
|
|
597
|
+
);
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
/** How long a `listen` (Talk to Lucy, Try it now) stays new: Home mounting again later with it starts nothing. */
|
|
601
|
+
const LISTEN_FRESH_MS = 10_000;
|
|
602
|
+
|
|
603
|
+
function Composer({
|
|
604
|
+
onSubmit,
|
|
605
|
+
large,
|
|
606
|
+
onFocusBox,
|
|
607
|
+
bigMic,
|
|
608
|
+
between,
|
|
609
|
+
listenAt,
|
|
610
|
+
}: {
|
|
611
|
+
onSubmit: (text: string) => void;
|
|
612
|
+
large?: boolean;
|
|
613
|
+
/** The voice stage: the big mic in the middle, `between` under it, the typing line at the foot. */
|
|
614
|
+
bigMic?: boolean;
|
|
615
|
+
between?: React.ReactNode;
|
|
616
|
+
/** A new value starts the mic, as a tap would: Talk to Lucy (the Action Button's control) and Try it now. */
|
|
617
|
+
listenAt?: number;
|
|
618
|
+
/** The box when its field takes the keyboard, null when it lets go: the page scrolls it above the keyboard. */
|
|
619
|
+
onFocusBox?: (box: View | null) => void;
|
|
620
|
+
}) {
|
|
621
|
+
const [text, setText] = useState('');
|
|
622
|
+
const [focused, setFocused] = useState(false);
|
|
623
|
+
const ready = text.trim().length > 0;
|
|
624
|
+
const reduced = useReducedMotion();
|
|
625
|
+
const box = useRef<View>(null);
|
|
626
|
+
const onScreen = useInView(box, { minFraction: 0.5 }) !== false;
|
|
627
|
+
const input = useRef<TextInput>(null);
|
|
628
|
+
// A build without the speech module: the keyboard's own dictation mic does the same job, so open it.
|
|
629
|
+
const [keyboardHint, setKeyboardHint] = useState(false);
|
|
630
|
+
const dictation = useDictation({
|
|
631
|
+
onText: setText,
|
|
632
|
+
onProblem: (problem, detail) => {
|
|
633
|
+
if (problem === 'unavailable') {
|
|
634
|
+
setKeyboardHint(true);
|
|
635
|
+
input.current?.focus();
|
|
636
|
+
return;
|
|
637
|
+
}
|
|
638
|
+
dictationProblem(problem, detail);
|
|
639
|
+
},
|
|
640
|
+
});
|
|
641
|
+
const ghost = useTypewriter(
|
|
642
|
+
TYPED_CHORES,
|
|
643
|
+
!bigMic && !reduced && onScreen && !focused && !text && !dictation.listening,
|
|
644
|
+
);
|
|
645
|
+
|
|
646
|
+
const submit = () => {
|
|
647
|
+
if (!ready) return;
|
|
648
|
+
// Sent while listening: end it without keeping what is still to come, or the words come back into the box.
|
|
649
|
+
if (dictation.listening) dictation.cancel();
|
|
650
|
+
onSubmit(text.trim());
|
|
651
|
+
setText('');
|
|
652
|
+
};
|
|
653
|
+
const mic = () => (dictation.listening ? dictation.stop() : dictation.start(text));
|
|
654
|
+
// Talk to Lucy and Account's Try it now bring Home up with `listen`: the mic starts as if it had been tapped.
|
|
655
|
+
useEffect(() => {
|
|
656
|
+
// An old `listen` is one already handled (Home mounting again with its params), not a new press.
|
|
657
|
+
if (!listenAt || Date.now() - listenAt > LISTEN_FRESH_MS || dictation.listening) return;
|
|
658
|
+
click();
|
|
659
|
+
dictation.start(text);
|
|
660
|
+
// Only a new `listenAt` starts it; the box's text and the mic's state are read as they are then.
|
|
661
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
662
|
+
}, [listenAt]);
|
|
663
|
+
|
|
664
|
+
return (
|
|
665
|
+
<>
|
|
666
|
+
{bigMic ? (
|
|
667
|
+
<>
|
|
668
|
+
<View style={s.stageMiddle}>
|
|
669
|
+
<BigMic listening={dictation.listening} onPress={mic} />
|
|
670
|
+
</View>
|
|
671
|
+
{between}
|
|
672
|
+
{/* Typing is the second way in: one slim line that grows, send inside it once there is text. */}
|
|
673
|
+
<View
|
|
674
|
+
ref={box}
|
|
675
|
+
collapsable={false}
|
|
676
|
+
style={[
|
|
677
|
+
bigMic ? s.typeBox : s.typeLine,
|
|
678
|
+
focused && s.composerFocused,
|
|
679
|
+
dictation.listening && s.pillListening,
|
|
680
|
+
]}
|
|
681
|
+
>
|
|
682
|
+
<TextInput
|
|
683
|
+
ref={input}
|
|
684
|
+
value={text}
|
|
685
|
+
onChangeText={setText}
|
|
686
|
+
onFocus={() => {
|
|
687
|
+
setFocused(true);
|
|
688
|
+
onFocusBox?.(box.current);
|
|
689
|
+
}}
|
|
690
|
+
onBlur={() => {
|
|
691
|
+
setFocused(false);
|
|
692
|
+
setKeyboardHint(false);
|
|
693
|
+
onFocusBox?.(null);
|
|
694
|
+
}}
|
|
695
|
+
maxLength={PROMPT_MAX}
|
|
696
|
+
placeholder={dictation.listening ? 'Listening…' : 'What should Lucy take off your plate?'}
|
|
697
|
+
placeholderTextColor={dictation.listening ? ui.accentText : ui.faint}
|
|
698
|
+
style={bigMic ? s.typeBoxInput : s.pillInput}
|
|
699
|
+
multiline
|
|
700
|
+
accessibilityLabel="A chore to hand over"
|
|
701
|
+
returnKeyType="send"
|
|
702
|
+
submitBehavior="blurAndSubmit"
|
|
703
|
+
onSubmitEditing={submit}
|
|
704
|
+
/>
|
|
705
|
+
{ready ? (
|
|
706
|
+
<Pressable
|
|
707
|
+
accessibilityRole="button"
|
|
708
|
+
accessibilityLabel="Hand it over"
|
|
709
|
+
onPress={submit}
|
|
710
|
+
hitSlop={8}
|
|
711
|
+
style={({ pressed }) => [
|
|
712
|
+
s.send,
|
|
713
|
+
{ backgroundColor: pressed ? ui.accentPressed : ui.accent },
|
|
714
|
+
]}
|
|
715
|
+
>
|
|
716
|
+
<Ionicons name="arrow-up" size={19} color={ui.surface} />
|
|
717
|
+
</Pressable>
|
|
718
|
+
) : null}
|
|
719
|
+
</View>
|
|
720
|
+
{keyboardHint ? <Text style={s.pillHint}>Tap the mic on your keyboard to speak</Text> : null}
|
|
721
|
+
</>
|
|
722
|
+
) : null}
|
|
723
|
+
{bigMic ? null : (
|
|
724
|
+
<View ref={box} collapsable={false} style={[s.composer, focused && s.composerFocused]}>
|
|
725
|
+
<View>
|
|
726
|
+
{ghost !== null ? (
|
|
727
|
+
<Text
|
|
728
|
+
style={[s.ghost, s.ghostBox]}
|
|
729
|
+
pointerEvents="none"
|
|
730
|
+
accessibilityElementsHidden
|
|
731
|
+
importantForAccessibility="no-hide-descendants"
|
|
732
|
+
>
|
|
733
|
+
{ghost}
|
|
734
|
+
<Caret />
|
|
735
|
+
</Text>
|
|
736
|
+
) : null}
|
|
737
|
+
<TextInput
|
|
738
|
+
ref={input}
|
|
739
|
+
value={text}
|
|
740
|
+
onChangeText={setText}
|
|
741
|
+
onFocus={() => {
|
|
742
|
+
setFocused(true);
|
|
743
|
+
onFocusBox?.(box.current);
|
|
744
|
+
}}
|
|
745
|
+
onBlur={() => {
|
|
746
|
+
setFocused(false);
|
|
747
|
+
setKeyboardHint(false);
|
|
748
|
+
onFocusBox?.(null);
|
|
749
|
+
}}
|
|
750
|
+
maxLength={PROMPT_MAX}
|
|
751
|
+
placeholder={
|
|
752
|
+
dictation.listening
|
|
753
|
+
? 'Listening…'
|
|
754
|
+
: ghost !== null
|
|
755
|
+
? ''
|
|
756
|
+
: 'What should Lucy take off your plate?'
|
|
757
|
+
}
|
|
758
|
+
placeholderTextColor={dictation.listening ? ui.accentText : ui.faint}
|
|
759
|
+
style={[s.composerInput, large && { minHeight: 64 }]}
|
|
760
|
+
multiline
|
|
761
|
+
accessibilityLabel="A chore to hand over"
|
|
762
|
+
returnKeyType="send"
|
|
763
|
+
submitBehavior="blurAndSubmit"
|
|
764
|
+
onSubmitEditing={submit}
|
|
765
|
+
/>
|
|
766
|
+
</View>
|
|
767
|
+
<View style={s.composerRow}>
|
|
768
|
+
<Ionicons
|
|
769
|
+
name={keyboardHint ? 'mic-outline' : 'call-outline'}
|
|
770
|
+
size={14}
|
|
771
|
+
color={ui.accentText}
|
|
772
|
+
/>
|
|
773
|
+
<Text style={[s.composerHint, keyboardHint && { color: ui.accentText }]}>
|
|
774
|
+
{keyboardHint
|
|
775
|
+
? 'Tap the mic on your keyboard to speak'
|
|
776
|
+
: 'Lucy calls, books and keeps track'}
|
|
777
|
+
</Text>
|
|
778
|
+
{/* As the chat's composer: the mic while there is nothing to send yet (or while listening), then send. */}
|
|
779
|
+
{!bigMic && (!ready || dictation.listening) ? (
|
|
780
|
+
<MicButton listening={dictation.listening} onPress={mic} size={36} />
|
|
781
|
+
) : null}
|
|
782
|
+
{ready ? (
|
|
783
|
+
<Pressable
|
|
784
|
+
accessibilityRole="button"
|
|
785
|
+
accessibilityLabel="Hand it over"
|
|
786
|
+
onPress={submit}
|
|
787
|
+
hitSlop={8}
|
|
788
|
+
style={({ pressed }) => [
|
|
789
|
+
s.send,
|
|
790
|
+
{ backgroundColor: pressed ? ui.accentPressed : ui.accent },
|
|
791
|
+
]}
|
|
792
|
+
>
|
|
793
|
+
<Ionicons name="arrow-up" size={19} color={ui.surface} />
|
|
794
|
+
</Pressable>
|
|
795
|
+
) : null}
|
|
796
|
+
</View>
|
|
797
|
+
</View>
|
|
798
|
+
)}
|
|
799
|
+
</>
|
|
800
|
+
);
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
function ImessagePill({ onPress }: { onPress: () => void }) {
|
|
804
|
+
return (
|
|
805
|
+
<Pressable
|
|
806
|
+
accessibilityRole="button"
|
|
807
|
+
onPress={onPress}
|
|
808
|
+
style={({ pressed }) => [s.pill, pressed && s.chipPressed]}
|
|
809
|
+
>
|
|
810
|
+
<MessagesAppIcon size={22} />
|
|
811
|
+
<Text style={s.pillText}>{TEXT_LUCY}</Text>
|
|
812
|
+
</Pressable>
|
|
813
|
+
);
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
function Trust({ children }: { children: string }) {
|
|
817
|
+
return (
|
|
818
|
+
<View style={s.trust}>
|
|
819
|
+
<Ionicons name="shield-checkmark-outline" size={15} color={ui.ok} />
|
|
820
|
+
<Text style={s.trustText}>{children}</Text>
|
|
821
|
+
</View>
|
|
822
|
+
);
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
/** A row of chores that drifts sideways (the web's marquee strip); a plain scroller when Reduce Motion is on. */
|
|
826
|
+
function Marquee({ chores, onChore, reverse }: { chores: Chore[]; onChore: (c: Chore) => void; reverse?: boolean }) {
|
|
827
|
+
const reduced = useReducedMotion();
|
|
828
|
+
const [width, setWidth] = useState(0);
|
|
829
|
+
const x = useRef(new Animated.Value(0)).current;
|
|
830
|
+
const box = useRef<View>(null);
|
|
831
|
+
// Drifts only while on screen: two endless rows were animating behind the rest of the page.
|
|
832
|
+
const visible = useInView(box, { minFraction: 0.01 }) !== false;
|
|
833
|
+
|
|
834
|
+
useEffect(() => {
|
|
835
|
+
if (reduced || !width || !visible) return undefined;
|
|
836
|
+
x.setValue(reverse ? -width : 0);
|
|
837
|
+
const loop = Animated.loop(
|
|
838
|
+
Animated.timing(x, {
|
|
839
|
+
toValue: reverse ? 0 : -width,
|
|
840
|
+
duration: width * 32,
|
|
841
|
+
easing: Easing.linear,
|
|
842
|
+
useNativeDriver: true,
|
|
843
|
+
}),
|
|
844
|
+
);
|
|
845
|
+
loop.start();
|
|
846
|
+
return () => loop.stop();
|
|
847
|
+
}, [reduced, width, reverse, x, visible]);
|
|
848
|
+
|
|
849
|
+
const row = (copy: number) => (
|
|
850
|
+
<View
|
|
851
|
+
style={s.marqueeRow}
|
|
852
|
+
onLayout={copy === 0 ? (e: LayoutChangeEvent) => setWidth(e.nativeEvent.layout.width) : undefined}
|
|
853
|
+
accessibilityElementsHidden={copy > 0}
|
|
854
|
+
importantForAccessibility={copy > 0 ? 'no-hide-descendants' : 'auto'}
|
|
855
|
+
>
|
|
856
|
+
{chores.map((c) => (
|
|
857
|
+
<ChoreChip key={`${copy}-${c.label}`} chore={c} onPress={onChore} small />
|
|
858
|
+
))}
|
|
859
|
+
</View>
|
|
860
|
+
);
|
|
861
|
+
|
|
862
|
+
if (reduced) {
|
|
863
|
+
return (
|
|
864
|
+
<ScrollView
|
|
865
|
+
horizontal
|
|
866
|
+
showsHorizontalScrollIndicator={false}
|
|
867
|
+
contentContainerStyle={{ paddingHorizontal: 20 }}
|
|
868
|
+
>
|
|
869
|
+
{row(0)}
|
|
870
|
+
</ScrollView>
|
|
871
|
+
);
|
|
872
|
+
}
|
|
873
|
+
return (
|
|
874
|
+
<View ref={box} collapsable={false} style={s.marquee}>
|
|
875
|
+
<Animated.View style={{ flexDirection: 'row', transform: [{ translateX: x }] }}>
|
|
876
|
+
{row(0)}
|
|
877
|
+
{row(1)}
|
|
878
|
+
</Animated.View>
|
|
879
|
+
</View>
|
|
880
|
+
);
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
const CALL_STEP_MS = 1500;
|
|
884
|
+
const CALL_HOLD_MS = 3400;
|
|
885
|
+
|
|
886
|
+
/**
|
|
887
|
+
* How many of `length` steps are done, looping while `active` (the web's useSequence): one every `stepMs`, a pause
|
|
888
|
+
* of `holdMs` on the finished state, then again. All done when not active, and under Reduce Motion.
|
|
889
|
+
*/
|
|
890
|
+
function useSequence(length: number, active: boolean, stepMs: number, holdMs: number): number {
|
|
891
|
+
const [done, setDone] = useState(length);
|
|
892
|
+
useEffect(() => {
|
|
893
|
+
if (!active) {
|
|
894
|
+
setDone(length);
|
|
895
|
+
return undefined;
|
|
896
|
+
}
|
|
897
|
+
let n = 0;
|
|
898
|
+
let timer: ReturnType<typeof setTimeout>;
|
|
899
|
+
const next = () => {
|
|
900
|
+
n = n >= length ? 0 : n + 1;
|
|
901
|
+
setDone(n);
|
|
902
|
+
timer = setTimeout(next, n >= length ? holdMs : stepMs);
|
|
903
|
+
};
|
|
904
|
+
setDone(0);
|
|
905
|
+
timer = setTimeout(next, stepMs);
|
|
906
|
+
return () => clearTimeout(timer);
|
|
907
|
+
}, [active, length, stepMs, holdMs]);
|
|
908
|
+
return done;
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
/** A looping 0 -> 1 clock for spinners and pulses; still when not running. */
|
|
912
|
+
function useLoop(running: boolean, duration: number): Animated.Value {
|
|
913
|
+
const t = useRef(new Animated.Value(0)).current;
|
|
914
|
+
useEffect(() => {
|
|
915
|
+
if (!running) {
|
|
916
|
+
t.setValue(0);
|
|
917
|
+
return undefined;
|
|
918
|
+
}
|
|
919
|
+
const loop = Animated.loop(
|
|
920
|
+
Animated.timing(t, { toValue: 1, duration, easing: Easing.linear, useNativeDriver: true }),
|
|
921
|
+
);
|
|
922
|
+
loop.start();
|
|
923
|
+
return () => loop.stop();
|
|
924
|
+
}, [running, duration, t]);
|
|
925
|
+
return t;
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
type CallState = 'done' | 'now' | 'next';
|
|
929
|
+
|
|
930
|
+
function CallDot({ state }: { state: CallState }) {
|
|
931
|
+
const spin = useLoop(state === 'now', 800);
|
|
932
|
+
if (state === 'done') {
|
|
933
|
+
return (
|
|
934
|
+
<View style={[s.callDot, { backgroundColor: CALL_GREEN, borderColor: CALL_GREEN }]}>
|
|
935
|
+
<Ionicons name="checkmark" size={13} color={ui.surface} />
|
|
936
|
+
</View>
|
|
937
|
+
);
|
|
938
|
+
}
|
|
939
|
+
if (state === 'now') {
|
|
940
|
+
return (
|
|
941
|
+
<Animated.View
|
|
942
|
+
style={[
|
|
943
|
+
s.callDot,
|
|
944
|
+
{
|
|
945
|
+
borderColor: ui.accent,
|
|
946
|
+
borderTopColor: 'transparent',
|
|
947
|
+
transform: [
|
|
948
|
+
{ rotate: spin.interpolate({ inputRange: [0, 1], outputRange: ['0deg', '360deg'] }) },
|
|
949
|
+
],
|
|
950
|
+
},
|
|
951
|
+
]}
|
|
952
|
+
/>
|
|
953
|
+
);
|
|
954
|
+
}
|
|
955
|
+
return <View style={s.callDot} />;
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
/** The live dot: green, with a ring that swells and fades (the web's cbh-live pulse). */
|
|
959
|
+
function LiveDot({ live }: { live: boolean }) {
|
|
960
|
+
const t = useLoop(live, 2000);
|
|
961
|
+
return (
|
|
962
|
+
<View style={s.liveDotWrap}>
|
|
963
|
+
{live ? (
|
|
964
|
+
<Animated.View
|
|
965
|
+
style={[
|
|
966
|
+
s.liveRing,
|
|
967
|
+
{
|
|
968
|
+
opacity: t.interpolate({ inputRange: [0, 0.7, 1], outputRange: [0.55, 0, 0] }),
|
|
969
|
+
transform: [
|
|
970
|
+
{ scale: t.interpolate({ inputRange: [0, 0.7, 1], outputRange: [1, 2.6, 2.6] }) },
|
|
971
|
+
],
|
|
972
|
+
},
|
|
973
|
+
]}
|
|
974
|
+
/>
|
|
975
|
+
) : null}
|
|
976
|
+
<View style={s.liveDot} />
|
|
977
|
+
</View>
|
|
978
|
+
);
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
/**
|
|
982
|
+
* Lucy's call, step by step (the web's <CallCard />): a dramatization, like the reels. While it is on screen the
|
|
983
|
+
* steps tick through one by one - the one in progress spinning - hold on "Call finished", and run again.
|
|
984
|
+
*/
|
|
985
|
+
function CallCard() {
|
|
986
|
+
const ref = useRef<View>(null);
|
|
987
|
+
const reduced = useReducedMotion();
|
|
988
|
+
const focused = useIsFocused();
|
|
989
|
+
const onScreen = useOnScreen(ref, focused && !reduced);
|
|
990
|
+
const done = useSequence(CALL_STEPS.length, onScreen && !reduced, CALL_STEP_MS, CALL_HOLD_MS);
|
|
991
|
+
const finished = done >= CALL_STEPS.length;
|
|
992
|
+
return (
|
|
993
|
+
<View
|
|
994
|
+
ref={ref}
|
|
995
|
+
collapsable={false}
|
|
996
|
+
style={s.callCard}
|
|
997
|
+
accessible
|
|
998
|
+
accessibilityLabel="Illustration: Lucy calls an internet provider, gets through the phone menu, waits on hold, and comes back with a lower rate."
|
|
999
|
+
>
|
|
1000
|
+
<View style={s.callHead}>
|
|
1001
|
+
<View style={s.callAvatar}>
|
|
1002
|
+
<Mark size={22} />
|
|
1003
|
+
</View>
|
|
1004
|
+
<View style={{ flex: 1 }}>
|
|
1005
|
+
<Text style={s.callTitle}>{finished ? 'Call finished' : 'Lucy is on the call'}</Text>
|
|
1006
|
+
<Text style={s.callSub}>Internet provider · 18:42</Text>
|
|
1007
|
+
</View>
|
|
1008
|
+
<View style={[s.live, finished && { backgroundColor: ui.fill }]}>
|
|
1009
|
+
<LiveDot live={!finished} />
|
|
1010
|
+
<Text style={[s.liveText, finished && { color: ui.muted }]}>{finished ? 'Done' : 'Live'}</Text>
|
|
1011
|
+
</View>
|
|
1012
|
+
</View>
|
|
1013
|
+
{CALL_STEPS.map((step: { label: string; detail: string }, i: number) => {
|
|
1014
|
+
const state: CallState = i < done ? 'done' : i === done ? 'now' : 'next';
|
|
1015
|
+
return (
|
|
1016
|
+
<View key={step.label} style={[s.callStep, state === 'next' && { opacity: 0.35 }]}>
|
|
1017
|
+
<CallDot state={state} />
|
|
1018
|
+
<View style={{ flex: 1 }}>
|
|
1019
|
+
<Text style={s.callLabel}>{step.label}</Text>
|
|
1020
|
+
<Text style={s.callDetail}>{step.detail}</Text>
|
|
1021
|
+
</View>
|
|
1022
|
+
</View>
|
|
1023
|
+
);
|
|
1024
|
+
})}
|
|
1025
|
+
</View>
|
|
1026
|
+
);
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
type ThreadLine = { from: 'you' | 'lucy'; text: string };
|
|
1030
|
+
const THREAD: ThreadLine[] = TEXT_THREAD;
|
|
1031
|
+
|
|
1032
|
+
/** On screen (at least a third of it) while this screen is the one showing: from the page's scroll, no polling. */
|
|
1033
|
+
function useOnScreen(ref: React.RefObject<View | null>, enabled: boolean): boolean {
|
|
1034
|
+
return useInView(ref, { enabled }) === true;
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
/** A bubble rising into place, as the web's .cbh-bubble animation. */
|
|
1038
|
+
function Bubble({ line, animate }: { line: ThreadLine; animate: boolean }) {
|
|
1039
|
+
const t = useRef(new Animated.Value(animate ? 0 : 1)).current;
|
|
1040
|
+
useEffect(() => {
|
|
1041
|
+
if (!animate) return;
|
|
1042
|
+
Animated.timing(t, {
|
|
1043
|
+
toValue: 1,
|
|
1044
|
+
duration: 260,
|
|
1045
|
+
easing: Easing.out(Easing.cubic),
|
|
1046
|
+
useNativeDriver: true,
|
|
1047
|
+
}).start();
|
|
1048
|
+
}, [animate, t]);
|
|
1049
|
+
return (
|
|
1050
|
+
<Animated.View
|
|
1051
|
+
style={[
|
|
1052
|
+
s.bubble,
|
|
1053
|
+
line.from === 'you' ? s.bubbleYou : s.bubbleLucy,
|
|
1054
|
+
{
|
|
1055
|
+
opacity: t,
|
|
1056
|
+
transform: [
|
|
1057
|
+
{ translateY: t.interpolate({ inputRange: [0, 1], outputRange: [10, 0] }) },
|
|
1058
|
+
{ scale: t.interpolate({ inputRange: [0, 1], outputRange: [0.96, 1] }) },
|
|
1059
|
+
],
|
|
1060
|
+
},
|
|
1061
|
+
]}
|
|
1062
|
+
>
|
|
1063
|
+
<Text style={s.bubbleText}>{line.text}</Text>
|
|
1064
|
+
</Animated.View>
|
|
1065
|
+
);
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
/**
|
|
1069
|
+
* Lucy working on her next text: the Lucy logo in a typing bubble, with the animation for what that text is about
|
|
1070
|
+
* (a call, an email...), as in the chat. Decorative; the thread's own label reads the whole conversation.
|
|
1071
|
+
*/
|
|
1072
|
+
function Typing({ next }: { next: string }) {
|
|
1073
|
+
return (
|
|
1074
|
+
<View
|
|
1075
|
+
style={[s.bubble, s.bubbleLucy, s.typing]}
|
|
1076
|
+
accessibilityElementsHidden
|
|
1077
|
+
importantForAccessibility="no-hide-descendants"
|
|
1078
|
+
>
|
|
1079
|
+
<LucyWorking size={22} motion={motionFor(next)} />
|
|
1080
|
+
</View>
|
|
1081
|
+
);
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
/**
|
|
1085
|
+
* An iMessage thread with Lucy (the web's <PhoneThread />): drawn, not a transcript. While it is on screen it plays
|
|
1086
|
+
* the web's timeline - you text, Lucy types, Lucy answers - holds, then plays again. Under Reduce Motion it is still.
|
|
1087
|
+
* The thread keeps its full height throughout, so the page never jumps as it plays.
|
|
1088
|
+
*/
|
|
1089
|
+
function PhoneThread() {
|
|
1090
|
+
const ref = useRef<View>(null);
|
|
1091
|
+
const reduced = useReducedMotion();
|
|
1092
|
+
const focused = useIsFocused();
|
|
1093
|
+
const onScreen = useOnScreen(ref, focused && !reduced);
|
|
1094
|
+
const [shown, setShown] = useState(THREAD.length);
|
|
1095
|
+
const [typing, setTyping] = useState(false);
|
|
1096
|
+
const [round, setRound] = useState(0);
|
|
1097
|
+
const [fullHeight, setFullHeight] = useState(0);
|
|
1098
|
+
|
|
1099
|
+
useEffect(() => {
|
|
1100
|
+
if (reduced || !onScreen) {
|
|
1101
|
+
setShown(THREAD.length);
|
|
1102
|
+
setTyping(false);
|
|
1103
|
+
return undefined;
|
|
1104
|
+
}
|
|
1105
|
+
const timers: ReturnType<typeof setTimeout>[] = [];
|
|
1106
|
+
const at = (ms: number, run: () => void) => timers.push(setTimeout(run, ms));
|
|
1107
|
+
let t = 0;
|
|
1108
|
+
setShown(0);
|
|
1109
|
+
setTyping(false);
|
|
1110
|
+
THREAD.forEach((line, i) => {
|
|
1111
|
+
if (line.from === 'lucy') {
|
|
1112
|
+
t += 600;
|
|
1113
|
+
at(t, () => setTyping(true));
|
|
1114
|
+
t += 1500;
|
|
1115
|
+
at(t, () => {
|
|
1116
|
+
setTyping(false);
|
|
1117
|
+
setShown(i + 1);
|
|
1118
|
+
});
|
|
1119
|
+
} else {
|
|
1120
|
+
t += i === 0 ? 400 : 1400;
|
|
1121
|
+
at(t, () => setShown(i + 1));
|
|
1122
|
+
}
|
|
1123
|
+
});
|
|
1124
|
+
at(t + 5000, () => setRound((r) => r + 1));
|
|
1125
|
+
return () => timers.forEach(clearTimeout);
|
|
1126
|
+
}, [reduced, onScreen, round]);
|
|
1127
|
+
|
|
1128
|
+
const animate = onScreen && !reduced;
|
|
1129
|
+
return (
|
|
1130
|
+
<View
|
|
1131
|
+
ref={ref}
|
|
1132
|
+
collapsable={false}
|
|
1133
|
+
style={s.phone}
|
|
1134
|
+
accessible
|
|
1135
|
+
accessibilityLabel={`An illustrative ${MESSAGES_APP} thread with Lucy. ${THREAD.map((m) => m.text).join(' ')}`}
|
|
1136
|
+
>
|
|
1137
|
+
<View style={s.phoneHead}>
|
|
1138
|
+
<View style={s.phoneAvatar}>
|
|
1139
|
+
<Mark size={20} />
|
|
1140
|
+
</View>
|
|
1141
|
+
<Text style={s.phoneName}>Lucy</Text>
|
|
1142
|
+
<Text style={s.phoneDay}>{`${MESSAGES_APP} · Today`}</Text>
|
|
1143
|
+
</View>
|
|
1144
|
+
<View
|
|
1145
|
+
style={fullHeight ? { minHeight: fullHeight } : undefined}
|
|
1146
|
+
onLayout={(e) => {
|
|
1147
|
+
// Measured with the whole thread showing (the first render), then held.
|
|
1148
|
+
if (!fullHeight && shown === THREAD.length) setFullHeight(e.nativeEvent.layout.height);
|
|
1149
|
+
}}
|
|
1150
|
+
>
|
|
1151
|
+
{THREAD.slice(0, shown).map((m) => (
|
|
1152
|
+
<Bubble key={`${round}-${m.text}`} line={m} animate={animate} />
|
|
1153
|
+
))}
|
|
1154
|
+
{typing ? <Typing next={THREAD[shown]?.text ?? ''} /> : null}
|
|
1155
|
+
{shown === THREAD.length ? <Text style={s.delivered}>Delivered</Text> : null}
|
|
1156
|
+
</View>
|
|
1157
|
+
</View>
|
|
1158
|
+
);
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
/**
|
|
1162
|
+
* Fades and rises into place the first time it scrolls into view (the web's .cbh-reveal). Anything already on screen
|
|
1163
|
+
* when the page opens is simply there; under Reduce Motion everything is.
|
|
1164
|
+
*/
|
|
1165
|
+
function Reveal({ children, delay = 0, ...rest }: ViewProps & { delay?: number }) {
|
|
1166
|
+
const ref = useRef<View>(null);
|
|
1167
|
+
const reduced = useReducedMotion();
|
|
1168
|
+
const t = useRef(new Animated.Value(1)).current;
|
|
1169
|
+
// Measured once against the page, then judged on the scroll offset; stops listening once it has shown.
|
|
1170
|
+
const inView = useInView(ref, { enabled: !reduced, edge: 0.92, once: true });
|
|
1171
|
+
const decided = useRef(false);
|
|
1172
|
+
const waiting = useRef(false);
|
|
1173
|
+
|
|
1174
|
+
useEffect(() => {
|
|
1175
|
+
if (reduced || inView === undefined) return;
|
|
1176
|
+
if (!decided.current) {
|
|
1177
|
+
decided.current = true;
|
|
1178
|
+
// Already on screen when the page opened: just there. Below the fold: hidden until it scrolls in.
|
|
1179
|
+
if (!inView) {
|
|
1180
|
+
waiting.current = true;
|
|
1181
|
+
t.setValue(0);
|
|
1182
|
+
}
|
|
1183
|
+
return;
|
|
1184
|
+
}
|
|
1185
|
+
if (inView && waiting.current) {
|
|
1186
|
+
waiting.current = false;
|
|
1187
|
+
Animated.timing(t, {
|
|
1188
|
+
toValue: 1,
|
|
1189
|
+
duration: 600,
|
|
1190
|
+
delay,
|
|
1191
|
+
easing: Easing.out(Easing.quad),
|
|
1192
|
+
useNativeDriver: true,
|
|
1193
|
+
}).start();
|
|
1194
|
+
}
|
|
1195
|
+
}, [inView, reduced, t, delay]);
|
|
1196
|
+
|
|
1197
|
+
return (
|
|
1198
|
+
<Animated.View
|
|
1199
|
+
ref={ref}
|
|
1200
|
+
collapsable={false}
|
|
1201
|
+
{...rest}
|
|
1202
|
+
style={[
|
|
1203
|
+
rest.style,
|
|
1204
|
+
reduced
|
|
1205
|
+
? null
|
|
1206
|
+
: {
|
|
1207
|
+
opacity: t,
|
|
1208
|
+
transform: [{ translateY: t.interpolate({ inputRange: [0, 1], outputRange: [24, 0] }) }],
|
|
1209
|
+
},
|
|
1210
|
+
]}
|
|
1211
|
+
>
|
|
1212
|
+
{children}
|
|
1213
|
+
</Animated.View>
|
|
1214
|
+
);
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
/** A number that counts up the first time it comes into view (the web's CountUp); screen readers hear the real one. */
|
|
1218
|
+
function CountUp({ to, decimals = 0, style }: { to: number; decimals?: number; style?: object }) {
|
|
1219
|
+
const ref = useRef<View>(null);
|
|
1220
|
+
const reduced = useReducedMotion();
|
|
1221
|
+
const focused = useIsFocused();
|
|
1222
|
+
const onScreen = useInView(ref, { enabled: focused && !reduced, once: true }) === true;
|
|
1223
|
+
const [value, setValue] = useState(to);
|
|
1224
|
+
const counted = useRef(false);
|
|
1225
|
+
|
|
1226
|
+
useEffect(() => {
|
|
1227
|
+
if (!onScreen || counted.current) return undefined;
|
|
1228
|
+
counted.current = true;
|
|
1229
|
+
const t = new Animated.Value(0);
|
|
1230
|
+
let shown = '';
|
|
1231
|
+
// A frame only re-renders when the number it shows changes.
|
|
1232
|
+
const id = t.addListener(({ value: p }) => {
|
|
1233
|
+
const next = (to * (1 - (1 - p) ** 3)).toFixed(decimals);
|
|
1234
|
+
if (next !== shown) {
|
|
1235
|
+
shown = next;
|
|
1236
|
+
setValue(Number(next));
|
|
1237
|
+
}
|
|
1238
|
+
});
|
|
1239
|
+
Animated.timing(t, { toValue: 1, duration: COUNT_MS, easing: Easing.linear, useNativeDriver: false }).start();
|
|
1240
|
+
return () => t.removeListener(id);
|
|
1241
|
+
}, [onScreen, to, decimals]);
|
|
1242
|
+
|
|
1243
|
+
return (
|
|
1244
|
+
<View ref={ref} collapsable={false} accessible accessibilityLabel={to.toFixed(decimals)}>
|
|
1245
|
+
<Text style={style}>{value.toFixed(decimals)}</Text>
|
|
1246
|
+
</View>
|
|
1247
|
+
);
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
/** clockbook.com's time-back video as Lottie (tools/lottie/time-back.mjs): 8.9 s, 534 frames at 60 fps. */
|
|
1251
|
+
const TIME_BACK = require('../../assets/lottie/time-back.json') as AnimationObject;
|
|
1252
|
+
/** The frame held under Reduce Motion: "38 min, back, every day", fully counted, at 2.5 s. */
|
|
1253
|
+
const TIME_BACK_STILL = 150 / 534;
|
|
1254
|
+
|
|
1255
|
+
/**
|
|
1256
|
+
* The web's time-back animation (clockbook.com plays it as loop-time-back.mp4), converted to Lottie scene for scene:
|
|
1257
|
+
* the clock pops in and winds back while the time back counts up every day, every week and every year, then it
|
|
1258
|
+
* settles beside the Clockbook wordmark. Vectors, so it is sharp at any size. Hidden from screen readers: the stats
|
|
1259
|
+
* under it read the same numbers.
|
|
1260
|
+
*/
|
|
1261
|
+
function TimeBackLottie() {
|
|
1262
|
+
const reduced = useReducedMotion();
|
|
1263
|
+
const [hasLottie] = useState(lottieInstalled);
|
|
1264
|
+
return (
|
|
1265
|
+
<View style={s.timeLottie} accessibilityElementsHidden importantForAccessibility="no-hide-descendants">
|
|
1266
|
+
{hasLottie ? (
|
|
1267
|
+
<LottieView
|
|
1268
|
+
source={TIME_BACK}
|
|
1269
|
+
autoPlay={!reduced}
|
|
1270
|
+
loop
|
|
1271
|
+
progress={reduced ? TIME_BACK_STILL : undefined}
|
|
1272
|
+
// Android draws the face mask on the minutes wedge with the GPU, and some GPUs drop the mask:
|
|
1273
|
+
// the wedge then fills its whole box as a flat square. Drawing in software keeps the mask.
|
|
1274
|
+
renderMode={Platform.OS === 'android' ? 'SOFTWARE' : 'AUTOMATIC'}
|
|
1275
|
+
resizeMode="contain"
|
|
1276
|
+
style={s.timeLottieView}
|
|
1277
|
+
/>
|
|
1278
|
+
) : (
|
|
1279
|
+
<View style={[s.timeLottieView, { alignItems: 'center', justifyContent: 'center' }]}>
|
|
1280
|
+
<Mark size={72} />
|
|
1281
|
+
</View>
|
|
1282
|
+
)}
|
|
1283
|
+
</View>
|
|
1284
|
+
);
|
|
1285
|
+
}
|
|
1286
|
+
|
|
1287
|
+
type Minute = { label: string; min: number; of: number; color: string };
|
|
1288
|
+
|
|
1289
|
+
/** How long the pie takes to fill in, slice by slice, as it comes into view. */
|
|
1290
|
+
const PIE_FILL_MS = 1500;
|
|
1291
|
+
const PIE_SIZE = 112;
|
|
1292
|
+
|
|
1293
|
+
/**
|
|
1294
|
+
* The web's "where your 38 minutes come from" loop, native and live: the pie fills in slice by slice in the list's
|
|
1295
|
+
* colours while the minutes count up beside it. It follows the list: a chore taken back fades to a ghost slice and the
|
|
1296
|
+
* count drops to what is left. Fills again each time it scrolls into view; under Reduce Motion it is simply drawn.
|
|
1297
|
+
* Hidden from screen readers: the list and its total read the same numbers.
|
|
1298
|
+
*/
|
|
1299
|
+
function MinutesPanel({ picked }: { picked: ReadonlySet<string> }) {
|
|
1300
|
+
const all = MINUTES as Minute[];
|
|
1301
|
+
const whole = all.reduce((sum, m) => sum + m.min, 0);
|
|
1302
|
+
const total = all.reduce((sum, m) => (picked.has(m.label) ? sum + m.min : sum), 0);
|
|
1303
|
+
const ref = useRef<View>(null);
|
|
1304
|
+
const reduced = useReducedMotion();
|
|
1305
|
+
const focused = useIsFocused();
|
|
1306
|
+
const onScreen = useInView(ref, { enabled: focused && !reduced }) === true;
|
|
1307
|
+
const [sweep, setSweep] = useState(1);
|
|
1308
|
+
const [shown, setShown] = useState(total);
|
|
1309
|
+
const count = useRef(new Animated.Value(total)).current;
|
|
1310
|
+
|
|
1311
|
+
useEffect(() => {
|
|
1312
|
+
const id = count.addListener(({ value }) => setShown(Math.round(value)));
|
|
1313
|
+
return () => count.removeListener(id);
|
|
1314
|
+
}, [count]);
|
|
1315
|
+
|
|
1316
|
+
// Fill in, and count up with it, each time it comes into view.
|
|
1317
|
+
useEffect(() => {
|
|
1318
|
+
if (!onScreen) return undefined;
|
|
1319
|
+
const t = new Animated.Value(0);
|
|
1320
|
+
let last = -1;
|
|
1321
|
+
const id = t.addListener(({ value }) => {
|
|
1322
|
+
const next = Math.round(value * 100) / 100;
|
|
1323
|
+
if (next !== last) {
|
|
1324
|
+
last = next;
|
|
1325
|
+
setSweep(next);
|
|
1326
|
+
}
|
|
1327
|
+
});
|
|
1328
|
+
count.setValue(0);
|
|
1329
|
+
const easing = Easing.out(Easing.cubic);
|
|
1330
|
+
const run = Animated.parallel([
|
|
1331
|
+
Animated.timing(t, { toValue: 1, duration: PIE_FILL_MS, easing, useNativeDriver: false }),
|
|
1332
|
+
Animated.timing(count, { toValue: total, duration: PIE_FILL_MS, easing, useNativeDriver: false }),
|
|
1333
|
+
]);
|
|
1334
|
+
run.start();
|
|
1335
|
+
return () => {
|
|
1336
|
+
run.stop();
|
|
1337
|
+
t.removeListener(id);
|
|
1338
|
+
setSweep(1);
|
|
1339
|
+
};
|
|
1340
|
+
// Only on coming into view (`total` is left out on purpose): a pick re-counts below without refilling.
|
|
1341
|
+
}, [onScreen]);
|
|
1342
|
+
|
|
1343
|
+
// A pick changed: count to the new total.
|
|
1344
|
+
useEffect(() => {
|
|
1345
|
+
if (reduced) {
|
|
1346
|
+
count.setValue(total);
|
|
1347
|
+
return undefined;
|
|
1348
|
+
}
|
|
1349
|
+
const run = Animated.timing(count, {
|
|
1350
|
+
toValue: total,
|
|
1351
|
+
duration: 450,
|
|
1352
|
+
easing: Easing.out(Easing.cubic),
|
|
1353
|
+
useNativeDriver: false,
|
|
1354
|
+
});
|
|
1355
|
+
run.start();
|
|
1356
|
+
return () => run.stop();
|
|
1357
|
+
}, [total, reduced, count]);
|
|
1358
|
+
|
|
1359
|
+
const r = PIE_SIZE / 2;
|
|
1360
|
+
const at = (a: number) => `${r + r * Math.cos(a)} ${r + r * Math.sin(a)}`;
|
|
1361
|
+
let from = 0;
|
|
1362
|
+
return (
|
|
1363
|
+
<View
|
|
1364
|
+
ref={ref}
|
|
1365
|
+
collapsable={false}
|
|
1366
|
+
style={s.minutesPanel}
|
|
1367
|
+
accessibilityElementsHidden
|
|
1368
|
+
importantForAccessibility="no-hide-descendants"
|
|
1369
|
+
>
|
|
1370
|
+
<Svg width={PIE_SIZE} height={PIE_SIZE}>
|
|
1371
|
+
{all.map((m) => {
|
|
1372
|
+
const share = m.min / whole;
|
|
1373
|
+
const start = from;
|
|
1374
|
+
from += share;
|
|
1375
|
+
const end = Math.min(start + share, sweep);
|
|
1376
|
+
if (end <= start) return null;
|
|
1377
|
+
const a0 = -Math.PI / 2 + start * Math.PI * 2;
|
|
1378
|
+
const a1 = -Math.PI / 2 + end * Math.PI * 2;
|
|
1379
|
+
const d =
|
|
1380
|
+
end - start >= 0.9999
|
|
1381
|
+
? `M ${r} 0 A ${r} ${r} 0 1 1 ${r - 0.01} 0 Z`
|
|
1382
|
+
: `M ${r} ${r} L ${at(a0)} A ${r} ${r} 0 ${a1 - a0 > Math.PI ? 1 : 0} 1 ${at(a1)} Z`;
|
|
1383
|
+
return (
|
|
1384
|
+
<Path
|
|
1385
|
+
key={m.label}
|
|
1386
|
+
d={d}
|
|
1387
|
+
fill={m.color}
|
|
1388
|
+
fillOpacity={picked.has(m.label) ? 1 : 0.18}
|
|
1389
|
+
stroke="#FFFFFF"
|
|
1390
|
+
strokeWidth={2}
|
|
1391
|
+
/>
|
|
1392
|
+
);
|
|
1393
|
+
})}
|
|
1394
|
+
</Svg>
|
|
1395
|
+
<View style={{ flex: 1 }}>
|
|
1396
|
+
<View style={s.panelRow}>
|
|
1397
|
+
<Text style={s.panelValue}>{shown}</Text>
|
|
1398
|
+
<Text style={s.panelUnit}>min</Text>
|
|
1399
|
+
</View>
|
|
1400
|
+
<Text style={s.panelLabel}>back, every day</Text>
|
|
1401
|
+
<Text style={s.minutesOutOf}>out of 169 minutes of daily life admin</Text>
|
|
1402
|
+
</View>
|
|
1403
|
+
</View>
|
|
1404
|
+
);
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1407
|
+
function MinutesPicker() {
|
|
1408
|
+
const all = MINUTES as Minute[];
|
|
1409
|
+
const max = Math.max(...all.map((m) => m.min));
|
|
1410
|
+
const [picked, setPicked] = useState<ReadonlySet<string>>(() => new Set(all.map((m) => m.label)));
|
|
1411
|
+
const total = all.reduce((sum, m) => (picked.has(m.label) ? sum + m.min : sum), 0);
|
|
1412
|
+
const year = Math.round((Math.round((total * 7) / 6) / 10) * 52);
|
|
1413
|
+
const toggle = (label: string) => {
|
|
1414
|
+
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
|
|
1415
|
+
setPicked((prev) => {
|
|
1416
|
+
const next = new Set(prev);
|
|
1417
|
+
if (!next.delete(label)) next.add(label);
|
|
1418
|
+
return next;
|
|
1419
|
+
});
|
|
1420
|
+
};
|
|
1421
|
+
return (
|
|
1422
|
+
<>
|
|
1423
|
+
<MinutesPanel picked={picked} />
|
|
1424
|
+
<Text style={s.minutesHint}>Tap to pick what you’d hand over.</Text>
|
|
1425
|
+
<View style={s.minutes}>
|
|
1426
|
+
{all.map((m) => {
|
|
1427
|
+
const on = picked.has(m.label);
|
|
1428
|
+
return (
|
|
1429
|
+
<Pressable
|
|
1430
|
+
key={m.label}
|
|
1431
|
+
accessibilityRole="checkbox"
|
|
1432
|
+
accessibilityState={{ checked: on }}
|
|
1433
|
+
accessibilityLabel={`${m.label}, ${m.min} minutes a day`}
|
|
1434
|
+
onPress={() => toggle(m.label)}
|
|
1435
|
+
style={({ pressed }) => [s.minuteRow, pressed && { backgroundColor: ui.fill }]}
|
|
1436
|
+
>
|
|
1437
|
+
<View style={[s.swatch, { backgroundColor: m.color, opacity: on ? 1 : 0.3 }]} />
|
|
1438
|
+
<View style={{ flex: 1, gap: 6 }}>
|
|
1439
|
+
<View style={s.minuteTop}>
|
|
1440
|
+
<Text style={[s.minuteLabel, !on && { color: ui.muted }]}>{m.label}</Text>
|
|
1441
|
+
<Text style={[s.minuteValue, !on && s.minuteOff]}>{m.min} min</Text>
|
|
1442
|
+
</View>
|
|
1443
|
+
<View style={s.bar}>
|
|
1444
|
+
<View
|
|
1445
|
+
style={[
|
|
1446
|
+
s.barFill,
|
|
1447
|
+
{
|
|
1448
|
+
width: on ? `${(m.min / max) * 100}%` : '0%',
|
|
1449
|
+
backgroundColor: m.color === '#FFE4D2' ? '#FFC29C' : m.color,
|
|
1450
|
+
},
|
|
1451
|
+
]}
|
|
1452
|
+
/>
|
|
1453
|
+
</View>
|
|
1454
|
+
</View>
|
|
1455
|
+
<View style={[s.minuteCheck, on && s.minuteCheckOn]}>
|
|
1456
|
+
{on ? <Ionicons name="checkmark" size={12} color={ui.surface} /> : null}
|
|
1457
|
+
</View>
|
|
1458
|
+
</Pressable>
|
|
1459
|
+
);
|
|
1460
|
+
})}
|
|
1461
|
+
<View style={[s.minuteRow, s.minuteLast, { opacity: 0.55 }]}>
|
|
1462
|
+
<View style={[s.swatch, s.swatchNone]} />
|
|
1463
|
+
<View style={{ flex: 1, gap: 6 }}>
|
|
1464
|
+
<View style={s.minuteTop}>
|
|
1465
|
+
<Text style={[s.minuteLabel, { color: ui.muted }]}>Housework</Text>
|
|
1466
|
+
<Text style={[s.minuteValue, { color: ui.muted }]}>0 min</Text>
|
|
1467
|
+
</View>
|
|
1468
|
+
<View style={s.bar} />
|
|
1469
|
+
</View>
|
|
1470
|
+
<View style={{ width: 20 }} />
|
|
1471
|
+
</View>
|
|
1472
|
+
</View>
|
|
1473
|
+
<View style={s.minutesTotal} accessibilityLiveRegion="polite">
|
|
1474
|
+
{total ? (
|
|
1475
|
+
<Text style={s.minutesTotalText}>
|
|
1476
|
+
{picked.size === all.length ? 'All of it' : 'Your pick'}:{' '}
|
|
1477
|
+
<Text style={s.minutesTotalB}>{total} min</Text> a day, about{' '}
|
|
1478
|
+
<Text style={s.minutesTotalB}>{year} hours</Text> a year.¹
|
|
1479
|
+
</Text>
|
|
1480
|
+
) : (
|
|
1481
|
+
<Text style={s.minutesTotalText}>Pick a chore to see the time it gives back.</Text>
|
|
1482
|
+
)}
|
|
1483
|
+
</View>
|
|
1484
|
+
</>
|
|
1485
|
+
);
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1488
|
+
function Faq({ q, a, last }: { q: string; a: string; last?: boolean }) {
|
|
1489
|
+
const [open, setOpen] = useState(false);
|
|
1490
|
+
return (
|
|
1491
|
+
<View style={[s.faq, last && { borderBottomWidth: 0 }]}>
|
|
1492
|
+
<Pressable
|
|
1493
|
+
accessibilityRole="button"
|
|
1494
|
+
accessibilityState={{ expanded: open }}
|
|
1495
|
+
onPress={() => {
|
|
1496
|
+
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
|
|
1497
|
+
setOpen((o) => !o);
|
|
1498
|
+
}}
|
|
1499
|
+
style={s.faqQ}
|
|
1500
|
+
>
|
|
1501
|
+
<Text style={s.faqQText}>{q}</Text>
|
|
1502
|
+
<View style={[s.faqIcon, open && { backgroundColor: ui.ink }]}>
|
|
1503
|
+
<Ionicons name={open ? 'remove' : 'add'} size={16} color={open ? ui.surface : ui.ink} />
|
|
1504
|
+
</View>
|
|
1505
|
+
</Pressable>
|
|
1506
|
+
{open ? <Text style={s.faqA}>{a}</Text> : null}
|
|
1507
|
+
</View>
|
|
1508
|
+
);
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
/* ------------------------------------------------------------------------------------------------ screen */
|
|
1512
|
+
|
|
1513
|
+
/**
|
|
1514
|
+
* Until Clockbook sells a subscription there is nothing to claim, so offers (offer/) show in development builds only,
|
|
1515
|
+
* and there before they start, to be checked: as the welcome's free week does.
|
|
1516
|
+
*/
|
|
1517
|
+
const OFFER_ON = __DEV__;
|
|
1518
|
+
|
|
1519
|
+
export default function HomeScreen() {
|
|
1520
|
+
const navigation = useNavigation<{
|
|
1521
|
+
setOptions: (options: object) => void;
|
|
1522
|
+
navigate: (route: string, params?: object) => void;
|
|
1523
|
+
dispatch: (action: object) => void;
|
|
1524
|
+
}>();
|
|
1525
|
+
const route = useRoute<{
|
|
1526
|
+
key: string;
|
|
1527
|
+
name: string;
|
|
1528
|
+
params?: { section?: SectionKey; at?: number; listen?: number };
|
|
1529
|
+
}>();
|
|
1530
|
+
const { width, height: winH } = useWindowDimensions();
|
|
1531
|
+
const headerHeight = useHeaderHeight();
|
|
1532
|
+
// The header is see-through at the top, so the hero's aurora runs behind it as on the web; it turns to the page's
|
|
1533
|
+
// cream as the page scrolls under it.
|
|
1534
|
+
const scrollY = useRef(new Animated.Value(0)).current;
|
|
1535
|
+
// The keyboard covers the lower part of the page: the focused chore box is docked on top of it, as the chat's
|
|
1536
|
+
// composer is, wherever it sat before. The page makes the room under itself on both platforms (on iOS, doing it
|
|
1537
|
+
// here keeps UIKit's own scroll from fighting ours), less any the system made by shrinking the window (Android
|
|
1538
|
+
// phones where the app is not drawn edge to edge).
|
|
1539
|
+
const page = useRef<View>(null);
|
|
1540
|
+
const { keyboard, covers, onLayout: onPageLayout } = useKeyboardCover(page);
|
|
1541
|
+
const scrollAt = useRef(0);
|
|
1542
|
+
const focusedBox = useRef<View | null>(null);
|
|
1543
|
+
// Moving from one chore box to the other leaves the keyboard where it is: docking runs again for the new box.
|
|
1544
|
+
const [focusTurn, setFocusTurn] = useState(0);
|
|
1545
|
+
const onComposerFocus = (box: View | null) => {
|
|
1546
|
+
focusedBox.current = box;
|
|
1547
|
+
if (box) setFocusTurn((n) => n + 1);
|
|
1548
|
+
};
|
|
1549
|
+
// Room added above the page while a box near the top is docked; gone with the keyboard.
|
|
1550
|
+
const [lift, setLift] = useState(0);
|
|
1551
|
+
useEffect(() => {
|
|
1552
|
+
if (!keyboard.shown) {
|
|
1553
|
+
setLift(0);
|
|
1554
|
+
return undefined;
|
|
1555
|
+
}
|
|
1556
|
+
const dock = () =>
|
|
1557
|
+
page.current?.measureInWindow((_px, pageY, _pw, pageH) =>
|
|
1558
|
+
focusedBox.current?.measureInWindow((_x, y, _w, h) => {
|
|
1559
|
+
// The page runs to the bottom of the window. Measured against it, the box and the keyboard share
|
|
1560
|
+
// one frame (Android measures from under the status bar, iOS from the top of the screen); the
|
|
1561
|
+
// keyboard covers `covers` of the page's bottom.
|
|
1562
|
+
const top = pageY + pageH - covers;
|
|
1563
|
+
const by = Math.round(y + h + KEYBOARD_GAP - top);
|
|
1564
|
+
if (Math.abs(by) <= 1) return;
|
|
1565
|
+
const to = scrollAt.current + by;
|
|
1566
|
+
if (to < 0) {
|
|
1567
|
+
// Near the top the page cannot scroll the box down to the keyboard: room above the page
|
|
1568
|
+
// brings it down instead, until the keyboard goes.
|
|
1569
|
+
setLift((l) => l - to);
|
|
1570
|
+
scrollRef.current?.scrollTo({ y: 0, animated: true });
|
|
1571
|
+
} else {
|
|
1572
|
+
scrollRef.current?.scrollTo({ y: to, animated: true });
|
|
1573
|
+
}
|
|
1574
|
+
}),
|
|
1575
|
+
);
|
|
1576
|
+
// Once the keyboard has landed and the room under the page is laid out; then once more, in case the
|
|
1577
|
+
// system scrolled to the caret in between.
|
|
1578
|
+
const first = Platform.OS === 'ios' ? keyboard.duration + 60 : 80;
|
|
1579
|
+
const timers = [setTimeout(dock, first), setTimeout(dock, first + 300)];
|
|
1580
|
+
return () => timers.forEach(clearTimeout);
|
|
1581
|
+
}, [keyboard.shown, keyboard.duration, covers, focusTurn]);
|
|
1582
|
+
const scrollRef = useRef<ScrollView>(null);
|
|
1583
|
+
const { viewport, handlers: viewportHandlers, contentRef } = useViewportController();
|
|
1584
|
+
const offsets = useRef<Partial<Record<SectionKey, number>>>({});
|
|
1585
|
+
const [imessageOpen, setImessageOpen] = useState(false);
|
|
1586
|
+
const totalMin = MINUTES.reduce((sum: number, m: { min: number }) => sum + m.min, 0);
|
|
1587
|
+
const areaWidth = Math.min(width * 0.78, 330);
|
|
1588
|
+
|
|
1589
|
+
// Every chore and the iMessage line need an account: the sign-in prompt first, then on with it once signed in.
|
|
1590
|
+
const { authenticated, gate, prompt } = useSignInGate((r, params) => navigation.navigate(r, params));
|
|
1591
|
+
// The hero speaks to who is here: a hello by name and what Lucy is on, once signed in.
|
|
1592
|
+
const { user } = useIsUserAuthenticated();
|
|
1593
|
+
const person = (authenticated && user ? user : null) as { given_name?: string; name?: string } | null;
|
|
1594
|
+
const firstName = (person?.given_name || person?.name || '').trim().split(/\s+/)[0] || '';
|
|
1595
|
+
const choreCount = useChoreCount(Boolean(person));
|
|
1596
|
+
// A phone's first launch opens the welcome, once (welcome/seen.ts).
|
|
1597
|
+
const welcomeSeen = useWelcomeSeen();
|
|
1598
|
+
useEffect(() => {
|
|
1599
|
+
if (welcomeSeen === false) navigation.navigate(CLOCKBOOK_ROUTES.WELCOME);
|
|
1600
|
+
}, [navigation, welcomeSeen]);
|
|
1601
|
+
// Talk to Lucy, the Action Button's control (talk/talkToLucy.ts), opens the app with a press waiting: Home, at the
|
|
1602
|
+
// top, with the big mic listening, whichever screen was open. Not before the welcome is done; a press waits a minute.
|
|
1603
|
+
useEffect(() => {
|
|
1604
|
+
if (welcomeSeen !== true) return undefined;
|
|
1605
|
+
return watchTalkRequests(() => navigation.navigate(...drawerRoute(CLOCKBOOK_ROUTES.HOME, listeningHome())));
|
|
1606
|
+
}, [navigation, welcomeSeen]);
|
|
1607
|
+
// Push for the signed-in person (asked once), and a tapped notification opens Lucy's chat. Not before the welcome
|
|
1608
|
+
// is done: its notification step is the one that asks.
|
|
1609
|
+
usePushNotifications(Boolean(authenticated) && welcomeSeen === true, () =>
|
|
1610
|
+
navigation.navigate(CLOCKBOOK_ROUTES.CHAT, { at: Date.now() }),
|
|
1611
|
+
);
|
|
1612
|
+
// Black Friday (offer/): shown once to a signed-in person who is past the welcome and on Home, the black spreading
|
|
1613
|
+
// from Home's own clock; after that a chip in the hero, until it ends or is claimed.
|
|
1614
|
+
const onHome = useIsFocused();
|
|
1615
|
+
const offerSeen = useOfferSeen(BLACK_FRIDAY.id);
|
|
1616
|
+
const minute = useNow(60_000, OFFER_ON);
|
|
1617
|
+
const offerOn = offerShows(minute, BLACK_FRIDAY, { on: OFFER_ON, early: __DEV__ });
|
|
1618
|
+
const [offerOpen, setOfferOpen] = useState<'offer' | 'claimed' | null>(null);
|
|
1619
|
+
const [offerSheet, setOfferSheet] = useState(false);
|
|
1620
|
+
const [offerAt, setOfferAt] = useState<{ origin: Point; target: Point } | null>(null);
|
|
1621
|
+
const markBox = useRef<View>(null);
|
|
1622
|
+
const eyebrowBox = useRef<View>(null);
|
|
1623
|
+
const openOffer = useCallback((mode: 'offer' | 'claimed') => {
|
|
1624
|
+
const centre = (box: View | null, then: (p: Point | null) => void) => {
|
|
1625
|
+
if (!box) return then(null);
|
|
1626
|
+
box.measureInWindow((x, y, w, h) => then(w > 0 && h > 0 ? { x: x + w / 2, y: y + h / 2 } : null));
|
|
1627
|
+
};
|
|
1628
|
+
centre(markBox.current, (origin) =>
|
|
1629
|
+
centre(eyebrowBox.current, (target) => {
|
|
1630
|
+
setOfferAt(origin ? { origin, target: target ?? origin } : null);
|
|
1631
|
+
setOfferOpen(mode);
|
|
1632
|
+
}),
|
|
1633
|
+
);
|
|
1634
|
+
}, []);
|
|
1635
|
+
useEffect(() => {
|
|
1636
|
+
if (!offerOn || !authenticated || welcomeSeen !== true || !onHome || offerSeen !== 'new') return undefined;
|
|
1637
|
+
// A beat on Home first, so the black plainly comes out of its clock.
|
|
1638
|
+
const timer = setTimeout(() => {
|
|
1639
|
+
markOffer(BLACK_FRIDAY.id, 'seen').catch(() => undefined);
|
|
1640
|
+
openOffer('offer');
|
|
1641
|
+
}, 700);
|
|
1642
|
+
return () => clearTimeout(timer);
|
|
1643
|
+
}, [authenticated, offerOn, offerSeen, onHome, openOffer, welcomeSeen]);
|
|
1644
|
+
// A chore goes to Lucy's chat, which sends it straight away (`at` makes the same chore twice send twice).
|
|
1645
|
+
const handOver = (chore: string) =>
|
|
1646
|
+
gate('chat', () => navigation.navigate(CLOCKBOOK_ROUTES.CHAT, { prompt: chore, at: Date.now() }), chore);
|
|
1647
|
+
const onChip = (c: Chore) => handOver(c.prompt);
|
|
1648
|
+
// The web home's iMessage dialog, native: Open Messages with "Hi Lucy" (and the code linking this phone) ready.
|
|
1649
|
+
const textLucy = () => gate('imessage', () => setImessageOpen(true));
|
|
1650
|
+
// The header is set once; these refs keep its buttons on the latest handlers.
|
|
1651
|
+
const textLucyRef = useRef(textLucy);
|
|
1652
|
+
textLucyRef.current = textLucy;
|
|
1653
|
+
const openChatRef = useRef(() => gate('chat', () => navigation.navigate(CLOCKBOOK_ROUTES.CHAT)));
|
|
1654
|
+
openChatRef.current = () => gate('chat', () => navigation.navigate(CLOCKBOOK_ROUTES.CHAT));
|
|
1655
|
+
|
|
1656
|
+
const anchor = (key: SectionKey) => (e: LayoutChangeEvent) => {
|
|
1657
|
+
offsets.current[key] = e.nativeEvent.layout.y;
|
|
1658
|
+
};
|
|
1659
|
+
const { section, at, listen } = route.params ?? {};
|
|
1660
|
+
useEffect(() => {
|
|
1661
|
+
if (!at) return;
|
|
1662
|
+
const y = section ? offsets.current[section] : 0;
|
|
1663
|
+
if (y === undefined) return;
|
|
1664
|
+
scrollRef.current?.scrollTo({ y: Math.max(0, y - headerHeight - 12), animated: true });
|
|
1665
|
+
}, [section, at, headerHeight]);
|
|
1666
|
+
|
|
1667
|
+
useLayoutEffect(() => {
|
|
1668
|
+
navigation.setOptions({
|
|
1669
|
+
// No title and no brand: the header is just the menu and Lucy's buttons, over the hero's aurora.
|
|
1670
|
+
headerTitle: () => null,
|
|
1671
|
+
headerTransparent: true,
|
|
1672
|
+
headerBackground: () => (
|
|
1673
|
+
<View style={StyleSheet.absoluteFill}>
|
|
1674
|
+
<Animated.View
|
|
1675
|
+
style={[
|
|
1676
|
+
StyleSheet.absoluteFill,
|
|
1677
|
+
s.headerFill,
|
|
1678
|
+
{
|
|
1679
|
+
opacity: scrollY.interpolate({
|
|
1680
|
+
inputRange: [0, 40],
|
|
1681
|
+
outputRange: [0, 1],
|
|
1682
|
+
extrapolate: 'clamp',
|
|
1683
|
+
}),
|
|
1684
|
+
},
|
|
1685
|
+
]}
|
|
1686
|
+
/>
|
|
1687
|
+
</View>
|
|
1688
|
+
),
|
|
1689
|
+
headerLeft: () => (
|
|
1690
|
+
<View style={[s.headerSide, { marginLeft: PAD, alignItems: 'flex-start' }]}>
|
|
1691
|
+
<FloatingButton
|
|
1692
|
+
icon="menu"
|
|
1693
|
+
label="Menu"
|
|
1694
|
+
onPress={() => navigation.dispatch(DrawerActions.toggleDrawer())}
|
|
1695
|
+
/>
|
|
1696
|
+
</View>
|
|
1697
|
+
),
|
|
1698
|
+
headerRight: () => (
|
|
1699
|
+
<View style={[s.headerSide, { marginRight: PAD, alignItems: 'flex-end' }]}>
|
|
1700
|
+
{/* A compact white capsule, two small app-style icons close together: Text Lucy in Messages,
|
|
1701
|
+
and Lucy's chat. Each keeps a full touch area through its hit slop. */}
|
|
1702
|
+
<View style={s.iconCapsule}>
|
|
1703
|
+
<Pressable
|
|
1704
|
+
accessibilityRole="button"
|
|
1705
|
+
accessibilityLabel={TEXT_LUCY}
|
|
1706
|
+
onPress={() => textLucyRef.current()}
|
|
1707
|
+
hitSlop={12}
|
|
1708
|
+
style={({ pressed }) => [s.iconCapsuleBtn, pressed && { opacity: 0.5 }]}
|
|
1709
|
+
>
|
|
1710
|
+
<MessagesAppIcon size={18} />
|
|
1711
|
+
</Pressable>
|
|
1712
|
+
<Pressable
|
|
1713
|
+
accessibilityRole="button"
|
|
1714
|
+
accessibilityLabel="Chat with Lucy"
|
|
1715
|
+
onPress={() => openChatRef.current()}
|
|
1716
|
+
hitSlop={12}
|
|
1717
|
+
style={({ pressed }) => [s.iconCapsuleBtn, pressed && { opacity: 0.5 }]}
|
|
1718
|
+
>
|
|
1719
|
+
<View style={s.chatAppIcon}>
|
|
1720
|
+
<Ionicons name="chatbubble-ellipses" size={10} color="#FFFFFF" />
|
|
1721
|
+
</View>
|
|
1722
|
+
</Pressable>
|
|
1723
|
+
</View>
|
|
1724
|
+
</View>
|
|
1725
|
+
),
|
|
1726
|
+
headerShadowVisible: false,
|
|
1727
|
+
});
|
|
1728
|
+
}, [navigation, scrollY]);
|
|
1729
|
+
|
|
1730
|
+
return (
|
|
1731
|
+
<View ref={page} collapsable={false} style={s.page} onLayout={onPageLayout}>
|
|
1732
|
+
<ViewportProvider value={viewport}>
|
|
1733
|
+
<ScrollView
|
|
1734
|
+
ref={scrollRef}
|
|
1735
|
+
style={s.page}
|
|
1736
|
+
contentContainerStyle={{
|
|
1737
|
+
paddingTop: lift,
|
|
1738
|
+
paddingBottom: 28 + covers,
|
|
1739
|
+
}}
|
|
1740
|
+
keyboardShouldPersistTaps="handled"
|
|
1741
|
+
keyboardDismissMode="on-drag"
|
|
1742
|
+
showsVerticalScrollIndicator={false}
|
|
1743
|
+
{...viewportHandlers}
|
|
1744
|
+
scrollEventThrottle={16}
|
|
1745
|
+
onScroll={(e) => {
|
|
1746
|
+
viewportHandlers.onScroll(e);
|
|
1747
|
+
scrollY.setValue(e.nativeEvent.contentOffset.y);
|
|
1748
|
+
scrollAt.current = e.nativeEvent.contentOffset.y;
|
|
1749
|
+
}}
|
|
1750
|
+
>
|
|
1751
|
+
<View ref={contentRef} collapsable={false}>
|
|
1752
|
+
{/* Hero: Lucy, the promise, the chore box, over the web's aurora */}
|
|
1753
|
+
<View style={[s.heroZone, { paddingTop: headerHeight }]}>
|
|
1754
|
+
<Aurora />
|
|
1755
|
+
<View style={s.hero}>
|
|
1756
|
+
<Rise style={{ alignSelf: 'center' }}>
|
|
1757
|
+
<View ref={markBox} collapsable={false}>
|
|
1758
|
+
<HaloMark />
|
|
1759
|
+
</View>
|
|
1760
|
+
</Rise>
|
|
1761
|
+
<Rise delay={70}>
|
|
1762
|
+
{/* The eyebrow, or while Black Friday runs and has been shown, its chip. */}
|
|
1763
|
+
<View ref={eyebrowBox} collapsable={false} style={s.eyebrowBox}>
|
|
1764
|
+
{offerOn && offerSeen === 'seen' ? (
|
|
1765
|
+
<OfferChip
|
|
1766
|
+
offer={BLACK_FRIDAY}
|
|
1767
|
+
now={minute}
|
|
1768
|
+
onPress={() => setOfferSheet(true)}
|
|
1769
|
+
onLongPress={__DEV__ ? () => openOffer('offer') : undefined}
|
|
1770
|
+
/>
|
|
1771
|
+
) : (
|
|
1772
|
+
<Text
|
|
1773
|
+
style={[s.heroEyebrow, { textAlign: 'center' }]}
|
|
1774
|
+
// Development builds: a long press shows Black Friday again.
|
|
1775
|
+
onLongPress={
|
|
1776
|
+
OFFER_ON
|
|
1777
|
+
? () => resetOffer(BLACK_FRIDAY.id).catch(() => undefined)
|
|
1778
|
+
: undefined
|
|
1779
|
+
}
|
|
1780
|
+
>
|
|
1781
|
+
For everyone with a to-do list
|
|
1782
|
+
</Text>
|
|
1783
|
+
)}
|
|
1784
|
+
</View>
|
|
1785
|
+
</Rise>
|
|
1786
|
+
<Rise delay={140}>
|
|
1787
|
+
<Heading
|
|
1788
|
+
pre="Get your evenings "
|
|
1789
|
+
em="back."
|
|
1790
|
+
large
|
|
1791
|
+
center
|
|
1792
|
+
style={{ marginTop: 8 }}
|
|
1793
|
+
/>
|
|
1794
|
+
</Rise>
|
|
1795
|
+
<Rise delay={210}>
|
|
1796
|
+
<Text style={[s.lead, { textAlign: 'center' }]}>
|
|
1797
|
+
Clockbook takes the life admin off your plate: the calls, the bills, the
|
|
1798
|
+
cancellations, the groceries and the appointments.
|
|
1799
|
+
</Text>
|
|
1800
|
+
</Rise>
|
|
1801
|
+
{/* The mic first, then the box: speak it, or type it. */}
|
|
1802
|
+
<Rise delay={280}>
|
|
1803
|
+
<Composer
|
|
1804
|
+
onSubmit={handOver}
|
|
1805
|
+
onFocusBox={onComposerFocus}
|
|
1806
|
+
bigMic
|
|
1807
|
+
listenAt={listen}
|
|
1808
|
+
/>
|
|
1809
|
+
</Rise>
|
|
1810
|
+
</View>
|
|
1811
|
+
<Rise delay={350}>
|
|
1812
|
+
<Text style={s.tryLabel}>Try</Text>
|
|
1813
|
+
<ScrollView
|
|
1814
|
+
horizontal
|
|
1815
|
+
nestedScrollEnabled
|
|
1816
|
+
showsHorizontalScrollIndicator={false}
|
|
1817
|
+
decelerationRate="fast"
|
|
1818
|
+
snapToInterval={CARD_W + 12}
|
|
1819
|
+
contentContainerStyle={s.tryRow}
|
|
1820
|
+
>
|
|
1821
|
+
{HERO_CHORES.slice(0, 5).map((c: Chore) => (
|
|
1822
|
+
<IdeaCard key={c.label} chore={c} onPress={onChip} />
|
|
1823
|
+
))}
|
|
1824
|
+
</ScrollView>
|
|
1825
|
+
</Rise>
|
|
1826
|
+
<Rise delay={420}>
|
|
1827
|
+
{/* Text Lucy, and the promise that goes with every chore, as one card. */}
|
|
1828
|
+
<View style={s.textCard}>
|
|
1829
|
+
<Pressable
|
|
1830
|
+
accessibilityRole="button"
|
|
1831
|
+
onPress={textLucy}
|
|
1832
|
+
style={({ pressed }) => [
|
|
1833
|
+
s.textCardRow,
|
|
1834
|
+
pressed && { backgroundColor: ui.fill },
|
|
1835
|
+
]}
|
|
1836
|
+
>
|
|
1837
|
+
<MessagesAppIcon size={36} />
|
|
1838
|
+
<Text style={s.textCardTitle}>{TEXT_LUCY}</Text>
|
|
1839
|
+
<Ionicons name="chevron-forward" size={18} color={ui.faint} />
|
|
1840
|
+
</Pressable>
|
|
1841
|
+
<View style={s.textCardTrust}>
|
|
1842
|
+
<Trust>Nothing is paid or changed without your yes</Trust>
|
|
1843
|
+
</View>
|
|
1844
|
+
</View>
|
|
1845
|
+
</Rise>
|
|
1846
|
+
</View>
|
|
1847
|
+
|
|
1848
|
+
{/* Strip */}
|
|
1849
|
+
<View style={s.strip}>
|
|
1850
|
+
<Marquee chores={STRIP_CHORES.slice(0, 11)} onChore={onChip} />
|
|
1851
|
+
<Marquee chores={STRIP_CHORES.slice(11)} onChore={onChip} reverse />
|
|
1852
|
+
<EdgeFade side="left" />
|
|
1853
|
+
<EdgeFade side="right" />
|
|
1854
|
+
</View>
|
|
1855
|
+
|
|
1856
|
+
{/* How it works: Muse's Ideas list */}
|
|
1857
|
+
<Reveal style={s.sectionList} onLayout={anchor('how')}>
|
|
1858
|
+
<View style={s.sectionHead}>
|
|
1859
|
+
<Eyebrow>How it works</Eyebrow>
|
|
1860
|
+
<Heading pre="Text it. It gets " em="done." />
|
|
1861
|
+
</View>
|
|
1862
|
+
{/* A timeline: each step's icon on the line that joins them. */}
|
|
1863
|
+
<View style={s.steps}>
|
|
1864
|
+
{STEPS.map((step: { title: string; body: string }, i: number) => {
|
|
1865
|
+
const last = i === STEPS.length - 1;
|
|
1866
|
+
return (
|
|
1867
|
+
<View key={step.title} style={s.step}>
|
|
1868
|
+
<View style={s.stepRail}>
|
|
1869
|
+
<View style={s.stepIcon}>
|
|
1870
|
+
<Ionicons
|
|
1871
|
+
name={STEP_ICONS[i] ?? 'sparkles-outline'}
|
|
1872
|
+
size={20}
|
|
1873
|
+
color={ui.accentText}
|
|
1874
|
+
/>
|
|
1875
|
+
</View>
|
|
1876
|
+
{last ? null : <View style={s.stepLine} />}
|
|
1877
|
+
</View>
|
|
1878
|
+
<View style={[s.stepBody, last && { paddingBottom: 0 }]}>
|
|
1879
|
+
<Text style={s.stepTitle}>{step.title}</Text>
|
|
1880
|
+
<Text style={s.body}>{step.body}</Text>
|
|
1881
|
+
</View>
|
|
1882
|
+
</View>
|
|
1883
|
+
);
|
|
1884
|
+
})}
|
|
1885
|
+
</View>
|
|
1886
|
+
</Reveal>
|
|
1887
|
+
|
|
1888
|
+
{/* Time back: the web's dark card (.cbh-time-card) */}
|
|
1889
|
+
<Reveal style={s.sectionTight}>
|
|
1890
|
+
<View style={s.timeCardShadow}>
|
|
1891
|
+
<View style={s.timeCard}>
|
|
1892
|
+
<DarkFill />
|
|
1893
|
+
<TimeBackLottie />
|
|
1894
|
+
<View style={s.timeCopy}>
|
|
1895
|
+
<Eyebrow dark>Time back</Eyebrow>
|
|
1896
|
+
<Heading
|
|
1897
|
+
dark
|
|
1898
|
+
pre="After work, sleep and chores, the evening is "
|
|
1899
|
+
em="short."
|
|
1900
|
+
style={s.timeTitle}
|
|
1901
|
+
/>
|
|
1902
|
+
<View style={s.stats}>
|
|
1903
|
+
{STATS.map((st) => (
|
|
1904
|
+
<View key={st.label} style={s.stat}>
|
|
1905
|
+
<View style={s.statRow}>
|
|
1906
|
+
<CountUp
|
|
1907
|
+
to={st.to}
|
|
1908
|
+
decimals={st.decimals}
|
|
1909
|
+
style={s.statValue}
|
|
1910
|
+
/>
|
|
1911
|
+
<Text style={s.statUnit}> {st.unit}</Text>
|
|
1912
|
+
</View>
|
|
1913
|
+
<Text style={s.statLabel}>{st.label}</Text>
|
|
1914
|
+
</View>
|
|
1915
|
+
))}
|
|
1916
|
+
</View>
|
|
1917
|
+
<Text style={s.timeNote}>
|
|
1918
|
+
A working adult spends about 2.8 hours a day on life admin. Clockbook gives
|
|
1919
|
+
you 38 minutes of it back, every day: about 229 hours a year, or 28
|
|
1920
|
+
workdays.¹
|
|
1921
|
+
</Text>
|
|
1922
|
+
</View>
|
|
1923
|
+
</View>
|
|
1924
|
+
</View>
|
|
1925
|
+
</Reveal>
|
|
1926
|
+
|
|
1927
|
+
{/* Lucy makes the call */}
|
|
1928
|
+
<Reveal style={s.section} onLayout={anchor('calls')}>
|
|
1929
|
+
<Eyebrow icon={<Ionicons name="call-outline" size={14} color={ui.muted} />}>
|
|
1930
|
+
Lucy makes the call
|
|
1931
|
+
</Eyebrow>
|
|
1932
|
+
<Heading pre="Never sit on " em="hold" post=" again." />
|
|
1933
|
+
<Text style={s.bodyLead}>
|
|
1934
|
+
Text Lucy what you need. She calls, works the phone menu, waits through the hold music
|
|
1935
|
+
and talks to a real person. When they need to hear from you, she rings you in.
|
|
1936
|
+
</Text>
|
|
1937
|
+
<CallCard />
|
|
1938
|
+
</Reveal>
|
|
1939
|
+
{/* Two columns, the second set lower, as the web's .cbh-reels. */}
|
|
1940
|
+
<Reveal style={s.reels} delay={90}>
|
|
1941
|
+
{REELS.map((r, i) => (
|
|
1942
|
+
<View key={r.title} style={[s.reel, i === 1 && { marginTop: 40 }]}>
|
|
1943
|
+
<Reel {...r} />
|
|
1944
|
+
</View>
|
|
1945
|
+
))}
|
|
1946
|
+
</Reveal>
|
|
1947
|
+
<Text style={[s.note, { paddingHorizontal: PAD + 4 }]}>{VIDEO_NOTE}</Text>
|
|
1948
|
+
|
|
1949
|
+
{/* iMessage */}
|
|
1950
|
+
<Reveal style={[s.section, s.band]} onLayout={anchor('imessage')}>
|
|
1951
|
+
<SoftFill />
|
|
1952
|
+
<Eyebrow icon={<MessagesAppIcon size={16} />}>{`Now on ${MESSAGES_APP}`}</Eyebrow>
|
|
1953
|
+
<Heading pre="Text Lucy like you’d text a " em="friend." />
|
|
1954
|
+
<Text style={s.bodyLead}>
|
|
1955
|
+
Lucy is in Messages too. Send her a chore from {TEXT_FROM}, and she texts back as it
|
|
1956
|
+
gets done. Same Lucy, same account, nothing to install.
|
|
1957
|
+
</Text>
|
|
1958
|
+
<PhoneThread />
|
|
1959
|
+
<View style={s.textSteps}>
|
|
1960
|
+
{textSteps(TEXT_STEPS).map((step, i) => (
|
|
1961
|
+
<View key={step.title} style={s.textStep}>
|
|
1962
|
+
<View style={s.textN}>
|
|
1963
|
+
<Text style={s.textNText}>{i + 1}</Text>
|
|
1964
|
+
</View>
|
|
1965
|
+
<View style={{ flex: 1 }}>
|
|
1966
|
+
<Text style={s.textStepTitle}>{step.title}</Text>
|
|
1967
|
+
<Text style={s.body}>{step.body}</Text>
|
|
1968
|
+
</View>
|
|
1969
|
+
</View>
|
|
1970
|
+
))}
|
|
1971
|
+
</View>
|
|
1972
|
+
<Pressable
|
|
1973
|
+
accessibilityRole="button"
|
|
1974
|
+
onPress={textLucy}
|
|
1975
|
+
style={({ pressed }) => [s.btn, pressed && s.btnPressed]}
|
|
1976
|
+
>
|
|
1977
|
+
<MessagesAppIcon size={22} />
|
|
1978
|
+
<Text style={s.btnText}>{TEXT_LUCY}</Text>
|
|
1979
|
+
</Pressable>
|
|
1980
|
+
<Text style={[s.note, { textAlign: 'center' }]}>Message and data rates may apply.</Text>
|
|
1981
|
+
</Reveal>
|
|
1982
|
+
|
|
1983
|
+
{/* What it handles */}
|
|
1984
|
+
<Reveal style={s.sectionHeadOnly} onLayout={anchor('areas')}>
|
|
1985
|
+
<Eyebrow>What it handles</Eyebrow>
|
|
1986
|
+
<Heading pre="Hand over every corner of " em="home life." />
|
|
1987
|
+
</Reveal>
|
|
1988
|
+
<ScrollView
|
|
1989
|
+
horizontal
|
|
1990
|
+
nestedScrollEnabled
|
|
1991
|
+
showsHorizontalScrollIndicator={false}
|
|
1992
|
+
contentContainerStyle={s.areas}
|
|
1993
|
+
decelerationRate="fast"
|
|
1994
|
+
snapToInterval={areaWidth + 12}
|
|
1995
|
+
>
|
|
1996
|
+
{AREAS.map((a: { key: string; title: string; blurb: string; chores: Chore[] }) => (
|
|
1997
|
+
<View key={a.key} style={[s.area, { width: areaWidth }]}>
|
|
1998
|
+
<AreaShot area={a.key} />
|
|
1999
|
+
<Text style={s.areaTitle}>{a.title}</Text>
|
|
2000
|
+
<Text style={s.body}>{a.blurb}</Text>
|
|
2001
|
+
<View style={s.areaChips}>
|
|
2002
|
+
{a.chores.map((c) => (
|
|
2003
|
+
<ChoreChip key={c.label} chore={c} onPress={onChip} small />
|
|
2004
|
+
))}
|
|
2005
|
+
</View>
|
|
2006
|
+
</View>
|
|
2007
|
+
))}
|
|
2008
|
+
</ScrollView>
|
|
2009
|
+
|
|
2010
|
+
{/* Where it comes from: a soft band, as the web's #minutes */}
|
|
2011
|
+
<Reveal style={[s.section, s.band]}>
|
|
2012
|
+
<SoftFill />
|
|
2013
|
+
<Eyebrow>Where it comes from</Eyebrow>
|
|
2014
|
+
<Heading pre={`${totalMin} minutes, chore by `} em="chore." />
|
|
2015
|
+
<MinutesPicker />
|
|
2016
|
+
<Text style={[s.body, { marginTop: 14 }]}>
|
|
2017
|
+
Clockbook can't fold the laundry. The {HOUSEWORK_MIN} minutes a day of cleaning and
|
|
2018
|
+
washing stay yours; the rest you can hand over.¹
|
|
2019
|
+
</Text>
|
|
2020
|
+
</Reveal>
|
|
2021
|
+
|
|
2022
|
+
{/* Questions: plain rows */}
|
|
2023
|
+
<Reveal style={s.sectionList} onLayout={anchor('faq')}>
|
|
2024
|
+
<View style={s.sectionHead}>
|
|
2025
|
+
<Eyebrow>Questions</Eyebrow>
|
|
2026
|
+
<Heading pre="Good to " em="know." />
|
|
2027
|
+
</View>
|
|
2028
|
+
<View style={s.faqs}>
|
|
2029
|
+
{FAQS.map((f: { q: string; a: string }, i: number) => (
|
|
2030
|
+
<Faq key={f.q} q={f.q} a={f.a} last={i === FAQS.length - 1} />
|
|
2031
|
+
))}
|
|
2032
|
+
</View>
|
|
2033
|
+
</Reveal>
|
|
2034
|
+
|
|
2035
|
+
{/* The first chore */}
|
|
2036
|
+
<Reveal style={s.final}>
|
|
2037
|
+
<View style={s.finalShadow}>
|
|
2038
|
+
<View style={s.finalCard}>
|
|
2039
|
+
<FinalFill />
|
|
2040
|
+
<TimeBackMark size={40} />
|
|
2041
|
+
<Heading
|
|
2042
|
+
pre="What’s the first chore you’d "
|
|
2043
|
+
em="hand over?"
|
|
2044
|
+
center
|
|
2045
|
+
style={s.finalTitle}
|
|
2046
|
+
/>
|
|
2047
|
+
<View style={{ alignSelf: 'stretch' }}>
|
|
2048
|
+
<Composer onSubmit={handOver} onFocusBox={onComposerFocus} />
|
|
2049
|
+
</View>
|
|
2050
|
+
<View style={s.finalChannels}>
|
|
2051
|
+
<ImessagePill onPress={textLucy} />
|
|
2052
|
+
<View style={{ alignSelf: 'stretch' }}>
|
|
2053
|
+
<Trust>Lucy asks before she pays for anything or changes an account</Trust>
|
|
2054
|
+
</View>
|
|
2055
|
+
</View>
|
|
2056
|
+
</View>
|
|
2057
|
+
</View>
|
|
2058
|
+
</Reveal>
|
|
2059
|
+
|
|
2060
|
+
{/* Business: Yantra */}
|
|
2061
|
+
<Reveal style={s.sectionTight}>
|
|
2062
|
+
<View style={s.yantraCard}>
|
|
2063
|
+
{/* The mark and the title side by side, the title starting right after the logo. */}
|
|
2064
|
+
<View style={s.yantraHead}>
|
|
2065
|
+
<View style={s.yantraIcon}>
|
|
2066
|
+
<YantraMark size={24} />
|
|
2067
|
+
</View>
|
|
2068
|
+
<Heading pre="Running a business? That’s " em="Yantra." style={s.yantraTitle} />
|
|
2069
|
+
</View>
|
|
2070
|
+
<Text style={[s.body, { marginTop: 8 }]}>
|
|
2071
|
+
Clockbook keeps life admin easy for everyone. For your team’s work, from timesheets
|
|
2072
|
+
and invoices to the workflows between them, there’s Yantra, the AI workspace
|
|
2073
|
+
Clockbook runs on.
|
|
2074
|
+
</Text>
|
|
2075
|
+
<Button
|
|
2076
|
+
label="Go to yantra.app"
|
|
2077
|
+
icon="open-outline"
|
|
2078
|
+
variant="secondary"
|
|
2079
|
+
onPress={() => openYantraUrl(yantraAppUrl())}
|
|
2080
|
+
style={{ marginTop: 18, alignSelf: 'flex-start' }}
|
|
2081
|
+
/>
|
|
2082
|
+
</View>
|
|
2083
|
+
</Reveal>
|
|
2084
|
+
|
|
2085
|
+
{/* Footer: a quiet sign-off, the footnote under it. */}
|
|
2086
|
+
<View style={s.footer}>
|
|
2087
|
+
<View style={s.footerRule} />
|
|
2088
|
+
<Mark size={28} />
|
|
2089
|
+
<Text style={s.footerName}>Clockbook</Text>
|
|
2090
|
+
<Text style={s.footerTag}>Time back, every day.</Text>
|
|
2091
|
+
<Text style={s.footnote}>
|
|
2092
|
+
¹ {FOOTNOTE} {VIDEO_NOTE}
|
|
2093
|
+
</Text>
|
|
2094
|
+
</View>
|
|
2095
|
+
</View>
|
|
2096
|
+
</ScrollView>
|
|
2097
|
+
</ViewportProvider>
|
|
2098
|
+
{prompt}
|
|
2099
|
+
<ImessageSheet
|
|
2100
|
+
visible={imessageOpen}
|
|
2101
|
+
onClose={() => setImessageOpen(false)}
|
|
2102
|
+
onChatHere={() => {
|
|
2103
|
+
setImessageOpen(false);
|
|
2104
|
+
navigation.navigate(CLOCKBOOK_ROUTES.CHAT, { at: Date.now() });
|
|
2105
|
+
}}
|
|
2106
|
+
onSignIn={() => {
|
|
2107
|
+
setImessageOpen(false);
|
|
2108
|
+
navigation.navigate(AuthMobileNavigationRoutesEnum.Login, { redirect: 'back' });
|
|
2109
|
+
}}
|
|
2110
|
+
/>
|
|
2111
|
+
<BlackFridayOffer
|
|
2112
|
+
visible={offerOpen !== null}
|
|
2113
|
+
mode={offerOpen ?? 'offer'}
|
|
2114
|
+
offer={BLACK_FRIDAY}
|
|
2115
|
+
origin={offerAt?.origin ?? null}
|
|
2116
|
+
target={offerAt?.target ?? null}
|
|
2117
|
+
onClaim={() => markOffer(BLACK_FRIDAY.id, 'claimed').catch(() => undefined)}
|
|
2118
|
+
onClose={() => setOfferOpen(null)}
|
|
2119
|
+
/>
|
|
2120
|
+
<OfferSheet
|
|
2121
|
+
visible={offerSheet}
|
|
2122
|
+
offer={BLACK_FRIDAY}
|
|
2123
|
+
onClose={() => setOfferSheet(false)}
|
|
2124
|
+
onClaim={() => {
|
|
2125
|
+
setOfferSheet(false);
|
|
2126
|
+
markOffer(BLACK_FRIDAY.id, 'claimed').catch(() => undefined);
|
|
2127
|
+
// The sheet's own Modal goes first, then the celebration's comes.
|
|
2128
|
+
setTimeout(() => openOffer('claimed'), 320);
|
|
2129
|
+
}}
|
|
2130
|
+
/>
|
|
2131
|
+
</View>
|
|
2132
|
+
);
|
|
2133
|
+
}
|
|
2134
|
+
|
|
2135
|
+
/* ------------------------------------------------------------------------------------------------ styles */
|
|
2136
|
+
|
|
2137
|
+
/** The web's call green (.cbh-call-step done / .cbh-live). */
|
|
2138
|
+
const CALL_GREEN = '#1FA855';
|
|
2139
|
+
|
|
2140
|
+
const CARD_W = 248;
|
|
2141
|
+
|
|
2142
|
+
/** The time-back card's peach (numbers, eyebrow) and its warm grey (labels, note), as the web's. */
|
|
2143
|
+
const TIME_PEACH = '#FFB48A';
|
|
2144
|
+
const TIME_LABEL = '#D8CEC5';
|
|
2145
|
+
|
|
2146
|
+
const s = StyleSheet.create({
|
|
2147
|
+
page: { flex: 1, backgroundColor: ui.bg },
|
|
2148
|
+
headerActions: { flexDirection: 'row', alignItems: 'center', gap: 8 },
|
|
2149
|
+
iconCapsule: {
|
|
2150
|
+
flexDirection: 'row',
|
|
2151
|
+
alignItems: 'center',
|
|
2152
|
+
gap: 12,
|
|
2153
|
+
height: 38,
|
|
2154
|
+
paddingHorizontal: 14,
|
|
2155
|
+
borderRadius: 19,
|
|
2156
|
+
backgroundColor: ui.surface,
|
|
2157
|
+
...float,
|
|
2158
|
+
},
|
|
2159
|
+
iconCapsuleBtn: { width: 20, height: 20, alignItems: 'center', justifyContent: 'center' },
|
|
2160
|
+
// Lucy's chat as a small app icon, the twin of the Messages one beside it.
|
|
2161
|
+
chatAppIcon: {
|
|
2162
|
+
width: 18,
|
|
2163
|
+
height: 18,
|
|
2164
|
+
borderRadius: 5,
|
|
2165
|
+
backgroundColor: ui.accent,
|
|
2166
|
+
alignItems: 'center',
|
|
2167
|
+
justifyContent: 'center',
|
|
2168
|
+
},
|
|
2169
|
+
headerSide: { minWidth: 84 },
|
|
2170
|
+
// The web nav's cream once scrolled, with its faint line under it.
|
|
2171
|
+
headerFill: {
|
|
2172
|
+
backgroundColor: ui.bg,
|
|
2173
|
+
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
2174
|
+
borderBottomColor: ui.hairline,
|
|
2175
|
+
},
|
|
2176
|
+
|
|
2177
|
+
// type
|
|
2178
|
+
eyebrowRow: { flexDirection: 'row', alignItems: 'center', gap: 6, marginBottom: 8 },
|
|
2179
|
+
eyebrow: { ...type.groupLabel, fontWeight: '600' },
|
|
2180
|
+
eyebrowDark: { color: TIME_PEACH },
|
|
2181
|
+
heading: { ...type.title, fontSize: 24, lineHeight: 30 },
|
|
2182
|
+
headingLarge: { ...type.largeTitle, fontSize: 28, lineHeight: 34, letterSpacing: -0.6 },
|
|
2183
|
+
headingEm: { color: ui.accentText },
|
|
2184
|
+
headingDark: { color: '#FFFFFF' },
|
|
2185
|
+
headingEmDark: { color: '#FF8A3D' },
|
|
2186
|
+
lead: { ...type.callout, fontSize: 15.5, lineHeight: 22, marginTop: 8, marginBottom: 18 },
|
|
2187
|
+
body: { ...type.callout },
|
|
2188
|
+
bodyLead: { ...type.callout, fontSize: 16, lineHeight: 23, marginTop: 10, marginBottom: 22 },
|
|
2189
|
+
note: { ...type.footnote, fontSize: 12, lineHeight: 17, marginTop: 10 },
|
|
2190
|
+
|
|
2191
|
+
// hero
|
|
2192
|
+
heroZone: { paddingBottom: 8 },
|
|
2193
|
+
hero: { paddingHorizontal: PAD, paddingTop: 8, paddingBottom: 4 },
|
|
2194
|
+
halo: { width: 60, height: 60, marginTop: 14, alignItems: 'center', justifyContent: 'center' },
|
|
2195
|
+
haloGlow: { position: 'absolute', width: 120, height: 120, left: -30, top: -30 },
|
|
2196
|
+
haloTile: {
|
|
2197
|
+
width: 60,
|
|
2198
|
+
height: 60,
|
|
2199
|
+
borderRadius: 18,
|
|
2200
|
+
backgroundColor: ui.surface,
|
|
2201
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
2202
|
+
borderColor: ui.hairline,
|
|
2203
|
+
alignItems: 'center',
|
|
2204
|
+
justifyContent: 'center',
|
|
2205
|
+
...float,
|
|
2206
|
+
},
|
|
2207
|
+
eyebrowBox: { alignItems: 'center' },
|
|
2208
|
+
heroEyebrow: {
|
|
2209
|
+
fontSize: 12,
|
|
2210
|
+
lineHeight: 16,
|
|
2211
|
+
fontWeight: '700',
|
|
2212
|
+
letterSpacing: 1.6,
|
|
2213
|
+
textTransform: 'uppercase',
|
|
2214
|
+
color: ui.accentText,
|
|
2215
|
+
marginTop: 22,
|
|
2216
|
+
},
|
|
2217
|
+
composerRow: { flexDirection: 'row', alignItems: 'center', gap: 8, paddingLeft: 2 },
|
|
2218
|
+
composerHint: { ...type.footnote, flex: 1, color: ui.ink2 },
|
|
2219
|
+
ghostBox: { position: 'absolute', left: 0, right: 8, top: 9 },
|
|
2220
|
+
caretText: { color: ui.accent, fontWeight: '300' },
|
|
2221
|
+
tryHead: { paddingHorizontal: PAD + 4, marginTop: 26, marginBottom: 10, gap: 1 },
|
|
2222
|
+
card: {
|
|
2223
|
+
width: CARD_W,
|
|
2224
|
+
padding: 16,
|
|
2225
|
+
borderRadius: 20,
|
|
2226
|
+
backgroundColor: ui.surface,
|
|
2227
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
2228
|
+
borderColor: ui.hairline,
|
|
2229
|
+
...lift,
|
|
2230
|
+
},
|
|
2231
|
+
cardHead: { flexDirection: 'row', alignItems: 'center', gap: 12 },
|
|
2232
|
+
cardIcon: {
|
|
2233
|
+
width: 36,
|
|
2234
|
+
height: 36,
|
|
2235
|
+
borderRadius: 12,
|
|
2236
|
+
backgroundColor: ui.accentSoft,
|
|
2237
|
+
alignItems: 'center',
|
|
2238
|
+
justifyContent: 'center',
|
|
2239
|
+
},
|
|
2240
|
+
cardTitle: { ...type.headline, flex: 1, fontSize: 15.5, lineHeight: 20 },
|
|
2241
|
+
// A small "hand it over" arrow: the card sends this chore to Lucy.
|
|
2242
|
+
cardGo: {
|
|
2243
|
+
width: 28,
|
|
2244
|
+
height: 28,
|
|
2245
|
+
borderRadius: 14,
|
|
2246
|
+
backgroundColor: ui.fill,
|
|
2247
|
+
alignItems: 'center',
|
|
2248
|
+
justifyContent: 'center',
|
|
2249
|
+
transform: [{ rotate: '45deg' }],
|
|
2250
|
+
},
|
|
2251
|
+
cardBody: { ...type.footnote, fontSize: 13.5, lineHeight: 19, marginTop: 12 },
|
|
2252
|
+
fade: { position: 'absolute', top: 0, bottom: 0, width: 28 },
|
|
2253
|
+
ghost: { flexShrink: 1, fontSize: 15.5, lineHeight: 21, color: ui.muted },
|
|
2254
|
+
tryLabel: {
|
|
2255
|
+
fontSize: 17,
|
|
2256
|
+
lineHeight: 22,
|
|
2257
|
+
fontWeight: '600',
|
|
2258
|
+
color: ui.ink,
|
|
2259
|
+
paddingHorizontal: PAD + 4,
|
|
2260
|
+
marginTop: 32,
|
|
2261
|
+
marginBottom: 12,
|
|
2262
|
+
},
|
|
2263
|
+
tryRow: { paddingHorizontal: PAD, gap: 12, paddingBottom: 8 },
|
|
2264
|
+
channels: { paddingHorizontal: PAD + 4, marginTop: 14 },
|
|
2265
|
+
textCard: {
|
|
2266
|
+
marginTop: 24,
|
|
2267
|
+
marginHorizontal: PAD,
|
|
2268
|
+
borderRadius: 20,
|
|
2269
|
+
overflow: 'hidden',
|
|
2270
|
+
backgroundColor: ui.surface,
|
|
2271
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
2272
|
+
borderColor: ui.hairline,
|
|
2273
|
+
...lift,
|
|
2274
|
+
},
|
|
2275
|
+
textCardRow: { flexDirection: 'row', alignItems: 'center', gap: 12, paddingHorizontal: 16, paddingVertical: 14 },
|
|
2276
|
+
textCardTitle: { flex: 1, fontSize: 16, fontWeight: '600', letterSpacing: -0.2, color: ui.ink },
|
|
2277
|
+
textCardTrust: { paddingHorizontal: 16, paddingVertical: 12, backgroundColor: ui.okSoft },
|
|
2278
|
+
|
|
2279
|
+
// composer
|
|
2280
|
+
composer: {
|
|
2281
|
+
backgroundColor: ui.surface,
|
|
2282
|
+
borderRadius: 22,
|
|
2283
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
2284
|
+
borderColor: ui.hairline,
|
|
2285
|
+
paddingLeft: 16,
|
|
2286
|
+
paddingRight: 8,
|
|
2287
|
+
paddingTop: 6,
|
|
2288
|
+
paddingBottom: 8,
|
|
2289
|
+
...lift,
|
|
2290
|
+
},
|
|
2291
|
+
composerFocused: { borderColor: 'rgba(255,90,0,0.35)' },
|
|
2292
|
+
// Plan A's big mic, centred over the box.
|
|
2293
|
+
// The voice stage.
|
|
2294
|
+
stage: { paddingHorizontal: PAD, paddingTop: 16, paddingBottom: 16 },
|
|
2295
|
+
stageMiddle: { alignItems: 'center', marginTop: 8, marginBottom: 16 },
|
|
2296
|
+
stageTitle: {
|
|
2297
|
+
fontSize: 28,
|
|
2298
|
+
lineHeight: 34,
|
|
2299
|
+
fontWeight: '700',
|
|
2300
|
+
letterSpacing: -0.6,
|
|
2301
|
+
color: ui.ink,
|
|
2302
|
+
textAlign: 'center',
|
|
2303
|
+
marginTop: 8,
|
|
2304
|
+
},
|
|
2305
|
+
bigMic: { alignItems: 'center' },
|
|
2306
|
+
bigMicStage: { width: 176, height: 176, alignItems: 'center', justifyContent: 'center' },
|
|
2307
|
+
dial: { width: DIAL, height: DIAL, alignItems: 'center', justifyContent: 'center' },
|
|
2308
|
+
sphere: {
|
|
2309
|
+
width: SPHERE,
|
|
2310
|
+
height: SPHERE,
|
|
2311
|
+
borderRadius: SPHERE / 2,
|
|
2312
|
+
alignItems: 'center',
|
|
2313
|
+
justifyContent: 'center',
|
|
2314
|
+
overflow: 'visible',
|
|
2315
|
+
shadowColor: ui.accent,
|
|
2316
|
+
shadowOpacity: 0.35,
|
|
2317
|
+
shadowRadius: 20,
|
|
2318
|
+
shadowOffset: { width: 0, height: 10 },
|
|
2319
|
+
elevation: 8,
|
|
2320
|
+
},
|
|
2321
|
+
sphereRing: {
|
|
2322
|
+
position: 'absolute',
|
|
2323
|
+
width: SPHERE,
|
|
2324
|
+
height: SPHERE,
|
|
2325
|
+
borderRadius: SPHERE / 2,
|
|
2326
|
+
backgroundColor: ui.accent,
|
|
2327
|
+
},
|
|
2328
|
+
// The box under the big mic: a few lines tall, send inside at the foot once there is text.
|
|
2329
|
+
typeBox: {
|
|
2330
|
+
flexDirection: 'row',
|
|
2331
|
+
alignItems: 'flex-end',
|
|
2332
|
+
gap: 8,
|
|
2333
|
+
minHeight: 96,
|
|
2334
|
+
paddingLeft: 18,
|
|
2335
|
+
paddingRight: 10,
|
|
2336
|
+
paddingTop: 12,
|
|
2337
|
+
paddingBottom: 10,
|
|
2338
|
+
borderRadius: 22,
|
|
2339
|
+
backgroundColor: ui.surface,
|
|
2340
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
2341
|
+
borderColor: ui.hairline,
|
|
2342
|
+
...lift,
|
|
2343
|
+
},
|
|
2344
|
+
typeBoxInput: {
|
|
2345
|
+
flex: 1,
|
|
2346
|
+
alignSelf: 'stretch',
|
|
2347
|
+
fontSize: 15.5,
|
|
2348
|
+
lineHeight: 21,
|
|
2349
|
+
color: ui.ink,
|
|
2350
|
+
minHeight: 72,
|
|
2351
|
+
maxHeight: 140,
|
|
2352
|
+
paddingTop: 2,
|
|
2353
|
+
textAlignVertical: 'top',
|
|
2354
|
+
...field,
|
|
2355
|
+
},
|
|
2356
|
+
ring: { position: 'absolute' },
|
|
2357
|
+
hello: { fontSize: 15, lineHeight: 20, fontWeight: '600', color: ui.accentText, textAlign: 'center' },
|
|
2358
|
+
steps: { paddingHorizontal: PAD + 4, marginTop: 16 },
|
|
2359
|
+
step: { flexDirection: 'row', gap: 16 },
|
|
2360
|
+
stepRail: { width: 44, alignItems: 'center' },
|
|
2361
|
+
stepIcon: {
|
|
2362
|
+
width: 44,
|
|
2363
|
+
height: 44,
|
|
2364
|
+
borderRadius: 22,
|
|
2365
|
+
backgroundColor: ui.accentSoft,
|
|
2366
|
+
alignItems: 'center',
|
|
2367
|
+
justifyContent: 'center',
|
|
2368
|
+
},
|
|
2369
|
+
stepLine: { flex: 1, width: 2, marginVertical: 4, borderRadius: 1, backgroundColor: 'rgba(255,90,0,0.18)' },
|
|
2370
|
+
stepBody: { flex: 1, paddingTop: 10, paddingBottom: 24 },
|
|
2371
|
+
stepTitle: { ...type.headline, fontSize: 16, marginBottom: 4 },
|
|
2372
|
+
heroSub: { fontSize: 15, lineHeight: 20, color: ui.muted, marginTop: 8, textAlign: 'center' },
|
|
2373
|
+
onIt: {
|
|
2374
|
+
alignSelf: 'center',
|
|
2375
|
+
flexDirection: 'row',
|
|
2376
|
+
alignItems: 'center',
|
|
2377
|
+
gap: 8,
|
|
2378
|
+
marginTop: 12,
|
|
2379
|
+
height: 32,
|
|
2380
|
+
paddingHorizontal: 12,
|
|
2381
|
+
borderRadius: 16,
|
|
2382
|
+
backgroundColor: ui.accentSoft,
|
|
2383
|
+
},
|
|
2384
|
+
onItDot: { width: 8, height: 8, borderRadius: 4, backgroundColor: ui.accent },
|
|
2385
|
+
onItText: { fontSize: 13, fontWeight: '600', color: ui.accentText },
|
|
2386
|
+
ideaChipsScroll: { flexGrow: 0, marginHorizontal: -PAD, marginBottom: 12 },
|
|
2387
|
+
ideaChips: { flexDirection: 'row', gap: 8, paddingHorizontal: PAD },
|
|
2388
|
+
ideaChip: {
|
|
2389
|
+
flexDirection: 'row',
|
|
2390
|
+
alignItems: 'center',
|
|
2391
|
+
gap: 8,
|
|
2392
|
+
height: 40,
|
|
2393
|
+
paddingHorizontal: 16,
|
|
2394
|
+
borderRadius: 20,
|
|
2395
|
+
backgroundColor: ui.surface,
|
|
2396
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
2397
|
+
borderColor: 'rgba(255,90,0,0.18)',
|
|
2398
|
+
},
|
|
2399
|
+
ideaChipText: { fontSize: 13, fontWeight: '600', color: ui.ink },
|
|
2400
|
+
bigMicOuter: {
|
|
2401
|
+
width: 132,
|
|
2402
|
+
height: 132,
|
|
2403
|
+
borderRadius: 66,
|
|
2404
|
+
backgroundColor: ui.accentSoft,
|
|
2405
|
+
alignItems: 'center',
|
|
2406
|
+
justifyContent: 'center',
|
|
2407
|
+
},
|
|
2408
|
+
bigMicInner: {
|
|
2409
|
+
width: 108,
|
|
2410
|
+
height: 108,
|
|
2411
|
+
borderRadius: 54,
|
|
2412
|
+
backgroundColor: '#FFD9C2',
|
|
2413
|
+
alignItems: 'center',
|
|
2414
|
+
justifyContent: 'center',
|
|
2415
|
+
},
|
|
2416
|
+
bigMicLift: {
|
|
2417
|
+
borderRadius: 36,
|
|
2418
|
+
shadowColor: ui.accent,
|
|
2419
|
+
shadowOpacity: 0.35,
|
|
2420
|
+
shadowRadius: 14,
|
|
2421
|
+
shadowOffset: { width: 0, height: 8 },
|
|
2422
|
+
elevation: 6,
|
|
2423
|
+
},
|
|
2424
|
+
bigMicLabel: { ...type.headline, fontSize: 17, marginTop: 12 },
|
|
2425
|
+
bigMicSubRow: { flexDirection: 'row', alignItems: 'center', gap: 6, marginTop: 4 },
|
|
2426
|
+
// The slim typing line under the big mic.
|
|
2427
|
+
typeLine: {
|
|
2428
|
+
flexDirection: 'row',
|
|
2429
|
+
alignItems: 'flex-end',
|
|
2430
|
+
gap: 8,
|
|
2431
|
+
minHeight: 52,
|
|
2432
|
+
paddingLeft: 18,
|
|
2433
|
+
paddingRight: 8,
|
|
2434
|
+
paddingVertical: 8,
|
|
2435
|
+
borderRadius: 26,
|
|
2436
|
+
backgroundColor: ui.surface,
|
|
2437
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
2438
|
+
borderColor: ui.hairline,
|
|
2439
|
+
...lift,
|
|
2440
|
+
},
|
|
2441
|
+
pillListening: { backgroundColor: '#FFF6F0', borderColor: 'rgba(255,90,0,0.35)' },
|
|
2442
|
+
pillInput: {
|
|
2443
|
+
flex: 1,
|
|
2444
|
+
fontSize: 15.5,
|
|
2445
|
+
lineHeight: 21,
|
|
2446
|
+
color: ui.ink,
|
|
2447
|
+
minHeight: 36,
|
|
2448
|
+
maxHeight: 120,
|
|
2449
|
+
paddingTop: 7,
|
|
2450
|
+
paddingBottom: 7,
|
|
2451
|
+
...field,
|
|
2452
|
+
},
|
|
2453
|
+
pillHint: { ...type.footnote, color: ui.accentText, textAlign: 'center', marginTop: 8 },
|
|
2454
|
+
bigMicSub: { ...type.subhead, fontSize: 14.5, marginTop: 2 },
|
|
2455
|
+
composerInput: {
|
|
2456
|
+
fontSize: 15.5,
|
|
2457
|
+
lineHeight: 21,
|
|
2458
|
+
color: ui.ink,
|
|
2459
|
+
minHeight: 58,
|
|
2460
|
+
maxHeight: 140,
|
|
2461
|
+
paddingTop: 9,
|
|
2462
|
+
paddingBottom: 4,
|
|
2463
|
+
paddingRight: 8,
|
|
2464
|
+
...field,
|
|
2465
|
+
},
|
|
2466
|
+
composerNote: { ...type.footnote, textAlign: 'center', marginTop: 10 },
|
|
2467
|
+
send: { width: 36, height: 36, borderRadius: 18, alignItems: 'center', justifyContent: 'center' },
|
|
2468
|
+
|
|
2469
|
+
// chips & pills
|
|
2470
|
+
chip: {
|
|
2471
|
+
flexDirection: 'row',
|
|
2472
|
+
alignItems: 'center',
|
|
2473
|
+
gap: 6,
|
|
2474
|
+
paddingVertical: 8,
|
|
2475
|
+
paddingHorizontal: 13,
|
|
2476
|
+
borderRadius: radius.pill,
|
|
2477
|
+
backgroundColor: ui.surface,
|
|
2478
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
2479
|
+
borderColor: ui.hairline,
|
|
2480
|
+
},
|
|
2481
|
+
chipSmall: { paddingVertical: 6, paddingHorizontal: 12, gap: 6 },
|
|
2482
|
+
chipPressed: { backgroundColor: ui.accentSoft },
|
|
2483
|
+
chipText: { fontSize: 14, fontWeight: '500', color: ui.ink },
|
|
2484
|
+
chipTextSmall: { fontSize: 13, color: ui.ink2 },
|
|
2485
|
+
pill: {
|
|
2486
|
+
flexDirection: 'row',
|
|
2487
|
+
alignItems: 'center',
|
|
2488
|
+
gap: 8,
|
|
2489
|
+
paddingVertical: 9,
|
|
2490
|
+
paddingLeft: 9,
|
|
2491
|
+
paddingRight: 16,
|
|
2492
|
+
borderRadius: radius.pill,
|
|
2493
|
+
backgroundColor: ui.surface,
|
|
2494
|
+
...lift,
|
|
2495
|
+
},
|
|
2496
|
+
pillText: { fontSize: 15, fontWeight: '600', color: ui.ink },
|
|
2497
|
+
trust: { flexDirection: 'row', alignItems: 'center', gap: 6 },
|
|
2498
|
+
trustText: { ...type.footnote, flexShrink: 1 },
|
|
2499
|
+
|
|
2500
|
+
// strip
|
|
2501
|
+
strip: { marginTop: 32, gap: 8, paddingVertical: 4 },
|
|
2502
|
+
marquee: { overflow: 'hidden' },
|
|
2503
|
+
marqueeRow: { flexDirection: 'row', gap: 8, paddingRight: 8 },
|
|
2504
|
+
|
|
2505
|
+
// sections: a varied rhythm, roomy between topics and tight within them
|
|
2506
|
+
section: { paddingHorizontal: PAD + 4, paddingTop: 48, paddingBottom: 8 },
|
|
2507
|
+
sectionList: { paddingTop: 48 },
|
|
2508
|
+
sectionHead: { paddingHorizontal: PAD + 4, marginBottom: 4 },
|
|
2509
|
+
sectionHeadOnly: { paddingHorizontal: PAD + 4, paddingTop: 48, marginBottom: 16 },
|
|
2510
|
+
sectionTight: { paddingHorizontal: PAD, paddingTop: 32 },
|
|
2511
|
+
band: { backgroundColor: ui.soft, marginTop: 48, paddingTop: 40, paddingBottom: 32 },
|
|
2512
|
+
|
|
2513
|
+
// time back: the web's dark card
|
|
2514
|
+
timeCardShadow: { borderRadius: 24, backgroundColor: '#1A1714', ...float },
|
|
2515
|
+
timeCard: { borderRadius: 24, overflow: 'hidden' },
|
|
2516
|
+
timeLottie: { margin: 10, marginBottom: 0, borderRadius: 18, overflow: 'hidden', backgroundColor: '#FFF7F2' },
|
|
2517
|
+
timeLottieView: { width: '100%', aspectRatio: 1 },
|
|
2518
|
+
panelRow: { flexDirection: 'row', alignItems: 'baseline' },
|
|
2519
|
+
minutesPanel: {
|
|
2520
|
+
flexDirection: 'row',
|
|
2521
|
+
alignItems: 'center',
|
|
2522
|
+
gap: 18,
|
|
2523
|
+
marginTop: 16,
|
|
2524
|
+
padding: 16,
|
|
2525
|
+
borderRadius: radius.card,
|
|
2526
|
+
backgroundColor: ui.surface,
|
|
2527
|
+
...lift,
|
|
2528
|
+
},
|
|
2529
|
+
minutesOutOf: { ...type.caption, fontWeight: '400', marginTop: 6 },
|
|
2530
|
+
panelValue: {
|
|
2531
|
+
fontSize: 46,
|
|
2532
|
+
lineHeight: 52,
|
|
2533
|
+
fontWeight: '800',
|
|
2534
|
+
letterSpacing: -1.6,
|
|
2535
|
+
color: ui.ink,
|
|
2536
|
+
fontVariant: ['tabular-nums'],
|
|
2537
|
+
},
|
|
2538
|
+
panelUnit: { fontSize: 22, fontWeight: '800', letterSpacing: -0.5, color: ui.accent, marginLeft: 3 },
|
|
2539
|
+
panelLabel: { fontSize: 15, fontWeight: '600', color: ui.ink2, marginTop: -2 },
|
|
2540
|
+
timeCopy: { padding: 16, paddingTop: 14, paddingBottom: 18 },
|
|
2541
|
+
timeTitle: { fontSize: 21, lineHeight: 26, letterSpacing: -0.3 },
|
|
2542
|
+
stats: { flexDirection: 'row', gap: 12, marginTop: 16 },
|
|
2543
|
+
stat: {
|
|
2544
|
+
flex: 1,
|
|
2545
|
+
paddingTop: 10,
|
|
2546
|
+
borderTopWidth: StyleSheet.hairlineWidth,
|
|
2547
|
+
borderTopColor: 'rgba(255,255,255,0.16)',
|
|
2548
|
+
},
|
|
2549
|
+
statValue: {
|
|
2550
|
+
fontSize: 24,
|
|
2551
|
+
lineHeight: 29,
|
|
2552
|
+
fontWeight: '600',
|
|
2553
|
+
letterSpacing: -0.8,
|
|
2554
|
+
color: TIME_PEACH,
|
|
2555
|
+
fontVariant: ['tabular-nums'],
|
|
2556
|
+
},
|
|
2557
|
+
statRow: { flexDirection: 'row', alignItems: 'baseline' },
|
|
2558
|
+
statUnit: { fontSize: 12.5, fontWeight: '500', color: TIME_PEACH },
|
|
2559
|
+
statLabel: { ...type.caption, fontWeight: '400', fontSize: 12, color: TIME_LABEL, marginTop: 3 },
|
|
2560
|
+
timeNote: { ...type.footnote, fontSize: 13, lineHeight: 19, color: TIME_LABEL, marginTop: 14 },
|
|
2561
|
+
|
|
2562
|
+
// calls
|
|
2563
|
+
callCard: {
|
|
2564
|
+
borderRadius: radius.card + 4,
|
|
2565
|
+
backgroundColor: ui.surface,
|
|
2566
|
+
paddingHorizontal: 18,
|
|
2567
|
+
paddingVertical: 16,
|
|
2568
|
+
...float,
|
|
2569
|
+
},
|
|
2570
|
+
callHead: {
|
|
2571
|
+
flexDirection: 'row',
|
|
2572
|
+
alignItems: 'center',
|
|
2573
|
+
gap: 12,
|
|
2574
|
+
paddingBottom: 14,
|
|
2575
|
+
marginBottom: 6,
|
|
2576
|
+
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
2577
|
+
borderBottomColor: ui.hairline,
|
|
2578
|
+
},
|
|
2579
|
+
callAvatar: {
|
|
2580
|
+
width: 40,
|
|
2581
|
+
height: 40,
|
|
2582
|
+
borderRadius: 20,
|
|
2583
|
+
backgroundColor: ui.accentSoft,
|
|
2584
|
+
alignItems: 'center',
|
|
2585
|
+
justifyContent: 'center',
|
|
2586
|
+
},
|
|
2587
|
+
callTitle: { ...type.headline, fontSize: 16 },
|
|
2588
|
+
callSub: { ...type.footnote, fontVariant: ['tabular-nums'] },
|
|
2589
|
+
live: {
|
|
2590
|
+
flexDirection: 'row',
|
|
2591
|
+
alignItems: 'center',
|
|
2592
|
+
gap: 6,
|
|
2593
|
+
paddingVertical: 5,
|
|
2594
|
+
paddingHorizontal: 10,
|
|
2595
|
+
borderRadius: radius.pill,
|
|
2596
|
+
backgroundColor: ui.okSoft,
|
|
2597
|
+
},
|
|
2598
|
+
liveDotWrap: { width: 8, height: 8, alignItems: 'center', justifyContent: 'center' },
|
|
2599
|
+
liveDot: { width: 8, height: 8, borderRadius: 4, backgroundColor: CALL_GREEN },
|
|
2600
|
+
liveRing: { position: 'absolute', width: 8, height: 8, borderRadius: 4, backgroundColor: CALL_GREEN },
|
|
2601
|
+
liveText: { fontSize: 12.5, fontWeight: '600', color: ui.ok },
|
|
2602
|
+
callStep: { flexDirection: 'row', gap: 12, paddingVertical: 9 },
|
|
2603
|
+
callDot: {
|
|
2604
|
+
width: 22,
|
|
2605
|
+
height: 22,
|
|
2606
|
+
borderRadius: 11,
|
|
2607
|
+
borderWidth: 1.5,
|
|
2608
|
+
borderColor: '#E3DCD3',
|
|
2609
|
+
backgroundColor: ui.surface,
|
|
2610
|
+
alignItems: 'center',
|
|
2611
|
+
justifyContent: 'center',
|
|
2612
|
+
marginTop: 1,
|
|
2613
|
+
},
|
|
2614
|
+
callLabel: { fontSize: 15, fontWeight: '500', color: ui.ink },
|
|
2615
|
+
callDetail: { ...type.footnote, marginTop: 1 },
|
|
2616
|
+
reels: { flexDirection: 'row', alignItems: 'flex-start', paddingHorizontal: PAD + 4, gap: 14, marginTop: 24 },
|
|
2617
|
+
reel: { flex: 1 },
|
|
2618
|
+
|
|
2619
|
+
// iMessage
|
|
2620
|
+
phone: {
|
|
2621
|
+
borderRadius: 22,
|
|
2622
|
+
backgroundColor: ui.bg,
|
|
2623
|
+
paddingHorizontal: 12,
|
|
2624
|
+
paddingTop: 12,
|
|
2625
|
+
paddingBottom: 10,
|
|
2626
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
2627
|
+
borderColor: ui.hairline,
|
|
2628
|
+
},
|
|
2629
|
+
phoneHead: { alignItems: 'center', paddingBottom: 6, marginBottom: 4 },
|
|
2630
|
+
phoneAvatar: {
|
|
2631
|
+
width: 34,
|
|
2632
|
+
height: 34,
|
|
2633
|
+
borderRadius: 17,
|
|
2634
|
+
backgroundColor: ui.accentSoft,
|
|
2635
|
+
alignItems: 'center',
|
|
2636
|
+
justifyContent: 'center',
|
|
2637
|
+
},
|
|
2638
|
+
phoneName: { fontSize: 13, fontWeight: '600', color: ui.ink, marginTop: 3 },
|
|
2639
|
+
phoneDay: { ...type.caption, fontWeight: '400', marginTop: 2 },
|
|
2640
|
+
bubble: { maxWidth: '82%', paddingVertical: 7, paddingHorizontal: 12, borderRadius: 17, marginTop: 5 },
|
|
2641
|
+
bubbleYou: { alignSelf: 'flex-end', backgroundColor: ui.bubbleYou },
|
|
2642
|
+
bubbleLucy: { alignSelf: 'flex-start', backgroundColor: ui.bubbleLucy },
|
|
2643
|
+
bubbleText: { fontSize: 14, lineHeight: 19, color: ui.ink },
|
|
2644
|
+
delivered: { alignSelf: 'flex-end', ...type.caption, fontWeight: '400', marginTop: 4 },
|
|
2645
|
+
typing: { flexDirection: 'row', alignItems: 'center', paddingVertical: 5, paddingHorizontal: 11 },
|
|
2646
|
+
textSteps: { gap: 12, marginTop: 18 },
|
|
2647
|
+
textStep: { flexDirection: 'row', gap: 12 },
|
|
2648
|
+
textN: {
|
|
2649
|
+
width: 26,
|
|
2650
|
+
height: 26,
|
|
2651
|
+
borderRadius: 13,
|
|
2652
|
+
backgroundColor: ui.fill,
|
|
2653
|
+
alignItems: 'center',
|
|
2654
|
+
justifyContent: 'center',
|
|
2655
|
+
},
|
|
2656
|
+
textNText: { fontSize: 13, fontWeight: '700', color: ui.ink },
|
|
2657
|
+
textStepTitle: { ...type.headline, fontSize: 15, marginBottom: 1 },
|
|
2658
|
+
|
|
2659
|
+
// buttons
|
|
2660
|
+
btn: {
|
|
2661
|
+
flexDirection: 'row',
|
|
2662
|
+
alignItems: 'center',
|
|
2663
|
+
justifyContent: 'center',
|
|
2664
|
+
gap: 10,
|
|
2665
|
+
marginTop: 24,
|
|
2666
|
+
height: 50,
|
|
2667
|
+
borderRadius: radius.pill,
|
|
2668
|
+
backgroundColor: ui.ink,
|
|
2669
|
+
},
|
|
2670
|
+
btnPressed: { opacity: 0.88 },
|
|
2671
|
+
btnText: { fontSize: 16, fontWeight: '600', color: ui.surface },
|
|
2672
|
+
|
|
2673
|
+
// areas
|
|
2674
|
+
areas: { paddingHorizontal: PAD, gap: 12, paddingBottom: 10 },
|
|
2675
|
+
area: { borderRadius: radius.card + 4, backgroundColor: ui.surface, padding: 16, ...lift },
|
|
2676
|
+
areaTitle: { ...type.headline, fontSize: 19, marginBottom: 4 },
|
|
2677
|
+
areaChips: { flexDirection: 'row', flexWrap: 'wrap', gap: 7, marginTop: 14 },
|
|
2678
|
+
|
|
2679
|
+
// minutes
|
|
2680
|
+
minutesHint: { ...type.subhead, marginTop: 16 },
|
|
2681
|
+
minutes: { marginTop: 10, borderRadius: radius.group, backgroundColor: ui.surface, overflow: 'hidden' },
|
|
2682
|
+
minuteRow: {
|
|
2683
|
+
flexDirection: 'row',
|
|
2684
|
+
alignItems: 'center',
|
|
2685
|
+
gap: 12,
|
|
2686
|
+
paddingVertical: 12,
|
|
2687
|
+
paddingHorizontal: 14,
|
|
2688
|
+
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
2689
|
+
borderBottomColor: ui.hairline,
|
|
2690
|
+
},
|
|
2691
|
+
minuteLast: { borderBottomWidth: 0 },
|
|
2692
|
+
swatch: { width: 12, height: 12, borderRadius: 4, borderWidth: 1, borderColor: 'rgba(90,45,10,0.1)' },
|
|
2693
|
+
swatchNone: { backgroundColor: 'transparent' },
|
|
2694
|
+
minuteOff: { color: ui.muted, textDecorationLine: 'line-through' },
|
|
2695
|
+
minuteCheck: {
|
|
2696
|
+
width: 22,
|
|
2697
|
+
height: 22,
|
|
2698
|
+
borderRadius: 11,
|
|
2699
|
+
borderWidth: 1.5,
|
|
2700
|
+
borderColor: '#E3DCD3',
|
|
2701
|
+
backgroundColor: ui.surface,
|
|
2702
|
+
alignItems: 'center',
|
|
2703
|
+
justifyContent: 'center',
|
|
2704
|
+
},
|
|
2705
|
+
minuteCheckOn: { backgroundColor: CALL_GREEN, borderColor: CALL_GREEN },
|
|
2706
|
+
minutesTotal: { marginTop: 14 },
|
|
2707
|
+
minutesTotalText: { ...type.callout, fontSize: 15 },
|
|
2708
|
+
minutesTotalB: { fontWeight: '600', color: ui.accentText, fontVariant: ['tabular-nums'] },
|
|
2709
|
+
minuteTop: { flexDirection: 'row', justifyContent: 'space-between' },
|
|
2710
|
+
minuteLabel: { fontSize: 15, fontWeight: '500', color: ui.ink },
|
|
2711
|
+
minuteValue: { fontSize: 14, fontWeight: '600', color: ui.ink, fontVariant: ['tabular-nums'] },
|
|
2712
|
+
bar: { height: 8, borderRadius: radius.pill, backgroundColor: ui.fill, overflow: 'hidden' },
|
|
2713
|
+
barFill: { height: '100%', borderRadius: radius.pill },
|
|
2714
|
+
|
|
2715
|
+
// faq
|
|
2716
|
+
faqs: {
|
|
2717
|
+
marginTop: 16,
|
|
2718
|
+
marginHorizontal: PAD,
|
|
2719
|
+
borderRadius: 20,
|
|
2720
|
+
overflow: 'hidden',
|
|
2721
|
+
backgroundColor: ui.surface,
|
|
2722
|
+
...lift,
|
|
2723
|
+
},
|
|
2724
|
+
faq: { paddingHorizontal: 16, borderBottomWidth: StyleSheet.hairlineWidth, borderBottomColor: ui.hairline },
|
|
2725
|
+
faqQ: { flexDirection: 'row', alignItems: 'center', gap: 12, paddingVertical: 16 },
|
|
2726
|
+
faqQText: { ...type.headline, flex: 1, fontSize: 16 },
|
|
2727
|
+
faqIcon: {
|
|
2728
|
+
width: 28,
|
|
2729
|
+
height: 28,
|
|
2730
|
+
borderRadius: 14,
|
|
2731
|
+
backgroundColor: ui.fill,
|
|
2732
|
+
alignItems: 'center',
|
|
2733
|
+
justifyContent: 'center',
|
|
2734
|
+
},
|
|
2735
|
+
faqA: { ...type.callout, paddingBottom: 16, marginTop: -4 },
|
|
2736
|
+
|
|
2737
|
+
// final
|
|
2738
|
+
final: { paddingHorizontal: PAD, paddingTop: 36 },
|
|
2739
|
+
finalChannels: { alignSelf: 'stretch', alignItems: 'center', gap: 8, marginTop: 14 },
|
|
2740
|
+
finalTitle: { fontSize: 21, lineHeight: 27, marginTop: 12, marginBottom: 16 },
|
|
2741
|
+
finalShadow: { borderRadius: 24, backgroundColor: ui.surface, ...float },
|
|
2742
|
+
finalCard: {
|
|
2743
|
+
alignItems: 'center',
|
|
2744
|
+
borderRadius: 24,
|
|
2745
|
+
overflow: 'hidden',
|
|
2746
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
2747
|
+
borderColor: ui.hairline,
|
|
2748
|
+
paddingHorizontal: 16,
|
|
2749
|
+
paddingTop: 24,
|
|
2750
|
+
paddingBottom: 18,
|
|
2751
|
+
},
|
|
2752
|
+
|
|
2753
|
+
// yantra
|
|
2754
|
+
yantraCard: { borderRadius: radius.card + 4, padding: 16, backgroundColor: ui.surface, ...lift },
|
|
2755
|
+
yantraHead: { flexDirection: 'row', alignItems: 'center', gap: 12 },
|
|
2756
|
+
yantraTitle: { flex: 1, fontSize: 21, lineHeight: 26 },
|
|
2757
|
+
yantraIcon: {
|
|
2758
|
+
width: 40,
|
|
2759
|
+
height: 40,
|
|
2760
|
+
borderRadius: 12,
|
|
2761
|
+
backgroundColor: ui.fill,
|
|
2762
|
+
alignItems: 'center',
|
|
2763
|
+
justifyContent: 'center',
|
|
2764
|
+
},
|
|
2765
|
+
yantraKicker: { ...type.groupLabel, fontWeight: '600' },
|
|
2766
|
+
|
|
2767
|
+
// footer
|
|
2768
|
+
footer: { alignItems: 'center', paddingHorizontal: 28, paddingTop: 44, paddingBottom: 12 },
|
|
2769
|
+
footerRule: { width: 36, height: 3, borderRadius: 2, backgroundColor: ui.hairline, marginBottom: 28 },
|
|
2770
|
+
footerName: { ...type.headline, marginTop: 10 },
|
|
2771
|
+
footerTag: { ...type.subhead, marginTop: 2 },
|
|
2772
|
+
footnote: { ...type.caption, fontWeight: '400', fontSize: 11, lineHeight: 16, textAlign: 'center', marginTop: 18 },
|
|
2773
|
+
});
|