@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,261 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where Lucy does the work, shown instead of explained: in the chat, on her computer in the cloud, or
|
|
3
|
+
* on the person's own computer once it is connected. Each place plays a small scene of a real job, and
|
|
4
|
+
* the three take turns until the person picks one.
|
|
5
|
+
*
|
|
6
|
+
* The scenes are Lottie files made with the Motion engine (tools/lottie/generate.mjs). The card
|
|
7
|
+
* around them, the words and the tabs stay in React Native, and one effect starts a scene and its tab's
|
|
8
|
+
* progress bar together. With Reduce Motion or a screen reader it holds each scene's finished frame and
|
|
9
|
+
* does not move on by itself.
|
|
10
|
+
*/
|
|
11
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
12
|
+
import { AccessibilityInfo, Animated, Easing, Pressable, Share, StyleSheet, Text, View } from 'react-native';
|
|
13
|
+
import LottieView, { type AnimationObject } from 'lottie-react-native';
|
|
14
|
+
import { Ionicons } from '@expo/vector-icons';
|
|
15
|
+
import { lottieInstalled } from './lottieInstalled';
|
|
16
|
+
import {
|
|
17
|
+
nextStage,
|
|
18
|
+
SCENE_FRAMES,
|
|
19
|
+
SCENE_SETTLED_FRAME,
|
|
20
|
+
sceneFor,
|
|
21
|
+
STAGE_MS,
|
|
22
|
+
workplaces,
|
|
23
|
+
type MyComputer,
|
|
24
|
+
type SceneId,
|
|
25
|
+
} from '../chat/whereLucyWorks';
|
|
26
|
+
import { useReducedMotion } from '../hooks/useReducedMotion';
|
|
27
|
+
import { cardShadow, colors, RADIUS } from '../theme/colors';
|
|
28
|
+
|
|
29
|
+
const SCENES: Record<SceneId, AnimationObject> = {
|
|
30
|
+
chat: require('../assets/lottie/where-lucy-works-chat.json'),
|
|
31
|
+
cloud: require('../assets/lottie/where-lucy-works-cloud.json'),
|
|
32
|
+
'mine-none': require('../assets/lottie/where-lucy-works-mine-none.json'),
|
|
33
|
+
'mine-online': require('../assets/lottie/where-lucy-works-mine-online.json'),
|
|
34
|
+
'mine-offline': require('../assets/lottie/where-lucy-works-mine-offline.json'),
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const FADE_MS = 340;
|
|
38
|
+
const FADE_OUT_MS = 120;
|
|
39
|
+
/** Spelled out: StyleSheet.absoluteFillObject is gone from newer React Native, and spreads to nothing there. */
|
|
40
|
+
const FILL = { position: 'absolute', left: 0, right: 0, top: 0, bottom: 0 } as const;
|
|
41
|
+
|
|
42
|
+
export function WhereLucyWorks({ computer, desktopLink }: { computer: MyComputer | null; desktopLink: string }) {
|
|
43
|
+
const reduced = useReducedMotion();
|
|
44
|
+
const [screenReader, setScreenReader] = useState(false);
|
|
45
|
+
const still = reduced || screenReader;
|
|
46
|
+
const places = useMemo(() => workplaces(computer), [computer]);
|
|
47
|
+
const scenes = useMemo(() => places.map((place) => sceneFor(place.id, computer)), [places, computer]);
|
|
48
|
+
const [hasLottie] = useState(lottieInstalled);
|
|
49
|
+
const [index, setIndex] = useState(0);
|
|
50
|
+
const [replays, setReplays] = useState(0);
|
|
51
|
+
const auto = useRef(true);
|
|
52
|
+
const played = useRef(0);
|
|
53
|
+
const players = useRef<(LottieView | null)[]>([]);
|
|
54
|
+
const scene = scenes[index];
|
|
55
|
+
|
|
56
|
+
const clock = useRef(new Animated.Value(0)).current;
|
|
57
|
+
/** One value per scene, so going from the last tab to the first does not pass through the one between. */
|
|
58
|
+
const shown = useRef([1, 0, 0].map((value) => new Animated.Value(value))).current;
|
|
59
|
+
const textIn = useRef(new Animated.Value(1)).current;
|
|
60
|
+
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
let alive = true;
|
|
63
|
+
AccessibilityInfo.isScreenReaderEnabled()
|
|
64
|
+
.then((value) => alive && setScreenReader(value))
|
|
65
|
+
.catch(() => undefined);
|
|
66
|
+
const sub = AccessibilityInfo.addEventListener('screenReaderChanged', setScreenReader);
|
|
67
|
+
return () => {
|
|
68
|
+
alive = false;
|
|
69
|
+
sub.remove();
|
|
70
|
+
};
|
|
71
|
+
}, []);
|
|
72
|
+
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
if (still) {
|
|
75
|
+
shown.forEach((value, i) => value.setValue(i === index ? 1 : 0));
|
|
76
|
+
textIn.setValue(1);
|
|
77
|
+
clock.setValue(1);
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
const player = players.current[index];
|
|
81
|
+
player?.play(0, SCENE_FRAMES);
|
|
82
|
+
// One scene leaves before the next arrives: two half-drawn scenes on top of each other read as a glitch.
|
|
83
|
+
shown.forEach((value, i) => {
|
|
84
|
+
const incoming = i === index;
|
|
85
|
+
Animated.timing(value, {
|
|
86
|
+
toValue: incoming ? 1 : 0,
|
|
87
|
+
duration: incoming ? FADE_MS : FADE_OUT_MS,
|
|
88
|
+
delay: incoming ? FADE_OUT_MS : 0,
|
|
89
|
+
easing: Easing.out(Easing.cubic),
|
|
90
|
+
useNativeDriver: true,
|
|
91
|
+
}).start();
|
|
92
|
+
});
|
|
93
|
+
textIn.setValue(0);
|
|
94
|
+
Animated.timing(textIn, {
|
|
95
|
+
toValue: 1,
|
|
96
|
+
duration: FADE_MS,
|
|
97
|
+
easing: Easing.out(Easing.cubic),
|
|
98
|
+
useNativeDriver: true,
|
|
99
|
+
}).start();
|
|
100
|
+
clock.setValue(0);
|
|
101
|
+
const run = Animated.timing(clock, {
|
|
102
|
+
toValue: 1,
|
|
103
|
+
duration: STAGE_MS,
|
|
104
|
+
easing: Easing.linear,
|
|
105
|
+
useNativeDriver: true,
|
|
106
|
+
});
|
|
107
|
+
run.start(({ finished }) => {
|
|
108
|
+
if (!finished || !auto.current) return;
|
|
109
|
+
played.current += 1;
|
|
110
|
+
const next = nextStage(played.current, places.length);
|
|
111
|
+
if (next === null) auto.current = false;
|
|
112
|
+
setIndex(next ?? 0);
|
|
113
|
+
});
|
|
114
|
+
return () => {
|
|
115
|
+
run.stop();
|
|
116
|
+
player?.pause();
|
|
117
|
+
};
|
|
118
|
+
}, [index, replays, scene, still, places.length, clock, shown, textIn]);
|
|
119
|
+
|
|
120
|
+
const pick = (next: number) => {
|
|
121
|
+
auto.current = false;
|
|
122
|
+
if (next === index) setReplays((count) => count + 1);
|
|
123
|
+
else setIndex(next);
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const place = places[index];
|
|
127
|
+
return (
|
|
128
|
+
<View style={s.card}>
|
|
129
|
+
{hasLottie ? (
|
|
130
|
+
<View style={s.stage} accessibilityElementsHidden importantForAccessibility="no-hide-descendants">
|
|
131
|
+
{scenes.map((id, i) => (
|
|
132
|
+
<Animated.View key={places[i].id} pointerEvents="none" style={[s.layer, { opacity: shown[i] }]}>
|
|
133
|
+
<LottieView
|
|
134
|
+
ref={(view) => {
|
|
135
|
+
players.current[i] = view;
|
|
136
|
+
}}
|
|
137
|
+
source={SCENES[id]}
|
|
138
|
+
loop={false}
|
|
139
|
+
progress={still ? SCENE_SETTLED_FRAME / SCENE_FRAMES : undefined}
|
|
140
|
+
resizeMode="contain"
|
|
141
|
+
style={s.scene}
|
|
142
|
+
/>
|
|
143
|
+
</Animated.View>
|
|
144
|
+
))}
|
|
145
|
+
</View>
|
|
146
|
+
) : null}
|
|
147
|
+
|
|
148
|
+
<Animated.View
|
|
149
|
+
style={[
|
|
150
|
+
s.copy,
|
|
151
|
+
{
|
|
152
|
+
opacity: textIn,
|
|
153
|
+
transform: [{ translateY: textIn.interpolate({ inputRange: [0, 1], outputRange: [6, 0] }) }],
|
|
154
|
+
},
|
|
155
|
+
]}
|
|
156
|
+
>
|
|
157
|
+
<View style={s.titleRow}>
|
|
158
|
+
<Text style={s.title} numberOfLines={1} accessibilityRole="header">
|
|
159
|
+
{place.title}
|
|
160
|
+
<Text style={s.titleEm}>{place.titleEm}</Text>
|
|
161
|
+
</Text>
|
|
162
|
+
{place.id === 'mine' && !computer ? (
|
|
163
|
+
<Pressable
|
|
164
|
+
accessibilityRole="button"
|
|
165
|
+
accessibilityLabel="Send the link to my computer"
|
|
166
|
+
accessibilityHint="Shares the link to install Yantra on your computer"
|
|
167
|
+
hitSlop={8}
|
|
168
|
+
onPress={() => {
|
|
169
|
+
auto.current = false;
|
|
170
|
+
Share.share({ message: desktopLink }).catch(() => undefined);
|
|
171
|
+
}}
|
|
172
|
+
style={({ pressed }) => [s.link, pressed && { opacity: 0.5 }]}
|
|
173
|
+
>
|
|
174
|
+
<Text style={s.linkText}>Send link</Text>
|
|
175
|
+
<Ionicons name="arrow-forward" size={13} color={colors.orangeText} />
|
|
176
|
+
</Pressable>
|
|
177
|
+
) : null}
|
|
178
|
+
</View>
|
|
179
|
+
<Text style={s.body} numberOfLines={2}>
|
|
180
|
+
{place.body}
|
|
181
|
+
</Text>
|
|
182
|
+
</Animated.View>
|
|
183
|
+
|
|
184
|
+
<View style={s.tabs} accessibilityRole="tablist">
|
|
185
|
+
{places.map((item, i) => {
|
|
186
|
+
const selected = i === index;
|
|
187
|
+
return (
|
|
188
|
+
<Pressable
|
|
189
|
+
key={item.id}
|
|
190
|
+
accessibilityRole="tab"
|
|
191
|
+
accessibilityState={{ selected }}
|
|
192
|
+
accessibilityLabel={item.tab}
|
|
193
|
+
onPress={() => pick(i)}
|
|
194
|
+
style={s.tab}
|
|
195
|
+
hitSlop={{ top: 8, bottom: 8 }}
|
|
196
|
+
>
|
|
197
|
+
<View style={s.track}>
|
|
198
|
+
{selected ? (
|
|
199
|
+
<Animated.View
|
|
200
|
+
style={[s.fill, { transform: [{ scaleX: clock }], transformOrigin: 'left' }]}
|
|
201
|
+
/>
|
|
202
|
+
) : null}
|
|
203
|
+
</View>
|
|
204
|
+
<Text style={[s.tabLabel, selected && s.tabLabelOn]} numberOfLines={1}>
|
|
205
|
+
{item.tab}
|
|
206
|
+
</Text>
|
|
207
|
+
</Pressable>
|
|
208
|
+
);
|
|
209
|
+
})}
|
|
210
|
+
</View>
|
|
211
|
+
</View>
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const s = StyleSheet.create({
|
|
216
|
+
card: {
|
|
217
|
+
alignSelf: 'stretch',
|
|
218
|
+
marginTop: 20,
|
|
219
|
+
padding: 12,
|
|
220
|
+
borderRadius: RADIUS,
|
|
221
|
+
backgroundColor: colors.card,
|
|
222
|
+
borderWidth: 1,
|
|
223
|
+
borderColor: colors.line,
|
|
224
|
+
...cardShadow,
|
|
225
|
+
shadowOpacity: 0.07,
|
|
226
|
+
elevation: 2,
|
|
227
|
+
},
|
|
228
|
+
stage: { height: 132, borderRadius: 16, backgroundColor: colors.soft, overflow: 'hidden' },
|
|
229
|
+
layer: FILL,
|
|
230
|
+
scene: { width: '100%', height: '100%' },
|
|
231
|
+
|
|
232
|
+
copy: { minHeight: 88, paddingHorizontal: 4, paddingTop: 12 },
|
|
233
|
+
titleRow: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', gap: 8 },
|
|
234
|
+
title: {
|
|
235
|
+
flexShrink: 1,
|
|
236
|
+
fontWeight: '600',
|
|
237
|
+
fontSize: 19,
|
|
238
|
+
lineHeight: 24,
|
|
239
|
+
letterSpacing: -0.3,
|
|
240
|
+
color: colors.ink,
|
|
241
|
+
},
|
|
242
|
+
titleEm: { fontWeight: '600', color: colors.orangeText },
|
|
243
|
+
body: { fontWeight: '400', fontSize: 14, lineHeight: 19.5, color: colors.muted, marginTop: 4 },
|
|
244
|
+
link: {
|
|
245
|
+
flexDirection: 'row',
|
|
246
|
+
alignItems: 'center',
|
|
247
|
+
gap: 3,
|
|
248
|
+
minHeight: 30,
|
|
249
|
+
paddingHorizontal: 11,
|
|
250
|
+
borderRadius: 15,
|
|
251
|
+
backgroundColor: colors.orangeSoft,
|
|
252
|
+
},
|
|
253
|
+
linkText: { fontWeight: '600', fontSize: 12.5, color: colors.orangeText },
|
|
254
|
+
|
|
255
|
+
tabs: { flexDirection: 'row', gap: 8, paddingHorizontal: 4, paddingTop: 2, paddingBottom: 2 },
|
|
256
|
+
tab: { flex: 1, minHeight: 34, justifyContent: 'center', gap: 6 },
|
|
257
|
+
track: { height: 3, borderRadius: 2, backgroundColor: colors.track, overflow: 'hidden' },
|
|
258
|
+
fill: { height: 3, borderRadius: 2, backgroundColor: colors.orange },
|
|
259
|
+
tabLabel: { fontWeight: '400', fontSize: 12.5, color: colors.muted },
|
|
260
|
+
tabLabelOn: { fontWeight: '600', color: colors.ink },
|
|
261
|
+
});
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Account > Workspace, as Yantra's (its WorkspaceSection / the web's OrgProjectSwitcher): the organization, project
|
|
3
|
+
* and environment Lucy works in, picked and then saved together. Saving writes the person's `account.default.*`
|
|
4
|
+
* (chat/workspace.ts) and has Lucy sign in again, so chats, chores and connected apps follow the new workspace.
|
|
5
|
+
*/
|
|
6
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
7
|
+
import { ActivityIndicator, Pressable, ScrollView, StyleSheet, Text, View } from 'react-native';
|
|
8
|
+
import { Ionicons } from '@expo/vector-icons';
|
|
9
|
+
import {
|
|
10
|
+
listEnvironments,
|
|
11
|
+
listOrganizations,
|
|
12
|
+
listProjects,
|
|
13
|
+
loadDefaults,
|
|
14
|
+
saveWorkspace,
|
|
15
|
+
type EnvironmentOption,
|
|
16
|
+
type OrgOption,
|
|
17
|
+
type ProjectOption,
|
|
18
|
+
} from '../chat/workspace';
|
|
19
|
+
import { Sheet } from './ChatSheets';
|
|
20
|
+
import { Button, Group, GroupRow } from './ui';
|
|
21
|
+
import { PAD, type, ui } from '../theme/muse';
|
|
22
|
+
|
|
23
|
+
type Picking = 'org' | 'project' | 'environment' | null;
|
|
24
|
+
|
|
25
|
+
/** A picker as a page sheet: the choices as one group, a check on the current one. */
|
|
26
|
+
function Picker({
|
|
27
|
+
visible,
|
|
28
|
+
title,
|
|
29
|
+
options,
|
|
30
|
+
selected,
|
|
31
|
+
onSelect,
|
|
32
|
+
onClose,
|
|
33
|
+
}: {
|
|
34
|
+
visible: boolean;
|
|
35
|
+
title: string;
|
|
36
|
+
options: { value: string; label: string; detail?: string }[];
|
|
37
|
+
selected: string;
|
|
38
|
+
onSelect: (value: string) => void;
|
|
39
|
+
onClose: () => void;
|
|
40
|
+
}) {
|
|
41
|
+
return (
|
|
42
|
+
<Sheet visible={visible} title={title} onClose={onClose}>
|
|
43
|
+
<ScrollView contentContainerStyle={{ paddingTop: 8, paddingBottom: 40 }}>
|
|
44
|
+
<Group>
|
|
45
|
+
{options.map((o, i) => {
|
|
46
|
+
const on = o.value === selected;
|
|
47
|
+
return (
|
|
48
|
+
<Pressable
|
|
49
|
+
key={o.value || '_'}
|
|
50
|
+
accessibilityRole="button"
|
|
51
|
+
accessibilityState={{ selected: on }}
|
|
52
|
+
onPress={() => {
|
|
53
|
+
onSelect(o.value);
|
|
54
|
+
onClose();
|
|
55
|
+
}}
|
|
56
|
+
style={({ pressed }) => [
|
|
57
|
+
st.option,
|
|
58
|
+
i < options.length - 1 && st.optionRule,
|
|
59
|
+
pressed && { backgroundColor: ui.fill },
|
|
60
|
+
]}
|
|
61
|
+
>
|
|
62
|
+
<View style={{ flex: 1 }}>
|
|
63
|
+
<Text style={[type.body, on && { fontWeight: '600' }]} numberOfLines={1}>
|
|
64
|
+
{o.label}
|
|
65
|
+
</Text>
|
|
66
|
+
{o.detail ? (
|
|
67
|
+
<Text style={type.footnote} numberOfLines={1}>
|
|
68
|
+
{o.detail}
|
|
69
|
+
</Text>
|
|
70
|
+
) : null}
|
|
71
|
+
</View>
|
|
72
|
+
{on ? <Ionicons name="checkmark" size={20} color={ui.accent} /> : null}
|
|
73
|
+
</Pressable>
|
|
74
|
+
);
|
|
75
|
+
})}
|
|
76
|
+
</Group>
|
|
77
|
+
</ScrollView>
|
|
78
|
+
</Sheet>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function WorkspaceSection({ enabled }: { enabled: boolean }) {
|
|
83
|
+
const [saved, setSaved] = useState({ organization: '', project: '', environment: '' });
|
|
84
|
+
const [org, setOrg] = useState('');
|
|
85
|
+
const [project, setProject] = useState('');
|
|
86
|
+
const [environment, setEnvironment] = useState('');
|
|
87
|
+
const [orgs, setOrgs] = useState<OrgOption[] | null>(null);
|
|
88
|
+
const [projects, setProjects] = useState<ProjectOption[] | null>(null);
|
|
89
|
+
const [environments, setEnvironments] = useState<EnvironmentOption[] | null>(null);
|
|
90
|
+
const [picking, setPicking] = useState<Picking>(null);
|
|
91
|
+
const [busy, setBusy] = useState(false);
|
|
92
|
+
const [notice, setNotice] = useState<{ ok: boolean; text: string } | null>(null);
|
|
93
|
+
|
|
94
|
+
// What is saved, and the organizations to choose from.
|
|
95
|
+
const load = useCallback(async () => {
|
|
96
|
+
setNotice(null);
|
|
97
|
+
try {
|
|
98
|
+
const [defaults, list] = await Promise.all([loadDefaults(), listOrganizations()]);
|
|
99
|
+
setOrgs(list);
|
|
100
|
+
const current = {
|
|
101
|
+
organization: defaults.organization ?? '',
|
|
102
|
+
project: defaults.project ?? '',
|
|
103
|
+
environment: defaults.environment ?? '',
|
|
104
|
+
};
|
|
105
|
+
// No saved default: Lucy uses the first organization, so show that one.
|
|
106
|
+
if (!current.organization && list[0]) current.organization = list[0].name;
|
|
107
|
+
setSaved(current);
|
|
108
|
+
setOrg(current.organization);
|
|
109
|
+
setProject(current.project);
|
|
110
|
+
setEnvironment(current.environment);
|
|
111
|
+
} catch {
|
|
112
|
+
setOrgs([]);
|
|
113
|
+
setNotice({ ok: false, text: 'We couldn’t load your workspaces. Pull back in a moment and retry.' });
|
|
114
|
+
}
|
|
115
|
+
}, []);
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
if (enabled) load();
|
|
118
|
+
}, [enabled, load]);
|
|
119
|
+
|
|
120
|
+
// The organization's projects; a new organization starts on its saved project when it has it, else its first.
|
|
121
|
+
useEffect(() => {
|
|
122
|
+
if (!org) return undefined;
|
|
123
|
+
let live = true;
|
|
124
|
+
setProjects(null);
|
|
125
|
+
listProjects(org)
|
|
126
|
+
.then((list) => {
|
|
127
|
+
if (!live) return;
|
|
128
|
+
setProjects(list);
|
|
129
|
+
setProject((prev) => {
|
|
130
|
+
if (prev && list.some((p) => p.projectId === prev)) return prev;
|
|
131
|
+
if (org === saved.organization && list.some((p) => p.projectId === saved.project))
|
|
132
|
+
return saved.project;
|
|
133
|
+
return list[0]?.projectId ?? '';
|
|
134
|
+
});
|
|
135
|
+
})
|
|
136
|
+
.catch(() => live && setProjects([]));
|
|
137
|
+
return () => {
|
|
138
|
+
live = false;
|
|
139
|
+
};
|
|
140
|
+
}, [org, saved.organization, saved.project]);
|
|
141
|
+
|
|
142
|
+
// The project's environments (they key on its document id); one from another project falls back to Production.
|
|
143
|
+
const projectDocId = useMemo(() => projects?.find((p) => p.projectId === project)?.id ?? '', [projects, project]);
|
|
144
|
+
useEffect(() => {
|
|
145
|
+
if (!projectDocId) {
|
|
146
|
+
setEnvironments(null);
|
|
147
|
+
return undefined;
|
|
148
|
+
}
|
|
149
|
+
let live = true;
|
|
150
|
+
listEnvironments(projectDocId)
|
|
151
|
+
.then((list) => {
|
|
152
|
+
if (!live) return;
|
|
153
|
+
setEnvironments(list);
|
|
154
|
+
setEnvironment((prev) => (list.some((e) => e.id === prev) ? prev : ''));
|
|
155
|
+
})
|
|
156
|
+
.catch(() => live && setEnvironments([{ id: '', name: 'Production' }]));
|
|
157
|
+
return () => {
|
|
158
|
+
live = false;
|
|
159
|
+
};
|
|
160
|
+
}, [projectDocId]);
|
|
161
|
+
|
|
162
|
+
const dirty = org !== saved.organization || project !== saved.project || environment !== saved.environment;
|
|
163
|
+
const canSave = dirty && !!org && !!project && !busy;
|
|
164
|
+
|
|
165
|
+
const save = async () => {
|
|
166
|
+
if (!canSave) return;
|
|
167
|
+
setBusy(true);
|
|
168
|
+
setNotice(null);
|
|
169
|
+
try {
|
|
170
|
+
await saveWorkspace({ organization: org, project, environment });
|
|
171
|
+
setSaved({ organization: org, project, environment });
|
|
172
|
+
setNotice({ ok: true, text: 'Saved. Lucy now works in this workspace.' });
|
|
173
|
+
} catch {
|
|
174
|
+
setNotice({ ok: false, text: 'We couldn’t switch your workspace. Try again.' });
|
|
175
|
+
} finally {
|
|
176
|
+
setBusy(false);
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
const orgLabel = orgs === null ? 'Loading…' : (orgs.find((o) => o.name === org)?.title ?? 'Select');
|
|
181
|
+
let projectLabel = projects?.find((p) => p.projectId === project)?.name ?? 'Select';
|
|
182
|
+
if (projects === null) projectLabel = org ? 'Loading…' : 'Pick an organization';
|
|
183
|
+
else if (!projects.length) projectLabel = 'No projects yet';
|
|
184
|
+
const environmentLabel = environments?.find((e) => e.id === environment)?.name ?? 'Production';
|
|
185
|
+
|
|
186
|
+
return (
|
|
187
|
+
<>
|
|
188
|
+
<Group>
|
|
189
|
+
<GroupRow
|
|
190
|
+
icon="business-outline"
|
|
191
|
+
label="Organization"
|
|
192
|
+
value={orgLabel}
|
|
193
|
+
onPress={() => setPicking('org')}
|
|
194
|
+
disabled={busy || !orgs?.length}
|
|
195
|
+
/>
|
|
196
|
+
<GroupRow
|
|
197
|
+
icon="folder-outline"
|
|
198
|
+
label="Project"
|
|
199
|
+
value={projectLabel}
|
|
200
|
+
onPress={() => setPicking('project')}
|
|
201
|
+
disabled={busy || !projects?.length}
|
|
202
|
+
/>
|
|
203
|
+
<GroupRow
|
|
204
|
+
icon="layers-outline"
|
|
205
|
+
label="Environment"
|
|
206
|
+
value={environmentLabel}
|
|
207
|
+
onPress={() => setPicking('environment')}
|
|
208
|
+
disabled={busy || !environments?.length}
|
|
209
|
+
last
|
|
210
|
+
/>
|
|
211
|
+
</Group>
|
|
212
|
+
{notice ? (
|
|
213
|
+
<Text style={[st.notice, { color: notice.ok ? ui.ok : ui.danger }]} accessibilityLiveRegion="polite">
|
|
214
|
+
{notice.text}
|
|
215
|
+
</Text>
|
|
216
|
+
) : (
|
|
217
|
+
<Text style={st.note}>Lucy’s chats, chores and connected apps belong to this workspace.</Text>
|
|
218
|
+
)}
|
|
219
|
+
{dirty ? (
|
|
220
|
+
<View style={st.saveRow}>
|
|
221
|
+
<Button
|
|
222
|
+
label="Cancel"
|
|
223
|
+
variant="secondary"
|
|
224
|
+
onPress={() => {
|
|
225
|
+
setOrg(saved.organization);
|
|
226
|
+
setProject(saved.project);
|
|
227
|
+
setEnvironment(saved.environment);
|
|
228
|
+
setNotice(null);
|
|
229
|
+
}}
|
|
230
|
+
style={{ flex: 1 }}
|
|
231
|
+
/>
|
|
232
|
+
{busy ? (
|
|
233
|
+
<View style={[st.busy]}>
|
|
234
|
+
<ActivityIndicator color={ui.surface} />
|
|
235
|
+
</View>
|
|
236
|
+
) : (
|
|
237
|
+
<Button label="Switch workspace" onPress={save} disabled={!canSave} style={{ flex: 1.4 }} />
|
|
238
|
+
)}
|
|
239
|
+
</View>
|
|
240
|
+
) : null}
|
|
241
|
+
|
|
242
|
+
<Picker
|
|
243
|
+
visible={picking === 'org'}
|
|
244
|
+
title="Organization"
|
|
245
|
+
options={(orgs ?? []).map((o) => ({
|
|
246
|
+
value: o.name,
|
|
247
|
+
label: o.title,
|
|
248
|
+
detail: o.title !== o.name ? o.name : undefined,
|
|
249
|
+
}))}
|
|
250
|
+
selected={org}
|
|
251
|
+
onSelect={(v) => {
|
|
252
|
+
if (v === org) return;
|
|
253
|
+
setOrg(v);
|
|
254
|
+
setProject('');
|
|
255
|
+
setEnvironment('');
|
|
256
|
+
setNotice(null);
|
|
257
|
+
}}
|
|
258
|
+
onClose={() => setPicking(null)}
|
|
259
|
+
/>
|
|
260
|
+
<Picker
|
|
261
|
+
visible={picking === 'project'}
|
|
262
|
+
title="Project"
|
|
263
|
+
options={(projects ?? []).map((p) => ({ value: p.projectId, label: p.name }))}
|
|
264
|
+
selected={project}
|
|
265
|
+
onSelect={(v) => {
|
|
266
|
+
setProject(v);
|
|
267
|
+
setNotice(null);
|
|
268
|
+
}}
|
|
269
|
+
onClose={() => setPicking(null)}
|
|
270
|
+
/>
|
|
271
|
+
<Picker
|
|
272
|
+
visible={picking === 'environment'}
|
|
273
|
+
title="Environment"
|
|
274
|
+
options={(environments ?? []).map((e) => ({ value: e.id, label: e.name }))}
|
|
275
|
+
selected={environment}
|
|
276
|
+
onSelect={(v) => {
|
|
277
|
+
setEnvironment(v);
|
|
278
|
+
setNotice(null);
|
|
279
|
+
}}
|
|
280
|
+
onClose={() => setPicking(null)}
|
|
281
|
+
/>
|
|
282
|
+
</>
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
const st = StyleSheet.create({
|
|
287
|
+
option: {
|
|
288
|
+
flexDirection: 'row',
|
|
289
|
+
alignItems: 'center',
|
|
290
|
+
gap: 12,
|
|
291
|
+
minHeight: 50,
|
|
292
|
+
paddingHorizontal: PAD,
|
|
293
|
+
paddingVertical: 10,
|
|
294
|
+
},
|
|
295
|
+
optionRule: { borderBottomWidth: StyleSheet.hairlineWidth, borderBottomColor: ui.hairline },
|
|
296
|
+
note: { ...type.footnote, paddingHorizontal: PAD + 4, marginTop: 8 },
|
|
297
|
+
notice: { ...type.footnote, fontWeight: '500', paddingHorizontal: PAD + 4, marginTop: 8 },
|
|
298
|
+
saveRow: { flexDirection: 'row', gap: 10, paddingHorizontal: PAD, marginTop: 12 },
|
|
299
|
+
busy: {
|
|
300
|
+
flex: 1.4,
|
|
301
|
+
minHeight: 48,
|
|
302
|
+
borderRadius: 14,
|
|
303
|
+
backgroundColor: ui.accent,
|
|
304
|
+
alignItems: 'center',
|
|
305
|
+
justifyContent: 'center',
|
|
306
|
+
},
|
|
307
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Yantra mark, at rest - as the web home draws it beside "Running a business? That's Yantra." (browser
|
|
3
|
+
* src/pages/Home/YantraMark.tsx). Only that card uses it: it points a business to Yantra. Clockbook's own mark is Logo.
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import Svg, { Path, Polygon } from 'react-native-svg';
|
|
7
|
+
|
|
8
|
+
export function YantraMark({ size = 36 }: { size?: number }) {
|
|
9
|
+
return (
|
|
10
|
+
<Svg
|
|
11
|
+
width={size}
|
|
12
|
+
height={Math.round((size * 212) / 228)}
|
|
13
|
+
viewBox="78 62 228 212"
|
|
14
|
+
accessibilityElementsHidden
|
|
15
|
+
importantForAccessibility="no"
|
|
16
|
+
>
|
|
17
|
+
<Polygon fill="#DF1E5B" points="85.22,256.89 105.11,223.09 129.35,256.89" />
|
|
18
|
+
<Polygon fill="#31B57E" points="298.71,256.89 254.57,256.89 278.82,223.09" />
|
|
19
|
+
<Polygon fill="#DF1E5B" points="182.27,256.89 142.89,256.89 111.22,212.73 128.56,183.26" />
|
|
20
|
+
<Polygon fill="#31B57E" points="272.71,212.73 241.04,256.89 201.66,256.89 255.37,183.26" />
|
|
21
|
+
<Path
|
|
22
|
+
fill="#EAB12B"
|
|
23
|
+
fillRule="evenodd"
|
|
24
|
+
d="M246.64,168.43H137.28l-2.64,4.51l57.32,78.6l57.32-78.6L246.64,168.43z M191.96,208.5c-5.76,0-10.43-4.67-10.43-10.43c0-5.76,4.67-10.43,10.43-10.43c5.77,0,10.45,4.67,10.45,10.43C202.41,203.83,197.73,208.5,191.96,208.5z"
|
|
25
|
+
/>
|
|
26
|
+
<Polygon fill="#39C5EF" points="217.45,118.82 166.48,118.82 191.97,75.53" />
|
|
27
|
+
<Polygon fill="#39C5EF" points="240.18,157.43 143.75,157.43 160.01,129.82 223.92,129.82" />
|
|
28
|
+
</Svg>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The header a drawer screen wears, as Home's: the round menu button on the left and the title centred on the whole
|
|
3
|
+
* width (drawn on the header's background: as the title it was centred only between the two sides).
|
|
4
|
+
*/
|
|
5
|
+
import React, { useLayoutEffect } from 'react';
|
|
6
|
+
import { StyleSheet, Text, View } from 'react-native';
|
|
7
|
+
import { DrawerActions, useNavigation } from '@react-navigation/native';
|
|
8
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
9
|
+
import { FloatingButton } from './ui';
|
|
10
|
+
import { PAD, ui } from '../theme/muse';
|
|
11
|
+
|
|
12
|
+
export function useDrawerHeader(title: string) {
|
|
13
|
+
const navigation = useNavigation<{ setOptions: (o: object) => void; dispatch: (a: object) => void }>();
|
|
14
|
+
const top = useSafeAreaInsets().top;
|
|
15
|
+
useLayoutEffect(() => {
|
|
16
|
+
navigation.setOptions({
|
|
17
|
+
headerTitle: () => null,
|
|
18
|
+
headerStyle: { backgroundColor: ui.bg },
|
|
19
|
+
headerShadowVisible: false,
|
|
20
|
+
headerBackground: () => (
|
|
21
|
+
<View style={[StyleSheet.absoluteFill, { backgroundColor: ui.bg }]}>
|
|
22
|
+
<View style={[s.center, { top }]}>
|
|
23
|
+
<Text style={s.title} numberOfLines={1} accessibilityRole="header">
|
|
24
|
+
{title}
|
|
25
|
+
</Text>
|
|
26
|
+
</View>
|
|
27
|
+
</View>
|
|
28
|
+
),
|
|
29
|
+
headerLeft: () => (
|
|
30
|
+
<View style={{ marginLeft: PAD }}>
|
|
31
|
+
<FloatingButton
|
|
32
|
+
icon="menu"
|
|
33
|
+
label="Menu"
|
|
34
|
+
onPress={() => navigation.dispatch(DrawerActions.toggleDrawer())}
|
|
35
|
+
/>
|
|
36
|
+
</View>
|
|
37
|
+
),
|
|
38
|
+
headerRight: () => null,
|
|
39
|
+
});
|
|
40
|
+
}, [navigation, title, top]);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const s = StyleSheet.create({
|
|
44
|
+
center: { position: 'absolute', left: 80, right: 80, bottom: 0, alignItems: 'center', justifyContent: 'center' },
|
|
45
|
+
title: { fontSize: 17, fontWeight: '600', letterSpacing: -0.2, color: ui.ink },
|
|
46
|
+
});
|