@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,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "Sign in to Clockbook": the web home's sign-in dialog (clock-tik-browser pages/Home/HomePage.tsx SignInDialog), native.
|
|
3
|
+
* Shown before anything that needs an account (Try it, a chore, Text Lucy on iMessage) when nobody is signed in; Continue
|
|
4
|
+
* opens @adminide-stack/user-auth0-mobile's Login, and what they asked for runs once they are back, signed in.
|
|
5
|
+
*/
|
|
6
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
7
|
+
import { Pressable, StyleSheet, Text, View } from 'react-native';
|
|
8
|
+
import { Ionicons } from '@expo/vector-icons';
|
|
9
|
+
import { AuthMobileNavigationRoutesEnum, useIsUserAuthenticated } from '@adminide-stack/user-auth0-client';
|
|
10
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
11
|
+
import { BottomSheet } from './BottomSheet';
|
|
12
|
+
import { Mark } from './Logo';
|
|
13
|
+
import { MessagesAppIcon } from './MessagesAppIcon';
|
|
14
|
+
import { Button } from './ui';
|
|
15
|
+
import { PAD, radius, type, ui } from '../theme/muse';
|
|
16
|
+
|
|
17
|
+
export type SignInPurpose = 'chat' | 'imessage';
|
|
18
|
+
|
|
19
|
+
const COPY: Record<SignInPurpose | 'chore', { title: string; body: string }> = {
|
|
20
|
+
chat: { title: 'Sign in to Clockbook', body: 'Sign in or create an account to hand your chores to Lucy.' },
|
|
21
|
+
chore: {
|
|
22
|
+
title: 'Sign in to hand it over',
|
|
23
|
+
body: 'Sign in or create an account, and Lucy starts on this as soon as you are back.',
|
|
24
|
+
},
|
|
25
|
+
imessage: {
|
|
26
|
+
title: 'Sign in to text Lucy',
|
|
27
|
+
body: 'Sign in or create an account, and Messages opens with a text to Lucy ready to send.',
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export function SignInPrompt({
|
|
32
|
+
purpose,
|
|
33
|
+
chore,
|
|
34
|
+
onContinue,
|
|
35
|
+
onCancel,
|
|
36
|
+
}: {
|
|
37
|
+
/** null hides it. */
|
|
38
|
+
purpose: SignInPurpose | null;
|
|
39
|
+
/** The chore they typed or tapped, quoted in the prompt. */
|
|
40
|
+
chore?: string;
|
|
41
|
+
onContinue: () => void;
|
|
42
|
+
onCancel: () => void;
|
|
43
|
+
}) {
|
|
44
|
+
const insets = useSafeAreaInsets();
|
|
45
|
+
const copy = COPY[purpose === 'chat' && chore ? 'chore' : (purpose ?? 'chat')];
|
|
46
|
+
return (
|
|
47
|
+
<BottomSheet
|
|
48
|
+
visible={purpose !== null}
|
|
49
|
+
onClose={onCancel}
|
|
50
|
+
style={[styles.card, { paddingBottom: Math.max(insets.bottom, 14) + 8 }]}
|
|
51
|
+
>
|
|
52
|
+
<View style={styles.grabber} />
|
|
53
|
+
<Pressable
|
|
54
|
+
onPress={onCancel}
|
|
55
|
+
hitSlop={10}
|
|
56
|
+
accessibilityRole="button"
|
|
57
|
+
accessibilityLabel="Close"
|
|
58
|
+
style={styles.close}
|
|
59
|
+
>
|
|
60
|
+
<Ionicons name="close" size={18} color={ui.ink2} />
|
|
61
|
+
</Pressable>
|
|
62
|
+
<View style={styles.mark}>
|
|
63
|
+
{purpose === 'imessage' ? (
|
|
64
|
+
<MessagesAppIcon size={52} />
|
|
65
|
+
) : (
|
|
66
|
+
<View style={styles.markTile}>
|
|
67
|
+
<Mark size={34} />
|
|
68
|
+
</View>
|
|
69
|
+
)}
|
|
70
|
+
</View>
|
|
71
|
+
<Text accessibilityRole="header" style={[type.title, styles.center]}>
|
|
72
|
+
{copy.title}
|
|
73
|
+
</Text>
|
|
74
|
+
{purpose === 'chat' && chore ? (
|
|
75
|
+
<Text style={[type.callout, styles.chore]} numberOfLines={3}>
|
|
76
|
+
“{chore}”
|
|
77
|
+
</Text>
|
|
78
|
+
) : null}
|
|
79
|
+
<Text style={[type.callout, styles.center, styles.body]}>{copy.body}</Text>
|
|
80
|
+
<Button label="Continue to sign in" icon="log-in-outline" onPress={onContinue} style={styles.continue} />
|
|
81
|
+
<Button label="Not now" variant="secondary" onPress={onCancel} style={styles.cancel} />
|
|
82
|
+
<Text style={[type.caption, styles.center, styles.fine]}>
|
|
83
|
+
You sign in with Yantra, which Clockbook runs on, then come straight back here.
|
|
84
|
+
</Text>
|
|
85
|
+
</BottomSheet>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Runs `action` when someone is signed in; otherwise asks them to sign in first, and runs it once they are (the web home
|
|
91
|
+
* does the same with a chore). Render `prompt` once in the screen. `navigate` is the screen's navigation.navigate;
|
|
92
|
+
* `beforeSignIn` runs just before Login opens (the drawer closes itself).
|
|
93
|
+
*/
|
|
94
|
+
export function useSignInGate(navigate: (route: string, params?: object) => void, beforeSignIn?: () => void) {
|
|
95
|
+
const { authenticated } = useIsUserAuthenticated();
|
|
96
|
+
const [ask, setAsk] = useState<{ purpose: SignInPurpose; chore?: string } | null>(null);
|
|
97
|
+
const pending = useRef<(() => void) | null>(null);
|
|
98
|
+
|
|
99
|
+
// Back from Login, signed in: do what they asked for.
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
if (!authenticated || !pending.current) return;
|
|
102
|
+
const action = pending.current;
|
|
103
|
+
pending.current = null;
|
|
104
|
+
action();
|
|
105
|
+
}, [authenticated]);
|
|
106
|
+
|
|
107
|
+
const gate = useCallback(
|
|
108
|
+
(purpose: SignInPurpose, action: () => void, chore?: string) => {
|
|
109
|
+
if (authenticated) {
|
|
110
|
+
action();
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
pending.current = action;
|
|
114
|
+
setAsk({ purpose, chore: chore?.trim() || undefined });
|
|
115
|
+
},
|
|
116
|
+
[authenticated],
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
const cancel = useCallback(() => {
|
|
120
|
+
pending.current = null;
|
|
121
|
+
setAsk(null);
|
|
122
|
+
}, []);
|
|
123
|
+
const signIn = useCallback(() => {
|
|
124
|
+
setAsk(null);
|
|
125
|
+
beforeSignIn?.();
|
|
126
|
+
navigate(AuthMobileNavigationRoutesEnum.Login, { redirect: 'back' });
|
|
127
|
+
}, [navigate, beforeSignIn]);
|
|
128
|
+
|
|
129
|
+
return {
|
|
130
|
+
authenticated,
|
|
131
|
+
gate,
|
|
132
|
+
prompt: (
|
|
133
|
+
<SignInPrompt purpose={ask?.purpose ?? null} chore={ask?.chore} onContinue={signIn} onCancel={cancel} />
|
|
134
|
+
),
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const styles = StyleSheet.create({
|
|
139
|
+
card: {
|
|
140
|
+
backgroundColor: ui.surface,
|
|
141
|
+
borderTopLeftRadius: 24,
|
|
142
|
+
borderTopRightRadius: 24,
|
|
143
|
+
paddingHorizontal: PAD + 4,
|
|
144
|
+
paddingTop: 10,
|
|
145
|
+
alignItems: 'stretch',
|
|
146
|
+
},
|
|
147
|
+
grabber: { alignSelf: 'center', width: 36, height: 5, borderRadius: 3, backgroundColor: ui.fill, marginBottom: 14 },
|
|
148
|
+
close: {
|
|
149
|
+
position: 'absolute',
|
|
150
|
+
top: 16,
|
|
151
|
+
right: 16,
|
|
152
|
+
width: 30,
|
|
153
|
+
height: 30,
|
|
154
|
+
borderRadius: 15,
|
|
155
|
+
backgroundColor: ui.fill,
|
|
156
|
+
alignItems: 'center',
|
|
157
|
+
justifyContent: 'center',
|
|
158
|
+
},
|
|
159
|
+
center: { textAlign: 'center' },
|
|
160
|
+
mark: { alignSelf: 'center', marginBottom: 14 },
|
|
161
|
+
markTile: {
|
|
162
|
+
width: 56,
|
|
163
|
+
height: 56,
|
|
164
|
+
borderRadius: 28,
|
|
165
|
+
backgroundColor: ui.accentSoft,
|
|
166
|
+
alignItems: 'center',
|
|
167
|
+
justifyContent: 'center',
|
|
168
|
+
},
|
|
169
|
+
chore: {
|
|
170
|
+
marginTop: 12,
|
|
171
|
+
paddingVertical: 10,
|
|
172
|
+
paddingHorizontal: 14,
|
|
173
|
+
borderRadius: radius.button,
|
|
174
|
+
backgroundColor: ui.fill,
|
|
175
|
+
color: ui.ink,
|
|
176
|
+
textAlign: 'center',
|
|
177
|
+
},
|
|
178
|
+
body: { marginTop: 8, color: ui.muted },
|
|
179
|
+
continue: { marginTop: 22 },
|
|
180
|
+
cancel: { marginTop: 10 },
|
|
181
|
+
fine: { marginTop: 12 },
|
|
182
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** A signed-out screen's middle: an icon, what signing in gives, and Sign in. */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { StyleSheet, Text, View } from 'react-native';
|
|
4
|
+
import { Ionicons } from '@expo/vector-icons';
|
|
5
|
+
import { Button, type IconName } from './ui';
|
|
6
|
+
import { type, ui } from '../theme/muse';
|
|
7
|
+
|
|
8
|
+
export function SignedOut({
|
|
9
|
+
icon,
|
|
10
|
+
title,
|
|
11
|
+
body,
|
|
12
|
+
onSignIn,
|
|
13
|
+
}: {
|
|
14
|
+
icon: IconName;
|
|
15
|
+
title: string;
|
|
16
|
+
body: string;
|
|
17
|
+
onSignIn: () => void;
|
|
18
|
+
}) {
|
|
19
|
+
return (
|
|
20
|
+
<View style={s.wrap}>
|
|
21
|
+
<View style={s.icon}>
|
|
22
|
+
<Ionicons name={icon} size={28} color={ui.accent} />
|
|
23
|
+
</View>
|
|
24
|
+
<Text style={[type.title, { textAlign: 'center' }]}>{title}</Text>
|
|
25
|
+
<Text style={[type.callout, { textAlign: 'center', marginTop: 6 }]}>{body}</Text>
|
|
26
|
+
<Button
|
|
27
|
+
label="Sign in"
|
|
28
|
+
icon="log-in-outline"
|
|
29
|
+
onPress={onSignIn}
|
|
30
|
+
style={{ marginTop: 22, alignSelf: 'stretch' }}
|
|
31
|
+
/>
|
|
32
|
+
</View>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const s = StyleSheet.create({
|
|
37
|
+
wrap: { flex: 1, alignItems: 'center', justifyContent: 'center', paddingHorizontal: 32 },
|
|
38
|
+
icon: {
|
|
39
|
+
width: 64,
|
|
40
|
+
height: 64,
|
|
41
|
+
borderRadius: 20,
|
|
42
|
+
backgroundColor: ui.accentSoft,
|
|
43
|
+
alignItems: 'center',
|
|
44
|
+
justifyContent: 'center',
|
|
45
|
+
marginBottom: 16,
|
|
46
|
+
},
|
|
47
|
+
});
|