@adminide-stack/clock-tik-mobile 0.0.0-stage → 12.0.37-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-flow/data/pending-insights.jsonl +43 -0
- package/.claude-flow/sessions/session-1794323376548.json +14 -0
- package/CHANGELOG.md +41 -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 +45 -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 +27 -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 +2715 -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 +188 -0
- package/src/__tests__/choresList.test.ts +100 -0
- package/src/__tests__/connectLink.test.ts +21 -0
- package/src/__tests__/content.test.ts +54 -0
- package/src/__tests__/dictation.test.ts +186 -0
- package/src/__tests__/envConfig.test.ts +14 -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 +75 -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 +50 -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 +2776 -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,261 @@
|
|
|
1
|
+
import {jsxs,jsx,Fragment}from'react/jsx-runtime';import {useState,useRef,useCallback,useEffect}from'react';import {AppState,Platform,StyleSheet,View,Pressable,Text,ActivityIndicator}from'react-native';import {Ionicons}from'@expo/vector-icons';import {useSafeAreaInsets}from'react-native-safe-area-context';import {Mark}from'./Logo.js';import {BottomSheet}from'./BottomSheet.js';import {MessagesAppIcon}from'./MessagesAppIcon.js';import {Button}from'./ui.js';import {MESSAGES_APP}from'../imessage/platform.js';import {openMessages}from'../imessage/openMessages.js';import {ui,type,radius,PAD}from'../theme/muse.js';import {fetchTextLink,LUCY_GREETING,TextLinkError}from'../imessage/textLink.js';var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
const RATE_LIMITED = "That was a lot of tries in a minute. Give it a moment, then try again.";
|
|
18
|
+
const FAILED = `We couldn\u2019t get your ${MESSAGES_APP} link just now. Try again in a moment.`;
|
|
19
|
+
const SIGNED_OUT = "Your sign-in ran out. Sign in again, then try once more.";
|
|
20
|
+
const RECHECK_MS = 15e3;
|
|
21
|
+
const GREETING_SHOWN = `\u201C${LUCY_GREETING}\u201D`;
|
|
22
|
+
const REACH = Platform.OS === "android" ? "sms" : "imessage";
|
|
23
|
+
function messageFor(err) {
|
|
24
|
+
if (err instanceof TextLinkError) {
|
|
25
|
+
if (err.kind === "rate-limited")
|
|
26
|
+
return {
|
|
27
|
+
message: RATE_LIMITED
|
|
28
|
+
};
|
|
29
|
+
if (err.kind === "signed-out")
|
|
30
|
+
return {
|
|
31
|
+
message: SIGNED_OUT,
|
|
32
|
+
signedOut: true
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
message: FAILED
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function Steps() {
|
|
40
|
+
const steps = ["Tap Open Messages", `Send ${GREETING_SHOWN}`, "Lucy texts back"];
|
|
41
|
+
return /* @__PURE__ */ jsx(View, { style: styles.steps, accessibilityRole: "list", accessibilityLabel: "How it works", children: steps.map((step, i) => /* @__PURE__ */ jsxs(View, { style: styles.step, children: [
|
|
42
|
+
/* @__PURE__ */ jsx(View, { style: styles.stepN, children: /* @__PURE__ */ jsx(Text, { style: styles.stepNText, children: i + 1 }) }),
|
|
43
|
+
/* @__PURE__ */ jsx(Text, { style: styles.stepText, children: step })
|
|
44
|
+
] }, step)) });
|
|
45
|
+
}
|
|
46
|
+
function ImessageSheet({
|
|
47
|
+
visible,
|
|
48
|
+
message,
|
|
49
|
+
onClose,
|
|
50
|
+
onChatHere,
|
|
51
|
+
onSignIn
|
|
52
|
+
}) {
|
|
53
|
+
var _a;
|
|
54
|
+
const insets = useSafeAreaInsets();
|
|
55
|
+
const [state, setState] = useState({
|
|
56
|
+
status: "loading"
|
|
57
|
+
});
|
|
58
|
+
const abort = useRef(null);
|
|
59
|
+
const lastLoad = useRef(0);
|
|
60
|
+
const load = useCallback(() => {
|
|
61
|
+
var _a2;
|
|
62
|
+
(_a2 = abort.current) == null ? void 0 : _a2.abort();
|
|
63
|
+
const ctrl = new AbortController();
|
|
64
|
+
abort.current = ctrl;
|
|
65
|
+
lastLoad.current = Date.now();
|
|
66
|
+
setState((prev) => prev.status === "ready" ? prev : {
|
|
67
|
+
status: "loading"
|
|
68
|
+
});
|
|
69
|
+
fetchTextLink(REACH, {
|
|
70
|
+
message,
|
|
71
|
+
signal: ctrl.signal
|
|
72
|
+
}).then((link2) => !ctrl.signal.aborted && setState({
|
|
73
|
+
status: "ready",
|
|
74
|
+
link: link2
|
|
75
|
+
})).catch((err) => !ctrl.signal.aborted && setState(__spreadValues({
|
|
76
|
+
status: "error"
|
|
77
|
+
}, messageFor(err))));
|
|
78
|
+
}, [message]);
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
var _a2;
|
|
81
|
+
if (!visible) {
|
|
82
|
+
(_a2 = abort.current) == null ? void 0 : _a2.abort();
|
|
83
|
+
setState({
|
|
84
|
+
status: "loading"
|
|
85
|
+
});
|
|
86
|
+
return void 0;
|
|
87
|
+
}
|
|
88
|
+
load();
|
|
89
|
+
const sub = AppState.addEventListener("change", (s) => {
|
|
90
|
+
if (s === "active" && Date.now() - lastLoad.current > RECHECK_MS)
|
|
91
|
+
load();
|
|
92
|
+
});
|
|
93
|
+
return () => {
|
|
94
|
+
var _a3;
|
|
95
|
+
sub.remove();
|
|
96
|
+
(_a3 = abort.current) == null ? void 0 : _a3.abort();
|
|
97
|
+
};
|
|
98
|
+
}, [visible, load]);
|
|
99
|
+
const link = state.status === "ready" ? state.link : null;
|
|
100
|
+
const href = (_a = link == null ? void 0 : link.href) != null ? _a : null;
|
|
101
|
+
const android = Platform.OS === "android";
|
|
102
|
+
const title = android ? "Text Lucy from Messages" : "Text Lucy on iMessage";
|
|
103
|
+
const ready = (message == null ? void 0 : message.trim()) ? "your chore" : GREETING_SHOWN;
|
|
104
|
+
const onOpenMessages = async () => {
|
|
105
|
+
if (!href || !(link == null ? void 0 : link.to) || link.body === null)
|
|
106
|
+
return;
|
|
107
|
+
const ok = await openMessages({
|
|
108
|
+
to: link.to,
|
|
109
|
+
body: link.body,
|
|
110
|
+
href
|
|
111
|
+
});
|
|
112
|
+
if (ok)
|
|
113
|
+
onClose();
|
|
114
|
+
else
|
|
115
|
+
setState({
|
|
116
|
+
status: "error",
|
|
117
|
+
message: "Messages couldn\u2019t open on this phone. Chat with Lucy here instead."
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
return /* @__PURE__ */ jsxs(BottomSheet, { visible, onClose, style: [styles.card, {
|
|
121
|
+
paddingBottom: Math.max(insets.bottom, 14) + 8
|
|
122
|
+
}], children: [
|
|
123
|
+
/* @__PURE__ */ jsx(View, { style: styles.grabber }),
|
|
124
|
+
/* @__PURE__ */ jsx(Pressable, { onPress: onClose, hitSlop: 10, accessibilityRole: "button", accessibilityLabel: "Close", style: styles.close, children: /* @__PURE__ */ jsx(Ionicons, { name: "close", size: 18, color: ui.ink2 }) }),
|
|
125
|
+
/* @__PURE__ */ jsxs(View, { style: styles.badge, accessibilityElementsHidden: true, importantForAccessibility: "no", children: [
|
|
126
|
+
/* @__PURE__ */ jsx(MessagesAppIcon, { size: 56 }),
|
|
127
|
+
/* @__PURE__ */ jsx(View, { style: styles.badgeMark, children: /* @__PURE__ */ jsx(Mark, { size: 17 }) })
|
|
128
|
+
] }),
|
|
129
|
+
/* @__PURE__ */ jsx(Text, { accessibilityRole: "header", style: [type.title, styles.center], children: title }),
|
|
130
|
+
/* @__PURE__ */ jsx(Text, { style: [type.callout, styles.center, styles.body], children: "Lucy answers in Messages, like any other text. Hand her a chore from wherever you are." }),
|
|
131
|
+
/* @__PURE__ */ jsx(View, { style: styles.content, accessibilityLiveRegion: "polite", children: state.status === "error" ? /* @__PURE__ */ jsxs(View, { style: styles.note, children: [
|
|
132
|
+
/* @__PURE__ */ jsx(Text, { style: [type.callout, styles.center], children: state.message }),
|
|
133
|
+
/* @__PURE__ */ jsx(Button, { label: state.signedOut ? "Sign in" : "Try again", icon: state.signedOut ? "log-in-outline" : "refresh", variant: "secondary", onPress: state.signedOut ? onSignIn : load, style: styles.small })
|
|
134
|
+
] }) : state.status === "loading" ? /* @__PURE__ */ jsxs(View, { style: styles.loading, children: [
|
|
135
|
+
/* @__PURE__ */ jsx(ActivityIndicator, { color: ui.accent }),
|
|
136
|
+
/* @__PURE__ */ jsx(Text, { style: [type.footnote, styles.center], children: `Getting your ${MESSAGES_APP} link\u2026` })
|
|
137
|
+
] }) : !href ? /* @__PURE__ */ jsxs(View, { style: styles.note, children: [
|
|
138
|
+
/* @__PURE__ */ jsx(Text, { style: [type.callout, styles.center], children: (link == null ? void 0 : link.reach) === "sms" && !link.smsAvailable ? "Texting Lucy from an Android phone isn\u2019t open yet. Chat with her here instead." : `Lucy\u2019s ${MESSAGES_APP} line isn\u2019t answering right now. Try again in a minute, or chat with her here.` }),
|
|
139
|
+
/* @__PURE__ */ jsx(Button, { label: "Try again", icon: "refresh", variant: "secondary", onPress: load, style: styles.small })
|
|
140
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
141
|
+
(link == null ? void 0 : link.linked) ? null : /* @__PURE__ */ jsx(Steps, {}),
|
|
142
|
+
/* @__PURE__ */ jsx(View, { accessibilityHint: `Opens Messages with ${ready} ready to send`, children: /* @__PURE__ */ jsx(Button, { label: "Open Messages", icon: "chatbubble", onPress: onOpenMessages }) }),
|
|
143
|
+
/* @__PURE__ */ jsx(Text, { style: [type.footnote, styles.center, styles.hint], children: (link == null ? void 0 : link.linked) ? "Your phone already texts Lucy. Just tap send." : `Messages opens with ${ready} ready. Send it, and this phone is linked to your account.` })
|
|
144
|
+
] }) }),
|
|
145
|
+
/* @__PURE__ */ jsx(Button, { label: "Chat with Lucy here instead", icon: "chatbox-ellipses-outline", variant: "secondary", onPress: onChatHere, style: styles.chatHere }),
|
|
146
|
+
/* @__PURE__ */ jsx(Text, { style: [type.caption, styles.center, styles.fine], children: "Message and data rates may apply." })
|
|
147
|
+
] });
|
|
148
|
+
}
|
|
149
|
+
const styles = StyleSheet.create({
|
|
150
|
+
card: {
|
|
151
|
+
backgroundColor: ui.surface,
|
|
152
|
+
borderTopLeftRadius: 24,
|
|
153
|
+
borderTopRightRadius: 24,
|
|
154
|
+
paddingHorizontal: PAD + 4,
|
|
155
|
+
paddingTop: 10,
|
|
156
|
+
alignItems: "stretch"
|
|
157
|
+
},
|
|
158
|
+
grabber: {
|
|
159
|
+
alignSelf: "center",
|
|
160
|
+
width: 36,
|
|
161
|
+
height: 5,
|
|
162
|
+
borderRadius: 3,
|
|
163
|
+
backgroundColor: ui.fill,
|
|
164
|
+
marginBottom: 14
|
|
165
|
+
},
|
|
166
|
+
close: {
|
|
167
|
+
position: "absolute",
|
|
168
|
+
top: 16,
|
|
169
|
+
right: 16,
|
|
170
|
+
width: 30,
|
|
171
|
+
height: 30,
|
|
172
|
+
borderRadius: 15,
|
|
173
|
+
backgroundColor: ui.fill,
|
|
174
|
+
alignItems: "center",
|
|
175
|
+
justifyContent: "center"
|
|
176
|
+
},
|
|
177
|
+
center: {
|
|
178
|
+
textAlign: "center"
|
|
179
|
+
},
|
|
180
|
+
badge: {
|
|
181
|
+
alignSelf: "center",
|
|
182
|
+
width: 62,
|
|
183
|
+
height: 62,
|
|
184
|
+
marginBottom: 14
|
|
185
|
+
},
|
|
186
|
+
badgeMark: {
|
|
187
|
+
position: "absolute",
|
|
188
|
+
right: -2,
|
|
189
|
+
bottom: -2,
|
|
190
|
+
width: 26,
|
|
191
|
+
height: 26,
|
|
192
|
+
borderRadius: 13,
|
|
193
|
+
backgroundColor: ui.surface,
|
|
194
|
+
alignItems: "center",
|
|
195
|
+
justifyContent: "center"
|
|
196
|
+
},
|
|
197
|
+
body: {
|
|
198
|
+
marginTop: 6,
|
|
199
|
+
color: ui.muted
|
|
200
|
+
},
|
|
201
|
+
content: {
|
|
202
|
+
marginTop: 20,
|
|
203
|
+
minHeight: 96,
|
|
204
|
+
justifyContent: "center"
|
|
205
|
+
},
|
|
206
|
+
loading: {
|
|
207
|
+
alignItems: "center",
|
|
208
|
+
gap: 10
|
|
209
|
+
},
|
|
210
|
+
note: {
|
|
211
|
+
alignItems: "center",
|
|
212
|
+
gap: 14
|
|
213
|
+
},
|
|
214
|
+
small: {
|
|
215
|
+
height: 42
|
|
216
|
+
},
|
|
217
|
+
hint: {
|
|
218
|
+
marginTop: 10
|
|
219
|
+
},
|
|
220
|
+
steps: {
|
|
221
|
+
flexDirection: "row",
|
|
222
|
+
justifyContent: "center",
|
|
223
|
+
flexWrap: "wrap",
|
|
224
|
+
gap: 8,
|
|
225
|
+
marginBottom: 16
|
|
226
|
+
},
|
|
227
|
+
step: {
|
|
228
|
+
flexDirection: "row",
|
|
229
|
+
alignItems: "center",
|
|
230
|
+
gap: 6,
|
|
231
|
+
paddingVertical: 6,
|
|
232
|
+
paddingLeft: 6,
|
|
233
|
+
paddingRight: 11,
|
|
234
|
+
borderRadius: radius.pill,
|
|
235
|
+
backgroundColor: ui.fill
|
|
236
|
+
},
|
|
237
|
+
stepN: {
|
|
238
|
+
width: 20,
|
|
239
|
+
height: 20,
|
|
240
|
+
borderRadius: 10,
|
|
241
|
+
backgroundColor: ui.accentSoft,
|
|
242
|
+
alignItems: "center",
|
|
243
|
+
justifyContent: "center"
|
|
244
|
+
},
|
|
245
|
+
stepNText: {
|
|
246
|
+
fontSize: 11,
|
|
247
|
+
fontWeight: "700",
|
|
248
|
+
color: ui.accentText
|
|
249
|
+
},
|
|
250
|
+
stepText: {
|
|
251
|
+
fontSize: 13,
|
|
252
|
+
fontWeight: "500",
|
|
253
|
+
color: ui.ink2
|
|
254
|
+
},
|
|
255
|
+
chatHere: {
|
|
256
|
+
marginTop: 16
|
|
257
|
+
},
|
|
258
|
+
fine: {
|
|
259
|
+
marginTop: 12
|
|
260
|
+
}
|
|
261
|
+
});export{ImessageSheet};//# sourceMappingURL=ImessageSheet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImessageSheet.js","sources":["../../src/components/ImessageSheet.tsx"],"sourcesContent":["/**\n * \"Text Lucy on iMessage\" for someone signed in, as a Muse-style approval sheet rising from the bottom: the web home's dialog (browser src/pages/Home/imessage/\n * ImessageDialog.tsx), on the phone: it gets this person's link (imessage/textLink.ts) and Open Messages opens\n * Messages at Lucy's line with \"Hi Lucy\" ready, carrying the hidden one-time code that links this phone to their\n * account. On a phone there is no QR code to scan: the phone in the hand is the one that texts.\n */\nimport React, { useCallback, useEffect, useRef, useState } from 'react';\nimport { ActivityIndicator, AppState, Platform, Pressable, StyleSheet, Text, View } from 'react-native';\nimport { Ionicons } from '@expo/vector-icons';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\nimport { Mark } from './Logo';\nimport { BottomSheet } from './BottomSheet';\nimport { MessagesAppIcon } from './MessagesAppIcon';\nimport { Button } from './ui';\nimport { MESSAGES_APP } from '../imessage/platform';\nimport { openMessages } from '../imessage/openMessages';\nimport { PAD, radius, type, ui } from '../theme/muse';\nimport { fetchTextLink, LUCY_GREETING, TextLinkError, type TextLink, type TextReach } from '../imessage/textLink';\n\ntype State =\n | { status: 'loading' }\n | { status: 'ready'; link: TextLink }\n | { status: 'error'; message: string; signedOut?: boolean };\n\nconst RATE_LIMITED = 'That was a lot of tries in a minute. Give it a moment, then try again.';\nconst FAILED = `We couldn’t get your ${MESSAGES_APP} link just now. Try again in a moment.`;\nconst SIGNED_OUT = 'Your sign-in ran out. Sign in again, then try once more.';\n/** Look again at most this often when the person comes back to the app (e.g. after sending from Messages). */\nconst RECHECK_MS = 15_000;\nconst GREETING_SHOWN = `“${LUCY_GREETING}”`;\n\n/** An iPhone texts Lucy's iMessage handle; an Android phone texts the number that forwards to the same line. */\nconst REACH: TextReach = Platform.OS === 'android' ? 'sms' : 'imessage';\n\nfunction messageFor(err: unknown): { message: string; signedOut?: boolean } {\n if (err instanceof TextLinkError) {\n if (err.kind === 'rate-limited') return { message: RATE_LIMITED };\n if (err.kind === 'signed-out') return { message: SIGNED_OUT, signedOut: true };\n }\n return { message: FAILED };\n}\n\nfunction Steps() {\n const steps = ['Tap Open Messages', `Send ${GREETING_SHOWN}`, 'Lucy texts back'];\n return (\n <View style={styles.steps} accessibilityRole=\"list\" accessibilityLabel=\"How it works\">\n {steps.map((step, i) => (\n <View key={step} style={styles.step}>\n <View style={styles.stepN}>\n <Text style={styles.stepNText}>{i + 1}</Text>\n </View>\n <Text style={styles.stepText}>{step}</Text>\n </View>\n ))}\n </View>\n );\n}\n\nexport function ImessageSheet({\n visible,\n message,\n onClose,\n onChatHere,\n onSignIn,\n}: {\n visible: boolean;\n /** A chore to send as the first text instead of the greeting. */\n message?: string;\n onClose: () => void;\n /** \"Chat with Lucy here instead\": the app's own chat. */\n onChatHere: () => void;\n /** The sign-in ran out: sign in again. */\n onSignIn: () => void;\n}) {\n const insets = useSafeAreaInsets();\n const [state, setState] = useState<State>({ status: 'loading' });\n const abort = useRef<AbortController | null>(null);\n const lastLoad = useRef(0);\n\n const load = useCallback(() => {\n abort.current?.abort();\n const ctrl = new AbortController();\n abort.current = ctrl;\n lastLoad.current = Date.now();\n setState((prev) => (prev.status === 'ready' ? prev : { status: 'loading' }));\n fetchTextLink(REACH, { message, signal: ctrl.signal })\n .then((link) => !ctrl.signal.aborted && setState({ status: 'ready', link }))\n .catch((err) => !ctrl.signal.aborted && setState({ status: 'error', ...messageFor(err) }));\n }, [message]);\n\n useEffect(() => {\n if (!visible) {\n abort.current?.abort();\n setState({ status: 'loading' });\n return undefined;\n }\n load();\n // Back from Messages: the phone may be linked now, and the code may have run out.\n const sub = AppState.addEventListener('change', (s) => {\n if (s === 'active' && Date.now() - lastLoad.current > RECHECK_MS) load();\n });\n return () => {\n sub.remove();\n abort.current?.abort();\n };\n }, [visible, load]);\n\n const link = state.status === 'ready' ? state.link : null;\n const href = link?.href ?? null;\n const android = Platform.OS === 'android';\n const title = android ? 'Text Lucy from Messages' : 'Text Lucy on iMessage';\n const ready = message?.trim() ? 'your chore' : GREETING_SHOWN;\n\n const onOpenMessages = async () => {\n if (!href || !link?.to || link.body === null) return;\n // The phone's own Messages, never whichever app claims `sms:` links (WhatsApp, when it is the default).\n const ok = await openMessages({ to: link.to, body: link.body, href });\n // Off to Messages: coming back should land on the app, not on this sheet again.\n if (ok) onClose();\n else\n setState({\n status: 'error',\n message: 'Messages couldn’t open on this phone. Chat with Lucy here instead.',\n });\n };\n\n return (\n <BottomSheet\n visible={visible}\n onClose={onClose}\n style={[styles.card, { paddingBottom: Math.max(insets.bottom, 14) + 8 }]}\n >\n <View style={styles.grabber} />\n <Pressable\n onPress={onClose}\n hitSlop={10}\n accessibilityRole=\"button\"\n accessibilityLabel=\"Close\"\n style={styles.close}\n >\n <Ionicons name=\"close\" size={18} color={ui.ink2} />\n </Pressable>\n\n <View style={styles.badge} accessibilityElementsHidden importantForAccessibility=\"no\">\n <MessagesAppIcon size={56} />\n <View style={styles.badgeMark}>\n <Mark size={17} />\n </View>\n </View>\n\n <Text accessibilityRole=\"header\" style={[type.title, styles.center]}>\n {title}\n </Text>\n <Text style={[type.callout, styles.center, styles.body]}>\n Lucy answers in Messages, like any other text. Hand her a chore from wherever you are.\n </Text>\n\n <View style={styles.content} accessibilityLiveRegion=\"polite\">\n {state.status === 'error' ? (\n <View style={styles.note}>\n <Text style={[type.callout, styles.center]}>{state.message}</Text>\n <Button\n label={state.signedOut ? 'Sign in' : 'Try again'}\n icon={state.signedOut ? 'log-in-outline' : 'refresh'}\n variant=\"secondary\"\n onPress={state.signedOut ? onSignIn : load}\n style={styles.small}\n />\n </View>\n ) : state.status === 'loading' ? (\n <View style={styles.loading}>\n <ActivityIndicator color={ui.accent} />\n <Text style={[type.footnote, styles.center]}>{`Getting your ${MESSAGES_APP} link…`}</Text>\n </View>\n ) : !href ? (\n <View style={styles.note}>\n <Text style={[type.callout, styles.center]}>\n {link?.reach === 'sms' && !link.smsAvailable\n ? 'Texting Lucy from an Android phone isn’t open yet. Chat with her here instead.'\n : `Lucy’s ${MESSAGES_APP} line isn’t answering right now. Try again in a minute, or chat with her here.`}\n </Text>\n <Button\n label=\"Try again\"\n icon=\"refresh\"\n variant=\"secondary\"\n onPress={load}\n style={styles.small}\n />\n </View>\n ) : (\n <>\n {link?.linked ? null : <Steps />}\n <View accessibilityHint={`Opens Messages with ${ready} ready to send`}>\n <Button label=\"Open Messages\" icon=\"chatbubble\" onPress={onOpenMessages} />\n </View>\n <Text style={[type.footnote, styles.center, styles.hint]}>\n {link?.linked\n ? 'Your phone already texts Lucy. Just tap send.'\n : `Messages opens with ${ready} ready. Send it, and this phone is linked to your account.`}\n </Text>\n </>\n )}\n </View>\n\n <Button\n label=\"Chat with Lucy here instead\"\n icon=\"chatbox-ellipses-outline\"\n variant=\"secondary\"\n onPress={onChatHere}\n style={styles.chatHere}\n />\n <Text style={[type.caption, styles.center, styles.fine]}>Message and data rates may apply.</Text>\n </BottomSheet>\n );\n}\n\nconst styles = StyleSheet.create({\n card: {\n backgroundColor: ui.surface,\n borderTopLeftRadius: 24,\n borderTopRightRadius: 24,\n paddingHorizontal: PAD + 4,\n paddingTop: 10,\n alignItems: 'stretch',\n },\n grabber: { alignSelf: 'center', width: 36, height: 5, borderRadius: 3, backgroundColor: ui.fill, marginBottom: 14 },\n close: {\n position: 'absolute',\n top: 16,\n right: 16,\n width: 30,\n height: 30,\n borderRadius: 15,\n backgroundColor: ui.fill,\n alignItems: 'center',\n justifyContent: 'center',\n },\n center: { textAlign: 'center' },\n badge: { alignSelf: 'center', width: 62, height: 62, marginBottom: 14 },\n badgeMark: {\n position: 'absolute',\n right: -2,\n bottom: -2,\n width: 26,\n height: 26,\n borderRadius: 13,\n backgroundColor: ui.surface,\n alignItems: 'center',\n justifyContent: 'center',\n },\n body: { marginTop: 6, color: ui.muted },\n content: { marginTop: 20, minHeight: 96, justifyContent: 'center' },\n loading: { alignItems: 'center', gap: 10 },\n note: { alignItems: 'center', gap: 14 },\n small: { height: 42 },\n hint: { marginTop: 10 },\n steps: { flexDirection: 'row', justifyContent: 'center', flexWrap: 'wrap', gap: 8, marginBottom: 16 },\n step: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 6,\n paddingVertical: 6,\n paddingLeft: 6,\n paddingRight: 11,\n borderRadius: radius.pill,\n backgroundColor: ui.fill,\n },\n stepN: {\n width: 20,\n height: 20,\n borderRadius: 10,\n backgroundColor: ui.accentSoft,\n alignItems: 'center',\n justifyContent: 'center',\n },\n stepNText: { fontSize: 11, fontWeight: '700', color: ui.accentText },\n stepText: { fontSize: 13, fontWeight: '500', color: ui.ink2 },\n chatHere: { marginTop: 16 },\n fine: { marginTop: 12 },\n});\n"],"names":["_a","link"],"mappings":";;;;;;;;;;;;;;;;AA4BA,MA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AA,IACZ,OAAO,EAAG,CAAA;AAAA,GACZ;AAAA,EACA,QAAU,EAAA;AAAA,IACR,SAAW,EAAA;AAAA,GACb;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,SAAW,EAAA;AAAA;AAEf,CAAC,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {jsx}from'react/jsx-runtime';import {useRef}from'react';import {Platform,LayoutAnimation,View}from'react-native';import {useKeyboardCover}from'../hooks/useKeyboard.js';function KeyboardAvoider({
|
|
2
|
+
style,
|
|
3
|
+
children,
|
|
4
|
+
extra = 0
|
|
5
|
+
}) {
|
|
6
|
+
const view = useRef(null);
|
|
7
|
+
const {
|
|
8
|
+
keyboard,
|
|
9
|
+
covers,
|
|
10
|
+
onLayout
|
|
11
|
+
} = useKeyboardCover(view);
|
|
12
|
+
const pad = keyboard.shown ? covers + extra : 0;
|
|
13
|
+
const last = useRef(pad);
|
|
14
|
+
if (last.current !== pad) {
|
|
15
|
+
last.current = pad;
|
|
16
|
+
if (Platform.OS === "ios" && keyboard.duration > 10) {
|
|
17
|
+
LayoutAnimation.configureNext({
|
|
18
|
+
duration: keyboard.duration,
|
|
19
|
+
update: {
|
|
20
|
+
duration: keyboard.duration,
|
|
21
|
+
type: LayoutAnimation.Types.keyboard
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return /* @__PURE__ */ jsx(View, { ref: view, collapsable: false, style: [style, {
|
|
27
|
+
paddingBottom: pad
|
|
28
|
+
}], onLayout, children });
|
|
29
|
+
}export{KeyboardAvoider};//# sourceMappingURL=KeyboardAvoider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KeyboardAvoider.js","sources":["../../src/components/KeyboardAvoider.tsx"],"sourcesContent":["/**\n * Keeps its bottom edge above the keyboard, on iOS and Android alike. It must run to the bottom of the screen (a\n * screen's lower part, as the chat's composer area does): it pads its own bottom by exactly as much of it as the\n * keyboard covers.\n *\n * React Native's KeyboardAvoidingView measures itself against its parent, not the screen, so under a header it fell\n * short by the header's height. Android may also have made the room already by shrinking the window (phones where\n * the app is not drawn edge to edge): `useKeyboardCover` counts only what is still covered.\n */\nimport React, { useRef } from 'react';\nimport { LayoutAnimation, Platform, View, type StyleProp, type ViewStyle } from 'react-native';\nimport { useKeyboardCover } from '../hooks/useKeyboard';\n\nexport function KeyboardAvoider({\n style,\n children,\n extra = 0,\n}: {\n style?: StyleProp<ViewStyle>;\n children: React.ReactNode;\n /** Room to leave between the content and the keyboard. */\n extra?: number;\n}) {\n const view = useRef<View>(null);\n const { keyboard, covers, onLayout } = useKeyboardCover(view);\n const pad = keyboard.shown ? covers + extra : 0;\n\n // iOS: the room opens with the keyboard's own curve. It has to be set up before the layout that changes it.\n const last = useRef(pad);\n if (last.current !== pad) {\n last.current = pad;\n if (Platform.OS === 'ios' && keyboard.duration > 10) {\n LayoutAnimation.configureNext({\n duration: keyboard.duration,\n update: { duration: keyboard.duration, type: LayoutAnimation.Types.keyboard },\n });\n }\n }\n\n return (\n <View ref={view} collapsable={false} style={[style, { paddingBottom: pad }]} onLayout={onLayout}>\n {children}\n </View>\n );\n}\n"],"names":[],"mappings":"+KAYO,SAAS,eAAgB,CAAA;AAAA,EAC9B,KAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAQ,GAAA;AACV,CAKG,EAAA;AACD,EAAM,MAAA,IAAA,GAAO,OAAa,IAAI,CAAA;AAC9B,EAAM,MAAA;AAAA,IACJ,QAAA;AAAA,IACA,MAAA;AAAA,IACA;AAAA,GACF,GAAI,iBAAiB,IAAI,CAAA;AACzB,EAAA,MAAM,GAAM,GAAA,QAAA,CAAS,KAAQ,GAAA,MAAA,GAAS,KAAQ,GAAA,CAAA;AAG9C,EAAM,MAAA,IAAA,GAAO,OAAO,GAAG,CAAA;AACvB,EAAI,IAAA,IAAA,CAAK,YAAY,GAAK,EAAA;AACxB,IAAA,IAAA,CAAK,OAAU,GAAA,GAAA;AACf,IAAA,IAAI,QAAS,CAAA,EAAA,KAAO,KAAS,IAAA,QAAA,CAAS,WAAW,EAAI,EAAA;AACnD,MAAA,eAAA,CAAgB,aAAc,CAAA;AAAA,QAC5B,UAAU,QAAS,CAAA,QAAA;AAAA,QACnB,MAAQ,EAAA;AAAA,UACN,UAAU,QAAS,CAAA,QAAA;AAAA,UACnB,IAAA,EAAM,gBAAgB,KAAM,CAAA;AAAA;AAC9B,OACD,CAAA;AAAA;AACH;AAEF,EAAO,uBAAA,GAAA,CAAC,QAAK,GAAK,EAAA,IAAA,EAAM,aAAa,KAAO,EAAA,KAAA,EAAO,CAAC,KAAO,EAAA;AAAA,IACzD,aAAe,EAAA;AAAA,GAChB,CAAG,EAAA,QAAA,EACO,QACL,EAAA,CAAA;AACR"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import {jsxs,jsx}from'react/jsx-runtime';import {useRef,useEffect}from'react';import {Animated,Easing,View}from'react-native';import Svg,{Path,G}from'react-native-svg';import {useReducedMotion}from'../hooks/useReducedMotion.js';const FACE = "M3.65431 2.48441C0.852759 4.57381 -1.0145 8.80565 0.59548 11.9202C2.54894 15.7078 8.94577 16.4915 12.679 13.568C15.692 11.2047 17.2099 6.23883 14.8294 3.0487C12.3249 -0.303215 6.84311 0.105248 3.65431 2.48441Z";
|
|
2
|
+
const BACK = "M2.6909 12.4321C4.83798 15.1892 9.10828 16.9676 12.1883 15.2973C15.9348 13.2649 16.5859 6.85417 13.5848 3.18198C11.1612 0.215315 6.16615 -1.19508 3.02576 1.24708C-0.275768 3.82054 0.246747 9.29302 2.6909 12.4321Z";
|
|
3
|
+
const HANDS = "M11.0318 12.4421C10.9331 12.4414 10.8376 12.4065 10.7617 12.3434C10.6858 12.2803 10.6341 12.1929 10.6154 12.0959C10.0796 9.31957 7.58042 8.7261 7.47433 8.70223C7.411 8.68796 7.35176 8.65947 7.30108 8.61891C7.2504 8.57836 7.20962 8.52679 7.18182 8.46814C7.15403 8.40948 7.13995 8.34526 7.14065 8.28036C7.14135 8.21545 7.15682 8.15155 7.18588 8.09351C8.09829 6.27665 7.19715 3.72309 7.18588 3.69723C7.14737 3.59083 7.1527 3.47349 7.2007 3.37102C7.2487 3.26856 7.33544 3.18935 7.44184 3.15084C7.54823 3.11233 7.66557 3.11766 7.76804 3.16566C7.8705 3.21366 7.94971 3.3004 7.98822 3.40679C8.02801 3.51687 8.89135 5.95107 8.14272 8.01925C9.05248 8.35941 10.9549 9.36598 11.4509 11.9315C11.4723 12.0426 11.4487 12.1577 11.3853 12.2514C11.3219 12.3452 11.2238 12.4099 11.1127 12.4314C11.0861 12.4374 11.059 12.4409 11.0318 12.4421Z";
|
|
4
|
+
const HOUR = "M7.62 8.30 C 8.45 6.10 7.62 3.70 7.585 3.55";
|
|
5
|
+
const MINUTE = "M7.62 8.30 C 8.35 8.55 10.55 9.35 11.03 12.02";
|
|
6
|
+
const PIVOT = {
|
|
7
|
+
x: 7.62,
|
|
8
|
+
y: 8.3
|
|
9
|
+
};
|
|
10
|
+
const TURN_MS = 2400;
|
|
11
|
+
const MARK = {
|
|
12
|
+
FACE,
|
|
13
|
+
BACK,
|
|
14
|
+
HOUR,
|
|
15
|
+
MINUTE,
|
|
16
|
+
PIVOT
|
|
17
|
+
};
|
|
18
|
+
function Mark({
|
|
19
|
+
size = 28
|
|
20
|
+
}) {
|
|
21
|
+
return /* @__PURE__ */ jsxs(Svg, { width: size, height: size, viewBox: "0 0 16 16", accessibilityElementsHidden: true, importantForAccessibility: "no", children: [
|
|
22
|
+
/* @__PURE__ */ jsx(Path, { opacity: 0.25, fill: "#FF5A00", d: BACK }),
|
|
23
|
+
/* @__PURE__ */ jsx(Path, { fill: "#FF5A00", d: FACE }),
|
|
24
|
+
/* @__PURE__ */ jsx(Path, { fill: "#fff", d: HANDS })
|
|
25
|
+
] });
|
|
26
|
+
}
|
|
27
|
+
function AnimatedMark({
|
|
28
|
+
size = 72
|
|
29
|
+
}) {
|
|
30
|
+
const reduced = useReducedMotion();
|
|
31
|
+
const turn = useRef(new Animated.Value(0)).current;
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (reduced) {
|
|
34
|
+
turn.setValue(0);
|
|
35
|
+
return void 0;
|
|
36
|
+
}
|
|
37
|
+
const loop = Animated.loop(Animated.timing(turn, {
|
|
38
|
+
toValue: 1,
|
|
39
|
+
duration: TURN_MS,
|
|
40
|
+
easing: Easing.inOut(Easing.cubic),
|
|
41
|
+
useNativeDriver: true
|
|
42
|
+
}));
|
|
43
|
+
loop.start();
|
|
44
|
+
return () => loop.stop();
|
|
45
|
+
}, [reduced, turn]);
|
|
46
|
+
const unit = size / 18;
|
|
47
|
+
const dx = (PIVOT.x + 1 - 9) * unit;
|
|
48
|
+
const dy = (PIVOT.y + 1 - 9) * unit;
|
|
49
|
+
const rotate = turn.interpolate({
|
|
50
|
+
inputRange: [0, 1],
|
|
51
|
+
outputRange: ["0deg", "-360deg"]
|
|
52
|
+
});
|
|
53
|
+
return /* @__PURE__ */ jsxs(View, { style: {
|
|
54
|
+
width: size,
|
|
55
|
+
height: size
|
|
56
|
+
}, accessibilityElementsHidden: true, importantForAccessibility: "no", children: [
|
|
57
|
+
/* @__PURE__ */ jsxs(Svg, { width: size, height: size, viewBox: "-1 -1 18 18", style: {
|
|
58
|
+
position: "absolute"
|
|
59
|
+
}, children: [
|
|
60
|
+
/* @__PURE__ */ jsx(Path, { opacity: 0.25, fill: "#FF5A00", d: BACK }),
|
|
61
|
+
/* @__PURE__ */ jsx(Path, { fill: "#FF5A00", d: FACE }),
|
|
62
|
+
/* @__PURE__ */ jsx(G, { fill: "none", stroke: "#fff", strokeWidth: 0.86, strokeLinecap: "round", children: /* @__PURE__ */ jsx(Path, { d: HOUR }) })
|
|
63
|
+
] }),
|
|
64
|
+
/* @__PURE__ */ jsx(Animated.View, { style: {
|
|
65
|
+
position: "absolute",
|
|
66
|
+
width: size,
|
|
67
|
+
height: size,
|
|
68
|
+
transform: [{
|
|
69
|
+
translateX: dx
|
|
70
|
+
}, {
|
|
71
|
+
translateY: dy
|
|
72
|
+
}, {
|
|
73
|
+
rotate
|
|
74
|
+
}, {
|
|
75
|
+
translateX: -dx
|
|
76
|
+
}, {
|
|
77
|
+
translateY: -dy
|
|
78
|
+
}]
|
|
79
|
+
}, children: /* @__PURE__ */ jsx(Svg, { width: size, height: size, viewBox: "-1 -1 18 18", children: /* @__PURE__ */ jsx(Path, { d: MINUTE, fill: "none", stroke: "#fff", strokeWidth: 0.86, strokeLinecap: "round" }) }) })
|
|
80
|
+
] });
|
|
81
|
+
}export{AnimatedMark,MARK,Mark};//# sourceMappingURL=Logo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Logo.js","sources":["../../src/components/Logo.tsx"],"sourcesContent":["/**\n * The Clockbook mark (the brand artwork, 16 x 16), as the web Clockbook home draws it.\n * `Mark` is the static logo. `AnimatedMark` is the \"time back\" loop: the minute hand rewinds one\n * turn every 2.4 s; it holds still when the phone asks for reduced motion.\n */\nimport React, { useEffect, useRef } from 'react';\nimport { Animated, Easing, View } from 'react-native';\nimport Svg, { G, Path } from 'react-native-svg';\nimport { useReducedMotion } from '../hooks/useReducedMotion';\n\nconst FACE =\n 'M3.65431 2.48441C0.852759 4.57381 -1.0145 8.80565 0.59548 11.9202C2.54894 15.7078 8.94577 16.4915 12.679 13.568C15.692 11.2047 17.2099 6.23883 14.8294 3.0487C12.3249 -0.303215 6.84311 0.105248 3.65431 2.48441Z';\nconst BACK =\n 'M2.6909 12.4321C4.83798 15.1892 9.10828 16.9676 12.1883 15.2973C15.9348 13.2649 16.5859 6.85417 13.5848 3.18198C11.1612 0.215315 6.16615 -1.19508 3.02576 1.24708C-0.275768 3.82054 0.246747 9.29302 2.6909 12.4321Z';\nconst HANDS =\n 'M11.0318 12.4421C10.9331 12.4414 10.8376 12.4065 10.7617 12.3434C10.6858 12.2803 10.6341 12.1929 10.6154 12.0959C10.0796 9.31957 7.58042 8.7261 7.47433 8.70223C7.411 8.68796 7.35176 8.65947 7.30108 8.61891C7.2504 8.57836 7.20962 8.52679 7.18182 8.46814C7.15403 8.40948 7.13995 8.34526 7.14065 8.28036C7.14135 8.21545 7.15682 8.15155 7.18588 8.09351C8.09829 6.27665 7.19715 3.72309 7.18588 3.69723C7.14737 3.59083 7.1527 3.47349 7.2007 3.37102C7.2487 3.26856 7.33544 3.18935 7.44184 3.15084C7.54823 3.11233 7.66557 3.11766 7.76804 3.16566C7.8705 3.21366 7.94971 3.3004 7.98822 3.40679C8.02801 3.51687 8.89135 5.95107 8.14272 8.01925C9.05248 8.35941 10.9549 9.36598 11.4509 11.9315C11.4723 12.0426 11.4487 12.1577 11.3853 12.2514C11.3219 12.3452 11.2238 12.4099 11.1127 12.4314C11.0861 12.4374 11.059 12.4409 11.0318 12.4421Z';\nconst HOUR = 'M7.62 8.30 C 8.45 6.10 7.62 3.70 7.585 3.55';\nconst MINUTE = 'M7.62 8.30 C 8.35 8.55 10.55 9.35 11.03 12.02';\n\n/** Where the hands meet, in the 16 x 16 artwork: the minute hand turns about this point. */\nconst PIVOT = { x: 7.62, y: 8.3 };\nconst TURN_MS = 2400;\n\n/** The artwork's paths, for drawings built on the mark (the welcome's lit orb). */\nexport const MARK = { FACE, BACK, HANDS, HOUR, MINUTE, PIVOT } as const;\n\nexport function Mark({ size = 28 }: { size?: number }) {\n return (\n <Svg width={size} height={size} viewBox=\"0 0 16 16\" accessibilityElementsHidden importantForAccessibility=\"no\">\n <Path opacity={0.25} fill=\"#FF5A00\" d={BACK} />\n <Path fill=\"#FF5A00\" d={FACE} />\n <Path fill=\"#fff\" d={HANDS} />\n </Svg>\n );\n}\n\n/**\n * The face with its hour hand, and the minute hand drawn on a second layer that rotates about\n * the pivot (the layer is the same box as the face, so its centre transform is offset to the pivot).\n */\nexport function AnimatedMark({ size = 72 }: { size?: number }) {\n const reduced = useReducedMotion();\n const turn = useRef(new Animated.Value(0)).current;\n\n useEffect(() => {\n if (reduced) {\n turn.setValue(0);\n return undefined;\n }\n const loop = Animated.loop(\n Animated.timing(turn, {\n toValue: 1,\n duration: TURN_MS,\n easing: Easing.inOut(Easing.cubic),\n useNativeDriver: true,\n }),\n );\n loop.start();\n return () => loop.stop();\n }, [reduced, turn]);\n\n // viewBox -1..17 (18 units), as the web's animated mark.\n const unit = size / 18;\n const dx = (PIVOT.x + 1 - 9) * unit;\n const dy = (PIVOT.y + 1 - 9) * unit;\n const rotate = turn.interpolate({ inputRange: [0, 1], outputRange: ['0deg', '-360deg'] });\n\n return (\n <View style={{ width: size, height: size }} accessibilityElementsHidden importantForAccessibility=\"no\">\n <Svg width={size} height={size} viewBox=\"-1 -1 18 18\" style={{ position: 'absolute' }}>\n <Path opacity={0.25} fill=\"#FF5A00\" d={BACK} />\n <Path fill=\"#FF5A00\" d={FACE} />\n <G fill=\"none\" stroke=\"#fff\" strokeWidth={0.86} strokeLinecap=\"round\">\n <Path d={HOUR} />\n </G>\n </Svg>\n <Animated.View\n style={{\n position: 'absolute',\n width: size,\n height: size,\n transform: [\n { translateX: dx },\n { translateY: dy },\n { rotate },\n { translateX: -dx },\n { translateY: -dy },\n ],\n }}\n >\n <Svg width={size} height={size} viewBox=\"-1 -1 18 18\">\n <Path d={MINUTE} fill=\"none\" stroke=\"#fff\" strokeWidth={0.86} strokeLinecap=\"round\" />\n </Svg>\n </Animated.View>\n </View>\n );\n}\n"],"names":[],"mappings":"oOASA,MAAM,IAAO,GAAA,mNAAA;AACb,MAAM,IAAO,GAAA,sNAAA;AACb,MAAM,KAAQ,GAAA,yzBAAA;AACd,MAAM,IAAO,GAAA,6CAAA;AACb,MAAM,MAAS,GAAA,+CAAA;AAGf,MAAM,KAAQ,GAAA;AAAA,EACZ,CAAG,EAAA,IAAA;AAAA,EACH,CAAG,EAAA;AACL,CAAA;AACA,MAAM,OAAU,GAAA,IAAA;AAGT,MAAM,IAAO,GAAA;AAAA,EAClB,IAAA;AAAA,EACA,IAAA;AAAA,EAEA,IAAA;AAAA,EACA,MAAA;A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AA;AAAA,oBACC,GAAA,CAAA,QAAA,CAAS,IAAT,EAAA,EAAc,KAAO,EAAA;AAAA,MAC5B,QAAU,EAAA,UAAA;AAAA,MACV,KAAO,EAAA,IAAA;AAAA,MACP,MAAQ,EAAA,IAAA;AAAA,MACR,WAAW,CAAC;AAAA,QACV,UAAY,EAAA;AAAA,OACX,EAAA;AAAA,QACD,UAAY,EAAA;AAAA,OACX,EAAA;AAAA,QACD;AAAA,OACC,EAAA;AAAA,QACD,YAAY,CAAC;AAAA,OACZ,EAAA;AAAA,QACD,YAAY,CAAC;AAAA,OACd;AAAA,KACH,EACY,8BAAC,GAAI,EAAA,EAAA,KAAA,EAAO,MAAM,MAAQ,EAAA,IAAA,EAAM,OAAQ,EAAA,aAAA,EACpC,QAAC,kBAAA,GAAA,CAAA,IAAA,EAAA,EAAK,GAAG,MAAQ,EAAA,IAAA,EAAK,QAAO,MAAO,EAAA,MAAA,EAAO,aAAa,IAAM,EAAA,aAAA,EAAc,OAAQ,EAAA,CAAA,EACxF,CACJ,EAAA;AAAA,GACJ,EAAA,CAAA;AACR"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {jsx}from'react/jsx-runtime';import {useState,useRef,useEffect}from'react';import {StyleSheet}from'react-native';import LottieView from'lottie-react-native';import {Mark}from'./Logo.js';import {lottieInstalled}from'./lottieInstalled.js';import {useReducedMotion}from'../hooks/useReducedMotion.js';import {colors}from'../theme/colors.js';import {fonts}from'../theme/fonts.js';const MOTIONS = {
|
|
2
|
+
think: require("../assets/lottie/lucy-mark-think.json"),
|
|
3
|
+
write: require("../assets/lottie/lucy-mark-write.json"),
|
|
4
|
+
call: require("../assets/lottie/lucy-mark-call.json"),
|
|
5
|
+
calendar: require("../assets/lottie/lucy-mark-calendar.json"),
|
|
6
|
+
email: require("../assets/lottie/lucy-mark-email.json"),
|
|
7
|
+
search: require("../assets/lottie/lucy-mark-search.json"),
|
|
8
|
+
message: require("../assets/lottie/lucy-mark-message.json"),
|
|
9
|
+
details: require("../assets/lottie/lucy-mark-details.json"),
|
|
10
|
+
connect: require("../assets/lottie/lucy-mark-connect.json")
|
|
11
|
+
};
|
|
12
|
+
const CONTENT_FRAME = 40;
|
|
13
|
+
const ARRIVED_FRAME = 80;
|
|
14
|
+
const LAST_FRAME = 224;
|
|
15
|
+
function LucyWorking({
|
|
16
|
+
size,
|
|
17
|
+
motion
|
|
18
|
+
}) {
|
|
19
|
+
const reduced = useReducedMotion();
|
|
20
|
+
const [hasLottie] = useState(lottieInstalled);
|
|
21
|
+
const [settled, setSettled] = useState(null);
|
|
22
|
+
const onScreen = useRef(false);
|
|
23
|
+
const player = useRef(null);
|
|
24
|
+
const looping = settled === motion;
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
if (reduced)
|
|
28
|
+
return;
|
|
29
|
+
if (looping) {
|
|
30
|
+
(_a = player.current) == null ? void 0 : _a.play(ARRIVED_FRAME, LAST_FRAME);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
(_b = player.current) == null ? void 0 : _b.play(onScreen.current ? CONTENT_FRAME : 0, ARRIVED_FRAME);
|
|
34
|
+
onScreen.current = true;
|
|
35
|
+
}, [motion, looping, reduced]);
|
|
36
|
+
if (!hasLottie)
|
|
37
|
+
return /* @__PURE__ */ jsx(Mark, { size: size * (16 / 18) });
|
|
38
|
+
return /* @__PURE__ */ jsx(LottieView, { ref: player, source: MOTIONS[motion], loop: looping, progress: reduced ? ARRIVED_FRAME / LAST_FRAME : void 0, onAnimationFinish: (cancelled) => {
|
|
39
|
+
if (!cancelled)
|
|
40
|
+
setSettled(motion);
|
|
41
|
+
}, style: {
|
|
42
|
+
width: size,
|
|
43
|
+
height: size
|
|
44
|
+
} });
|
|
45
|
+
}
|
|
46
|
+
StyleSheet.create({
|
|
47
|
+
row: {
|
|
48
|
+
flexDirection: "row",
|
|
49
|
+
alignItems: "center",
|
|
50
|
+
gap: 6,
|
|
51
|
+
alignSelf: "flex-start",
|
|
52
|
+
paddingVertical: 5,
|
|
53
|
+
paddingLeft: 8,
|
|
54
|
+
paddingRight: 12,
|
|
55
|
+
borderRadius: 999,
|
|
56
|
+
backgroundColor: colors.soft
|
|
57
|
+
},
|
|
58
|
+
rowWordsOnly: {
|
|
59
|
+
paddingVertical: 7,
|
|
60
|
+
paddingLeft: 12
|
|
61
|
+
},
|
|
62
|
+
words: {
|
|
63
|
+
fontFamily: fonts.sansMedium,
|
|
64
|
+
fontSize: 13.5,
|
|
65
|
+
color: colors.ink2
|
|
66
|
+
}
|
|
67
|
+
});export{LucyWorking};//# sourceMappingURL=LucyWorking.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LucyWorking.js","sources":["../../src/components/LucyWorking.tsx"],"sourcesContent":["/**\n * The Clockbook logo while Lucy is busy, in place of a spinner, with a different animation for each kind of work.\n * It arrives once, then loops for as long as the work goes on; when she moves on, only what is inside the logo\n * changes. Made with the Motion engine (tools/lottie/generate.mjs).\n *\n * With Reduce Motion it holds still, and on a binary without Lottie it draws the static logo.\n */\nimport React, { useEffect, useRef, useState } from 'react';\nimport { Animated, Easing, StyleSheet, View } from 'react-native';\nimport LottieView, { type AnimationObject } from 'lottie-react-native';\nimport { Mark } from './Logo';\nimport { lottieInstalled } from './lottieInstalled';\nimport { motionFor, type LucyMotion } from '../chat/lucyMotion';\nimport { useReducedMotion } from '../hooks/useReducedMotion';\nimport { colors } from '../theme/colors';\nimport { fonts } from '../theme/fonts';\n\nconst MOTIONS: Record<LucyMotion, AnimationObject> = {\n think: require('../assets/lottie/lucy-mark-think.json'),\n write: require('../assets/lottie/lucy-mark-write.json'),\n call: require('../assets/lottie/lucy-mark-call.json'),\n calendar: require('../assets/lottie/lucy-mark-calendar.json'),\n email: require('../assets/lottie/lucy-mark-email.json'),\n search: require('../assets/lottie/lucy-mark-search.json'),\n message: require('../assets/lottie/lucy-mark-message.json'),\n details: require('../assets/lottie/lucy-mark-details.json'),\n connect: require('../assets/lottie/lucy-mark-connect.json'),\n};\n/** Where the inside of the logo starts to arrive, the frame it loops from, and its last. */\nconst CONTENT_FRAME = 40;\nconst ARRIVED_FRAME = 80;\nconst LAST_FRAME = 224;\nconst WORDS_MS = 260;\n\nexport function LucyWorking({ size, motion }: { size: number; motion: LucyMotion }) {\n const reduced = useReducedMotion();\n const [hasLottie] = useState(lottieInstalled);\n const [settled, setSettled] = useState<LucyMotion | null>(null);\n const onScreen = useRef(false);\n const player = useRef<LottieView>(null);\n const looping = settled === motion;\n\n useEffect(() => {\n if (reduced) return;\n if (looping) {\n player.current?.play(ARRIVED_FRAME, LAST_FRAME);\n return;\n }\n player.current?.play(onScreen.current ? CONTENT_FRAME : 0, ARRIVED_FRAME);\n onScreen.current = true;\n }, [motion, looping, reduced]);\n\n if (!hasLottie) return <Mark size={size * (16 / 18)} />;\n return (\n <LottieView\n ref={player}\n source={MOTIONS[motion]}\n loop={looping}\n progress={reduced ? ARRIVED_FRAME / LAST_FRAME : undefined}\n onAnimationFinish={(cancelled) => {\n if (!cancelled) setSettled(motion);\n }}\n style={{ width: size, height: size }}\n />\n );\n}\n\n/**\n * What Lucy is doing right now. The new words rise in as she moves on to the next step. `logo` is off while her\n * avatar is the thing moving, so two logos never sit side by side.\n */\nexport function LucyStatus({ words, logo }: { words: string; logo: boolean }) {\n const reduced = useReducedMotion();\n const arrive = useRef(new Animated.Value(1)).current;\n\n useEffect(() => {\n if (reduced) {\n arrive.setValue(1);\n return;\n }\n arrive.setValue(0);\n Animated.timing(arrive, {\n toValue: 1,\n duration: WORDS_MS,\n easing: Easing.out(Easing.cubic),\n useNativeDriver: true,\n }).start();\n }, [words, reduced, arrive]);\n\n return (\n <View style={[s.row, !logo && s.rowWordsOnly]}>\n {logo ? <LucyWorking size={24} motion={motionFor(words)} /> : null}\n <Animated.Text\n style={[\n s.words,\n {\n opacity: arrive,\n transform: [{ translateY: arrive.interpolate({ inputRange: [0, 1], outputRange: [5, 0] }) }],\n },\n ]}\n >\n {words}…\n </Animated.Text>\n </View>\n );\n}\n\nconst s = StyleSheet.create({\n row: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 6,\n alignSelf: 'flex-start',\n paddingVertical: 5,\n paddingLeft: 8,\n paddingRight: 12,\n borderRadius: 999,\n backgroundColor: colors.soft,\n },\n rowWordsOnly: { paddingVertical: 7, paddingLeft: 12 },\n words: { fontFamily: fonts.sansMedium, fontSize: 13.5, color: colors.ink2 },\n});\n"],"names":[],"mappings":"8XAgBA,MAAM,OAA+C,GAAA;AAAA,EACnD,KAAA,EAAO,QAAQ,uCAAuC,CAAA;AAAA,EACtD,KAAA,EAAO,QAAQ,uCAAuC,CAAA;AAAA,EACtD,IAAA,EAAM,QAAQ,sCAAsC,CAAA;AAAA,EACpD,QAAA,EAAU,QAAQ,0CAA0C,CAAA;AAAA,EAC5D,KAAA,EAAO,QAAQ,uCAAuC,CAAA;AAAA,EACtD,MAAA,EAAQ,QAAQ,wCAAwC,CAAA;AAAA,EACxD,OAAA,EAAS,QAAQ,yCAAyC,CAAA;AAAA,EAC1D,OAAA,EAAS,QAAQ,yCAAyC,CAAA;AAAA,EAC1D,OAAA,EAAS,QAAQ,yCAAyC;AAC5D,CAAA;AAEA,MAAM,aAAgB,GAAA,EAAA;AACtB,MAAM,aAAgB,GAAA,EAAA;AACtB,MAAM,UAAa,GAAA,GAAA;AAEZ,SAAS,WAAY,CAAA;AAAA,EAC1B,IAAA;AAAA,EACA;AACF,CAGG,EAAA;AACD,EAAA,MAAM,UAAU,gBAAiB,EAAA;AACjC,EAAA,MAAM,CAAC,SAAS,CAAI,GAAA,QAAA,CAAS,eAAe,CAAA;AAC5C,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAI,SAA4B,IAAI,CAAA;AAC9D,EAAM,MAAA,QAAA,GAAW,OAAO,KAAK,CAAA;AAC7B,EAAM,MAAA,MAAA,GAAS,OAAmB,IAAI,CAAA;AACtC,EAAA,MAAM,UAAU,OAAY,KAAA,M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