@oxyhq/services 22.10.0 → 22.11.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/lib/commonjs/ui/components/AvatarCameraBadge.js +42 -0
- package/lib/commonjs/ui/components/AvatarCameraBadge.js.map +1 -0
- package/lib/commonjs/ui/components/OxyAccountDialogScreen.js +41 -19
- package/lib/commonjs/ui/components/OxyAccountDialogScreen.js.map +1 -1
- package/lib/commonjs/ui/components/OxyAuthChooser.js +640 -168
- package/lib/commonjs/ui/components/OxyAuthChooser.js.map +1 -1
- package/lib/commonjs/ui/components/ProfileButton.js +14 -0
- package/lib/commonjs/ui/components/ProfileButton.js.map +1 -1
- package/lib/commonjs/ui/components/ProfileSummaryCard.js +3 -23
- package/lib/commonjs/ui/components/ProfileSummaryCard.js.map +1 -1
- package/lib/commonjs/ui/components/SurfaceScreen.js +41 -5
- package/lib/commonjs/ui/components/SurfaceScreen.js.map +1 -1
- package/lib/commonjs/ui/components/oxyAuthChooserStyles.js +78 -26
- package/lib/commonjs/ui/components/oxyAuthChooserStyles.js.map +1 -1
- package/lib/commonjs/ui/components/photogrid/JustifiedPhotoGrid.js +83 -23
- package/lib/commonjs/ui/components/photogrid/JustifiedPhotoGrid.js.map +1 -1
- package/lib/commonjs/ui/context/OxyContext.js +73 -37
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/queryKeys.js +18 -1
- package/lib/commonjs/ui/hooks/queries/queryKeys.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/useFileQueries.js +129 -0
- package/lib/commonjs/ui/hooks/queries/useFileQueries.js.map +1 -0
- package/lib/commonjs/ui/hooks/useAvatarPicker.js +36 -48
- package/lib/commonjs/ui/hooks/useAvatarPicker.js.map +1 -1
- package/lib/commonjs/ui/hooks/useReduceMotion.js +57 -0
- package/lib/commonjs/ui/hooks/useReduceMotion.js.map +1 -0
- package/lib/commonjs/ui/hooks/useSurfaceHeader.js +1 -1
- package/lib/commonjs/ui/hooks/useSurfaceHeader.js.map +1 -1
- package/lib/commonjs/ui/navigation/accountDialogManager.js +22 -0
- package/lib/commonjs/ui/navigation/accountDialogManager.js.map +1 -1
- package/lib/commonjs/ui/navigation/bottomSheetManager.js +5 -6
- package/lib/commonjs/ui/navigation/bottomSheetManager.js.map +1 -1
- package/lib/commonjs/ui/navigation/routes.js +1 -0
- package/lib/commonjs/ui/navigation/routes.js.map +1 -1
- package/lib/commonjs/ui/navigation/surfaceNavStack.js +62 -15
- package/lib/commonjs/ui/navigation/surfaceNavStack.js.map +1 -1
- package/lib/commonjs/ui/navigation/surfaceRegistry.js +38 -17
- package/lib/commonjs/ui/navigation/surfaceRegistry.js.map +1 -1
- package/lib/commonjs/ui/navigation/surfaces.js +98 -21
- package/lib/commonjs/ui/navigation/surfaces.js.map +1 -1
- package/lib/commonjs/ui/screens/AvatarCropScreen.js +281 -279
- package/lib/commonjs/ui/screens/AvatarCropScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ChangeAvatarScreen.js +301 -0
- package/lib/commonjs/ui/screens/ChangeAvatarScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/FileManagementScreen.js +194 -431
- package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/WelcomeNewUserScreen.js +16 -48
- package/lib/commonjs/ui/screens/WelcomeNewUserScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/fileManagement/FileLibraryError.js +63 -0
- package/lib/commonjs/ui/screens/fileManagement/FileLibraryError.js.map +1 -0
- package/lib/commonjs/ui/screens/fileManagement/PhotoPickerSection.js +54 -41
- package/lib/commonjs/ui/screens/fileManagement/PhotoPickerSection.js.map +1 -1
- package/lib/commonjs/ui/screens/fileManagement/hooks/useFileUploadState.js +44 -81
- package/lib/commonjs/ui/screens/fileManagement/hooks/useFileUploadState.js.map +1 -1
- package/lib/commonjs/ui/stores/resetSessionScopedStores.js +8 -3
- package/lib/commonjs/ui/stores/resetSessionScopedStores.js.map +1 -1
- package/lib/commonjs/ui/utils/avatarUtils.js +11 -2
- package/lib/commonjs/ui/utils/avatarUtils.js.map +1 -1
- package/lib/commonjs/ui/utils/fileManagement.js +0 -79
- package/lib/commonjs/ui/utils/fileManagement.js.map +1 -1
- package/lib/module/ui/components/AvatarCameraBadge.js +40 -0
- package/lib/module/ui/components/AvatarCameraBadge.js.map +1 -0
- package/lib/module/ui/components/OxyAccountDialogScreen.js +41 -19
- package/lib/module/ui/components/OxyAccountDialogScreen.js.map +1 -1
- package/lib/module/ui/components/OxyAuthChooser.js +642 -171
- package/lib/module/ui/components/OxyAuthChooser.js.map +1 -1
- package/lib/module/ui/components/ProfileButton.js +15 -1
- package/lib/module/ui/components/ProfileButton.js.map +1 -1
- package/lib/module/ui/components/ProfileSummaryCard.js +2 -23
- package/lib/module/ui/components/ProfileSummaryCard.js.map +1 -1
- package/lib/module/ui/components/SurfaceScreen.js +43 -7
- package/lib/module/ui/components/SurfaceScreen.js.map +1 -1
- package/lib/module/ui/components/oxyAuthChooserStyles.js +78 -26
- package/lib/module/ui/components/oxyAuthChooserStyles.js.map +1 -1
- package/lib/module/ui/components/photogrid/JustifiedPhotoGrid.js +83 -25
- package/lib/module/ui/components/photogrid/JustifiedPhotoGrid.js.map +1 -1
- package/lib/module/ui/context/OxyContext.js +74 -38
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/hooks/queries/queryKeys.js +16 -0
- package/lib/module/ui/hooks/queries/queryKeys.js.map +1 -1
- package/lib/module/ui/hooks/queries/useFileQueries.js +120 -0
- package/lib/module/ui/hooks/queries/useFileQueries.js.map +1 -0
- package/lib/module/ui/hooks/useAvatarPicker.js +37 -49
- package/lib/module/ui/hooks/useAvatarPicker.js.map +1 -1
- package/lib/module/ui/hooks/useReduceMotion.js +53 -0
- package/lib/module/ui/hooks/useReduceMotion.js.map +1 -0
- package/lib/module/ui/hooks/useSurfaceHeader.js +1 -1
- package/lib/module/ui/hooks/useSurfaceHeader.js.map +1 -1
- package/lib/module/ui/navigation/accountDialogManager.js +20 -0
- package/lib/module/ui/navigation/accountDialogManager.js.map +1 -1
- package/lib/module/ui/navigation/bottomSheetManager.js +6 -7
- package/lib/module/ui/navigation/bottomSheetManager.js.map +1 -1
- package/lib/module/ui/navigation/routes.js +1 -0
- package/lib/module/ui/navigation/routes.js.map +1 -1
- package/lib/module/ui/navigation/surfaceNavStack.js +62 -15
- package/lib/module/ui/navigation/surfaceNavStack.js.map +1 -1
- package/lib/module/ui/navigation/surfaceRegistry.js +38 -17
- package/lib/module/ui/navigation/surfaceRegistry.js.map +1 -1
- package/lib/module/ui/navigation/surfaces.js +97 -22
- package/lib/module/ui/navigation/surfaces.js.map +1 -1
- package/lib/module/ui/screens/AvatarCropScreen.js +283 -281
- package/lib/module/ui/screens/AvatarCropScreen.js.map +1 -1
- package/lib/module/ui/screens/ChangeAvatarScreen.js +298 -0
- package/lib/module/ui/screens/ChangeAvatarScreen.js.map +1 -0
- package/lib/module/ui/screens/FileManagementScreen.js +196 -433
- package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/WelcomeNewUserScreen.js +17 -49
- package/lib/module/ui/screens/WelcomeNewUserScreen.js.map +1 -1
- package/lib/module/ui/screens/fileManagement/FileLibraryError.js +59 -0
- package/lib/module/ui/screens/fileManagement/FileLibraryError.js.map +1 -0
- package/lib/module/ui/screens/fileManagement/PhotoPickerSection.js +54 -42
- package/lib/module/ui/screens/fileManagement/PhotoPickerSection.js.map +1 -1
- package/lib/module/ui/screens/fileManagement/hooks/useFileUploadState.js +45 -81
- package/lib/module/ui/screens/fileManagement/hooks/useFileUploadState.js.map +1 -1
- package/lib/module/ui/stores/resetSessionScopedStores.js +8 -3
- package/lib/module/ui/stores/resetSessionScopedStores.js.map +1 -1
- package/lib/module/ui/utils/avatarUtils.js +11 -2
- package/lib/module/ui/utils/avatarUtils.js.map +1 -1
- package/lib/module/ui/utils/fileManagement.js +0 -78
- package/lib/module/ui/utils/fileManagement.js.map +1 -1
- package/lib/typescript/commonjs/ui/components/AvatarCameraBadge.d.ts +4 -0
- package/lib/typescript/commonjs/ui/components/AvatarCameraBadge.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/OxyAccountDialogScreen.d.ts +2 -1
- package/lib/typescript/commonjs/ui/components/OxyAccountDialogScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/OxyAuthChooser.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/ProfileButton.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/ProfileSummaryCard.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/SurfaceScreen.d.ts +1 -4
- package/lib/typescript/commonjs/ui/components/SurfaceScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/oxyAuthChooserStyles.d.ts +71 -19
- package/lib/typescript/commonjs/ui/components/oxyAuthChooserStyles.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/photogrid/JustifiedPhotoGrid.d.ts +10 -8
- package/lib/typescript/commonjs/ui/components/photogrid/JustifiedPhotoGrid.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/queryKeys.d.ts +9 -0
- package/lib/typescript/commonjs/ui/hooks/queries/queryKeys.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/useFileQueries.d.ts +50 -0
- package/lib/typescript/commonjs/ui/hooks/queries/useFileQueries.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/hooks/useAvatarPicker.d.ts +15 -10
- package/lib/typescript/commonjs/ui/hooks/useAvatarPicker.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/useReduceMotion.d.ts +14 -0
- package/lib/typescript/commonjs/ui/hooks/useReduceMotion.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/hooks/useSurfaceHeader.d.ts +1 -1
- package/lib/typescript/commonjs/ui/hooks/useSurfaceHeader.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/navigation/accountDialogManager.d.ts +13 -0
- package/lib/typescript/commonjs/ui/navigation/accountDialogManager.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/navigation/bottomSheetManager.d.ts +4 -5
- package/lib/typescript/commonjs/ui/navigation/bottomSheetManager.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/navigation/routes.d.ts +1 -1
- package/lib/typescript/commonjs/ui/navigation/routes.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/navigation/surfaceNavStack.d.ts +21 -0
- package/lib/typescript/commonjs/ui/navigation/surfaceNavStack.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/navigation/surfaceRegistry.d.ts +73 -13
- package/lib/typescript/commonjs/ui/navigation/surfaceRegistry.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/navigation/surfaces.d.ts +42 -11
- package/lib/typescript/commonjs/ui/navigation/surfaces.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/AvatarCropScreen.d.ts +18 -5
- package/lib/typescript/commonjs/ui/screens/AvatarCropScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/ChangeAvatarScreen.d.ts +34 -0
- package/lib/typescript/commonjs/ui/screens/ChangeAvatarScreen.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/FileManagementScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/WelcomeNewUserScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/fileManagement/FileLibraryError.d.ts +23 -0
- package/lib/typescript/commonjs/ui/screens/fileManagement/FileLibraryError.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/fileManagement/PhotoPickerSection.d.ts +4 -0
- package/lib/typescript/commonjs/ui/screens/fileManagement/PhotoPickerSection.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/fileManagement/hooks/useFileUploadState.d.ts +10 -2
- package/lib/typescript/commonjs/ui/screens/fileManagement/hooks/useFileUploadState.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/stores/resetSessionScopedStores.d.ts +8 -1
- package/lib/typescript/commonjs/ui/stores/resetSessionScopedStores.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/types/navigation.d.ts +2 -0
- package/lib/typescript/commonjs/ui/types/navigation.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/utils/avatarUtils.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/utils/fileManagement.d.ts +0 -48
- package/lib/typescript/commonjs/ui/utils/fileManagement.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/AvatarCameraBadge.d.ts +4 -0
- package/lib/typescript/module/ui/components/AvatarCameraBadge.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/OxyAccountDialogScreen.d.ts +2 -1
- package/lib/typescript/module/ui/components/OxyAccountDialogScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/OxyAuthChooser.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/ProfileButton.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/ProfileSummaryCard.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/SurfaceScreen.d.ts +1 -4
- package/lib/typescript/module/ui/components/SurfaceScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/oxyAuthChooserStyles.d.ts +71 -19
- package/lib/typescript/module/ui/components/oxyAuthChooserStyles.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/photogrid/JustifiedPhotoGrid.d.ts +10 -8
- package/lib/typescript/module/ui/components/photogrid/JustifiedPhotoGrid.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queries/queryKeys.d.ts +9 -0
- package/lib/typescript/module/ui/hooks/queries/queryKeys.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queries/useFileQueries.d.ts +50 -0
- package/lib/typescript/module/ui/hooks/queries/useFileQueries.d.ts.map +1 -0
- package/lib/typescript/module/ui/hooks/useAvatarPicker.d.ts +15 -10
- package/lib/typescript/module/ui/hooks/useAvatarPicker.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useReduceMotion.d.ts +14 -0
- package/lib/typescript/module/ui/hooks/useReduceMotion.d.ts.map +1 -0
- package/lib/typescript/module/ui/hooks/useSurfaceHeader.d.ts +1 -1
- package/lib/typescript/module/ui/hooks/useSurfaceHeader.d.ts.map +1 -1
- package/lib/typescript/module/ui/navigation/accountDialogManager.d.ts +13 -0
- package/lib/typescript/module/ui/navigation/accountDialogManager.d.ts.map +1 -1
- package/lib/typescript/module/ui/navigation/bottomSheetManager.d.ts +4 -5
- package/lib/typescript/module/ui/navigation/bottomSheetManager.d.ts.map +1 -1
- package/lib/typescript/module/ui/navigation/routes.d.ts +1 -1
- package/lib/typescript/module/ui/navigation/routes.d.ts.map +1 -1
- package/lib/typescript/module/ui/navigation/surfaceNavStack.d.ts +21 -0
- package/lib/typescript/module/ui/navigation/surfaceNavStack.d.ts.map +1 -1
- package/lib/typescript/module/ui/navigation/surfaceRegistry.d.ts +73 -13
- package/lib/typescript/module/ui/navigation/surfaceRegistry.d.ts.map +1 -1
- package/lib/typescript/module/ui/navigation/surfaces.d.ts +42 -11
- package/lib/typescript/module/ui/navigation/surfaces.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/AvatarCropScreen.d.ts +18 -5
- package/lib/typescript/module/ui/screens/AvatarCropScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/ChangeAvatarScreen.d.ts +34 -0
- package/lib/typescript/module/ui/screens/ChangeAvatarScreen.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/FileManagementScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/WelcomeNewUserScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/fileManagement/FileLibraryError.d.ts +23 -0
- package/lib/typescript/module/ui/screens/fileManagement/FileLibraryError.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/fileManagement/PhotoPickerSection.d.ts +4 -0
- package/lib/typescript/module/ui/screens/fileManagement/PhotoPickerSection.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/fileManagement/hooks/useFileUploadState.d.ts +10 -2
- package/lib/typescript/module/ui/screens/fileManagement/hooks/useFileUploadState.d.ts.map +1 -1
- package/lib/typescript/module/ui/stores/resetSessionScopedStores.d.ts +8 -1
- package/lib/typescript/module/ui/stores/resetSessionScopedStores.d.ts.map +1 -1
- package/lib/typescript/module/ui/types/navigation.d.ts +2 -0
- package/lib/typescript/module/ui/types/navigation.d.ts.map +1 -1
- package/lib/typescript/module/ui/utils/avatarUtils.d.ts.map +1 -1
- package/lib/typescript/module/ui/utils/fileManagement.d.ts +0 -48
- package/lib/typescript/module/ui/utils/fileManagement.d.ts.map +1 -1
- package/package.json +8 -4
- package/src/ui/components/AvatarCameraBadge.tsx +35 -0
- package/src/ui/components/OxyAccountDialogScreen.tsx +38 -15
- package/src/ui/components/OxyAuthChooser.tsx +722 -185
- package/src/ui/components/ProfileButton.tsx +16 -1
- package/src/ui/components/ProfileSummaryCard.tsx +2 -25
- package/src/ui/components/SurfaceScreen.tsx +48 -14
- package/src/ui/components/oxyAuthChooserStyles.ts +75 -23
- package/src/ui/components/photogrid/JustifiedPhotoGrid.tsx +158 -84
- package/src/ui/components/photogrid/__tests__/chunkPhotos.test.ts +51 -0
- package/src/ui/context/OxyContext.tsx +74 -34
- package/src/ui/hooks/queries/queryKeys.ts +15 -0
- package/src/ui/hooks/queries/useFileQueries.ts +162 -0
- package/src/ui/hooks/useAvatarPicker.ts +38 -53
- package/src/ui/hooks/useReduceMotion.ts +58 -0
- package/src/ui/hooks/useSurfaceHeader.ts +2 -1
- package/src/ui/navigation/__tests__/getSurfaceConfig.test.ts +55 -7
- package/src/ui/navigation/__tests__/surfaceNavStack.test.ts +81 -0
- package/src/ui/navigation/accountDialogManager.ts +28 -0
- package/src/ui/navigation/bottomSheetManager.ts +6 -7
- package/src/ui/navigation/routes.ts +3 -1
- package/src/ui/navigation/surfaceNavStack.ts +72 -9
- package/src/ui/navigation/surfaceRegistry.ts +91 -17
- package/src/ui/navigation/surfaces.ts +108 -29
- package/src/ui/screens/AvatarCropScreen.tsx +336 -298
- package/src/ui/screens/ChangeAvatarScreen.tsx +359 -0
- package/src/ui/screens/FileManagementScreen.tsx +189 -432
- package/src/ui/screens/WelcomeNewUserScreen.tsx +18 -48
- package/src/ui/screens/fileManagement/FileLibraryError.tsx +56 -0
- package/src/ui/screens/fileManagement/PhotoPickerSection.tsx +56 -46
- package/src/ui/screens/fileManagement/hooks/useFileUploadState.ts +55 -71
- package/src/ui/stores/resetSessionScopedStores.ts +8 -3
- package/src/ui/types/navigation.ts +2 -0
- package/src/ui/utils/avatarUtils.ts +11 -2
- package/src/ui/utils/fileManagement.ts +1 -101
- package/lib/commonjs/ui/stores/fileStore.js +0 -153
- package/lib/commonjs/ui/stores/fileStore.js.map +0 -1
- package/lib/module/ui/stores/fileStore.js +0 -145
- package/lib/module/ui/stores/fileStore.js.map +0 -1
- package/lib/typescript/commonjs/ui/stores/fileStore.d.ts +0 -31
- package/lib/typescript/commonjs/ui/stores/fileStore.d.ts.map +0 -1
- package/lib/typescript/module/ui/stores/fileStore.d.ts +0 -31
- package/lib/typescript/module/ui/stores/fileStore.d.ts.map +0 -1
- package/src/ui/stores/fileStore.ts +0 -118
|
@@ -47,7 +47,14 @@
|
|
|
47
47
|
*/
|
|
48
48
|
|
|
49
49
|
import type React from 'react';
|
|
50
|
-
import {
|
|
50
|
+
import {
|
|
51
|
+
Fragment,
|
|
52
|
+
useCallback,
|
|
53
|
+
useMemo,
|
|
54
|
+
useRef,
|
|
55
|
+
useState,
|
|
56
|
+
useSyncExternalStore,
|
|
57
|
+
} from 'react';
|
|
51
58
|
import {
|
|
52
59
|
Linking,
|
|
53
60
|
Platform,
|
|
@@ -57,10 +64,20 @@ import {
|
|
|
57
64
|
type StyleProp,
|
|
58
65
|
type ViewStyle,
|
|
59
66
|
} from 'react-native';
|
|
67
|
+
import Animated, {
|
|
68
|
+
Extrapolation,
|
|
69
|
+
interpolate,
|
|
70
|
+
useAnimatedStyle,
|
|
71
|
+
useSharedValue,
|
|
72
|
+
withTiming,
|
|
73
|
+
} from 'react-native-reanimated';
|
|
60
74
|
import { MaterialCommunityIcons } from '@expo/vector-icons';
|
|
61
75
|
import QRCode from 'react-native-qrcode-svg';
|
|
62
76
|
import { Avatar } from '@oxyhq/bloom/avatar';
|
|
77
|
+
import { AvatarGroup, type AvatarGroupItem } from '@oxyhq/bloom/avatar-group';
|
|
63
78
|
import { Button } from '@oxyhq/bloom/button';
|
|
79
|
+
import { PressableScale } from '@oxyhq/bloom/pressable-scale';
|
|
80
|
+
import { CompositionBar, type CompositionCategory } from '@oxyhq/bloom/composition-bar';
|
|
64
81
|
import { SettingsListGroup, SettingsListItem } from '@oxyhq/bloom/settings-list';
|
|
65
82
|
import { toast } from '@oxyhq/bloom';
|
|
66
83
|
import { Text } from '@oxyhq/bloom/typography';
|
|
@@ -72,24 +89,32 @@ import {
|
|
|
72
89
|
type AppColorName,
|
|
73
90
|
} from '@oxyhq/bloom/theme';
|
|
74
91
|
import type { AccountDialogSnapshot, OxyServices, SwitchableAccount } from '@oxyhq/core';
|
|
75
|
-
import { isOxyRpOrigin } from '@oxyhq/core';
|
|
92
|
+
import { getNormalizedUserHandle, isOxyRpOrigin } from '@oxyhq/core';
|
|
76
93
|
import { useQueryClient } from '@tanstack/react-query';
|
|
77
94
|
import { useOxy } from '../context/OxyContext';
|
|
78
95
|
import { useI18n } from '../hooks/useI18n';
|
|
96
|
+
import { getAccountDialogConsumerHooks } from '../navigation/accountDialogManager';
|
|
79
97
|
import { isWebBrowser } from '../utils/isWebBrowser';
|
|
80
98
|
import { getCommonsAcquisitionUrl } from '../utils/commonsStoreLinks';
|
|
99
|
+
import { useAccountStorageUsage } from '../hooks/queries/useServicesQueries';
|
|
81
100
|
import { authChooserStyles as styles } from './oxyAuthChooserStyles';
|
|
101
|
+
import AvatarCameraBadge from './AvatarCameraBadge';
|
|
82
102
|
|
|
83
|
-
/** Diameter of a row avatar. */
|
|
103
|
+
/** Diameter of a row avatar (the sign-in view's account rows). */
|
|
84
104
|
const ROW_AVATAR_SIZE = 40;
|
|
85
|
-
/** Diameter of the prominent current-account avatar in the collapsed header. */
|
|
86
|
-
const HEADER_AVATAR_SIZE = 48;
|
|
87
105
|
/** High-contrast QR colors — intentionally fixed (NOT themed) for scan reliability. */
|
|
88
106
|
const QR_PLATE_BG = '#FFFFFF';
|
|
89
107
|
const QR_FOREGROUND = '#000000';
|
|
90
108
|
const QR_SIZE = 196;
|
|
91
109
|
/** Commons' own identity-creation deep link (mirrors the `approve`/`attest`/`card` intents). */
|
|
92
110
|
const COMMONS_CREATE_IDENTITY_URL = 'oxycommons://create-identity';
|
|
111
|
+
/**
|
|
112
|
+
* "Accounts by Oxy" management app — the canonical home for account settings,
|
|
113
|
+
* data export, and storage management. The account-menu rows deep-link into it
|
|
114
|
+
* (`/data`, `/storage`, or its root) the same way `getCommonsAcquisitionUrl`
|
|
115
|
+
* hands off to Commons; nothing here invents new API endpoints.
|
|
116
|
+
*/
|
|
117
|
+
const ACCOUNTS_APP_URL = 'https://accounts.oxy.so';
|
|
93
118
|
|
|
94
119
|
export interface OxyAuthChooserProps {
|
|
95
120
|
/** Called after a completed switch, sign-in, or sign-up. */
|
|
@@ -119,6 +144,13 @@ interface OxyAuthChooserHandlers {
|
|
|
119
144
|
onSwitch: (accountId: string) => void;
|
|
120
145
|
onAdd: () => void;
|
|
121
146
|
onManage: () => void;
|
|
147
|
+
/**
|
|
148
|
+
* Change the current account's photo — opens the avatar-change flow. Because
|
|
149
|
+
* the account menu lives in the AccountDialog surface, this MORPHS that surface
|
|
150
|
+
* into `ChangeAvatar` (via `openAvatarPicker` → `openWithinOrPresent`), the same
|
|
151
|
+
* flow ManageAccount's avatar uses; it never stacks a new dialog.
|
|
152
|
+
*/
|
|
153
|
+
onEditAvatar: () => void;
|
|
122
154
|
}
|
|
123
155
|
|
|
124
156
|
type Theme = ReturnType<typeof useTheme>;
|
|
@@ -137,6 +169,8 @@ const OxyAuthChooser: React.FC<OxyAuthChooserProps> = ({ onComplete }) => {
|
|
|
137
169
|
signInWithPasskey,
|
|
138
170
|
registerWithPasskey,
|
|
139
171
|
oxyServices,
|
|
172
|
+
logout,
|
|
173
|
+
openAvatarPicker,
|
|
140
174
|
} = useOxy();
|
|
141
175
|
const theme = useTheme();
|
|
142
176
|
const { t } = useI18n();
|
|
@@ -199,12 +233,57 @@ const OxyAuthChooser: React.FC<OxyAuthChooserProps> = ({ onComplete }) => {
|
|
|
199
233
|
[createPasskeyPending, registerWithPasskey, onComplete, t],
|
|
200
234
|
);
|
|
201
235
|
|
|
236
|
+
// Web: auto-start "Sign in with Oxy" when the sign-in entry becomes the shown
|
|
237
|
+
// view — the QR handoff is the PRIMARY web surface, not a button behind a tap.
|
|
238
|
+
// `signInWithOxy()` tries the shared keychain first (silently, native-only)
|
|
239
|
+
// then falls to the QR handoff, which is what actually renders. Driven from the
|
|
240
|
+
// EVENTS that reach that view — the initial `subscribe` pass below (an
|
|
241
|
+
// open-to-sign-in) and the add / back-to-sign-in handlers — never a watcher
|
|
242
|
+
// effect. Guarded so it never restarts a live flow (phase must be idle) and is a
|
|
243
|
+
// no-op on native (button-driven). Reads the live snapshot at call time (an
|
|
244
|
+
// event callback, not render), so it is stable across renders.
|
|
245
|
+
const autoStartSignIn = useCallback(() => {
|
|
246
|
+
if (!controller || !isWebBrowser()) return;
|
|
247
|
+
const { view: currentView, signIn } = controller.getSnapshot();
|
|
248
|
+
if ((currentView !== 'signin' && currentView !== 'add') || signIn.phase !== 'idle') return;
|
|
249
|
+
void controller.signInWithOxy();
|
|
250
|
+
}, [controller]);
|
|
251
|
+
|
|
202
252
|
// Bind the headless controller. `getSnapshot` returns a stable reference
|
|
203
253
|
// between changes, so it is `useSyncExternalStore`-safe. Guard the no-provider
|
|
204
254
|
// loading state (`controller` is `null`) with an inert store.
|
|
255
|
+
//
|
|
256
|
+
// The subscribe callback ALSO carries two owner-mandated reactions to the
|
|
257
|
+
// controller. These run in the subscribe / notification callbacks — EVENT
|
|
258
|
+
// callbacks, not render/effect — so neither is a React effect hook:
|
|
259
|
+
// 1. Sign-in device-flow failures (poll / socket / popup-cancel land on
|
|
260
|
+
// `signIn` asynchronously) are toasted at the notification site, deduped
|
|
261
|
+
// per subscription — NEVER an inline banner in the QR view (owner mandate,
|
|
262
|
+
// same contract as account-switch).
|
|
263
|
+
// 2. On subscribe (mount / re-subscribe — a passive effect, the SAME timing
|
|
264
|
+
// the removed effects had) the web sign-in flow auto-starts if the opening
|
|
265
|
+
// view is the sign-in entry.
|
|
205
266
|
const subscribe = useCallback(
|
|
206
|
-
(listener: () => void) =>
|
|
207
|
-
|
|
267
|
+
(listener: () => void) => {
|
|
268
|
+
if (!controller) return () => undefined;
|
|
269
|
+
let lastToastedSignInError: string | null = null;
|
|
270
|
+
const maybeToastSignInError = () => {
|
|
271
|
+
const { signIn } = controller.getSnapshot();
|
|
272
|
+
if (signIn.phase === 'error' && signIn.error && signIn.error !== lastToastedSignInError) {
|
|
273
|
+
lastToastedSignInError = signIn.error;
|
|
274
|
+
toast.error(signIn.error);
|
|
275
|
+
} else if (signIn.phase !== 'error') {
|
|
276
|
+
lastToastedSignInError = null;
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
maybeToastSignInError();
|
|
280
|
+
autoStartSignIn();
|
|
281
|
+
return controller.subscribe(() => {
|
|
282
|
+
maybeToastSignInError();
|
|
283
|
+
listener();
|
|
284
|
+
});
|
|
285
|
+
},
|
|
286
|
+
[controller, autoStartSignIn],
|
|
208
287
|
);
|
|
209
288
|
const getSnapshot = useCallback(
|
|
210
289
|
() => (controller ? controller.getSnapshot() : EMPTY_SNAPSHOT),
|
|
@@ -213,44 +292,6 @@ const OxyAuthChooser: React.FC<OxyAuthChooserProps> = ({ onComplete }) => {
|
|
|
213
292
|
const snapshot = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
214
293
|
const { view } = snapshot;
|
|
215
294
|
|
|
216
|
-
// Sign-in device-flow failures land on `snapshot.signIn` asynchronously (poll /
|
|
217
|
-
// socket / popup cancel). Toast at the controller notification site — never an
|
|
218
|
-
// inline banner in the QR view (owner mandate, same contract as account-switch).
|
|
219
|
-
useEffect(() => {
|
|
220
|
-
if (!controller) return;
|
|
221
|
-
let lastToastedSignInError: string | null = null;
|
|
222
|
-
const maybeToastSignInError = () => {
|
|
223
|
-
const { signIn } = controller.getSnapshot();
|
|
224
|
-
if (signIn.phase === 'error' && signIn.error && signIn.error !== lastToastedSignInError) {
|
|
225
|
-
lastToastedSignInError = signIn.error;
|
|
226
|
-
toast.error(
|
|
227
|
-
signIn.error ||
|
|
228
|
-
t('accountSwitcher.toasts.signInFailed') ||
|
|
229
|
-
'Sign-in failed. Please try again.',
|
|
230
|
-
);
|
|
231
|
-
}
|
|
232
|
-
if (signIn.phase !== 'error') {
|
|
233
|
-
lastToastedSignInError = null;
|
|
234
|
-
}
|
|
235
|
-
};
|
|
236
|
-
maybeToastSignInError();
|
|
237
|
-
return controller.subscribe(maybeToastSignInError);
|
|
238
|
-
}, [controller, t]);
|
|
239
|
-
|
|
240
|
-
// Web: "Sign in with Oxy" auto-starts the instant the sign-in entry is
|
|
241
|
-
// reached — no button tap needed. `signInWithOxy()` tries the shared
|
|
242
|
-
// keychain first (silently, native-only) then falls to the QR handoff,
|
|
243
|
-
// which is what actually renders: the QR is the primary web surface, not a
|
|
244
|
-
// peer button among several. Gated on `phase === 'idle'` so navigating back
|
|
245
|
-
// to this view while a flow is already active (or re-entering it) never
|
|
246
|
-
// restarts/duplicates it. Native stays fully button-driven (unchanged) —
|
|
247
|
-
// this effect is a no-op there.
|
|
248
|
-
useEffect(() => {
|
|
249
|
-
if (!controller || !isWebBrowser()) return;
|
|
250
|
-
if ((view !== 'signin' && view !== 'add') || snapshot.signIn.phase !== 'idle') return;
|
|
251
|
-
void controller.signInWithOxy();
|
|
252
|
-
}, [controller, view, snapshot.signIn.phase]);
|
|
253
|
-
|
|
254
295
|
const [switching, setSwitching] = useState(false);
|
|
255
296
|
|
|
256
297
|
const handleSwitch = useCallback(
|
|
@@ -289,26 +330,98 @@ const OxyAuthChooser: React.FC<OxyAuthChooserProps> = ({ onComplete }) => {
|
|
|
289
330
|
|
|
290
331
|
const handleManage = useCallback(() => {
|
|
291
332
|
onComplete?.();
|
|
333
|
+
const hooks = getAccountDialogConsumerHooks();
|
|
334
|
+
if (hooks?.onNavigateManage) {
|
|
335
|
+
hooks.onNavigateManage();
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
292
338
|
showBottomSheet?.('ManageAccount');
|
|
293
339
|
}, [onComplete, showBottomSheet]);
|
|
294
340
|
|
|
341
|
+
const handleAdd = useCallback(() => {
|
|
342
|
+
const hooks = getAccountDialogConsumerHooks();
|
|
343
|
+
if (hooks?.onAddAccount) {
|
|
344
|
+
hooks.onAddAccount();
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
// No consumer override: enter the "add account" view and auto-start the web
|
|
348
|
+
// sign-in flow, from this handler (the event that reaches the view).
|
|
349
|
+
controller?.add();
|
|
350
|
+
autoStartSignIn();
|
|
351
|
+
}, [controller, autoStartSignIn]);
|
|
352
|
+
|
|
295
353
|
const handlers = useMemo<OxyAuthChooserHandlers>(
|
|
296
354
|
() => ({
|
|
297
355
|
onSwitch: (accountId) => {
|
|
298
356
|
void handleSwitch(accountId);
|
|
299
357
|
},
|
|
300
|
-
onAdd:
|
|
358
|
+
onAdd: handleAdd,
|
|
301
359
|
onManage: handleManage,
|
|
360
|
+
// Morphs the AccountDialog surface into `ChangeAvatar` (and back), then
|
|
361
|
+
// uploads / clears the picked photo — the single shared avatar write path.
|
|
362
|
+
onEditAvatar: () => openAvatarPicker(),
|
|
302
363
|
}),
|
|
303
|
-
[handleSwitch,
|
|
364
|
+
[handleSwitch, handleAdd, handleManage, openAvatarPicker],
|
|
304
365
|
);
|
|
305
366
|
|
|
367
|
+
// Real storage usage for the account menu's "Oxy storage" block. Disabled
|
|
368
|
+
// (no fetch) until a private-API session exists, so it is inert on the
|
|
369
|
+
// sign-in/QR/sign-up views; when present the block shows live used/total.
|
|
370
|
+
const storageQuery = useAccountStorageUsage();
|
|
371
|
+
const storage = useMemo<AccountStorageModel | null>(
|
|
372
|
+
() =>
|
|
373
|
+
storageQuery.data
|
|
374
|
+
? {
|
|
375
|
+
usedBytes: storageQuery.data.totalUsedBytes,
|
|
376
|
+
limitBytes: storageQuery.data.totalLimitBytes,
|
|
377
|
+
}
|
|
378
|
+
: null,
|
|
379
|
+
[storageQuery.data],
|
|
380
|
+
);
|
|
381
|
+
|
|
382
|
+
// The account-menu rows below the switcher: storage + data + settings + help
|
|
383
|
+
// deep-link into the "Accounts by Oxy" app or open the matching in-app sheet
|
|
384
|
+
// (Help, Legal); sign-out uses the SDK's own per-account sign-out. No new
|
|
385
|
+
// endpoints — the same handoff pattern `handleManage`/`getCommonsAcquisitionUrl`
|
|
386
|
+
// already use.
|
|
387
|
+
const accountMenu = useMemo<AccountsMenuActions>(() => {
|
|
388
|
+
const openUrl = (url: string) => {
|
|
389
|
+
void Linking.openURL(url);
|
|
390
|
+
};
|
|
391
|
+
const openSheet = (config: Parameters<NonNullable<typeof showBottomSheet>>[0]) => {
|
|
392
|
+
onComplete?.();
|
|
393
|
+
showBottomSheet?.(config);
|
|
394
|
+
};
|
|
395
|
+
return {
|
|
396
|
+
onOpenSettings: () => openUrl(ACCOUNTS_APP_URL),
|
|
397
|
+
onOpenData: () => openUrl(`${ACCOUNTS_APP_URL}/data`),
|
|
398
|
+
onManageStorage: () => openUrl(`${ACCOUNTS_APP_URL}/storage`),
|
|
399
|
+
onUpgradeStorage: () => openUrl(`${ACCOUNTS_APP_URL}/storage`),
|
|
400
|
+
onHelp: () => openSheet('HelpSupport'),
|
|
401
|
+
onPrivacy: () => openSheet({ screen: 'LegalDocuments', props: { initialStep: 1 } }),
|
|
402
|
+
onTerms: () => openSheet({ screen: 'LegalDocuments', props: { initialStep: 2 } }),
|
|
403
|
+
onSignOut: () => {
|
|
404
|
+
void logout();
|
|
405
|
+
onComplete?.();
|
|
406
|
+
},
|
|
407
|
+
};
|
|
408
|
+
}, [onComplete, showBottomSheet, logout]);
|
|
409
|
+
|
|
306
410
|
if (!controller) {
|
|
307
411
|
return null;
|
|
308
412
|
}
|
|
309
413
|
|
|
310
414
|
if (view === 'accounts') {
|
|
311
|
-
return
|
|
415
|
+
return (
|
|
416
|
+
<AccountsView
|
|
417
|
+
snapshot={snapshot}
|
|
418
|
+
theme={theme}
|
|
419
|
+
t={t}
|
|
420
|
+
handlers={handlers}
|
|
421
|
+
storage={storage}
|
|
422
|
+
menu={accountMenu}
|
|
423
|
+
/>
|
|
424
|
+
);
|
|
312
425
|
}
|
|
313
426
|
|
|
314
427
|
if (view === 'qr') {
|
|
@@ -345,7 +458,10 @@ const OxyAuthChooser: React.FC<OxyAuthChooserProps> = ({ onComplete }) => {
|
|
|
345
458
|
onCreateWithPasskey={handleCreateWithPasskey}
|
|
346
459
|
createPending={createPasskeyPending}
|
|
347
460
|
onOpenHub={() => void controller.startPasskeyHubSignIn()}
|
|
348
|
-
onBackToSignIn={() =>
|
|
461
|
+
onBackToSignIn={() => {
|
|
462
|
+
controller.setView('signin');
|
|
463
|
+
autoStartSignIn();
|
|
464
|
+
}}
|
|
349
465
|
/>
|
|
350
466
|
);
|
|
351
467
|
}
|
|
@@ -364,40 +480,219 @@ const OxyAuthChooser: React.FC<OxyAuthChooserProps> = ({ onComplete }) => {
|
|
|
364
480
|
};
|
|
365
481
|
|
|
366
482
|
// ---------------------------------------------------------------------------
|
|
367
|
-
// Accounts view
|
|
483
|
+
// Accounts view — the signed-in Oxy account MENU (NativeWind)
|
|
368
484
|
// ---------------------------------------------------------------------------
|
|
369
485
|
|
|
486
|
+
/** Used/total storage bytes for the "Oxy storage" block, or `null` when unknown. */
|
|
487
|
+
interface AccountStorageModel {
|
|
488
|
+
usedBytes: number;
|
|
489
|
+
limitBytes: number;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
/** The account-menu row actions the container wires (deep-links / sheets / sign-out). */
|
|
493
|
+
interface AccountsMenuActions {
|
|
494
|
+
onOpenSettings: () => void;
|
|
495
|
+
onOpenData: () => void;
|
|
496
|
+
onManageStorage: () => void;
|
|
497
|
+
onUpgradeStorage: () => void;
|
|
498
|
+
onHelp: () => void;
|
|
499
|
+
onPrivacy: () => void;
|
|
500
|
+
onTerms: () => void;
|
|
501
|
+
onSignOut: () => void;
|
|
502
|
+
}
|
|
503
|
+
|
|
370
504
|
interface AccountsViewProps {
|
|
371
505
|
snapshot: AccountDialogSnapshot;
|
|
372
506
|
theme: Theme;
|
|
373
507
|
t: Translate;
|
|
374
508
|
handlers: OxyAuthChooserHandlers;
|
|
509
|
+
storage: AccountStorageModel | null;
|
|
510
|
+
menu: AccountsMenuActions;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* Leading glyph for the rows that live in a Bloom grouped section (the MENU
|
|
515
|
+
* block) and for the storage card's cloud, which lines its title up with them.
|
|
516
|
+
* It is Bloom's OWN icon-slot size: `SettingsListItem` reserves a fixed 20px
|
|
517
|
+
* leading column and Bloom is consumed exactly as it ships, so a menu glyph
|
|
518
|
+
* larger than this would overhang into the row's title.
|
|
519
|
+
*/
|
|
520
|
+
const ROW_ICON_SIZE = 20;
|
|
521
|
+
/**
|
|
522
|
+
* The switch card's two corner states. Collapsed it is one row and reads as a
|
|
523
|
+
* PILL; opened it is a card holding rows, on the same 16px corner the Bloom
|
|
524
|
+
* grouped section below it uses. Interpolated across the reveal, never snapped.
|
|
525
|
+
*/
|
|
526
|
+
const SWITCH_CARD_PILL_RADIUS = 999;
|
|
527
|
+
const SWITCH_CARD_RADIUS = 16;
|
|
528
|
+
/**
|
|
529
|
+
* The fraction of the reveal over which the corner resolves. The corner is a
|
|
530
|
+
* FASTER gesture than the reveal — it has to be finished before the rows read as
|
|
531
|
+
* rows, or the card still looks like a pill while a list falls out of it — so it
|
|
532
|
+
* is clamped to the reveal's opening fraction instead of tracking it end to end.
|
|
533
|
+
* Measured in a browser against the 240ms reveal: the corner reaches its card
|
|
534
|
+
* value ~120ms in, with the list only ~20% revealed, and (mirrored) the pill is
|
|
535
|
+
* back ~250ms into the close, with the list already down to ~0.
|
|
536
|
+
*/
|
|
537
|
+
const SWITCH_CARD_RADIUS_SETTLE = 0.2;
|
|
538
|
+
/** Diameter of an account row's avatar in the switch list (own markup). */
|
|
539
|
+
const SWITCH_AVATAR_SIZE = 36;
|
|
540
|
+
/** Glyph inside a bordered affordance badge, sized to the avatar it stands in for. */
|
|
541
|
+
const BADGE_GLYPH_SIZE = 19;
|
|
542
|
+
/** The hero block's large current-account avatar. */
|
|
543
|
+
const HERO_AVATAR_SIZE = 72;
|
|
544
|
+
|
|
545
|
+
/**
|
|
546
|
+
* The hero's address line, shown under the "Hi, <name>!" greeting: the account's
|
|
547
|
+
* canonical `@oxy.so` email when it has one, else its normalized `@handle`. Never
|
|
548
|
+
* synthesizes a `username@oxy.so` address (the identity contract forbids it) — a
|
|
549
|
+
* non-Oxy or missing email falls back to `getNormalizedUserHandle`.
|
|
550
|
+
*/
|
|
551
|
+
function heroAddressLine(account: SwitchableAccount): string | null {
|
|
552
|
+
if (account.email?.toLowerCase().endsWith('@oxy.so')) {
|
|
553
|
+
return account.email;
|
|
554
|
+
}
|
|
555
|
+
const handle = getNormalizedUserHandle(account.user);
|
|
556
|
+
return handle ? `@${handle}` : null;
|
|
557
|
+
}
|
|
558
|
+
/** Avatars shown in the switch row's facepile before it collapses into `+N`. */
|
|
559
|
+
const FACEPILE_MAX = 2;
|
|
560
|
+
/** Facepile avatar diameter — one clear step down from a switch-list avatar. */
|
|
561
|
+
const FACEPILE_AVATAR_SIZE = 32;
|
|
562
|
+
/**
|
|
563
|
+
* Facepile overlap. Well under Bloom's `size / 3` default: the stack draws the
|
|
564
|
+
* FIRST item on top, so a deep overlap would bury the trailing `+N` chip's own
|
|
565
|
+
* label under the avatar before it.
|
|
566
|
+
*/
|
|
567
|
+
const FACEPILE_OVERLAP = 4;
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* `bytes` → `"11.6 GB"`. Whole plan sizes read as whole numbers (`"17 GB"`, not
|
|
572
|
+
* `"17.0 GB"`), and anything ≥ 100 GB drops the decimal entirely.
|
|
573
|
+
*/
|
|
574
|
+
function formatStorageGb(bytes: number): string {
|
|
575
|
+
const gb = bytes / 1024 ** 3;
|
|
576
|
+
if (gb >= 100 || Number.isInteger(gb)) return `${Math.round(gb)} GB`;
|
|
577
|
+
return `${gb.toFixed(1)} GB`;
|
|
375
578
|
}
|
|
376
579
|
|
|
580
|
+
type HoverPressableProps = Omit<React.ComponentProps<typeof Pressable>, 'className'> & {
|
|
581
|
+
baseClassName: string;
|
|
582
|
+
hoverClassName: string;
|
|
583
|
+
};
|
|
584
|
+
|
|
377
585
|
/**
|
|
378
|
-
*
|
|
379
|
-
*
|
|
380
|
-
*
|
|
381
|
-
*
|
|
382
|
-
*
|
|
383
|
-
|
|
384
|
-
|
|
586
|
+
* A `Pressable` that appends a hover-tint NativeWind token while pointer-hovered.
|
|
587
|
+
* The Metro web pipeline here does NOT emit NativeWind `hover:` variants, so hover
|
|
588
|
+
* is driven by RN's cross-platform `onHoverIn`/`onHoverOut` (they fire only on web
|
|
589
|
+
* via react-native-web; a no-op on native) toggling a plain background token —
|
|
590
|
+
* the tint stays a NativeWind class, only the trigger is JS.
|
|
591
|
+
*/
|
|
592
|
+
const HoverPressable: React.FC<HoverPressableProps> = ({
|
|
593
|
+
baseClassName,
|
|
594
|
+
hoverClassName,
|
|
595
|
+
...rest
|
|
596
|
+
}) => {
|
|
597
|
+
const [hovered, setHovered] = useState(false);
|
|
598
|
+
return (
|
|
599
|
+
<Pressable
|
|
600
|
+
{...rest}
|
|
601
|
+
className={hovered ? `${baseClassName} ${hoverClassName}` : baseClassName}
|
|
602
|
+
onHoverIn={() => setHovered(true)}
|
|
603
|
+
onHoverOut={() => setHovered(false)}
|
|
604
|
+
/>
|
|
605
|
+
);
|
|
606
|
+
};
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* The signed-in Oxy account MENU — a Google-account-menu-style full menu built
|
|
610
|
+
* entirely with NativeWind `className` (the dynamic per-account accent hex is
|
|
611
|
+
* the one inline style NativeWind can't express). Structure mirrors the
|
|
612
|
+
* approved demo:
|
|
613
|
+
* - ACCOUNT on its own distinct panel surface: a COMPACT current-account row
|
|
614
|
+
* (avatar + name + email + expand chevron) that toggles the switch list, a
|
|
615
|
+
* "Manage your Oxy account" pill, and — when expanded — the other switchable
|
|
616
|
+
* accounts + "Add another account" + "Manage accounts on this device".
|
|
617
|
+
* - OXY STORAGE: cloud + used/total + a progress bar + Upgrade / Manage chips.
|
|
618
|
+
* - MENU rows: Your data in Oxy · Oxy settings · Help & feedback · Sign out —
|
|
619
|
+
* Bloom's grouped section (`SettingsListGroup`/`SettingsListItem`), the same
|
|
620
|
+
* component every other SDK settings surface uses, not a local row copy.
|
|
621
|
+
* - FOOTER: Privacy Policy · Terms of Service.
|
|
622
|
+
*
|
|
623
|
+
* All three blocks share ONE rhythm taken from that grouped section: a 12px
|
|
624
|
+
* content inset, a 12px gap after the leading element, 16px between blocks, and
|
|
625
|
+
* a 16px trailing chevron column.
|
|
385
626
|
*
|
|
386
|
-
* Collapse state is a plain `useState` toggled in the
|
|
387
|
-
* no
|
|
388
|
-
* (nothing to switch to) the chevron is hidden and the
|
|
389
|
-
* "
|
|
390
|
-
* stay reachable without a pointless expand toggle.
|
|
627
|
+
* Collapse state is a plain `useState` toggled in the current row's press
|
|
628
|
+
* handler — no effect hook, no derived-from-props sync. With only ONE account
|
|
629
|
+
* (nothing to switch to) the chevron is hidden and the list renders inline so
|
|
630
|
+
* "Add another account" stays reachable without a pointless toggle.
|
|
391
631
|
*/
|
|
392
|
-
const AccountsView: React.FC<AccountsViewProps> = ({
|
|
632
|
+
const AccountsView: React.FC<AccountsViewProps> = ({
|
|
633
|
+
snapshot,
|
|
634
|
+
theme,
|
|
635
|
+
t,
|
|
636
|
+
handlers,
|
|
637
|
+
storage,
|
|
638
|
+
menu,
|
|
639
|
+
}) => {
|
|
393
640
|
const [expanded, setExpanded] = useState(false);
|
|
641
|
+
// Measured natural height of the switch list, so the reveal animates to an
|
|
642
|
+
// exact height (and the content below reflows down smoothly) instead of a
|
|
643
|
+
// guessed max. The measuring wrapper is style-based, NOT className'd — on
|
|
644
|
+
// RN-Web `onLayout` never fires for className'd Views (see AGENTS.md).
|
|
645
|
+
const [listContentHeight, setListContentHeight] = useState(0);
|
|
646
|
+
// 0 = collapsed, 1 = expanded. Set imperatively in the toggle handler (no
|
|
647
|
+
// effect hook). On RN-Web there is no worklets plugin, so every shared value a
|
|
648
|
+
// mapper reads MUST be in its deps array or it freezes on the first frame
|
|
649
|
+
// (AGENTS.md "Reanimated (web)").
|
|
650
|
+
const listProgress = useSharedValue(0);
|
|
651
|
+
const listStyle = useAnimatedStyle(
|
|
652
|
+
() => ({ height: listProgress.value * listContentHeight, opacity: listProgress.value }),
|
|
653
|
+
[listProgress, listContentHeight],
|
|
654
|
+
);
|
|
655
|
+
const chevronStyle = useAnimatedStyle(
|
|
656
|
+
() => ({ transform: [{ rotate: `${listProgress.value * 180}deg` }] }),
|
|
657
|
+
[listProgress],
|
|
658
|
+
);
|
|
659
|
+
// Collapsed, the switch card is a single row and reads as a PILL; opened, it
|
|
660
|
+
// becomes a card holding rows and takes the grouped-section corner. The corner
|
|
661
|
+
// is driven off the SAME `listProgress` as the reveal — but clamped to its
|
|
662
|
+
// opening fraction, so it resolves early instead of trailing the rows: the
|
|
663
|
+
// card already reads as a card by the time they are visible. Collapsing is the
|
|
664
|
+
// mirror image, the pill returning over the closing tail.
|
|
665
|
+
const switchCardStyle = useAnimatedStyle(
|
|
666
|
+
() => ({
|
|
667
|
+
borderRadius: interpolate(
|
|
668
|
+
listProgress.value,
|
|
669
|
+
[0, SWITCH_CARD_RADIUS_SETTLE],
|
|
670
|
+
[SWITCH_CARD_PILL_RADIUS, SWITCH_CARD_RADIUS],
|
|
671
|
+
Extrapolation.CLAMP,
|
|
672
|
+
),
|
|
673
|
+
}),
|
|
674
|
+
[listProgress],
|
|
675
|
+
);
|
|
676
|
+
// `CompositionBar` ships as an interactive breakdown: a selected segment
|
|
677
|
+
// replaces its hint line with that segment's readout. Tapping the selected one
|
|
678
|
+
// again clears it.
|
|
679
|
+
const [storageSegment, setStorageSegment] = useState<string | null>(null);
|
|
680
|
+
const toggleStorageSegment = useCallback(
|
|
681
|
+
(key: string) => setStorageSegment((previous) => (previous === key ? null : key)),
|
|
682
|
+
[],
|
|
683
|
+
);
|
|
684
|
+
const toggleExpanded = useCallback(() => {
|
|
685
|
+
const next = !expanded;
|
|
686
|
+
setExpanded(next);
|
|
687
|
+
listProgress.value = withTiming(next ? 1 : 0, { duration: 240 });
|
|
688
|
+
}, [expanded, listProgress]);
|
|
394
689
|
|
|
395
690
|
if (snapshot.loading && snapshot.accounts.length === 0) {
|
|
396
691
|
return (
|
|
397
|
-
<View
|
|
692
|
+
<View className="items-center justify-center gap-space-12 py-space-24">
|
|
398
693
|
<MaterialCommunityIcons name="loading" size={24} color={theme.colors.textSecondary} />
|
|
399
|
-
<Text
|
|
400
|
-
{t('accountSwitcher.loading')
|
|
694
|
+
<Text className="text-body text-text-secondary text-center">
|
|
695
|
+
{t('accountSwitcher.loading')}
|
|
401
696
|
</Text>
|
|
402
697
|
</View>
|
|
403
698
|
);
|
|
@@ -405,142 +700,384 @@ const AccountsView: React.FC<AccountsViewProps> = ({ snapshot, theme, t, handler
|
|
|
405
700
|
|
|
406
701
|
const switchingDisabled = snapshot.switchingAccountId !== null;
|
|
407
702
|
const current = snapshot.accounts.find((account) => account.isCurrent) ?? snapshot.accounts[0];
|
|
408
|
-
const
|
|
409
|
-
(account) => account.accountId !== current
|
|
410
|
-
);
|
|
411
|
-
// Current account first, then the rest — the expanded list order.
|
|
412
|
-
const orderedAccounts = current
|
|
413
|
-
? [current, ...snapshot.accounts.filter((account) => account.accountId !== current.accountId)]
|
|
703
|
+
const others = current
|
|
704
|
+
? snapshot.accounts.filter((account) => account.accountId !== current.accountId)
|
|
414
705
|
: snapshot.accounts;
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
706
|
+
const currentAccent = current
|
|
707
|
+
? resolveAccentHex(current.color, theme.colors.primary)
|
|
708
|
+
: theme.colors.primary;
|
|
709
|
+
// The hero's address line under the greeting: the account's canonical @oxy.so
|
|
710
|
+
// email when it has one, else its normalized `@handle` (never a synthesized
|
|
711
|
+
// `username@oxy.so`, per the identity contract — `getNormalizedUserHandle`).
|
|
712
|
+
const currentAddress = current ? heroAddressLine(current) : null;
|
|
713
|
+
// The switch list repeats the CURRENT account (first, ringed) — unlike the old
|
|
714
|
+
// compact header it is not represented anywhere else once the hero moved out
|
|
715
|
+
// of the card, and the list is where you switch back to it.
|
|
716
|
+
const switchableAccounts = current ? [current, ...others] : others;
|
|
717
|
+
const facepile: AvatarGroupItem[] = switchableAccounts.map((account) => ({
|
|
718
|
+
id: account.accountId,
|
|
719
|
+
uri: account.avatarUrl ?? undefined,
|
|
720
|
+
displayName: account.displayName,
|
|
721
|
+
}));
|
|
722
|
+
|
|
723
|
+
// Used vs free is a two-part COMPOSITION (the parts always fill the bar), not
|
|
724
|
+
// a progress value — exactly what Bloom's `CompositionBar` models. Both colors
|
|
725
|
+
// are theme tokens, so the bar is correct in light and dark.
|
|
726
|
+
const storageCategories: CompositionCategory[] = storage
|
|
727
|
+
? [
|
|
728
|
+
{
|
|
729
|
+
key: 'used',
|
|
730
|
+
name: t('accountMenu.storage.used'),
|
|
731
|
+
amount: storage.usedBytes,
|
|
732
|
+
color: theme.colors.primary,
|
|
733
|
+
},
|
|
734
|
+
{
|
|
735
|
+
key: 'free',
|
|
736
|
+
name: t('accountMenu.storage.free'),
|
|
737
|
+
amount: Math.max(0, storage.limitBytes - storage.usedBytes),
|
|
738
|
+
color: theme.colors.contrast50,
|
|
739
|
+
},
|
|
740
|
+
]
|
|
741
|
+
: [];
|
|
742
|
+
const usageLabel = storage
|
|
743
|
+
? t('accountMenu.storage.usage', {
|
|
744
|
+
used: formatStorageGb(storage.usedBytes),
|
|
745
|
+
total: formatStorageGb(storage.limitBytes),
|
|
746
|
+
})
|
|
747
|
+
: t('accountMenu.storage.unavailable');
|
|
748
|
+
|
|
749
|
+
// The switch list body, revealed under the "Switch account" row. Own markup,
|
|
750
|
+
// not a Bloom grouped section: this is not a list of settings rows and the
|
|
751
|
+
// component is not a card container. It mirrors the section's rhythm by hand —
|
|
752
|
+
// 12px content inset, 12px after the avatar, a hairline between rows — and
|
|
753
|
+
// draws those hairlines INSIDE the animated clip, so a collapsed list never
|
|
754
|
+
// strands one against the header row.
|
|
755
|
+
const listItems = (
|
|
756
|
+
<>
|
|
757
|
+
{switchableAccounts.map((account, index) => {
|
|
758
|
+
const accent = resolveAccentHex(account.color, theme.colors.primary);
|
|
759
|
+
const isSwitching = snapshot.switchingAccountId === account.accountId;
|
|
760
|
+
return (
|
|
761
|
+
<Fragment key={account.accountId}>
|
|
762
|
+
{index > 0 ? <View className="h-px bg-border opacity-30 ml-space-12" /> : null}
|
|
763
|
+
<HoverPressable
|
|
764
|
+
baseClassName={`flex-row items-center gap-space-12 px-space-12 py-[10px]${
|
|
765
|
+
switchingDisabled ? ' opacity-60' : ''
|
|
766
|
+
}`}
|
|
767
|
+
hoverClassName="bg-fill-secondary"
|
|
768
|
+
onPress={() => handlers.onSwitch(account.accountId)}
|
|
769
|
+
disabled={switchingDisabled}
|
|
770
|
+
accessibilityRole="button"
|
|
771
|
+
accessibilityLabel={account.displayName}
|
|
772
|
+
>
|
|
773
|
+
<View>
|
|
774
|
+
<Avatar
|
|
775
|
+
source={account.avatarUrl ?? undefined}
|
|
776
|
+
variant="thumb"
|
|
777
|
+
name={account.displayName}
|
|
778
|
+
size={SWITCH_AVATAR_SIZE}
|
|
779
|
+
/>
|
|
780
|
+
{/* The accent ring is an OVERLAY: it costs the row no width, so
|
|
781
|
+
every avatar in the list starts on the same content line. */}
|
|
782
|
+
{account.isCurrent ? (
|
|
783
|
+
<View
|
|
784
|
+
style={[styles.currentAvatarRing, { borderColor: accent }]}
|
|
785
|
+
pointerEvents="none"
|
|
786
|
+
/>
|
|
787
|
+
) : null}
|
|
788
|
+
</View>
|
|
789
|
+
<View className="flex-1 min-w-0">
|
|
790
|
+
<Text className="text-body font-semibold text-text" numberOfLines={1}>
|
|
791
|
+
{account.displayName}
|
|
792
|
+
</Text>
|
|
793
|
+
{account.email ? (
|
|
794
|
+
<Text className="text-caption text-text-secondary" numberOfLines={1}>
|
|
795
|
+
{account.email}
|
|
796
|
+
</Text>
|
|
797
|
+
) : null}
|
|
798
|
+
</View>
|
|
799
|
+
{isSwitching ? (
|
|
800
|
+
<MaterialCommunityIcons name="loading" size={20} color={accent} />
|
|
801
|
+
) : null}
|
|
802
|
+
</HoverPressable>
|
|
803
|
+
</Fragment>
|
|
804
|
+
);
|
|
805
|
+
})}
|
|
418
806
|
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
key={account.accountId}
|
|
425
|
-
icon={
|
|
426
|
-
<View
|
|
427
|
-
style={[styles.avatarRing, { borderColor: account.isCurrent ? accent : 'transparent' }]}
|
|
428
|
-
>
|
|
429
|
-
<Avatar
|
|
430
|
-
source={account.avatarUrl ?? undefined}
|
|
431
|
-
variant="thumb"
|
|
432
|
-
name={account.displayName}
|
|
433
|
-
size={ROW_AVATAR_SIZE}
|
|
434
|
-
/>
|
|
435
|
-
</View>
|
|
436
|
-
}
|
|
437
|
-
title={account.displayName}
|
|
438
|
-
description={account.email ?? undefined}
|
|
439
|
-
onPress={() => handlers.onSwitch(account.accountId)}
|
|
807
|
+
<View className="h-px bg-border opacity-30 ml-space-12" />
|
|
808
|
+
<AccountAffordanceRow
|
|
809
|
+
icon="plus"
|
|
810
|
+
label={t('accountMenu.addAnother')}
|
|
811
|
+
onPress={handlers.onAdd}
|
|
440
812
|
disabled={switchingDisabled}
|
|
441
|
-
|
|
442
|
-
showChevron={false}
|
|
443
|
-
rightElement={
|
|
444
|
-
isSwitching ? (
|
|
445
|
-
<MaterialCommunityIcons name="loading" size={20} color={accent} />
|
|
446
|
-
) : account.isCurrent ? (
|
|
447
|
-
<MaterialCommunityIcons name="check-circle" size={20} color={accent} />
|
|
448
|
-
) : undefined
|
|
449
|
-
}
|
|
813
|
+
theme={theme}
|
|
450
814
|
/>
|
|
451
|
-
|
|
452
|
-
|
|
815
|
+
<View className="h-px bg-border opacity-30 ml-space-12" />
|
|
816
|
+
<AccountAffordanceRow
|
|
817
|
+
icon="account-multiple-outline"
|
|
818
|
+
label={t('accountSwitcher.manageOnDevice')}
|
|
819
|
+
onPress={handlers.onManage}
|
|
820
|
+
disabled={switchingDisabled}
|
|
821
|
+
theme={theme}
|
|
822
|
+
/>
|
|
823
|
+
</>
|
|
824
|
+
);
|
|
825
|
+
|
|
826
|
+
const manageLabel = t('accountMenu.manage');
|
|
827
|
+
const switchLabel = t('accountMenu.switchAccount');
|
|
453
828
|
|
|
454
829
|
return (
|
|
455
|
-
<View
|
|
456
|
-
{
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
830
|
+
<View>
|
|
831
|
+
{/* HERO — chrome-free and centred, in the reference's reading order:
|
|
832
|
+
NOTHING above the avatar (the nav bar's Oxy wordmark stands alone), the
|
|
833
|
+
large pressable avatar (with a camera badge to change the photo), then
|
|
834
|
+
the greeting, then the account address under it, then the manage action.
|
|
835
|
+
The nav bar above stays BRANDED (see `OxyAccountDialogScreen`). */}
|
|
836
|
+
<View style={styles.hero}>
|
|
837
|
+
{current ? (
|
|
838
|
+
<>
|
|
839
|
+
<PressableScale
|
|
840
|
+
onPress={handlers.onEditAvatar}
|
|
841
|
+
accessibilityRole="button"
|
|
842
|
+
accessibilityLabel={t('editProfile.changeAvatar')}
|
|
843
|
+
style={styles.heroAvatarPressable}
|
|
844
|
+
>
|
|
845
|
+
<Avatar
|
|
846
|
+
source={current.avatarUrl ?? undefined}
|
|
847
|
+
name={current.displayName}
|
|
848
|
+
size={HERO_AVATAR_SIZE}
|
|
849
|
+
/>
|
|
850
|
+
<View
|
|
851
|
+
style={[styles.heroAvatarRing, { borderColor: currentAccent }]}
|
|
852
|
+
pointerEvents="none"
|
|
853
|
+
/>
|
|
854
|
+
<AvatarCameraBadge />
|
|
855
|
+
</PressableScale>
|
|
856
|
+
<View style={styles.heroNameBlock}>
|
|
857
|
+
<Text
|
|
858
|
+
style={[styles.heroGreeting, { color: theme.colors.text }]}
|
|
859
|
+
numberOfLines={2}
|
|
860
|
+
>
|
|
861
|
+
{t('accountMenu.greeting', { name: current.displayName })}
|
|
862
|
+
</Text>
|
|
863
|
+
{currentAddress ? (
|
|
864
|
+
<Text
|
|
865
|
+
style={[styles.heroAddress, { color: theme.colors.textSecondary }]}
|
|
866
|
+
numberOfLines={1}
|
|
867
|
+
>
|
|
868
|
+
{currentAddress}
|
|
869
|
+
</Text>
|
|
870
|
+
) : null}
|
|
871
|
+
</View>
|
|
872
|
+
</>
|
|
873
|
+
) : null}
|
|
874
|
+
{/* Bloom's own compact outlined pill — `secondary` is the outlined
|
|
875
|
+
variant, `small` the compact height; it hugs its label instead of
|
|
876
|
+
spanning the surface. */}
|
|
877
|
+
<Button
|
|
878
|
+
variant="secondary"
|
|
879
|
+
size="small"
|
|
880
|
+
onPress={handlers.onManage}
|
|
881
|
+
accessibilityLabel={manageLabel}
|
|
464
882
|
>
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
883
|
+
{manageLabel}
|
|
884
|
+
</Button>
|
|
885
|
+
</View>
|
|
886
|
+
|
|
887
|
+
{/* SWITCH ACCOUNT — own NativeWind card, NOT a Bloom grouped section: it
|
|
888
|
+
is a disclosure header over an animated list, not a list of settings
|
|
889
|
+
rows, and the grouped section is not a bare card container. It borrows
|
|
890
|
+
the section's LOOK by hand — the same `card` surface, 12px content inset
|
|
891
|
+
and 16px gap to the next block — and its corner animates from a pill
|
|
892
|
+
(collapsed, a single row) to that section's 16px card corner (opened,
|
|
893
|
+
a card of rows) on the same `listProgress` the reveal runs on. */}
|
|
894
|
+
<Animated.View className="bg-fill overflow-hidden mb-space-16" style={switchCardStyle}>
|
|
895
|
+
<HoverPressable
|
|
896
|
+
baseClassName={`flex-row items-center gap-space-12 px-space-12 py-[10px] min-h-[44px]${
|
|
897
|
+
switchingDisabled ? ' opacity-60' : ''
|
|
898
|
+
}`}
|
|
899
|
+
hoverClassName="bg-fill-secondary"
|
|
900
|
+
onPress={toggleExpanded}
|
|
901
|
+
disabled={switchingDisabled}
|
|
902
|
+
accessibilityRole="button"
|
|
903
|
+
// The ARIA prop, not `accessibilityState`: react-native-web 0.21
|
|
904
|
+
// forwards only this one, and RN maps it to
|
|
905
|
+
// `accessibilityState.expanded` natively — so the disclosure state
|
|
906
|
+
// reaches assistive tech on BOTH platforms.
|
|
907
|
+
aria-expanded={expanded}
|
|
908
|
+
accessibilityLabel={switchLabel}
|
|
909
|
+
>
|
|
910
|
+
<Text className="flex-1 text-body text-text" numberOfLines={1}>
|
|
911
|
+
{switchLabel}
|
|
912
|
+
</Text>
|
|
913
|
+
{/* The facepile previews who you can switch to; once the list is open
|
|
914
|
+
it would just restate the rows below it. */}
|
|
915
|
+
{expanded ? null : (
|
|
916
|
+
<AvatarGroup
|
|
917
|
+
items={facepile}
|
|
918
|
+
layout="stack"
|
|
919
|
+
size={FACEPILE_AVATAR_SIZE}
|
|
920
|
+
max={FACEPILE_MAX}
|
|
921
|
+
overlap={FACEPILE_OVERLAP}
|
|
473
922
|
variant="thumb"
|
|
474
|
-
|
|
475
|
-
|
|
923
|
+
showInitials
|
|
924
|
+
ringColor={theme.colors.card}
|
|
476
925
|
/>
|
|
926
|
+
)}
|
|
927
|
+
<View style={[styles.chevronCircle, { backgroundColor: theme.colors.contrast50 }]}>
|
|
928
|
+
<Animated.View style={chevronStyle}>
|
|
929
|
+
<MaterialCommunityIcons name="chevron-down" size={20} color={theme.colors.text} />
|
|
930
|
+
</Animated.View>
|
|
477
931
|
</View>
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
)
|
|
932
|
+
</HoverPressable>
|
|
933
|
+
|
|
934
|
+
{/* Animated reveal: an overflow-clipped container whose height + opacity
|
|
935
|
+
are driven by `listProgress`; the inner style-based wrapper measures
|
|
936
|
+
the natural content height via `onLayout`. */}
|
|
937
|
+
<Animated.View
|
|
938
|
+
style={[styles.collapse, listStyle]}
|
|
939
|
+
pointerEvents={expanded ? 'auto' : 'none'}
|
|
940
|
+
>
|
|
941
|
+
<View
|
|
942
|
+
style={styles.collapseMeasure}
|
|
943
|
+
onLayout={(event) => setListContentHeight(event.nativeEvent.layout.height)}
|
|
944
|
+
>
|
|
945
|
+
<View>{listItems}</View>
|
|
490
946
|
</View>
|
|
491
|
-
|
|
947
|
+
</Animated.View>
|
|
948
|
+
</Animated.View>
|
|
949
|
+
|
|
950
|
+
{/* OXY STORAGE — own NativeWind card for the same reason: a title, a meter
|
|
951
|
+
and two chips are not settings rows. Its cloud sits in the same 20px
|
|
952
|
+
column Bloom's own rows use, so the title below lines up with the menu
|
|
953
|
+
titles. `CompositionBar` is consumed exactly as it ships — an
|
|
954
|
+
interactive breakdown at its own thickness, its hint line carrying the
|
|
955
|
+
used/total copy and a tapped segment revealing that segment's share. */}
|
|
956
|
+
<View className="bg-fill rounded-[16px] overflow-hidden mb-space-16 px-space-12 py-[10px] gap-space-12">
|
|
957
|
+
<View className="flex-row items-center gap-space-12 min-h-[24px]">
|
|
958
|
+
<View className="w-[20px] items-center">
|
|
492
959
|
<MaterialCommunityIcons
|
|
493
|
-
name=
|
|
494
|
-
size={
|
|
960
|
+
name="cloud-outline"
|
|
961
|
+
size={ROW_ICON_SIZE}
|
|
495
962
|
color={theme.colors.textSecondary}
|
|
496
963
|
/>
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
{
|
|
964
|
+
</View>
|
|
965
|
+
<Text className="flex-1 text-body font-semibold text-text" numberOfLines={1}>
|
|
966
|
+
{t('accountMenu.storage.title')}
|
|
967
|
+
</Text>
|
|
968
|
+
</View>
|
|
969
|
+
<CompositionBar
|
|
970
|
+
categories={storageCategories}
|
|
971
|
+
selectedKey={storageSegment}
|
|
972
|
+
onSelect={toggleStorageSegment}
|
|
973
|
+
hintLabel={usageLabel}
|
|
974
|
+
formatReadout={(bytes, percent) => `${formatStorageGb(bytes)} · ${percent}%`}
|
|
975
|
+
/>
|
|
976
|
+
<View className="flex-row gap-space-8">
|
|
977
|
+
<StorageChip label={t('accountMenu.storage.upgrade')} onPress={menu.onUpgradeStorage} />
|
|
978
|
+
<StorageChip label={t('accountMenu.storage.manage')} onPress={menu.onManageStorage} />
|
|
979
|
+
</View>
|
|
980
|
+
</View>
|
|
508
981
|
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
982
|
+
{/* MENU — the same stock grouped section. */}
|
|
983
|
+
<SettingsListGroup>
|
|
984
|
+
<SettingsListItem
|
|
985
|
+
icon={<MenuIcon name="tray-arrow-down" theme={theme} />}
|
|
986
|
+
title={t('accountMenu.data')}
|
|
987
|
+
onPress={menu.onOpenData}
|
|
988
|
+
/>
|
|
989
|
+
<SettingsListItem
|
|
990
|
+
icon={<MenuIcon name="cog-outline" theme={theme} />}
|
|
991
|
+
title={t('accountMenu.settings')}
|
|
992
|
+
onPress={menu.onOpenSettings}
|
|
993
|
+
/>
|
|
994
|
+
<SettingsListItem
|
|
995
|
+
icon={<MenuIcon name="help-circle-outline" theme={theme} />}
|
|
996
|
+
title={t('accountMenu.help')}
|
|
997
|
+
onPress={menu.onHelp}
|
|
998
|
+
/>
|
|
999
|
+
<SettingsListItem
|
|
1000
|
+
icon={<MenuIcon name="logout" theme={theme} />}
|
|
1001
|
+
title={t('accountMenu.signOut')}
|
|
1002
|
+
onPress={menu.onSignOut}
|
|
1003
|
+
showChevron={false}
|
|
1004
|
+
/>
|
|
1005
|
+
</SettingsListGroup>
|
|
521
1006
|
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
title={t('accountSwitcher.manageOnDevice') || 'Manage accounts on this device'}
|
|
533
|
-
onPress={handlers.onManage}
|
|
534
|
-
disabled={switchingDisabled}
|
|
535
|
-
accessibilityLabel={t('accountSwitcher.manageOnDevice') || 'Manage accounts on this device'}
|
|
536
|
-
showChevron={false}
|
|
537
|
-
/>
|
|
538
|
-
</SettingsListGroup>
|
|
539
|
-
) : null}
|
|
1007
|
+
{/* FOOTER. */}
|
|
1008
|
+
<View className="flex-row items-center justify-center gap-space-12 px-space-12 pb-space-8">
|
|
1009
|
+
<Pressable onPress={menu.onPrivacy} accessibilityRole="link">
|
|
1010
|
+
<Text className="text-bodySmall text-text-secondary">{t('accountMenu.privacy')}</Text>
|
|
1011
|
+
</Pressable>
|
|
1012
|
+
<Text className="text-bodySmall text-text-tertiary">·</Text>
|
|
1013
|
+
<Pressable onPress={menu.onTerms} accessibilityRole="link">
|
|
1014
|
+
<Text className="text-bodySmall text-text-secondary">{t('accountMenu.terms')}</Text>
|
|
1015
|
+
</Pressable>
|
|
1016
|
+
</View>
|
|
540
1017
|
</View>
|
|
541
1018
|
);
|
|
542
1019
|
};
|
|
543
1020
|
|
|
1021
|
+
// ---------------------------------------------------------------------------
|
|
1022
|
+
// Account-menu row building blocks (NativeWind)
|
|
1023
|
+
// ---------------------------------------------------------------------------
|
|
1024
|
+
|
|
1025
|
+
/**
|
|
1026
|
+
* An account-list AFFORDANCE row ("Add another account", "Manage accounts on
|
|
1027
|
+
* this device") — a bordered circle sized to the avatar it stands in for, so its
|
|
1028
|
+
* label lands on the same line as every account name above it. Own markup, like
|
|
1029
|
+
* the account rows it closes: this list is not a Bloom grouped section.
|
|
1030
|
+
*/
|
|
1031
|
+
const AccountAffordanceRow: React.FC<{
|
|
1032
|
+
icon: keyof typeof MaterialCommunityIcons.glyphMap;
|
|
1033
|
+
label: string;
|
|
1034
|
+
onPress: () => void;
|
|
1035
|
+
disabled?: boolean;
|
|
1036
|
+
theme: Theme;
|
|
1037
|
+
}> = ({ icon, label, onPress, disabled, theme }) => (
|
|
1038
|
+
<HoverPressable
|
|
1039
|
+
baseClassName={`flex-row items-center gap-space-12 px-space-12 py-[10px]${
|
|
1040
|
+
disabled ? ' opacity-60' : ''
|
|
1041
|
+
}`}
|
|
1042
|
+
hoverClassName="bg-fill-secondary"
|
|
1043
|
+
onPress={onPress}
|
|
1044
|
+
disabled={disabled}
|
|
1045
|
+
accessibilityRole="button"
|
|
1046
|
+
accessibilityLabel={label}
|
|
1047
|
+
>
|
|
1048
|
+
<View className="w-[36px] h-[36px] items-center justify-center rounded-radius-max border border-border">
|
|
1049
|
+
<MaterialCommunityIcons name={icon} size={BADGE_GLYPH_SIZE} color={theme.colors.textSecondary} />
|
|
1050
|
+
</View>
|
|
1051
|
+
<Text className="flex-1 text-body font-semibold text-text" numberOfLines={1}>
|
|
1052
|
+
{label}
|
|
1053
|
+
</Text>
|
|
1054
|
+
</HoverPressable>
|
|
1055
|
+
);
|
|
1056
|
+
|
|
1057
|
+
/**
|
|
1058
|
+
* The leading glyph for a grouped-section menu row, sized to Bloom's 20px icon
|
|
1059
|
+
* column so the icons, the storage block's cloud and every row title align.
|
|
1060
|
+
*/
|
|
1061
|
+
const MenuIcon: React.FC<{
|
|
1062
|
+
name: keyof typeof MaterialCommunityIcons.glyphMap;
|
|
1063
|
+
theme: Theme;
|
|
1064
|
+
}> = ({ name, theme }) => (
|
|
1065
|
+
<MaterialCommunityIcons name={name} size={ROW_ICON_SIZE} color={theme.colors.textSecondary} />
|
|
1066
|
+
);
|
|
1067
|
+
|
|
1068
|
+
/** A storage action chip — a bordered pill on the sheet background. */
|
|
1069
|
+
const StorageChip: React.FC<{ label: string; onPress: () => void }> = ({ label, onPress }) => (
|
|
1070
|
+
<HoverPressable
|
|
1071
|
+
baseClassName="rounded-radius-max border border-border bg-bg py-[9px] px-[14px]"
|
|
1072
|
+
hoverClassName="bg-fill-secondary"
|
|
1073
|
+
onPress={onPress}
|
|
1074
|
+
accessibilityRole="button"
|
|
1075
|
+
accessibilityLabel={label}
|
|
1076
|
+
>
|
|
1077
|
+
<Text className="text-bodySmall font-semibold text-text">{label}</Text>
|
|
1078
|
+
</HoverPressable>
|
|
1079
|
+
);
|
|
1080
|
+
|
|
544
1081
|
interface AccountRowProps {
|
|
545
1082
|
account: SwitchableAccount;
|
|
546
1083
|
theme: Theme;
|
|
@@ -601,9 +1138,9 @@ const AccountRow: React.FC<AccountRowProps> = ({ account, theme, switching, disa
|
|
|
601
1138
|
};
|
|
602
1139
|
|
|
603
1140
|
// ---------------------------------------------------------------------------
|
|
604
|
-
// Sign-in view (add / signin) — NATIVE-facing today: on web
|
|
605
|
-
//
|
|
606
|
-
// only for a brief instant there.
|
|
1141
|
+
// Sign-in view (add / signin) — NATIVE-facing today: on web `autoStartSignIn`
|
|
1142
|
+
// (fired from the subscribe pass / the add / back-to-sign-in handlers) moves the
|
|
1143
|
+
// view to `qr` almost immediately, so this renders only for a brief instant there.
|
|
607
1144
|
// ---------------------------------------------------------------------------
|
|
608
1145
|
|
|
609
1146
|
interface SignInViewProps {
|