@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,565 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lucy's sheets, after the web chat's (browser src/pages/Home/chat) in the Muse-style look (theme/muse.ts): Chores as
|
|
3
|
+
* a Goals-style list (status headers, plain rows, "Show N more"), Connect your apps as a Connectors screen (search,
|
|
4
|
+
* grouped rows with Connect / Add), and How Lucy works as a plain list of ideas. Opened from the chat and the Account
|
|
5
|
+
* screen. Each is a page sheet: a title, Done, and the list.
|
|
6
|
+
*/
|
|
7
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
8
|
+
import { ActivityIndicator, Image, Modal, Platform, Pressable, ScrollView, StyleSheet, Text, View } from 'react-native';
|
|
9
|
+
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
10
|
+
import { Ionicons } from '@expo/vector-icons';
|
|
11
|
+
import {
|
|
12
|
+
cachedChores,
|
|
13
|
+
fetchChores,
|
|
14
|
+
liveChores,
|
|
15
|
+
onChoreLiveChanged,
|
|
16
|
+
onChoresChanged,
|
|
17
|
+
savedChores,
|
|
18
|
+
type Chore,
|
|
19
|
+
type ChoreList,
|
|
20
|
+
} from '../chat/chores';
|
|
21
|
+
import {
|
|
22
|
+
allConnectorsLink,
|
|
23
|
+
CONNECTOR_GROUPS,
|
|
24
|
+
connectLink,
|
|
25
|
+
connectVerb,
|
|
26
|
+
LUCY_CONNECTORS,
|
|
27
|
+
type ConnectorGroup as ConnectorGroupKey,
|
|
28
|
+
} from '../chat/connectors';
|
|
29
|
+
import { yantraAppUrl } from '../utils/links';
|
|
30
|
+
import { openYantraUrl } from '../utils/yantraLinks';
|
|
31
|
+
import { agentAppUrl } from '../chat/auth';
|
|
32
|
+
import { ConnectorLogo } from './ConnectorLogo';
|
|
33
|
+
import { Button, Group, GroupLabel, GroupRow, IdeaRow, SearchPill, Segmented, type IconName } from './ui';
|
|
34
|
+
import { PAD, radius, type, ui } from '../theme/muse';
|
|
35
|
+
|
|
36
|
+
/** A page sheet in the app's look: a large title, Done on the right, the content below. */
|
|
37
|
+
export function Sheet({
|
|
38
|
+
visible,
|
|
39
|
+
title,
|
|
40
|
+
onClose,
|
|
41
|
+
children,
|
|
42
|
+
}: {
|
|
43
|
+
visible: boolean;
|
|
44
|
+
title: string;
|
|
45
|
+
onClose: () => void;
|
|
46
|
+
children: React.ReactNode;
|
|
47
|
+
}) {
|
|
48
|
+
return (
|
|
49
|
+
// iOS shows a page sheet (with its grabber); Android has no sheet style, so a full screen clear of the bars.
|
|
50
|
+
<Modal visible={visible} animationType="slide" presentationStyle="pageSheet" onRequestClose={onClose}>
|
|
51
|
+
<SafeAreaView style={st.sheet} edges={Platform.OS === 'android' ? ['top', 'bottom'] : []}>
|
|
52
|
+
{Platform.OS === 'ios' ? <View style={st.grabber} /> : null}
|
|
53
|
+
<View style={st.head}>
|
|
54
|
+
<Text style={type.title} accessibilityRole="header" numberOfLines={1}>
|
|
55
|
+
{title}
|
|
56
|
+
</Text>
|
|
57
|
+
<Pressable accessibilityRole="button" onPress={onClose} hitSlop={10}>
|
|
58
|
+
<Text style={st.done}>Done</Text>
|
|
59
|
+
</Pressable>
|
|
60
|
+
</View>
|
|
61
|
+
{children}
|
|
62
|
+
</SafeAreaView>
|
|
63
|
+
</Modal>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/* ---------------------------------------------------------------------------------------------- chores */
|
|
68
|
+
|
|
69
|
+
/** The Goals-style groups: a coloured dot and label, then the chores under it. */
|
|
70
|
+
const CHORE_SECTIONS: ReadonlyArray<readonly [Exclude<keyof ChoreList, 'all'>, string, string, string]> = [
|
|
71
|
+
['asking', 'Needs your answer', ui.accent, ui.accentSoft],
|
|
72
|
+
['working', 'Working on it', ui.accent, ui.accentSoft],
|
|
73
|
+
['failed', 'Didn’t finish', ui.danger, ui.dangerSoft],
|
|
74
|
+
['done', 'Done', ui.ok, ui.okSoft],
|
|
75
|
+
];
|
|
76
|
+
/** Rows shown per group before "Show N more". */
|
|
77
|
+
const SHOWN = 3;
|
|
78
|
+
|
|
79
|
+
/** "4 min", "2 h", "3 d": how long ago, or how long it has been running. */
|
|
80
|
+
function ago(at: number, now: number): string {
|
|
81
|
+
const min = Math.max(1, Math.round((now - at) / 60_000));
|
|
82
|
+
if (min < 60) return `${min} min`;
|
|
83
|
+
const h = Math.round(min / 60);
|
|
84
|
+
if (h < 24) return `${h} h`;
|
|
85
|
+
return `${Math.round(h / 24)} d`;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** "just now", "4 min", "1 hr 20 min": how long Lucy has been on one (the web's elapsedLabel). */
|
|
89
|
+
function elapsed(ms: number): string {
|
|
90
|
+
const min = Math.floor(Math.max(0, ms) / 60_000);
|
|
91
|
+
if (min < 1) return 'just now';
|
|
92
|
+
if (min < 60) return `${min} min`;
|
|
93
|
+
const h = Math.floor(min / 60);
|
|
94
|
+
return min % 60 ? `${h} hr ${min % 60} min` : `${h} hr`;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** The status tile on a row, as the web's: a spinner while she works, a question bubble when she waits on you. */
|
|
98
|
+
function ChoreMark({ status }: { status: Chore['status'] }) {
|
|
99
|
+
if (status === 'working') {
|
|
100
|
+
return (
|
|
101
|
+
<View style={[st.mark, { backgroundColor: ui.accentSoft }]}>
|
|
102
|
+
<ActivityIndicator size="small" color={ui.accent} />
|
|
103
|
+
</View>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
if (status === 'asking') {
|
|
107
|
+
return (
|
|
108
|
+
<View style={[st.mark, { backgroundColor: ui.accent }]}>
|
|
109
|
+
<Ionicons name="chatbubble-ellipses-outline" size={18} color="#FFFFFF" />
|
|
110
|
+
</View>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
const done = status === 'done';
|
|
114
|
+
return (
|
|
115
|
+
<View style={[st.mark, { backgroundColor: done ? ui.okSoft : ui.dangerSoft }]}>
|
|
116
|
+
<Ionicons
|
|
117
|
+
name={done ? 'checkmark-circle-outline' : 'alert-circle-outline'}
|
|
118
|
+
size={19}
|
|
119
|
+
color={done ? ui.ok : ui.danger}
|
|
120
|
+
/>
|
|
121
|
+
</View>
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function ChoreRow({ chore, now, last }: { chore: Chore; now: number; last: boolean }) {
|
|
126
|
+
// The web's choreLine: where it stands, and since when.
|
|
127
|
+
const when =
|
|
128
|
+
chore.status === 'asking'
|
|
129
|
+
? 'Lucy has a question for you'
|
|
130
|
+
: chore.status === 'working'
|
|
131
|
+
? `${chore.line || 'Getting started…'} · ${elapsed(now - chore.startedAt)}`
|
|
132
|
+
: `${chore.status === 'done' ? 'Done' : 'Didn’t finish'} · ${ago(chore.endedAt ?? chore.startedAt, now)} ago`;
|
|
133
|
+
// What came back (or why it stopped), under a finished one.
|
|
134
|
+
const detail = chore.status === 'done' || chore.status === 'failed' ? chore.line : undefined;
|
|
135
|
+
return (
|
|
136
|
+
<View style={[st.chore, !last && st.hairline]}>
|
|
137
|
+
<ChoreMark status={chore.status} />
|
|
138
|
+
<View style={{ flex: 1 }}>
|
|
139
|
+
<Text style={type.headline} numberOfLines={2}>
|
|
140
|
+
{chore.title}
|
|
141
|
+
</Text>
|
|
142
|
+
<Text
|
|
143
|
+
style={[
|
|
144
|
+
type.callout,
|
|
145
|
+
{ color: chore.status === 'asking' ? ui.accentText : ui.muted, marginTop: 2 },
|
|
146
|
+
]}
|
|
147
|
+
numberOfLines={1}
|
|
148
|
+
>
|
|
149
|
+
{when}
|
|
150
|
+
</Text>
|
|
151
|
+
{detail ? (
|
|
152
|
+
<Text style={[type.caption, { marginTop: 4 }]} numberOfLines={2}>
|
|
153
|
+
{detail}
|
|
154
|
+
</Text>
|
|
155
|
+
) : null}
|
|
156
|
+
</View>
|
|
157
|
+
</View>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function ChoreGroup({
|
|
162
|
+
label,
|
|
163
|
+
dot,
|
|
164
|
+
dotSoft,
|
|
165
|
+
chores,
|
|
166
|
+
now,
|
|
167
|
+
}: {
|
|
168
|
+
label: string;
|
|
169
|
+
dot: string;
|
|
170
|
+
dotSoft: string;
|
|
171
|
+
chores: Chore[];
|
|
172
|
+
now: number;
|
|
173
|
+
}) {
|
|
174
|
+
const [all, setAll] = useState(false);
|
|
175
|
+
const shown = all ? chores : chores.slice(0, SHOWN);
|
|
176
|
+
const more = chores.length - shown.length;
|
|
177
|
+
return (
|
|
178
|
+
<View style={st.choreGroup}>
|
|
179
|
+
<View style={st.status}>
|
|
180
|
+
<View style={[st.dotRing, { backgroundColor: dotSoft }]}>
|
|
181
|
+
<View style={[st.dot, { backgroundColor: dot }]} />
|
|
182
|
+
</View>
|
|
183
|
+
<Text style={[st.statusLabel, { color: dot }]}>{label}</Text>
|
|
184
|
+
<Text style={type.caption}>{chores.length}</Text>
|
|
185
|
+
</View>
|
|
186
|
+
{shown.map((chore, i) => (
|
|
187
|
+
<ChoreRow key={chore.id} chore={chore} now={now} last={i === shown.length - 1 && !more} />
|
|
188
|
+
))}
|
|
189
|
+
{more > 0 ? (
|
|
190
|
+
<Pressable accessibilityRole="button" onPress={() => setAll(true)} hitSlop={6} style={st.more}>
|
|
191
|
+
<Ionicons name="ellipsis-horizontal" size={16} color={ui.faint} />
|
|
192
|
+
<Text style={[type.callout, { color: ui.muted }]}>Show {more} more</Text>
|
|
193
|
+
</Pressable>
|
|
194
|
+
) : null}
|
|
195
|
+
</View>
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/** How many chores Lucy is on right now: the header's badge. Re-read every minute while the chat is open. */
|
|
200
|
+
export function useChoreCount(enabled: boolean): { working: number; refresh: () => void } {
|
|
201
|
+
const [list, setList] = useState<ChoreList | null>(cachedChores);
|
|
202
|
+
const [, setTick] = useState(0);
|
|
203
|
+
const refresh = useCallback(() => {
|
|
204
|
+
fetchChores()
|
|
205
|
+
.then(setList)
|
|
206
|
+
.catch(() => undefined);
|
|
207
|
+
}, []);
|
|
208
|
+
useEffect(() => {
|
|
209
|
+
if (!enabled) return undefined;
|
|
210
|
+
refresh();
|
|
211
|
+
const id = setInterval(refresh, 60_000);
|
|
212
|
+
// A chore started or ended here: count again now, not on the next minute.
|
|
213
|
+
const off = onChoresChanged(refresh);
|
|
214
|
+
const offLive = onChoreLiveChanged(() => setTick((n) => n + 1));
|
|
215
|
+
return () => {
|
|
216
|
+
clearInterval(id);
|
|
217
|
+
off();
|
|
218
|
+
offLive();
|
|
219
|
+
};
|
|
220
|
+
}, [enabled, refresh]);
|
|
221
|
+
const live = list ? liveChores(list) : null;
|
|
222
|
+
// Under way, as the web's count: waiting on your answer, or being worked on.
|
|
223
|
+
return { working: live ? live.asking.length + live.working.length : 0, refresh };
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Lucy's chores as a pane (the chat's Chores tab, and the Chores sheet): Goals-style groups, read when it is shown.
|
|
228
|
+
* `bottom` keeps the last row clear of whatever floats over the pane (the tab bar).
|
|
229
|
+
*/
|
|
230
|
+
export function ChoresPane({
|
|
231
|
+
active,
|
|
232
|
+
header,
|
|
233
|
+
bottom = 40,
|
|
234
|
+
}: {
|
|
235
|
+
active: boolean;
|
|
236
|
+
header?: React.ReactNode;
|
|
237
|
+
bottom?: number;
|
|
238
|
+
}) {
|
|
239
|
+
// Opens on the last list (this session's, or the phone's), then reads again quietly: no spinner after the first time.
|
|
240
|
+
const [raw, setList] = useState<ChoreList | null>(cachedChores);
|
|
241
|
+
const [error, setError] = useState<string | null>(null);
|
|
242
|
+
const [now, setNow] = useState(Date.now());
|
|
243
|
+
const [tick, setTick] = useState(0);
|
|
244
|
+
// What the chat knows now (Lucy's progress, a question waiting) over what the records say.
|
|
245
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
246
|
+
const list = useMemo(() => (raw ? liveChores(raw) : null), [raw, tick]);
|
|
247
|
+
useEffect(() => onChoreLiveChanged(() => setTick((n) => n + 1)), []);
|
|
248
|
+
|
|
249
|
+
useEffect(() => {
|
|
250
|
+
if (raw) return;
|
|
251
|
+
savedChores()
|
|
252
|
+
.then((saved) => saved && setList((current) => current ?? saved))
|
|
253
|
+
.catch(() => undefined);
|
|
254
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
255
|
+
}, []);
|
|
256
|
+
|
|
257
|
+
const load = useCallback(() => {
|
|
258
|
+
setNow(Date.now());
|
|
259
|
+
fetchChores()
|
|
260
|
+
.then((fresh) => {
|
|
261
|
+
setError(null);
|
|
262
|
+
setList(fresh);
|
|
263
|
+
})
|
|
264
|
+
.catch((e: Error) =>
|
|
265
|
+
setList((current) => {
|
|
266
|
+
// A failed refresh keeps what is showing; only an empty screen shows the error.
|
|
267
|
+
if (!current) setError(e.message || 'Couldn’t get your chores');
|
|
268
|
+
return current;
|
|
269
|
+
}),
|
|
270
|
+
);
|
|
271
|
+
}, []);
|
|
272
|
+
|
|
273
|
+
useEffect(() => {
|
|
274
|
+
if (!active) return undefined;
|
|
275
|
+
load();
|
|
276
|
+
// Read again when a chore starts or ends here, and every 20 seconds while the list is open.
|
|
277
|
+
const off = onChoresChanged(load);
|
|
278
|
+
const id = setInterval(load, 20_000);
|
|
279
|
+
// The "· 2 min" under a working one keeps counting between reads.
|
|
280
|
+
const clock = setInterval(() => setNow(Date.now()), 15_000);
|
|
281
|
+
return () => {
|
|
282
|
+
off();
|
|
283
|
+
clearInterval(id);
|
|
284
|
+
clearInterval(clock);
|
|
285
|
+
};
|
|
286
|
+
}, [active, load]);
|
|
287
|
+
|
|
288
|
+
const empty = list && !list.asking.length && !list.working.length && !list.failed.length && !list.done.length;
|
|
289
|
+
return (
|
|
290
|
+
<ScrollView contentContainerStyle={{ paddingBottom: bottom }}>
|
|
291
|
+
{header}
|
|
292
|
+
{error ? (
|
|
293
|
+
<View style={st.center}>
|
|
294
|
+
<Text style={st.centerText}>{error}</Text>
|
|
295
|
+
<Button label="Try again" icon="refresh" variant="secondary" onPress={load} />
|
|
296
|
+
</View>
|
|
297
|
+
) : !list ? (
|
|
298
|
+
<View style={st.center}>
|
|
299
|
+
<ActivityIndicator color={ui.accent} />
|
|
300
|
+
</View>
|
|
301
|
+
) : empty ? (
|
|
302
|
+
<View style={st.center}>
|
|
303
|
+
<Ionicons name="checkmark-done-outline" size={30} color={ui.faint} />
|
|
304
|
+
<Text style={st.centerText}>
|
|
305
|
+
Nothing under way. Hand Lucy a chore and it shows here while she works on it.
|
|
306
|
+
</Text>
|
|
307
|
+
</View>
|
|
308
|
+
) : (
|
|
309
|
+
<>
|
|
310
|
+
<Text style={[type.subhead, st.lead]}>
|
|
311
|
+
What Lucy is on, what she needs from you, and what she finished. Long chores keep going when the
|
|
312
|
+
app is closed.
|
|
313
|
+
</Text>
|
|
314
|
+
{CHORE_SECTIONS.map(([key, label, dot, dotSoft]) =>
|
|
315
|
+
list[key].length ? (
|
|
316
|
+
<ChoreGroup
|
|
317
|
+
key={key}
|
|
318
|
+
label={label}
|
|
319
|
+
dot={dot}
|
|
320
|
+
dotSoft={dotSoft}
|
|
321
|
+
chores={list[key]}
|
|
322
|
+
now={now}
|
|
323
|
+
/>
|
|
324
|
+
) : null,
|
|
325
|
+
)}
|
|
326
|
+
</>
|
|
327
|
+
)}
|
|
328
|
+
</ScrollView>
|
|
329
|
+
);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
export function ChoresSheet({ visible, onClose }: { visible: boolean; onClose: () => void }) {
|
|
333
|
+
return (
|
|
334
|
+
<Sheet visible={visible} title="Lucy’s chores" onClose={onClose}>
|
|
335
|
+
<ChoresPane active={visible} />
|
|
336
|
+
</Sheet>
|
|
337
|
+
);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/* ---------------------------------------------------------------------------------------------- connectors */
|
|
341
|
+
|
|
342
|
+
/** An app's logo on its tile, as the web's Connectors panel shows it. */
|
|
343
|
+
function ConnectorIcon({ id }: { id: string }) {
|
|
344
|
+
return <ConnectorLogo id={id} size={32} style={st.connectorIcon} />;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* The Connectors pane (the chat's Apps tab, and the Connect sheet), as Muse's: a search pill, a switch between your
|
|
349
|
+
* apps and what is kept for Lucy, and rows with Connect / Add (each opens Yantra's connect page).
|
|
350
|
+
*/
|
|
351
|
+
export function ConnectorsPane({ header, bottom = 40 }: { header?: React.ReactNode; bottom?: number }) {
|
|
352
|
+
// Yantra on the same environment as Lucy's agent, so a connection made there is one she can use.
|
|
353
|
+
const go = (link: (app: string) => string) =>
|
|
354
|
+
agentAppUrl()
|
|
355
|
+
.catch(() => '')
|
|
356
|
+
.then((app) => openYantraUrl(link(app || yantraAppUrl())));
|
|
357
|
+
const [query, setQuery] = useState('');
|
|
358
|
+
const [group, setGroup] = useState<ConnectorGroupKey>('apps');
|
|
359
|
+
const q = query.trim().toLowerCase();
|
|
360
|
+
const rows = useMemo(
|
|
361
|
+
() =>
|
|
362
|
+
LUCY_CONNECTORS.filter(
|
|
363
|
+
(c) =>
|
|
364
|
+
(q ? true : c.group === group) &&
|
|
365
|
+
(!q || c.name.toLowerCase().includes(q) || c.does.toLowerCase().includes(q)),
|
|
366
|
+
),
|
|
367
|
+
[q, group],
|
|
368
|
+
);
|
|
369
|
+
return (
|
|
370
|
+
<ScrollView contentContainerStyle={{ paddingBottom: bottom }} keyboardShouldPersistTaps="handled">
|
|
371
|
+
{header}
|
|
372
|
+
<SearchPill value={query} onChangeText={setQuery} placeholder="Search connectors" />
|
|
373
|
+
{q ? null : (
|
|
374
|
+
<View style={{ marginTop: 12 }}>
|
|
375
|
+
<Segmented<ConnectorGroupKey>
|
|
376
|
+
options={CONNECTOR_GROUPS.map(([key, label]) => ({ key, label }))}
|
|
377
|
+
value={group}
|
|
378
|
+
onChange={setGroup}
|
|
379
|
+
/>
|
|
380
|
+
</View>
|
|
381
|
+
)}
|
|
382
|
+
{rows.length ? (
|
|
383
|
+
<Group style={{ marginTop: 16 }}>
|
|
384
|
+
{rows.map((c, i) => (
|
|
385
|
+
<GroupRow
|
|
386
|
+
key={c.id}
|
|
387
|
+
leading={<ConnectorIcon id={c.id} />}
|
|
388
|
+
label={c.name}
|
|
389
|
+
detail={c.does}
|
|
390
|
+
link={connectVerb(c)}
|
|
391
|
+
onPress={() => go((app) => connectLink(app, c.id))}
|
|
392
|
+
last={i === rows.length - 1}
|
|
393
|
+
/>
|
|
394
|
+
))}
|
|
395
|
+
</Group>
|
|
396
|
+
) : (
|
|
397
|
+
<Text style={[st.centerText, { marginTop: 32 }]}>No connector matches “{query.trim()}”.</Text>
|
|
398
|
+
)}
|
|
399
|
+
<Text style={[type.footnote, st.note]}>
|
|
400
|
+
You connect them on Yantra, the account Clockbook runs on. Once saved, Lucy can use them here.
|
|
401
|
+
</Text>
|
|
402
|
+
<Pressable
|
|
403
|
+
accessibilityRole="link"
|
|
404
|
+
onPress={() => go(allConnectorsLink)}
|
|
405
|
+
hitSlop={6}
|
|
406
|
+
style={({ pressed }) => [st.seeAll, pressed && { opacity: 0.6 }]}
|
|
407
|
+
>
|
|
408
|
+
<Text style={st.seeAllText}>See all on Yantra</Text>
|
|
409
|
+
<Ionicons
|
|
410
|
+
name="arrow-forward"
|
|
411
|
+
size={15}
|
|
412
|
+
color={ui.accentText}
|
|
413
|
+
style={{ transform: [{ rotate: '-45deg' }] }}
|
|
414
|
+
/>
|
|
415
|
+
</Pressable>
|
|
416
|
+
</ScrollView>
|
|
417
|
+
);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
export function ConnectSheet({ visible, onClose }: { visible: boolean; onClose: () => void }) {
|
|
421
|
+
return (
|
|
422
|
+
<Sheet visible={visible} title="Connectors" onClose={onClose}>
|
|
423
|
+
<ConnectorsPane />
|
|
424
|
+
</Sheet>
|
|
425
|
+
);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/* ---------------------------------------------------------------------------------------------- help */
|
|
429
|
+
|
|
430
|
+
/** The web chat's tour (tour/tourSteps.ts), as a guide to read. */
|
|
431
|
+
const HELP_STEPS: ReadonlyArray<readonly [IconName, string, string]> = [
|
|
432
|
+
[
|
|
433
|
+
'create-outline',
|
|
434
|
+
'Tell Lucy what you need',
|
|
435
|
+
'Type it the way you’d text a friend: cancel the gym, lower a bill, book the dentist. Lucy does the steps.',
|
|
436
|
+
],
|
|
437
|
+
[
|
|
438
|
+
'sparkles-outline',
|
|
439
|
+
'Or start with one of these',
|
|
440
|
+
'The chores people hand over first. Tap one and Lucy gets going.',
|
|
441
|
+
],
|
|
442
|
+
[
|
|
443
|
+
'apps-outline',
|
|
444
|
+
'Let Lucy use your apps',
|
|
445
|
+
'Connect your calendar, Gmail and the logins she needs, and she books, looks things up and signs in for you. They’re in your account menu, and you connect them on Yantra.',
|
|
446
|
+
],
|
|
447
|
+
[
|
|
448
|
+
'shield-checkmark-outline',
|
|
449
|
+
'You approve what matters',
|
|
450
|
+
'Lucy asks before she pays for anything or changes an account, and waits for your yes.',
|
|
451
|
+
],
|
|
452
|
+
[
|
|
453
|
+
'list-outline',
|
|
454
|
+
'Long chores keep going',
|
|
455
|
+
'A call on hold or a booking with a few steps keeps going, even if you close the app. Chores shows what Lucy is on, and what’s next.',
|
|
456
|
+
],
|
|
457
|
+
[
|
|
458
|
+
'chatbubble-outline',
|
|
459
|
+
'Text Lucy from your phone',
|
|
460
|
+
'Messages opens with your first text ready. Lucy answers right there.',
|
|
461
|
+
],
|
|
462
|
+
[
|
|
463
|
+
'time-outline',
|
|
464
|
+
'Every chat is kept',
|
|
465
|
+
'Your past chats are in History, on this phone. Open one and Lucy picks up right where you left off.',
|
|
466
|
+
],
|
|
467
|
+
['add-circle-outline', 'Start fresh any time', 'New chat starts a clean one, and this one goes to History.'],
|
|
468
|
+
];
|
|
469
|
+
|
|
470
|
+
export function HelpSheet({ visible, onClose }: { visible: boolean; onClose: () => void }) {
|
|
471
|
+
return (
|
|
472
|
+
<Sheet visible={visible} title="How Lucy works" onClose={onClose}>
|
|
473
|
+
<ScrollView contentContainerStyle={{ paddingBottom: 40 }}>
|
|
474
|
+
{HELP_STEPS.map(([icon, title, body], i) => (
|
|
475
|
+
<IdeaRow key={title} icon={icon} title={title} body={body} last={i === HELP_STEPS.length - 1} />
|
|
476
|
+
))}
|
|
477
|
+
</ScrollView>
|
|
478
|
+
</Sheet>
|
|
479
|
+
);
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
/* ---------------------------------------------------------------------------------------------- account */
|
|
483
|
+
|
|
484
|
+
export interface Person {
|
|
485
|
+
name?: string;
|
|
486
|
+
given_name?: string;
|
|
487
|
+
nickname?: string;
|
|
488
|
+
email?: string;
|
|
489
|
+
picture?: string;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
export function displayName(p: Person | null | undefined): string {
|
|
493
|
+
return p?.name?.trim() || p?.given_name?.trim() || p?.nickname?.trim() || p?.email?.trim() || 'Your account';
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
/** The person's picture, or their initial on Clockbook orange. */
|
|
497
|
+
export function PersonAvatar({ person, size = 30 }: { person: Person | null | undefined; size?: number }) {
|
|
498
|
+
const round = { width: size, height: size, borderRadius: size / 2 };
|
|
499
|
+
if (person?.picture)
|
|
500
|
+
return <Image source={{ uri: person.picture }} style={round} accessibilityIgnoresInvertColors />;
|
|
501
|
+
return (
|
|
502
|
+
<View style={[round, st.initial]}>
|
|
503
|
+
<Text style={[st.initialText, { fontSize: size * 0.42 }]}>
|
|
504
|
+
{displayName(person).charAt(0).toUpperCase()}
|
|
505
|
+
</Text>
|
|
506
|
+
</View>
|
|
507
|
+
);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
const st = StyleSheet.create({
|
|
511
|
+
sheet: { flex: 1, backgroundColor: ui.bg },
|
|
512
|
+
grabber: {
|
|
513
|
+
alignSelf: 'center',
|
|
514
|
+
width: 36,
|
|
515
|
+
height: 5,
|
|
516
|
+
borderRadius: 3,
|
|
517
|
+
backgroundColor: 'rgba(28,26,24,0.15)',
|
|
518
|
+
marginTop: 8,
|
|
519
|
+
},
|
|
520
|
+
head: {
|
|
521
|
+
flexDirection: 'row',
|
|
522
|
+
alignItems: 'center',
|
|
523
|
+
justifyContent: 'space-between',
|
|
524
|
+
gap: 12,
|
|
525
|
+
paddingHorizontal: PAD + 4,
|
|
526
|
+
paddingTop: 14,
|
|
527
|
+
paddingBottom: 14,
|
|
528
|
+
},
|
|
529
|
+
done: { fontSize: 17, fontWeight: '600', color: ui.accentText },
|
|
530
|
+
lead: { paddingHorizontal: PAD + 4, marginBottom: 4 },
|
|
531
|
+
center: { alignItems: 'center', gap: 14, paddingVertical: 48, paddingHorizontal: 32 },
|
|
532
|
+
centerText: { ...type.callout, color: ui.muted, textAlign: 'center' },
|
|
533
|
+
hairline: { borderBottomWidth: StyleSheet.hairlineWidth, borderBottomColor: ui.hairline },
|
|
534
|
+
|
|
535
|
+
choreGroup: { marginTop: 22 },
|
|
536
|
+
status: { flexDirection: 'row', alignItems: 'center', gap: 10, paddingHorizontal: PAD + 4, marginBottom: 4 },
|
|
537
|
+
dotRing: { width: 22, height: 22, borderRadius: 11, alignItems: 'center', justifyContent: 'center' },
|
|
538
|
+
dot: { width: 8, height: 8, borderRadius: 4 },
|
|
539
|
+
statusLabel: { flex: 1, fontSize: 17, fontWeight: '600' },
|
|
540
|
+
chore: {
|
|
541
|
+
flexDirection: 'row',
|
|
542
|
+
alignItems: 'flex-start',
|
|
543
|
+
gap: 12,
|
|
544
|
+
paddingVertical: 14,
|
|
545
|
+
marginLeft: PAD + 4,
|
|
546
|
+
paddingRight: PAD + 4,
|
|
547
|
+
},
|
|
548
|
+
more: { flexDirection: 'row', alignItems: 'center', gap: 10, paddingVertical: 12, paddingHorizontal: PAD + 4 },
|
|
549
|
+
mark: { width: 36, height: 36, borderRadius: 10, alignItems: 'center', justifyContent: 'center' },
|
|
550
|
+
|
|
551
|
+
connectorIcon: { marginRight: 12 },
|
|
552
|
+
note: { paddingHorizontal: PAD + 6, marginTop: 18 },
|
|
553
|
+
seeAll: {
|
|
554
|
+
flexDirection: 'row',
|
|
555
|
+
alignItems: 'center',
|
|
556
|
+
gap: 6,
|
|
557
|
+
alignSelf: 'flex-start',
|
|
558
|
+
paddingHorizontal: PAD + 6,
|
|
559
|
+
paddingVertical: 12,
|
|
560
|
+
},
|
|
561
|
+
seeAllText: { fontSize: 16, fontWeight: '500', color: ui.accentText },
|
|
562
|
+
|
|
563
|
+
initial: { backgroundColor: ui.accent, alignItems: 'center', justifyContent: 'center', borderRadius: radius.pill },
|
|
564
|
+
initialText: { fontWeight: '600', color: ui.surface },
|
|
565
|
+
});
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The apps Lucy connects to, drawn as the web chat draws them (clock-tik-browser pages/Home/chat/ConnectorsPanel.tsx
|
|
3
|
+
* ConnectorLogo): Google Calendar and Gmail in their own marks and colours on a white tile, anything else as an
|
|
4
|
+
* outlined icon in the chat's warm tile. The marks are Simple Icons' (via react-icons on the web), the key Lucide's.
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { StyleSheet, View, type StyleProp, type ViewStyle } from 'react-native';
|
|
8
|
+
import Svg, { Circle, Path } from 'react-native-svg';
|
|
9
|
+
import { Ionicons } from '@expo/vector-icons';
|
|
10
|
+
import { ui } from '../theme/muse';
|
|
11
|
+
|
|
12
|
+
const GOOGLE_CALENDAR =
|
|
13
|
+
'M18.316 5.684H24v12.632h-5.684V5.684zM5.684 24h12.632v-5.684H5.684V24zM18.316 5.684V0H1.895A1.894 1.894 0 0 0 0 1.895v16.421h5.684V5.684h12.632zm-7.207 6.25v-.065c.272-.144.5-.349.687-.617s.279-.595.279-.982c0-.379-.099-.72-.3-1.025a2.05 2.05 0 0 0-.832-.714 2.703 2.703 0 0 0-1.197-.257c-.6 0-1.094.156-1.481.467-.386.311-.65.671-.793 1.078l1.085.452c.086-.249.224-.461.413-.633.189-.172.445-.257.767-.257.33 0 .602.088.816.264a.86.86 0 0 1 .322.703c0 .33-.12.589-.36.778-.24.19-.535.284-.886.284h-.567v1.085h.633c.407 0 .748.109 1.02.327.272.218.407.499.407.843 0 .336-.129.614-.387.832s-.565.327-.924.327c-.351 0-.651-.103-.897-.311-.248-.208-.422-.502-.521-.881l-1.096.452c.178.616.505 1.082.977 1.401.472.319.984.478 1.538.477a2.84 2.84 0 0 0 1.293-.291c.382-.193.684-.458.902-.794.218-.336.327-.72.327-1.149 0-.429-.115-.797-.344-1.105a2.067 2.067 0 0 0-.881-.689zm2.093-1.931l.602.913L15 10.045v5.744h1.187V8.446h-.827l-2.158 1.557zM22.105 0h-3.289v5.184H24V1.895A1.894 1.894 0 0 0 22.105 0zm-3.289 23.5l4.684-4.684h-4.684V23.5zM0 22.105C0 23.152.848 24 1.895 24h3.289v-5.184H0v3.289z';
|
|
14
|
+
const GMAIL =
|
|
15
|
+
'M24 5.457v13.909c0 .904-.732 1.636-1.636 1.636h-3.819V11.73L12 16.64l-6.545-4.91v9.273H1.636A1.636 1.636 0 0 1 0 19.366V5.457c0-2.023 2.309-3.178 3.927-1.964L5.455 4.64 12 9.548l6.545-4.91 1.528-1.145C21.69 2.28 24 3.434 24 5.457z';
|
|
16
|
+
const KEY_ROUND =
|
|
17
|
+
'M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z';
|
|
18
|
+
|
|
19
|
+
const BRANDS: Record<string, { d: string; color: string }> = {
|
|
20
|
+
'google-calendar': { d: GOOGLE_CALENDAR, color: '#4285F4' },
|
|
21
|
+
'google-gmail': { d: GMAIL, color: '#EA4335' },
|
|
22
|
+
};
|
|
23
|
+
const OTHER_ICONS: Record<string, React.ComponentProps<typeof Ionicons>['name']> = {
|
|
24
|
+
'autofill-address': 'home-outline',
|
|
25
|
+
'autofill-payment-card': 'card-outline',
|
|
26
|
+
};
|
|
27
|
+
/** The chat's warm tile and the colour drawn on it (.cbh-chores-icon). */
|
|
28
|
+
const WARM = '#FFEADB';
|
|
29
|
+
const WARM_INK = '#B84100';
|
|
30
|
+
|
|
31
|
+
export const isBrand = (id: string) => id in BRANDS;
|
|
32
|
+
|
|
33
|
+
/** Just the mark, `size` points square. */
|
|
34
|
+
export function ConnectorMark({ id, size }: { id: string; size: number }) {
|
|
35
|
+
const brand = BRANDS[id];
|
|
36
|
+
if (brand) {
|
|
37
|
+
return (
|
|
38
|
+
<Svg width={size} height={size} viewBox="0 0 24 24">
|
|
39
|
+
<Path d={brand.d} fill={brand.color} />
|
|
40
|
+
</Svg>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
if (id === 'site-login') {
|
|
44
|
+
return (
|
|
45
|
+
<Svg
|
|
46
|
+
width={size}
|
|
47
|
+
height={size}
|
|
48
|
+
viewBox="0 0 24 24"
|
|
49
|
+
fill="none"
|
|
50
|
+
stroke={WARM_INK}
|
|
51
|
+
strokeWidth={2}
|
|
52
|
+
strokeLinecap="round"
|
|
53
|
+
strokeLinejoin="round"
|
|
54
|
+
>
|
|
55
|
+
<Path d={KEY_ROUND} />
|
|
56
|
+
<Circle cx={16.5} cy={7.5} r={0.5} fill={WARM_INK} />
|
|
57
|
+
</Svg>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
return <Ionicons name={OTHER_ICONS[id] ?? 'extension-puzzle-outline'} size={size} color={WARM_INK} />;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** The mark on its tile (.cbh-apps-logo, or the warm .cbh-chores-icon): `size` square, its corners rounded. */
|
|
64
|
+
export function ConnectorLogo({ id, size = 34, style }: { id: string; size?: number; style?: StyleProp<ViewStyle> }) {
|
|
65
|
+
const brand = isBrand(id);
|
|
66
|
+
return (
|
|
67
|
+
<View
|
|
68
|
+
style={[s.tile, { width: size, height: size, borderRadius: size * 0.32 }, brand ? s.white : s.warm, style]}
|
|
69
|
+
accessibilityElementsHidden
|
|
70
|
+
importantForAccessibility="no-hide-descendants"
|
|
71
|
+
>
|
|
72
|
+
<ConnectorMark id={id} size={Math.round(size * 0.5)} />
|
|
73
|
+
</View>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The apps as a small overlapping row of round chips, each ringed in white (.cbh-chat-apps-logos): the calendar,
|
|
79
|
+
* Gmail and logins, as the web chat's "Connect your apps".
|
|
80
|
+
*/
|
|
81
|
+
export function ConnectorStack({ ids, size = 24 }: { ids: string[]; size?: number }) {
|
|
82
|
+
return (
|
|
83
|
+
<View style={s.stack} accessibilityElementsHidden importantForAccessibility="no-hide-descendants">
|
|
84
|
+
{ids.map((id, n) => (
|
|
85
|
+
<View
|
|
86
|
+
key={id}
|
|
87
|
+
style={[
|
|
88
|
+
s.chip,
|
|
89
|
+
{ width: size + 4, height: size + 4, borderRadius: (size + 4) / 2 },
|
|
90
|
+
n > 0 && { marginLeft: -9 },
|
|
91
|
+
]}
|
|
92
|
+
>
|
|
93
|
+
<View
|
|
94
|
+
style={[
|
|
95
|
+
s.tile,
|
|
96
|
+
{ width: size, height: size, borderRadius: size / 2 },
|
|
97
|
+
isBrand(id) ? s.white : [s.warm, s.warmEdge],
|
|
98
|
+
]}
|
|
99
|
+
>
|
|
100
|
+
<ConnectorMark id={id} size={id === 'site-login' ? 13 : 12} />
|
|
101
|
+
</View>
|
|
102
|
+
</View>
|
|
103
|
+
))}
|
|
104
|
+
</View>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const s = StyleSheet.create({
|
|
109
|
+
tile: { alignItems: 'center', justifyContent: 'center' },
|
|
110
|
+
white: { backgroundColor: '#FFFFFF', borderWidth: StyleSheet.hairlineWidth, borderColor: 'rgba(26,23,20,0.14)' },
|
|
111
|
+
warm: { backgroundColor: WARM },
|
|
112
|
+
warmEdge: { borderWidth: StyleSheet.hairlineWidth, borderColor: 'rgba(26,23,20,0.14)' },
|
|
113
|
+
stack: { flexDirection: 'row' },
|
|
114
|
+
// The white ring around each chip, so they read apart where they overlap.
|
|
115
|
+
chip: { backgroundColor: ui.surface, alignItems: 'center', justifyContent: 'center' },
|
|
116
|
+
});
|