@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,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lucy's chores, a drawer screen: what she is working on, what she couldn't finish and what she has done (the chat's
|
|
3
|
+
* Chores tab, components/ChatSheets ChoresPane). Signed out, a prompt to sign in instead.
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { StyleSheet, View } from 'react-native';
|
|
7
|
+
import { useIsFocused, useNavigation } from '@react-navigation/native';
|
|
8
|
+
import { AuthMobileNavigationRoutesEnum, useIsUserAuthenticated } from '@adminide-stack/user-auth0-client';
|
|
9
|
+
import { ChoresPane } from '../../components/ChatSheets';
|
|
10
|
+
import { useDrawerHeader } from '../../components/drawerHeader';
|
|
11
|
+
import { SignedOut } from '../../components/SignedOut';
|
|
12
|
+
import { ui } from '../../theme/muse';
|
|
13
|
+
|
|
14
|
+
export default function ChoresScreen() {
|
|
15
|
+
useDrawerHeader('Lucy’s chores');
|
|
16
|
+
const focused = useIsFocused();
|
|
17
|
+
const navigation = useNavigation<{ navigate: (route: string, params?: object) => void }>();
|
|
18
|
+
const { authenticated } = useIsUserAuthenticated();
|
|
19
|
+
return (
|
|
20
|
+
<View style={s.page}>
|
|
21
|
+
{authenticated ? (
|
|
22
|
+
<ChoresPane active={focused} />
|
|
23
|
+
) : (
|
|
24
|
+
<SignedOut
|
|
25
|
+
icon="checkmark-done"
|
|
26
|
+
title="See what Lucy is on"
|
|
27
|
+
body="Sign in to follow the chores you handed Lucy, and what she finished."
|
|
28
|
+
onSignIn={() => navigation.navigate(AuthMobileNavigationRoutesEnum.Login, { redirect: 'back' })}
|
|
29
|
+
/>
|
|
30
|
+
)}
|
|
31
|
+
</View>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const s = StyleSheet.create({ page: { flex: 1, backgroundColor: ui.bg, paddingTop: 8 } });
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Connectors, a drawer screen: the apps Lucy can use (the chat's Apps tab, components/ChatSheets ConnectorsPane),
|
|
3
|
+
* each connected on Yantra, the account Clockbook runs on. Signed out, a prompt to sign in instead: a connection is
|
|
4
|
+
* made for an account, so there is nothing to connect before there is one.
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { StyleSheet, View } from 'react-native';
|
|
8
|
+
import { useNavigation } from '@react-navigation/native';
|
|
9
|
+
import { AuthMobileNavigationRoutesEnum, useIsUserAuthenticated } from '@adminide-stack/user-auth0-client';
|
|
10
|
+
import { ConnectorsPane } from '../../components/ChatSheets';
|
|
11
|
+
import { useDrawerHeader } from '../../components/drawerHeader';
|
|
12
|
+
import { SignedOut } from '../../components/SignedOut';
|
|
13
|
+
import { ui } from '../../theme/muse';
|
|
14
|
+
|
|
15
|
+
export default function ConnectorsScreen() {
|
|
16
|
+
useDrawerHeader('Connectors');
|
|
17
|
+
const navigation = useNavigation<{ navigate: (route: string, params?: object) => void }>();
|
|
18
|
+
const { authenticated } = useIsUserAuthenticated();
|
|
19
|
+
return (
|
|
20
|
+
<View style={s.page}>
|
|
21
|
+
{authenticated ? (
|
|
22
|
+
<ConnectorsPane />
|
|
23
|
+
) : (
|
|
24
|
+
<SignedOut
|
|
25
|
+
icon="apps"
|
|
26
|
+
title="Connect your apps"
|
|
27
|
+
body="Sign in to connect your calendar, email and the logins Lucy uses for your chores."
|
|
28
|
+
onSignIn={() => navigation.navigate(AuthMobileNavigationRoutesEnum.Login, { redirect: 'back' })}
|
|
29
|
+
/>
|
|
30
|
+
)}
|
|
31
|
+
</View>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const s = StyleSheet.create({ page: { flex: 1, backgroundColor: ui.bg, paddingTop: 8 } });
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lucy's chat history, a screen (pushed from the chat's header or the drawer), after the web's History panel
|
|
3
|
+
* (chat/HistoryPanel.tsx): "Your past chats", searchable, grouped Today / Yesterday / Previous 7 days / Older. Each chat a
|
|
4
|
+
* row with its icon, its title, when, and the last thing Lucy said; tapping opens it back in the chat, the bin asks
|
|
5
|
+
* (in place of the row, as the web does) before deleting it. Read from this phone's store (chat/store.ts), keyed by the
|
|
6
|
+
* signed-in account, as the chat keeps it.
|
|
7
|
+
*/
|
|
8
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
9
|
+
import { ActivityIndicator, Pressable, ScrollView, StyleSheet, Text, View } from 'react-native';
|
|
10
|
+
import { useFocusEffect, useNavigation } from '@react-navigation/native';
|
|
11
|
+
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
12
|
+
import { Ionicons } from '@expo/vector-icons';
|
|
13
|
+
import { accountKey, getChatToken } from '../../chat/auth';
|
|
14
|
+
import { displayText, parseAskUser } from '../../chat/protocol';
|
|
15
|
+
import { loadHistory, removePastChat, type PastChat } from '../../chat/store';
|
|
16
|
+
import { ScreenHeader, SearchPill } from '../../components/ui';
|
|
17
|
+
import { CLOCKBOOK_ROUTES, drawerRoute } from '../../config/routes';
|
|
18
|
+
import { PAD, type, ui } from '../../theme/muse';
|
|
19
|
+
|
|
20
|
+
const DAY = 24 * 60 * 60 * 1000;
|
|
21
|
+
const AGES = ['Today', 'Yesterday', 'Previous 7 days', 'Older'] as const;
|
|
22
|
+
type Age = (typeof AGES)[number];
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Where a past chat goes, and the time it shows (the web's chatWhen, chat/history.ts): the hour for today and
|
|
26
|
+
* yesterday, the weekday within the week, the date before that (with the year, once it is not this one's).
|
|
27
|
+
*/
|
|
28
|
+
function chatWhen(at: number, now = Date.now()): { age: Age; label: string } {
|
|
29
|
+
const dayStart = (t: number) => {
|
|
30
|
+
const d = new Date(t);
|
|
31
|
+
d.setHours(0, 0, 0, 0);
|
|
32
|
+
return d.getTime();
|
|
33
|
+
};
|
|
34
|
+
const days = Math.round((dayStart(now) - dayStart(at)) / DAY);
|
|
35
|
+
const date = new Date(at);
|
|
36
|
+
const time = date.toLocaleTimeString(undefined, { hour: 'numeric', minute: '2-digit' });
|
|
37
|
+
if (days <= 0) return { age: 'Today', label: time };
|
|
38
|
+
if (days === 1) return { age: 'Yesterday', label: time };
|
|
39
|
+
if (days < 7) return { age: 'Previous 7 days', label: date.toLocaleDateString(undefined, { weekday: 'long' }) };
|
|
40
|
+
const sameYear = date.getFullYear() === new Date(now).getFullYear();
|
|
41
|
+
return {
|
|
42
|
+
age: 'Older',
|
|
43
|
+
label: date.toLocaleDateString(undefined, {
|
|
44
|
+
month: 'short',
|
|
45
|
+
day: 'numeric',
|
|
46
|
+
...(sameYear ? {} : { year: 'numeric' }),
|
|
47
|
+
}),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** A message as plain words: no protocol markup (Lucy's question forms, widgets), no Markdown. */
|
|
52
|
+
function plain(content: string): string {
|
|
53
|
+
const text = displayText(content)
|
|
54
|
+
.replace(/^\s*\|?\s*:?-{2,}[-|:\s]*$/gm, '')
|
|
55
|
+
.replace(/\|/g, ' ')
|
|
56
|
+
.replace(/!?\[([^\]]*)\]\([^)]*\)/g, '$1')
|
|
57
|
+
.replace(/[#*_`>]/g, '')
|
|
58
|
+
.replace(/\s+/g, ' ')
|
|
59
|
+
.trim();
|
|
60
|
+
if (text) return text;
|
|
61
|
+
const ask = parseAskUser(content)?.questions[0]?.title;
|
|
62
|
+
return ask ? `Lucy asked: ${ask}` : '';
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function lastLine(chat: PastChat): string {
|
|
66
|
+
for (const m of [...chat.messages].reverse()) {
|
|
67
|
+
if (m.role !== 'assistant') continue;
|
|
68
|
+
const line = plain(m.content);
|
|
69
|
+
if (line) return line;
|
|
70
|
+
}
|
|
71
|
+
return '';
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** One past chat: its icon, title and when, and the last thing Lucy said; the bin at the end. */
|
|
75
|
+
function ChatRow({
|
|
76
|
+
chat,
|
|
77
|
+
when,
|
|
78
|
+
onOpen,
|
|
79
|
+
onDelete,
|
|
80
|
+
}: {
|
|
81
|
+
chat: PastChat;
|
|
82
|
+
when: string;
|
|
83
|
+
onOpen: () => void;
|
|
84
|
+
onDelete: () => void;
|
|
85
|
+
}) {
|
|
86
|
+
const preview = lastLine(chat);
|
|
87
|
+
return (
|
|
88
|
+
<View style={s.line}>
|
|
89
|
+
<Pressable
|
|
90
|
+
accessibilityRole="button"
|
|
91
|
+
accessibilityLabel={`${chat.title}, ${when}`}
|
|
92
|
+
accessibilityHint="Opens this chat"
|
|
93
|
+
onPress={onOpen}
|
|
94
|
+
onLongPress={onDelete}
|
|
95
|
+
style={({ pressed }) => [s.row, pressed && s.pressed]}
|
|
96
|
+
>
|
|
97
|
+
<View style={s.icon}>
|
|
98
|
+
<Ionicons name="chatbubble-ellipses-outline" size={18} color={ui.accentText} />
|
|
99
|
+
</View>
|
|
100
|
+
<View style={{ flex: 1 }}>
|
|
101
|
+
<View style={s.titleLine}>
|
|
102
|
+
<Text style={s.title} numberOfLines={1}>
|
|
103
|
+
{chat.title}
|
|
104
|
+
</Text>
|
|
105
|
+
<Text style={s.when}>{when}</Text>
|
|
106
|
+
</View>
|
|
107
|
+
{preview ? (
|
|
108
|
+
<Text style={s.preview} numberOfLines={1}>
|
|
109
|
+
{preview}
|
|
110
|
+
</Text>
|
|
111
|
+
) : null}
|
|
112
|
+
</View>
|
|
113
|
+
</Pressable>
|
|
114
|
+
<Pressable
|
|
115
|
+
accessibilityRole="button"
|
|
116
|
+
accessibilityLabel={`Delete “${chat.title}”`}
|
|
117
|
+
onPress={onDelete}
|
|
118
|
+
hitSlop={8}
|
|
119
|
+
style={({ pressed }) => [s.bin, pressed && s.pressed]}
|
|
120
|
+
>
|
|
121
|
+
<Ionicons name="trash-outline" size={17} color={ui.faint} />
|
|
122
|
+
</Pressable>
|
|
123
|
+
</View>
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** The web's "Delete this chat?", in place of the row. */
|
|
128
|
+
function DeleteAsk({ chat, onCancel, onDelete }: { chat: PastChat; onCancel: () => void; onDelete: () => void }) {
|
|
129
|
+
return (
|
|
130
|
+
<View style={s.ask} accessibilityRole="alert">
|
|
131
|
+
<Text style={s.askTitle} numberOfLines={2}>
|
|
132
|
+
Delete “{chat.title}”?
|
|
133
|
+
</Text>
|
|
134
|
+
<Text style={s.askBody}>It’s gone from this phone for good.</Text>
|
|
135
|
+
<View style={s.askActions}>
|
|
136
|
+
<Pressable
|
|
137
|
+
accessibilityRole="button"
|
|
138
|
+
onPress={onCancel}
|
|
139
|
+
style={({ pressed }) => [s.askBtn, pressed && s.pressed]}
|
|
140
|
+
>
|
|
141
|
+
<Text style={s.askCancel}>Cancel</Text>
|
|
142
|
+
</Pressable>
|
|
143
|
+
<Pressable
|
|
144
|
+
accessibilityRole="button"
|
|
145
|
+
onPress={onDelete}
|
|
146
|
+
style={({ pressed }) => [s.askBtn, s.askDanger, pressed && { opacity: 0.85 }]}
|
|
147
|
+
>
|
|
148
|
+
<Text style={s.askDelete}>Delete</Text>
|
|
149
|
+
</Pressable>
|
|
150
|
+
</View>
|
|
151
|
+
</View>
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export default function HistoryScreen() {
|
|
156
|
+
const navigation = useNavigation<{
|
|
157
|
+
goBack: () => void;
|
|
158
|
+
canGoBack: () => boolean;
|
|
159
|
+
navigate: (route: string, params?: object) => void;
|
|
160
|
+
}>();
|
|
161
|
+
const [account, setAccount] = useState<string | null>(null);
|
|
162
|
+
const [chats, setChats] = useState<PastChat[] | null>(null);
|
|
163
|
+
const [query, setQuery] = useState('');
|
|
164
|
+
const [deleting, setDeleting] = useState<string | null>(null);
|
|
165
|
+
|
|
166
|
+
// Fresh each time the screen shows: the chat may have archived one since.
|
|
167
|
+
useFocusEffect(
|
|
168
|
+
useCallback(() => {
|
|
169
|
+
let live = true;
|
|
170
|
+
getChatToken()
|
|
171
|
+
.then(async (token) => {
|
|
172
|
+
const key = accountKey(token);
|
|
173
|
+
const past = await loadHistory(key);
|
|
174
|
+
if (!live) return;
|
|
175
|
+
setAccount(key);
|
|
176
|
+
setChats([...past].sort((a, b) => b.at - a.at));
|
|
177
|
+
})
|
|
178
|
+
.catch(() => live && setChats([]));
|
|
179
|
+
return () => {
|
|
180
|
+
live = false;
|
|
181
|
+
setDeleting(null);
|
|
182
|
+
};
|
|
183
|
+
}, []),
|
|
184
|
+
);
|
|
185
|
+
|
|
186
|
+
const back = () =>
|
|
187
|
+
navigation.canGoBack() ? navigation.goBack() : navigation.navigate(...drawerRoute(CLOCKBOOK_ROUTES.CHAT));
|
|
188
|
+
const open = (id: string) =>
|
|
189
|
+
navigation.navigate(...drawerRoute(CLOCKBOOK_ROUTES.CHAT, { open: id, at: Date.now() }));
|
|
190
|
+
const remove = async (id: string) => {
|
|
191
|
+
setDeleting(null);
|
|
192
|
+
if (!account) return;
|
|
193
|
+
setChats([...(await removePastChat(account, id))].sort((a, b) => b.at - a.at));
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
const q = query.trim().toLowerCase();
|
|
197
|
+
const sections = useMemo(() => {
|
|
198
|
+
const now = Date.now();
|
|
199
|
+
const byAge = new Map<Age, { chat: PastChat; when: string }[]>();
|
|
200
|
+
for (const chat of chats ?? []) {
|
|
201
|
+
if (
|
|
202
|
+
q &&
|
|
203
|
+
!chat.title.toLowerCase().includes(q) &&
|
|
204
|
+
!chat.messages.some((m) => plain(m.content).toLowerCase().includes(q))
|
|
205
|
+
)
|
|
206
|
+
continue;
|
|
207
|
+
const { age, label } = chatWhen(chat.at, now);
|
|
208
|
+
byAge.set(age, [...(byAge.get(age) ?? []), { chat, when: label }]);
|
|
209
|
+
}
|
|
210
|
+
return AGES.flatMap((age) => {
|
|
211
|
+
const rows = byAge.get(age);
|
|
212
|
+
return rows ? [{ age, rows }] : [];
|
|
213
|
+
});
|
|
214
|
+
}, [chats, q]);
|
|
215
|
+
|
|
216
|
+
return (
|
|
217
|
+
<SafeAreaView style={s.page} edges={['top', 'left', 'right']}>
|
|
218
|
+
<ScreenHeader title="History" onBack={back} />
|
|
219
|
+
{chats === null ? (
|
|
220
|
+
<ActivityIndicator style={{ marginTop: 40 }} color={ui.muted} />
|
|
221
|
+
) : chats.length === 0 ? (
|
|
222
|
+
<View style={s.empty}>
|
|
223
|
+
<View style={s.emptyIcon}>
|
|
224
|
+
<Ionicons name="chatbubbles-outline" size={28} color={ui.accent} />
|
|
225
|
+
</View>
|
|
226
|
+
<Text style={[type.title, { textAlign: 'center' }]}>No past chats yet</Text>
|
|
227
|
+
<Text style={[type.callout, s.emptyBody]}>
|
|
228
|
+
When you start a new chat with Lucy, the one before it is kept here, so you can pick up where
|
|
229
|
+
you left off.
|
|
230
|
+
</Text>
|
|
231
|
+
</View>
|
|
232
|
+
) : (
|
|
233
|
+
<ScrollView contentContainerStyle={{ paddingBottom: 40 }} keyboardShouldPersistTaps="handled">
|
|
234
|
+
<View style={s.intro}>
|
|
235
|
+
<Text style={s.heading} accessibilityRole="header">
|
|
236
|
+
Your past chats
|
|
237
|
+
</Text>
|
|
238
|
+
<Text style={s.sub}>Kept on this phone. Lucy picks up where you left off.</Text>
|
|
239
|
+
</View>
|
|
240
|
+
<SearchPill value={query} onChangeText={setQuery} placeholder="Search chats" />
|
|
241
|
+
{sections.length === 0 ? (
|
|
242
|
+
<Text style={[type.callout, s.none]}>No chat matches “{query.trim()}”.</Text>
|
|
243
|
+
) : (
|
|
244
|
+
sections.map(({ age, rows }) => (
|
|
245
|
+
<View key={age} style={s.section}>
|
|
246
|
+
<Text style={s.sectionLabel}>{age}</Text>
|
|
247
|
+
{rows.map(({ chat, when }) =>
|
|
248
|
+
deleting === chat.id ? (
|
|
249
|
+
<DeleteAsk
|
|
250
|
+
key={chat.id}
|
|
251
|
+
chat={chat}
|
|
252
|
+
onCancel={() => setDeleting(null)}
|
|
253
|
+
onDelete={() => remove(chat.id)}
|
|
254
|
+
/>
|
|
255
|
+
) : (
|
|
256
|
+
<ChatRow
|
|
257
|
+
key={chat.id}
|
|
258
|
+
chat={chat}
|
|
259
|
+
when={when}
|
|
260
|
+
onOpen={() => open(chat.id)}
|
|
261
|
+
onDelete={() => setDeleting(chat.id)}
|
|
262
|
+
/>
|
|
263
|
+
),
|
|
264
|
+
)}
|
|
265
|
+
</View>
|
|
266
|
+
))
|
|
267
|
+
)}
|
|
268
|
+
</ScrollView>
|
|
269
|
+
)}
|
|
270
|
+
</SafeAreaView>
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
const s = StyleSheet.create({
|
|
275
|
+
page: { flex: 1, backgroundColor: ui.bg },
|
|
276
|
+
pressed: { backgroundColor: ui.fill },
|
|
277
|
+
|
|
278
|
+
intro: { paddingHorizontal: PAD + 4, paddingTop: 4, paddingBottom: 14 },
|
|
279
|
+
heading: { fontSize: 26, lineHeight: 32, fontWeight: '700', letterSpacing: -0.6, color: ui.ink },
|
|
280
|
+
sub: { fontSize: 14, lineHeight: 19, color: ui.muted, marginTop: 4 },
|
|
281
|
+
|
|
282
|
+
section: { marginTop: 22, paddingHorizontal: PAD - 6 },
|
|
283
|
+
// The web's section heads: small, upper case, spaced.
|
|
284
|
+
sectionLabel: {
|
|
285
|
+
fontSize: 12,
|
|
286
|
+
fontWeight: '700',
|
|
287
|
+
letterSpacing: 0.8,
|
|
288
|
+
textTransform: 'uppercase',
|
|
289
|
+
color: ui.muted,
|
|
290
|
+
paddingHorizontal: 10,
|
|
291
|
+
marginBottom: 4,
|
|
292
|
+
},
|
|
293
|
+
line: { flexDirection: 'row', alignItems: 'center' },
|
|
294
|
+
row: {
|
|
295
|
+
flex: 1,
|
|
296
|
+
flexDirection: 'row',
|
|
297
|
+
alignItems: 'center',
|
|
298
|
+
gap: 12,
|
|
299
|
+
paddingVertical: 10,
|
|
300
|
+
paddingHorizontal: 10,
|
|
301
|
+
borderRadius: 14,
|
|
302
|
+
},
|
|
303
|
+
icon: {
|
|
304
|
+
width: 40,
|
|
305
|
+
height: 40,
|
|
306
|
+
borderRadius: 12,
|
|
307
|
+
backgroundColor: ui.accentSoft,
|
|
308
|
+
alignItems: 'center',
|
|
309
|
+
justifyContent: 'center',
|
|
310
|
+
},
|
|
311
|
+
titleLine: { flexDirection: 'row', alignItems: 'baseline', gap: 8 },
|
|
312
|
+
title: { flex: 1, fontSize: 15.5, fontWeight: '600', letterSpacing: -0.2, color: ui.ink },
|
|
313
|
+
when: { fontSize: 12.5, color: ui.faint, fontVariant: ['tabular-nums'] },
|
|
314
|
+
preview: { fontSize: 13.5, lineHeight: 18, color: ui.muted, marginTop: 2 },
|
|
315
|
+
bin: { width: 40, height: 40, borderRadius: 20, alignItems: 'center', justifyContent: 'center' },
|
|
316
|
+
|
|
317
|
+
ask: {
|
|
318
|
+
marginVertical: 4,
|
|
319
|
+
marginHorizontal: 4,
|
|
320
|
+
padding: 14,
|
|
321
|
+
borderRadius: 16,
|
|
322
|
+
backgroundColor: ui.surface,
|
|
323
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
324
|
+
borderColor: ui.hairline,
|
|
325
|
+
},
|
|
326
|
+
askTitle: { fontSize: 15, fontWeight: '600', color: ui.ink },
|
|
327
|
+
askBody: { fontSize: 13.5, color: ui.muted, marginTop: 3 },
|
|
328
|
+
askActions: { flexDirection: 'row', justifyContent: 'flex-end', gap: 8, marginTop: 12 },
|
|
329
|
+
askBtn: { height: 36, paddingHorizontal: 16, borderRadius: 18, alignItems: 'center', justifyContent: 'center' },
|
|
330
|
+
askCancel: { fontSize: 14.5, fontWeight: '600', color: ui.ink2 },
|
|
331
|
+
askDanger: { backgroundColor: ui.danger },
|
|
332
|
+
askDelete: { fontSize: 14.5, fontWeight: '600', color: '#FFFFFF' },
|
|
333
|
+
|
|
334
|
+
none: { textAlign: 'center', marginTop: 32, paddingHorizontal: PAD },
|
|
335
|
+
empty: { flex: 1, alignItems: 'center', justifyContent: 'center', paddingHorizontal: 32, paddingBottom: 80 },
|
|
336
|
+
emptyBody: { textAlign: 'center', marginTop: 6 },
|
|
337
|
+
emptyIcon: {
|
|
338
|
+
width: 64,
|
|
339
|
+
height: 64,
|
|
340
|
+
borderRadius: 20,
|
|
341
|
+
backgroundColor: ui.accentSoft,
|
|
342
|
+
alignItems: 'center',
|
|
343
|
+
justifyContent: 'center',
|
|
344
|
+
marginBottom: 16,
|
|
345
|
+
},
|
|
346
|
+
});
|