@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
|
@@ -48,35 +48,47 @@
|
|
|
48
48
|
* that do not use NativeWind (e.g. the accounts app).
|
|
49
49
|
*/
|
|
50
50
|
|
|
51
|
-
import {
|
|
51
|
+
import { Fragment, useCallback, useMemo, useRef, useState, useSyncExternalStore } from 'react';
|
|
52
52
|
import { Linking, Platform, Pressable, TextInput, View } from 'react-native';
|
|
53
|
+
import Animated, { Extrapolation, interpolate, useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';
|
|
53
54
|
import { MaterialCommunityIcons } from '@expo/vector-icons';
|
|
54
55
|
import QRCode from 'react-native-qrcode-svg';
|
|
55
56
|
import { Avatar } from '@oxyhq/bloom/avatar';
|
|
57
|
+
import { AvatarGroup } from '@oxyhq/bloom/avatar-group';
|
|
56
58
|
import { Button } from '@oxyhq/bloom/button';
|
|
59
|
+
import { PressableScale } from '@oxyhq/bloom/pressable-scale';
|
|
60
|
+
import { CompositionBar } from '@oxyhq/bloom/composition-bar';
|
|
57
61
|
import { SettingsListGroup, SettingsListItem } from '@oxyhq/bloom/settings-list';
|
|
58
62
|
import { toast } from '@oxyhq/bloom';
|
|
59
63
|
import { Text } from '@oxyhq/bloom/typography';
|
|
60
64
|
import { useTheme, BloomColorScope, APP_COLOR_NAMES, APP_COLOR_PRESETS } from '@oxyhq/bloom/theme';
|
|
61
|
-
import { isOxyRpOrigin } from '@oxyhq/core';
|
|
65
|
+
import { getNormalizedUserHandle, isOxyRpOrigin } from '@oxyhq/core';
|
|
62
66
|
import { useQueryClient } from '@tanstack/react-query';
|
|
63
67
|
import { useOxy } from "../context/OxyContext.js";
|
|
64
68
|
import { useI18n } from "../hooks/useI18n.js";
|
|
69
|
+
import { getAccountDialogConsumerHooks } from "../navigation/accountDialogManager.js";
|
|
65
70
|
import { isWebBrowser } from "../utils/isWebBrowser.js";
|
|
66
71
|
import { getCommonsAcquisitionUrl } from "../utils/commonsStoreLinks.js";
|
|
72
|
+
import { useAccountStorageUsage } from "../hooks/queries/useServicesQueries.js";
|
|
67
73
|
import { authChooserStyles as styles } from "./oxyAuthChooserStyles.js";
|
|
74
|
+
import AvatarCameraBadge from "./AvatarCameraBadge.js";
|
|
68
75
|
|
|
69
|
-
/** Diameter of a row avatar. */
|
|
70
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
76
|
+
/** Diameter of a row avatar (the sign-in view's account rows). */
|
|
77
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
71
78
|
const ROW_AVATAR_SIZE = 40;
|
|
72
|
-
/** Diameter of the prominent current-account avatar in the collapsed header. */
|
|
73
|
-
const HEADER_AVATAR_SIZE = 48;
|
|
74
79
|
/** High-contrast QR colors — intentionally fixed (NOT themed) for scan reliability. */
|
|
75
80
|
const QR_PLATE_BG = '#FFFFFF';
|
|
76
81
|
const QR_FOREGROUND = '#000000';
|
|
77
82
|
const QR_SIZE = 196;
|
|
78
83
|
/** Commons' own identity-creation deep link (mirrors the `approve`/`attest`/`card` intents). */
|
|
79
84
|
const COMMONS_CREATE_IDENTITY_URL = 'oxycommons://create-identity';
|
|
85
|
+
/**
|
|
86
|
+
* "Accounts by Oxy" management app — the canonical home for account settings,
|
|
87
|
+
* data export, and storage management. The account-menu rows deep-link into it
|
|
88
|
+
* (`/data`, `/storage`, or its root) the same way `getCommonsAcquisitionUrl`
|
|
89
|
+
* hands off to Commons; nothing here invents new API endpoints.
|
|
90
|
+
*/
|
|
91
|
+
const ACCOUNTS_APP_URL = 'https://accounts.oxy.so';
|
|
80
92
|
/**
|
|
81
93
|
* Resolve an account's stored color (a named Bloom preset, e.g. `'purple'`) to
|
|
82
94
|
* a concrete brand hex for the row accent. Falls back to the theme primary when
|
|
@@ -107,7 +119,9 @@ const OxyAuthChooser = ({
|
|
|
107
119
|
refreshAccounts,
|
|
108
120
|
signInWithPasskey,
|
|
109
121
|
registerWithPasskey,
|
|
110
|
-
oxyServices
|
|
122
|
+
oxyServices,
|
|
123
|
+
logout,
|
|
124
|
+
openAvatarPicker
|
|
111
125
|
} = useOxy();
|
|
112
126
|
const theme = useTheme();
|
|
113
127
|
const {
|
|
@@ -161,21 +175,41 @@ const OxyAuthChooser = ({
|
|
|
161
175
|
}
|
|
162
176
|
}, [createPasskeyPending, registerWithPasskey, onComplete, t]);
|
|
163
177
|
|
|
178
|
+
// Web: auto-start "Sign in with Oxy" when the sign-in entry becomes the shown
|
|
179
|
+
// view — the QR handoff is the PRIMARY web surface, not a button behind a tap.
|
|
180
|
+
// `signInWithOxy()` tries the shared keychain first (silently, native-only)
|
|
181
|
+
// then falls to the QR handoff, which is what actually renders. Driven from the
|
|
182
|
+
// EVENTS that reach that view — the initial `subscribe` pass below (an
|
|
183
|
+
// open-to-sign-in) and the add / back-to-sign-in handlers — never a watcher
|
|
184
|
+
// effect. Guarded so it never restarts a live flow (phase must be idle) and is a
|
|
185
|
+
// no-op on native (button-driven). Reads the live snapshot at call time (an
|
|
186
|
+
// event callback, not render), so it is stable across renders.
|
|
187
|
+
const autoStartSignIn = useCallback(() => {
|
|
188
|
+
if (!controller || !isWebBrowser()) return;
|
|
189
|
+
const {
|
|
190
|
+
view: currentView,
|
|
191
|
+
signIn
|
|
192
|
+
} = controller.getSnapshot();
|
|
193
|
+
if (currentView !== 'signin' && currentView !== 'add' || signIn.phase !== 'idle') return;
|
|
194
|
+
void controller.signInWithOxy();
|
|
195
|
+
}, [controller]);
|
|
196
|
+
|
|
164
197
|
// Bind the headless controller. `getSnapshot` returns a stable reference
|
|
165
198
|
// between changes, so it is `useSyncExternalStore`-safe. Guard the no-provider
|
|
166
199
|
// loading state (`controller` is `null`) with an inert store.
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
//
|
|
175
|
-
//
|
|
176
|
-
//
|
|
177
|
-
|
|
178
|
-
|
|
200
|
+
//
|
|
201
|
+
// The subscribe callback ALSO carries two owner-mandated reactions to the
|
|
202
|
+
// controller. These run in the subscribe / notification callbacks — EVENT
|
|
203
|
+
// callbacks, not render/effect — so neither is a React effect hook:
|
|
204
|
+
// 1. Sign-in device-flow failures (poll / socket / popup-cancel land on
|
|
205
|
+
// `signIn` asynchronously) are toasted at the notification site, deduped
|
|
206
|
+
// per subscription — NEVER an inline banner in the QR view (owner mandate,
|
|
207
|
+
// same contract as account-switch).
|
|
208
|
+
// 2. On subscribe (mount / re-subscribe — a passive effect, the SAME timing
|
|
209
|
+
// the removed effects had) the web sign-in flow auto-starts if the opening
|
|
210
|
+
// view is the sign-in entry.
|
|
211
|
+
const subscribe = useCallback(listener => {
|
|
212
|
+
if (!controller) return () => undefined;
|
|
179
213
|
let lastToastedSignInError = null;
|
|
180
214
|
const maybeToastSignInError = () => {
|
|
181
215
|
const {
|
|
@@ -183,29 +217,23 @@ const OxyAuthChooser = ({
|
|
|
183
217
|
} = controller.getSnapshot();
|
|
184
218
|
if (signIn.phase === 'error' && signIn.error && signIn.error !== lastToastedSignInError) {
|
|
185
219
|
lastToastedSignInError = signIn.error;
|
|
186
|
-
toast.error(signIn.error
|
|
187
|
-
}
|
|
188
|
-
if (signIn.phase !== 'error') {
|
|
220
|
+
toast.error(signIn.error);
|
|
221
|
+
} else if (signIn.phase !== 'error') {
|
|
189
222
|
lastToastedSignInError = null;
|
|
190
223
|
}
|
|
191
224
|
};
|
|
192
225
|
maybeToastSignInError();
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
useEffect(() => {
|
|
205
|
-
if (!controller || !isWebBrowser()) return;
|
|
206
|
-
if (view !== 'signin' && view !== 'add' || snapshot.signIn.phase !== 'idle') return;
|
|
207
|
-
void controller.signInWithOxy();
|
|
208
|
-
}, [controller, view, snapshot.signIn.phase]);
|
|
226
|
+
autoStartSignIn();
|
|
227
|
+
return controller.subscribe(() => {
|
|
228
|
+
maybeToastSignInError();
|
|
229
|
+
listener();
|
|
230
|
+
});
|
|
231
|
+
}, [controller, autoStartSignIn]);
|
|
232
|
+
const getSnapshot = useCallback(() => controller ? controller.getSnapshot() : EMPTY_SNAPSHOT, [controller]);
|
|
233
|
+
const snapshot = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
234
|
+
const {
|
|
235
|
+
view
|
|
236
|
+
} = snapshot;
|
|
209
237
|
const [switching, setSwitching] = useState(false);
|
|
210
238
|
const handleSwitch = useCallback(async accountId => {
|
|
211
239
|
if (!controller || switching) return;
|
|
@@ -236,15 +264,81 @@ const OxyAuthChooser = ({
|
|
|
236
264
|
}, [controller, switching, snapshot.activeAccountId, onComplete, refreshAccounts, queryClient, t]);
|
|
237
265
|
const handleManage = useCallback(() => {
|
|
238
266
|
onComplete?.();
|
|
267
|
+
const hooks = getAccountDialogConsumerHooks();
|
|
268
|
+
if (hooks?.onNavigateManage) {
|
|
269
|
+
hooks.onNavigateManage();
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
239
272
|
showBottomSheet?.('ManageAccount');
|
|
240
273
|
}, [onComplete, showBottomSheet]);
|
|
274
|
+
const handleAdd = useCallback(() => {
|
|
275
|
+
const hooks = getAccountDialogConsumerHooks();
|
|
276
|
+
if (hooks?.onAddAccount) {
|
|
277
|
+
hooks.onAddAccount();
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
// No consumer override: enter the "add account" view and auto-start the web
|
|
281
|
+
// sign-in flow, from this handler (the event that reaches the view).
|
|
282
|
+
controller?.add();
|
|
283
|
+
autoStartSignIn();
|
|
284
|
+
}, [controller, autoStartSignIn]);
|
|
241
285
|
const handlers = useMemo(() => ({
|
|
242
286
|
onSwitch: accountId => {
|
|
243
287
|
void handleSwitch(accountId);
|
|
244
288
|
},
|
|
245
|
-
onAdd:
|
|
246
|
-
onManage: handleManage
|
|
247
|
-
|
|
289
|
+
onAdd: handleAdd,
|
|
290
|
+
onManage: handleManage,
|
|
291
|
+
// Morphs the AccountDialog surface into `ChangeAvatar` (and back), then
|
|
292
|
+
// uploads / clears the picked photo — the single shared avatar write path.
|
|
293
|
+
onEditAvatar: () => openAvatarPicker()
|
|
294
|
+
}), [handleSwitch, handleAdd, handleManage, openAvatarPicker]);
|
|
295
|
+
|
|
296
|
+
// Real storage usage for the account menu's "Oxy storage" block. Disabled
|
|
297
|
+
// (no fetch) until a private-API session exists, so it is inert on the
|
|
298
|
+
// sign-in/QR/sign-up views; when present the block shows live used/total.
|
|
299
|
+
const storageQuery = useAccountStorageUsage();
|
|
300
|
+
const storage = useMemo(() => storageQuery.data ? {
|
|
301
|
+
usedBytes: storageQuery.data.totalUsedBytes,
|
|
302
|
+
limitBytes: storageQuery.data.totalLimitBytes
|
|
303
|
+
} : null, [storageQuery.data]);
|
|
304
|
+
|
|
305
|
+
// The account-menu rows below the switcher: storage + data + settings + help
|
|
306
|
+
// deep-link into the "Accounts by Oxy" app or open the matching in-app sheet
|
|
307
|
+
// (Help, Legal); sign-out uses the SDK's own per-account sign-out. No new
|
|
308
|
+
// endpoints — the same handoff pattern `handleManage`/`getCommonsAcquisitionUrl`
|
|
309
|
+
// already use.
|
|
310
|
+
const accountMenu = useMemo(() => {
|
|
311
|
+
const openUrl = url => {
|
|
312
|
+
void Linking.openURL(url);
|
|
313
|
+
};
|
|
314
|
+
const openSheet = config => {
|
|
315
|
+
onComplete?.();
|
|
316
|
+
showBottomSheet?.(config);
|
|
317
|
+
};
|
|
318
|
+
return {
|
|
319
|
+
onOpenSettings: () => openUrl(ACCOUNTS_APP_URL),
|
|
320
|
+
onOpenData: () => openUrl(`${ACCOUNTS_APP_URL}/data`),
|
|
321
|
+
onManageStorage: () => openUrl(`${ACCOUNTS_APP_URL}/storage`),
|
|
322
|
+
onUpgradeStorage: () => openUrl(`${ACCOUNTS_APP_URL}/storage`),
|
|
323
|
+
onHelp: () => openSheet('HelpSupport'),
|
|
324
|
+
onPrivacy: () => openSheet({
|
|
325
|
+
screen: 'LegalDocuments',
|
|
326
|
+
props: {
|
|
327
|
+
initialStep: 1
|
|
328
|
+
}
|
|
329
|
+
}),
|
|
330
|
+
onTerms: () => openSheet({
|
|
331
|
+
screen: 'LegalDocuments',
|
|
332
|
+
props: {
|
|
333
|
+
initialStep: 2
|
|
334
|
+
}
|
|
335
|
+
}),
|
|
336
|
+
onSignOut: () => {
|
|
337
|
+
void logout();
|
|
338
|
+
onComplete?.();
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
}, [onComplete, showBottomSheet, logout]);
|
|
248
342
|
if (!controller) {
|
|
249
343
|
return null;
|
|
250
344
|
}
|
|
@@ -253,7 +347,9 @@ const OxyAuthChooser = ({
|
|
|
253
347
|
snapshot: snapshot,
|
|
254
348
|
theme: theme,
|
|
255
349
|
t: t,
|
|
256
|
-
handlers: handlers
|
|
350
|
+
handlers: handlers,
|
|
351
|
+
storage: storage,
|
|
352
|
+
menu: accountMenu
|
|
257
353
|
});
|
|
258
354
|
}
|
|
259
355
|
if (view === 'qr') {
|
|
@@ -283,7 +379,10 @@ const OxyAuthChooser = ({
|
|
|
283
379
|
onCreateWithPasskey: handleCreateWithPasskey,
|
|
284
380
|
createPending: createPasskeyPending,
|
|
285
381
|
onOpenHub: () => void controller.startPasskeyHubSignIn(),
|
|
286
|
-
onBackToSignIn: () =>
|
|
382
|
+
onBackToSignIn: () => {
|
|
383
|
+
controller.setView('signin');
|
|
384
|
+
autoStartSignIn();
|
|
385
|
+
}
|
|
287
386
|
});
|
|
288
387
|
}
|
|
289
388
|
return /*#__PURE__*/_jsx(SignInView, {
|
|
@@ -298,169 +397,541 @@ const OxyAuthChooser = ({
|
|
|
298
397
|
};
|
|
299
398
|
|
|
300
399
|
// ---------------------------------------------------------------------------
|
|
301
|
-
// Accounts view
|
|
400
|
+
// Accounts view — the signed-in Oxy account MENU (NativeWind)
|
|
302
401
|
// ---------------------------------------------------------------------------
|
|
303
402
|
|
|
403
|
+
/** Used/total storage bytes for the "Oxy storage" block, or `null` when unknown. */
|
|
404
|
+
|
|
405
|
+
/** The account-menu row actions the container wires (deep-links / sheets / sign-out). */
|
|
406
|
+
|
|
304
407
|
/**
|
|
305
|
-
*
|
|
306
|
-
*
|
|
307
|
-
*
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
|
|
311
|
-
|
|
408
|
+
* Leading glyph for the rows that live in a Bloom grouped section (the MENU
|
|
409
|
+
* block) and for the storage card's cloud, which lines its title up with them.
|
|
410
|
+
* It is Bloom's OWN icon-slot size: `SettingsListItem` reserves a fixed 20px
|
|
411
|
+
* leading column and Bloom is consumed exactly as it ships, so a menu glyph
|
|
412
|
+
* larger than this would overhang into the row's title.
|
|
413
|
+
*/
|
|
414
|
+
const ROW_ICON_SIZE = 20;
|
|
415
|
+
/**
|
|
416
|
+
* The switch card's two corner states. Collapsed it is one row and reads as a
|
|
417
|
+
* PILL; opened it is a card holding rows, on the same 16px corner the Bloom
|
|
418
|
+
* grouped section below it uses. Interpolated across the reveal, never snapped.
|
|
419
|
+
*/
|
|
420
|
+
const SWITCH_CARD_PILL_RADIUS = 999;
|
|
421
|
+
const SWITCH_CARD_RADIUS = 16;
|
|
422
|
+
/**
|
|
423
|
+
* The fraction of the reveal over which the corner resolves. The corner is a
|
|
424
|
+
* FASTER gesture than the reveal — it has to be finished before the rows read as
|
|
425
|
+
* rows, or the card still looks like a pill while a list falls out of it — so it
|
|
426
|
+
* is clamped to the reveal's opening fraction instead of tracking it end to end.
|
|
427
|
+
* Measured in a browser against the 240ms reveal: the corner reaches its card
|
|
428
|
+
* value ~120ms in, with the list only ~20% revealed, and (mirrored) the pill is
|
|
429
|
+
* back ~250ms into the close, with the list already down to ~0.
|
|
430
|
+
*/
|
|
431
|
+
const SWITCH_CARD_RADIUS_SETTLE = 0.2;
|
|
432
|
+
/** Diameter of an account row's avatar in the switch list (own markup). */
|
|
433
|
+
const SWITCH_AVATAR_SIZE = 36;
|
|
434
|
+
/** Glyph inside a bordered affordance badge, sized to the avatar it stands in for. */
|
|
435
|
+
const BADGE_GLYPH_SIZE = 19;
|
|
436
|
+
/** The hero block's large current-account avatar. */
|
|
437
|
+
const HERO_AVATAR_SIZE = 72;
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* The hero's address line, shown under the "Hi, <name>!" greeting: the account's
|
|
441
|
+
* canonical `@oxy.so` email when it has one, else its normalized `@handle`. Never
|
|
442
|
+
* synthesizes a `username@oxy.so` address (the identity contract forbids it) — a
|
|
443
|
+
* non-Oxy or missing email falls back to `getNormalizedUserHandle`.
|
|
444
|
+
*/
|
|
445
|
+
function heroAddressLine(account) {
|
|
446
|
+
if (account.email?.toLowerCase().endsWith('@oxy.so')) {
|
|
447
|
+
return account.email;
|
|
448
|
+
}
|
|
449
|
+
const handle = getNormalizedUserHandle(account.user);
|
|
450
|
+
return handle ? `@${handle}` : null;
|
|
451
|
+
}
|
|
452
|
+
/** Avatars shown in the switch row's facepile before it collapses into `+N`. */
|
|
453
|
+
const FACEPILE_MAX = 2;
|
|
454
|
+
/** Facepile avatar diameter — one clear step down from a switch-list avatar. */
|
|
455
|
+
const FACEPILE_AVATAR_SIZE = 32;
|
|
456
|
+
/**
|
|
457
|
+
* Facepile overlap. Well under Bloom's `size / 3` default: the stack draws the
|
|
458
|
+
* FIRST item on top, so a deep overlap would bury the trailing `+N` chip's own
|
|
459
|
+
* label under the avatar before it.
|
|
460
|
+
*/
|
|
461
|
+
const FACEPILE_OVERLAP = 4;
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* `bytes` → `"11.6 GB"`. Whole plan sizes read as whole numbers (`"17 GB"`, not
|
|
465
|
+
* `"17.0 GB"`), and anything ≥ 100 GB drops the decimal entirely.
|
|
466
|
+
*/
|
|
467
|
+
function formatStorageGb(bytes) {
|
|
468
|
+
const gb = bytes / 1024 ** 3;
|
|
469
|
+
if (gb >= 100 || Number.isInteger(gb)) return `${Math.round(gb)} GB`;
|
|
470
|
+
return `${gb.toFixed(1)} GB`;
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* A `Pressable` that appends a hover-tint NativeWind token while pointer-hovered.
|
|
474
|
+
* The Metro web pipeline here does NOT emit NativeWind `hover:` variants, so hover
|
|
475
|
+
* is driven by RN's cross-platform `onHoverIn`/`onHoverOut` (they fire only on web
|
|
476
|
+
* via react-native-web; a no-op on native) toggling a plain background token —
|
|
477
|
+
* the tint stays a NativeWind class, only the trigger is JS.
|
|
478
|
+
*/
|
|
479
|
+
const HoverPressable = ({
|
|
480
|
+
baseClassName,
|
|
481
|
+
hoverClassName,
|
|
482
|
+
...rest
|
|
483
|
+
}) => {
|
|
484
|
+
const [hovered, setHovered] = useState(false);
|
|
485
|
+
return /*#__PURE__*/_jsx(Pressable, {
|
|
486
|
+
...rest,
|
|
487
|
+
className: hovered ? `${baseClassName} ${hoverClassName}` : baseClassName,
|
|
488
|
+
onHoverIn: () => setHovered(true),
|
|
489
|
+
onHoverOut: () => setHovered(false)
|
|
490
|
+
});
|
|
491
|
+
};
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* The signed-in Oxy account MENU — a Google-account-menu-style full menu built
|
|
495
|
+
* entirely with NativeWind `className` (the dynamic per-account accent hex is
|
|
496
|
+
* the one inline style NativeWind can't express). Structure mirrors the
|
|
497
|
+
* approved demo:
|
|
498
|
+
* - ACCOUNT on its own distinct panel surface: a COMPACT current-account row
|
|
499
|
+
* (avatar + name + email + expand chevron) that toggles the switch list, a
|
|
500
|
+
* "Manage your Oxy account" pill, and — when expanded — the other switchable
|
|
501
|
+
* accounts + "Add another account" + "Manage accounts on this device".
|
|
502
|
+
* - OXY STORAGE: cloud + used/total + a progress bar + Upgrade / Manage chips.
|
|
503
|
+
* - MENU rows: Your data in Oxy · Oxy settings · Help & feedback · Sign out —
|
|
504
|
+
* Bloom's grouped section (`SettingsListGroup`/`SettingsListItem`), the same
|
|
505
|
+
* component every other SDK settings surface uses, not a local row copy.
|
|
506
|
+
* - FOOTER: Privacy Policy · Terms of Service.
|
|
507
|
+
*
|
|
508
|
+
* All three blocks share ONE rhythm taken from that grouped section: a 12px
|
|
509
|
+
* content inset, a 12px gap after the leading element, 16px between blocks, and
|
|
510
|
+
* a 16px trailing chevron column.
|
|
312
511
|
*
|
|
313
|
-
* Collapse state is a plain `useState` toggled in the
|
|
314
|
-
* no
|
|
315
|
-
* (nothing to switch to) the chevron is hidden and the
|
|
316
|
-
* "
|
|
317
|
-
* stay reachable without a pointless expand toggle.
|
|
512
|
+
* Collapse state is a plain `useState` toggled in the current row's press
|
|
513
|
+
* handler — no effect hook, no derived-from-props sync. With only ONE account
|
|
514
|
+
* (nothing to switch to) the chevron is hidden and the list renders inline so
|
|
515
|
+
* "Add another account" stays reachable without a pointless toggle.
|
|
318
516
|
*/
|
|
319
517
|
const AccountsView = ({
|
|
320
518
|
snapshot,
|
|
321
519
|
theme,
|
|
322
520
|
t,
|
|
323
|
-
handlers
|
|
521
|
+
handlers,
|
|
522
|
+
storage,
|
|
523
|
+
menu
|
|
324
524
|
}) => {
|
|
325
525
|
const [expanded, setExpanded] = useState(false);
|
|
526
|
+
// Measured natural height of the switch list, so the reveal animates to an
|
|
527
|
+
// exact height (and the content below reflows down smoothly) instead of a
|
|
528
|
+
// guessed max. The measuring wrapper is style-based, NOT className'd — on
|
|
529
|
+
// RN-Web `onLayout` never fires for className'd Views (see AGENTS.md).
|
|
530
|
+
const [listContentHeight, setListContentHeight] = useState(0);
|
|
531
|
+
// 0 = collapsed, 1 = expanded. Set imperatively in the toggle handler (no
|
|
532
|
+
// effect hook). On RN-Web there is no worklets plugin, so every shared value a
|
|
533
|
+
// mapper reads MUST be in its deps array or it freezes on the first frame
|
|
534
|
+
// (AGENTS.md "Reanimated (web)").
|
|
535
|
+
const listProgress = useSharedValue(0);
|
|
536
|
+
const listStyle = useAnimatedStyle(() => ({
|
|
537
|
+
height: listProgress.value * listContentHeight,
|
|
538
|
+
opacity: listProgress.value
|
|
539
|
+
}), [listProgress, listContentHeight]);
|
|
540
|
+
const chevronStyle = useAnimatedStyle(() => ({
|
|
541
|
+
transform: [{
|
|
542
|
+
rotate: `${listProgress.value * 180}deg`
|
|
543
|
+
}]
|
|
544
|
+
}), [listProgress]);
|
|
545
|
+
// Collapsed, the switch card is a single row and reads as a PILL; opened, it
|
|
546
|
+
// becomes a card holding rows and takes the grouped-section corner. The corner
|
|
547
|
+
// is driven off the SAME `listProgress` as the reveal — but clamped to its
|
|
548
|
+
// opening fraction, so it resolves early instead of trailing the rows: the
|
|
549
|
+
// card already reads as a card by the time they are visible. Collapsing is the
|
|
550
|
+
// mirror image, the pill returning over the closing tail.
|
|
551
|
+
const switchCardStyle = useAnimatedStyle(() => ({
|
|
552
|
+
borderRadius: interpolate(listProgress.value, [0, SWITCH_CARD_RADIUS_SETTLE], [SWITCH_CARD_PILL_RADIUS, SWITCH_CARD_RADIUS], Extrapolation.CLAMP)
|
|
553
|
+
}), [listProgress]);
|
|
554
|
+
// `CompositionBar` ships as an interactive breakdown: a selected segment
|
|
555
|
+
// replaces its hint line with that segment's readout. Tapping the selected one
|
|
556
|
+
// again clears it.
|
|
557
|
+
const [storageSegment, setStorageSegment] = useState(null);
|
|
558
|
+
const toggleStorageSegment = useCallback(key => setStorageSegment(previous => previous === key ? null : key), []);
|
|
559
|
+
const toggleExpanded = useCallback(() => {
|
|
560
|
+
const next = !expanded;
|
|
561
|
+
setExpanded(next);
|
|
562
|
+
listProgress.value = withTiming(next ? 1 : 0, {
|
|
563
|
+
duration: 240
|
|
564
|
+
});
|
|
565
|
+
}, [expanded, listProgress]);
|
|
326
566
|
if (snapshot.loading && snapshot.accounts.length === 0) {
|
|
327
567
|
return /*#__PURE__*/_jsxs(View, {
|
|
328
|
-
|
|
568
|
+
className: "items-center justify-center gap-space-12 py-space-24",
|
|
329
569
|
children: [/*#__PURE__*/_jsx(MaterialCommunityIcons, {
|
|
330
570
|
name: "loading",
|
|
331
571
|
size: 24,
|
|
332
572
|
color: theme.colors.textSecondary
|
|
333
573
|
}), /*#__PURE__*/_jsx(Text, {
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
}],
|
|
337
|
-
children: t('accountSwitcher.loading') || 'Loading accounts…'
|
|
574
|
+
className: "text-body text-text-secondary text-center",
|
|
575
|
+
children: t('accountSwitcher.loading')
|
|
338
576
|
})]
|
|
339
577
|
});
|
|
340
578
|
}
|
|
341
579
|
const switchingDisabled = snapshot.switchingAccountId !== null;
|
|
342
580
|
const current = snapshot.accounts.find(account => account.isCurrent) ?? snapshot.accounts[0];
|
|
343
|
-
const
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
//
|
|
347
|
-
//
|
|
348
|
-
const
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
581
|
+
const others = current ? snapshot.accounts.filter(account => account.accountId !== current.accountId) : snapshot.accounts;
|
|
582
|
+
const currentAccent = current ? resolveAccentHex(current.color, theme.colors.primary) : theme.colors.primary;
|
|
583
|
+
// The hero's address line under the greeting: the account's canonical @oxy.so
|
|
584
|
+
// email when it has one, else its normalized `@handle` (never a synthesized
|
|
585
|
+
// `username@oxy.so`, per the identity contract — `getNormalizedUserHandle`).
|
|
586
|
+
const currentAddress = current ? heroAddressLine(current) : null;
|
|
587
|
+
// The switch list repeats the CURRENT account (first, ringed) — unlike the old
|
|
588
|
+
// compact header it is not represented anywhere else once the hero moved out
|
|
589
|
+
// of the card, and the list is where you switch back to it.
|
|
590
|
+
const switchableAccounts = current ? [current, ...others] : others;
|
|
591
|
+
const facepile = switchableAccounts.map(account => ({
|
|
592
|
+
id: account.accountId,
|
|
593
|
+
uri: account.avatarUrl ?? undefined,
|
|
594
|
+
displayName: account.displayName
|
|
595
|
+
}));
|
|
596
|
+
|
|
597
|
+
// Used vs free is a two-part COMPOSITION (the parts always fill the bar), not
|
|
598
|
+
// a progress value — exactly what Bloom's `CompositionBar` models. Both colors
|
|
599
|
+
// are theme tokens, so the bar is correct in light and dark.
|
|
600
|
+
const storageCategories = storage ? [{
|
|
601
|
+
key: 'used',
|
|
602
|
+
name: t('accountMenu.storage.used'),
|
|
603
|
+
amount: storage.usedBytes,
|
|
604
|
+
color: theme.colors.primary
|
|
605
|
+
}, {
|
|
606
|
+
key: 'free',
|
|
607
|
+
name: t('accountMenu.storage.free'),
|
|
608
|
+
amount: Math.max(0, storage.limitBytes - storage.usedBytes),
|
|
609
|
+
color: theme.colors.contrast50
|
|
610
|
+
}] : [];
|
|
611
|
+
const usageLabel = storage ? t('accountMenu.storage.usage', {
|
|
612
|
+
used: formatStorageGb(storage.usedBytes),
|
|
613
|
+
total: formatStorageGb(storage.limitBytes)
|
|
614
|
+
}) : t('accountMenu.storage.unavailable');
|
|
615
|
+
|
|
616
|
+
// The switch list body, revealed under the "Switch account" row. Own markup,
|
|
617
|
+
// not a Bloom grouped section: this is not a list of settings rows and the
|
|
618
|
+
// component is not a card container. It mirrors the section's rhythm by hand —
|
|
619
|
+
// 12px content inset, 12px after the avatar, a hairline between rows — and
|
|
620
|
+
// draws those hairlines INSIDE the animated clip, so a collapsed list never
|
|
621
|
+
// strands one against the header row.
|
|
622
|
+
const listItems = /*#__PURE__*/_jsxs(_Fragment, {
|
|
623
|
+
children: [switchableAccounts.map((account, index) => {
|
|
624
|
+
const accent = resolveAccentHex(account.color, theme.colors.primary);
|
|
625
|
+
const isSwitching = snapshot.switchingAccountId === account.accountId;
|
|
626
|
+
return /*#__PURE__*/_jsxs(Fragment, {
|
|
627
|
+
children: [index > 0 ? /*#__PURE__*/_jsx(View, {
|
|
628
|
+
className: "h-px bg-border opacity-30 ml-space-12"
|
|
629
|
+
}) : null, /*#__PURE__*/_jsxs(HoverPressable, {
|
|
630
|
+
baseClassName: `flex-row items-center gap-space-12 px-space-12 py-[10px]${switchingDisabled ? ' opacity-60' : ''}`,
|
|
631
|
+
hoverClassName: "bg-fill-secondary",
|
|
632
|
+
onPress: () => handlers.onSwitch(account.accountId),
|
|
633
|
+
disabled: switchingDisabled,
|
|
634
|
+
accessibilityRole: "button",
|
|
635
|
+
accessibilityLabel: account.displayName,
|
|
636
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
637
|
+
children: [/*#__PURE__*/_jsx(Avatar, {
|
|
638
|
+
source: account.avatarUrl ?? undefined,
|
|
639
|
+
variant: "thumb",
|
|
640
|
+
name: account.displayName,
|
|
641
|
+
size: SWITCH_AVATAR_SIZE
|
|
642
|
+
}), account.isCurrent ? /*#__PURE__*/_jsx(View, {
|
|
643
|
+
style: [styles.currentAvatarRing, {
|
|
644
|
+
borderColor: accent
|
|
645
|
+
}],
|
|
646
|
+
pointerEvents: "none"
|
|
647
|
+
}) : null]
|
|
648
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
649
|
+
className: "flex-1 min-w-0",
|
|
650
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
651
|
+
className: "text-body font-semibold text-text",
|
|
652
|
+
numberOfLines: 1,
|
|
653
|
+
children: account.displayName
|
|
654
|
+
}), account.email ? /*#__PURE__*/_jsx(Text, {
|
|
655
|
+
className: "text-caption text-text-secondary",
|
|
656
|
+
numberOfLines: 1,
|
|
657
|
+
children: account.email
|
|
658
|
+
}) : null]
|
|
659
|
+
}), isSwitching ? /*#__PURE__*/_jsx(MaterialCommunityIcons, {
|
|
660
|
+
name: "loading",
|
|
661
|
+
size: 20,
|
|
662
|
+
color: accent
|
|
663
|
+
}) : null]
|
|
664
|
+
})]
|
|
665
|
+
}, account.accountId);
|
|
666
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
667
|
+
className: "h-px bg-border opacity-30 ml-space-12"
|
|
668
|
+
}), /*#__PURE__*/_jsx(AccountAffordanceRow, {
|
|
669
|
+
icon: "plus",
|
|
670
|
+
label: t('accountMenu.addAnother'),
|
|
671
|
+
onPress: handlers.onAdd,
|
|
367
672
|
disabled: switchingDisabled,
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
673
|
+
theme: theme
|
|
674
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
675
|
+
className: "h-px bg-border opacity-30 ml-space-12"
|
|
676
|
+
}), /*#__PURE__*/_jsx(AccountAffordanceRow, {
|
|
677
|
+
icon: "account-multiple-outline",
|
|
678
|
+
label: t('accountSwitcher.manageOnDevice'),
|
|
679
|
+
onPress: handlers.onManage,
|
|
680
|
+
disabled: switchingDisabled,
|
|
681
|
+
theme: theme
|
|
682
|
+
})]
|
|
683
|
+
});
|
|
684
|
+
const manageLabel = t('accountMenu.manage');
|
|
685
|
+
const switchLabel = t('accountMenu.switchAccount');
|
|
381
686
|
return /*#__PURE__*/_jsxs(View, {
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
687
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
688
|
+
style: styles.hero,
|
|
689
|
+
children: [current ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
690
|
+
children: [/*#__PURE__*/_jsxs(PressableScale, {
|
|
691
|
+
onPress: handlers.onEditAvatar,
|
|
692
|
+
accessibilityRole: "button",
|
|
693
|
+
accessibilityLabel: t('editProfile.changeAvatar'),
|
|
694
|
+
style: styles.heroAvatarPressable,
|
|
695
|
+
children: [/*#__PURE__*/_jsx(Avatar, {
|
|
696
|
+
source: current.avatarUrl ?? undefined,
|
|
697
|
+
name: current.displayName,
|
|
698
|
+
size: HERO_AVATAR_SIZE
|
|
699
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
700
|
+
style: [styles.heroAvatarRing, {
|
|
701
|
+
borderColor: currentAccent
|
|
702
|
+
}],
|
|
703
|
+
pointerEvents: "none"
|
|
704
|
+
}), /*#__PURE__*/_jsx(AvatarCameraBadge, {})]
|
|
705
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
706
|
+
style: styles.heroNameBlock,
|
|
707
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
708
|
+
style: [styles.heroGreeting, {
|
|
709
|
+
color: theme.colors.text
|
|
710
|
+
}],
|
|
711
|
+
numberOfLines: 2,
|
|
712
|
+
children: t('accountMenu.greeting', {
|
|
713
|
+
name: current.displayName
|
|
714
|
+
})
|
|
715
|
+
}), currentAddress ? /*#__PURE__*/_jsx(Text, {
|
|
716
|
+
style: [styles.heroAddress, {
|
|
717
|
+
color: theme.colors.textSecondary
|
|
718
|
+
}],
|
|
719
|
+
numberOfLines: 1,
|
|
720
|
+
children: currentAddress
|
|
721
|
+
}) : null]
|
|
722
|
+
})]
|
|
723
|
+
}) : null, /*#__PURE__*/_jsx(Button, {
|
|
724
|
+
variant: "secondary",
|
|
725
|
+
size: "small",
|
|
726
|
+
onPress: handlers.onManage,
|
|
727
|
+
accessibilityLabel: manageLabel,
|
|
728
|
+
children: manageLabel
|
|
729
|
+
})]
|
|
730
|
+
}), /*#__PURE__*/_jsxs(Animated.View, {
|
|
731
|
+
className: "bg-fill overflow-hidden mb-space-16",
|
|
732
|
+
style: switchCardStyle,
|
|
733
|
+
children: [/*#__PURE__*/_jsxs(HoverPressable, {
|
|
734
|
+
baseClassName: `flex-row items-center gap-space-12 px-space-12 py-[10px] min-h-[44px]${switchingDisabled ? ' opacity-60' : ''}`,
|
|
735
|
+
hoverClassName: "bg-fill-secondary",
|
|
736
|
+
onPress: toggleExpanded,
|
|
737
|
+
disabled: switchingDisabled,
|
|
738
|
+
accessibilityRole: "button"
|
|
739
|
+
// The ARIA prop, not `accessibilityState`: react-native-web 0.21
|
|
740
|
+
// forwards only this one, and RN maps it to
|
|
741
|
+
// `accessibilityState.expanded` natively — so the disclosure state
|
|
742
|
+
// reaches assistive tech on BOTH platforms.
|
|
743
|
+
,
|
|
744
|
+
"aria-expanded": expanded,
|
|
745
|
+
accessibilityLabel: switchLabel,
|
|
404
746
|
children: [/*#__PURE__*/_jsx(Text, {
|
|
405
|
-
|
|
406
|
-
color: theme.colors.text
|
|
407
|
-
}],
|
|
747
|
+
className: "flex-1 text-body text-text",
|
|
408
748
|
numberOfLines: 1,
|
|
409
|
-
children:
|
|
410
|
-
}),
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
}) : null, /*#__PURE__*/_jsx(Button, {
|
|
423
|
-
variant: "outline",
|
|
424
|
-
onPress: handlers.onManage,
|
|
425
|
-
style: styles.manageButton,
|
|
426
|
-
children: t('accountMenu.manage') || 'Manage your Oxy account'
|
|
427
|
-
}), showList ? /*#__PURE__*/_jsxs(SettingsListGroup, {
|
|
428
|
-
children: [hasOtherAccounts ? orderedAccounts.map(renderAccountItem) : null, /*#__PURE__*/_jsx(SettingsListItem, {
|
|
429
|
-
icon: /*#__PURE__*/_jsx(View, {
|
|
430
|
-
style: [styles.addBadge, {
|
|
431
|
-
borderColor: theme.colors.border
|
|
749
|
+
children: switchLabel
|
|
750
|
+
}), expanded ? null : /*#__PURE__*/_jsx(AvatarGroup, {
|
|
751
|
+
items: facepile,
|
|
752
|
+
layout: "stack",
|
|
753
|
+
size: FACEPILE_AVATAR_SIZE,
|
|
754
|
+
max: FACEPILE_MAX,
|
|
755
|
+
overlap: FACEPILE_OVERLAP,
|
|
756
|
+
variant: "thumb",
|
|
757
|
+
showInitials: true,
|
|
758
|
+
ringColor: theme.colors.card
|
|
759
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
760
|
+
style: [styles.chevronCircle, {
|
|
761
|
+
backgroundColor: theme.colors.contrast50
|
|
432
762
|
}],
|
|
763
|
+
children: /*#__PURE__*/_jsx(Animated.View, {
|
|
764
|
+
style: chevronStyle,
|
|
765
|
+
children: /*#__PURE__*/_jsx(MaterialCommunityIcons, {
|
|
766
|
+
name: "chevron-down",
|
|
767
|
+
size: 20,
|
|
768
|
+
color: theme.colors.text
|
|
769
|
+
})
|
|
770
|
+
})
|
|
771
|
+
})]
|
|
772
|
+
}), /*#__PURE__*/_jsx(Animated.View, {
|
|
773
|
+
style: [styles.collapse, listStyle],
|
|
774
|
+
pointerEvents: expanded ? 'auto' : 'none',
|
|
775
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
776
|
+
style: styles.collapseMeasure,
|
|
777
|
+
onLayout: event => setListContentHeight(event.nativeEvent.layout.height),
|
|
778
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
779
|
+
children: listItems
|
|
780
|
+
})
|
|
781
|
+
})
|
|
782
|
+
})]
|
|
783
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
784
|
+
className: "bg-fill rounded-[16px] overflow-hidden mb-space-16 px-space-12 py-[10px] gap-space-12",
|
|
785
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
786
|
+
className: "flex-row items-center gap-space-12 min-h-[24px]",
|
|
787
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
788
|
+
className: "w-[20px] items-center",
|
|
433
789
|
children: /*#__PURE__*/_jsx(MaterialCommunityIcons, {
|
|
434
|
-
name: "
|
|
435
|
-
size:
|
|
790
|
+
name: "cloud-outline",
|
|
791
|
+
size: ROW_ICON_SIZE,
|
|
436
792
|
color: theme.colors.textSecondary
|
|
437
793
|
})
|
|
794
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
795
|
+
className: "flex-1 text-body font-semibold text-text",
|
|
796
|
+
numberOfLines: 1,
|
|
797
|
+
children: t('accountMenu.storage.title')
|
|
798
|
+
})]
|
|
799
|
+
}), /*#__PURE__*/_jsx(CompositionBar, {
|
|
800
|
+
categories: storageCategories,
|
|
801
|
+
selectedKey: storageSegment,
|
|
802
|
+
onSelect: toggleStorageSegment,
|
|
803
|
+
hintLabel: usageLabel,
|
|
804
|
+
formatReadout: (bytes, percent) => `${formatStorageGb(bytes)} · ${percent}%`
|
|
805
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
806
|
+
className: "flex-row gap-space-8",
|
|
807
|
+
children: [/*#__PURE__*/_jsx(StorageChip, {
|
|
808
|
+
label: t('accountMenu.storage.upgrade'),
|
|
809
|
+
onPress: menu.onUpgradeStorage
|
|
810
|
+
}), /*#__PURE__*/_jsx(StorageChip, {
|
|
811
|
+
label: t('accountMenu.storage.manage'),
|
|
812
|
+
onPress: menu.onManageStorage
|
|
813
|
+
})]
|
|
814
|
+
})]
|
|
815
|
+
}), /*#__PURE__*/_jsxs(SettingsListGroup, {
|
|
816
|
+
children: [/*#__PURE__*/_jsx(SettingsListItem, {
|
|
817
|
+
icon: /*#__PURE__*/_jsx(MenuIcon, {
|
|
818
|
+
name: "tray-arrow-down",
|
|
819
|
+
theme: theme
|
|
438
820
|
}),
|
|
439
|
-
title: t('
|
|
440
|
-
onPress:
|
|
441
|
-
disabled: switchingDisabled,
|
|
442
|
-
accessibilityLabel: t('signin.addAccountTitle') || 'Add another account',
|
|
443
|
-
showChevron: false
|
|
821
|
+
title: t('accountMenu.data'),
|
|
822
|
+
onPress: menu.onOpenData
|
|
444
823
|
}), /*#__PURE__*/_jsx(SettingsListItem, {
|
|
445
|
-
icon: /*#__PURE__*/_jsx(
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
}],
|
|
449
|
-
children: /*#__PURE__*/_jsx(MaterialCommunityIcons, {
|
|
450
|
-
name: "cog-outline",
|
|
451
|
-
size: 20,
|
|
452
|
-
color: theme.colors.textSecondary
|
|
453
|
-
})
|
|
824
|
+
icon: /*#__PURE__*/_jsx(MenuIcon, {
|
|
825
|
+
name: "cog-outline",
|
|
826
|
+
theme: theme
|
|
454
827
|
}),
|
|
455
|
-
title: t('
|
|
456
|
-
onPress:
|
|
457
|
-
|
|
458
|
-
|
|
828
|
+
title: t('accountMenu.settings'),
|
|
829
|
+
onPress: menu.onOpenSettings
|
|
830
|
+
}), /*#__PURE__*/_jsx(SettingsListItem, {
|
|
831
|
+
icon: /*#__PURE__*/_jsx(MenuIcon, {
|
|
832
|
+
name: "help-circle-outline",
|
|
833
|
+
theme: theme
|
|
834
|
+
}),
|
|
835
|
+
title: t('accountMenu.help'),
|
|
836
|
+
onPress: menu.onHelp
|
|
837
|
+
}), /*#__PURE__*/_jsx(SettingsListItem, {
|
|
838
|
+
icon: /*#__PURE__*/_jsx(MenuIcon, {
|
|
839
|
+
name: "logout",
|
|
840
|
+
theme: theme
|
|
841
|
+
}),
|
|
842
|
+
title: t('accountMenu.signOut'),
|
|
843
|
+
onPress: menu.onSignOut,
|
|
459
844
|
showChevron: false
|
|
460
845
|
})]
|
|
461
|
-
})
|
|
846
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
847
|
+
className: "flex-row items-center justify-center gap-space-12 px-space-12 pb-space-8",
|
|
848
|
+
children: [/*#__PURE__*/_jsx(Pressable, {
|
|
849
|
+
onPress: menu.onPrivacy,
|
|
850
|
+
accessibilityRole: "link",
|
|
851
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
852
|
+
className: "text-bodySmall text-text-secondary",
|
|
853
|
+
children: t('accountMenu.privacy')
|
|
854
|
+
})
|
|
855
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
856
|
+
className: "text-bodySmall text-text-tertiary",
|
|
857
|
+
children: "\xB7"
|
|
858
|
+
}), /*#__PURE__*/_jsx(Pressable, {
|
|
859
|
+
onPress: menu.onTerms,
|
|
860
|
+
accessibilityRole: "link",
|
|
861
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
862
|
+
className: "text-bodySmall text-text-secondary",
|
|
863
|
+
children: t('accountMenu.terms')
|
|
864
|
+
})
|
|
865
|
+
})]
|
|
866
|
+
})]
|
|
462
867
|
});
|
|
463
868
|
};
|
|
869
|
+
|
|
870
|
+
// ---------------------------------------------------------------------------
|
|
871
|
+
// Account-menu row building blocks (NativeWind)
|
|
872
|
+
// ---------------------------------------------------------------------------
|
|
873
|
+
|
|
874
|
+
/**
|
|
875
|
+
* An account-list AFFORDANCE row ("Add another account", "Manage accounts on
|
|
876
|
+
* this device") — a bordered circle sized to the avatar it stands in for, so its
|
|
877
|
+
* label lands on the same line as every account name above it. Own markup, like
|
|
878
|
+
* the account rows it closes: this list is not a Bloom grouped section.
|
|
879
|
+
*/
|
|
880
|
+
const AccountAffordanceRow = ({
|
|
881
|
+
icon,
|
|
882
|
+
label,
|
|
883
|
+
onPress,
|
|
884
|
+
disabled,
|
|
885
|
+
theme
|
|
886
|
+
}) => /*#__PURE__*/_jsxs(HoverPressable, {
|
|
887
|
+
baseClassName: `flex-row items-center gap-space-12 px-space-12 py-[10px]${disabled ? ' opacity-60' : ''}`,
|
|
888
|
+
hoverClassName: "bg-fill-secondary",
|
|
889
|
+
onPress: onPress,
|
|
890
|
+
disabled: disabled,
|
|
891
|
+
accessibilityRole: "button",
|
|
892
|
+
accessibilityLabel: label,
|
|
893
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
894
|
+
className: "w-[36px] h-[36px] items-center justify-center rounded-radius-max border border-border",
|
|
895
|
+
children: /*#__PURE__*/_jsx(MaterialCommunityIcons, {
|
|
896
|
+
name: icon,
|
|
897
|
+
size: BADGE_GLYPH_SIZE,
|
|
898
|
+
color: theme.colors.textSecondary
|
|
899
|
+
})
|
|
900
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
901
|
+
className: "flex-1 text-body font-semibold text-text",
|
|
902
|
+
numberOfLines: 1,
|
|
903
|
+
children: label
|
|
904
|
+
})]
|
|
905
|
+
});
|
|
906
|
+
|
|
907
|
+
/**
|
|
908
|
+
* The leading glyph for a grouped-section menu row, sized to Bloom's 20px icon
|
|
909
|
+
* column so the icons, the storage block's cloud and every row title align.
|
|
910
|
+
*/
|
|
911
|
+
const MenuIcon = ({
|
|
912
|
+
name,
|
|
913
|
+
theme
|
|
914
|
+
}) => /*#__PURE__*/_jsx(MaterialCommunityIcons, {
|
|
915
|
+
name: name,
|
|
916
|
+
size: ROW_ICON_SIZE,
|
|
917
|
+
color: theme.colors.textSecondary
|
|
918
|
+
});
|
|
919
|
+
|
|
920
|
+
/** A storage action chip — a bordered pill on the sheet background. */
|
|
921
|
+
const StorageChip = ({
|
|
922
|
+
label,
|
|
923
|
+
onPress
|
|
924
|
+
}) => /*#__PURE__*/_jsx(HoverPressable, {
|
|
925
|
+
baseClassName: "rounded-radius-max border border-border bg-bg py-[9px] px-[14px]",
|
|
926
|
+
hoverClassName: "bg-fill-secondary",
|
|
927
|
+
onPress: onPress,
|
|
928
|
+
accessibilityRole: "button",
|
|
929
|
+
accessibilityLabel: label,
|
|
930
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
931
|
+
className: "text-bodySmall font-semibold text-text",
|
|
932
|
+
children: label
|
|
933
|
+
})
|
|
934
|
+
});
|
|
464
935
|
const AccountRow = ({
|
|
465
936
|
account,
|
|
466
937
|
theme,
|
|
@@ -529,9 +1000,9 @@ const AccountRow = ({
|
|
|
529
1000
|
};
|
|
530
1001
|
|
|
531
1002
|
// ---------------------------------------------------------------------------
|
|
532
|
-
// Sign-in view (add / signin) — NATIVE-facing today: on web
|
|
533
|
-
//
|
|
534
|
-
// only for a brief instant there.
|
|
1003
|
+
// Sign-in view (add / signin) — NATIVE-facing today: on web `autoStartSignIn`
|
|
1004
|
+
// (fired from the subscribe pass / the add / back-to-sign-in handlers) moves the
|
|
1005
|
+
// view to `qr` almost immediately, so this renders only for a brief instant there.
|
|
535
1006
|
// ---------------------------------------------------------------------------
|
|
536
1007
|
|
|
537
1008
|
const SignInView = ({
|