diff --git a/app/(onboarding)/services/ed/credentials.tsx b/app/(onboarding)/services/ed/credentials.tsx index 495109a9..337c19e3 100644 --- a/app/(onboarding)/services/ed/credentials.tsx +++ b/app/(onboarding)/services/ed/credentials.tsx @@ -1,4 +1,4 @@ - +import { Papicons } from "@getpapillon/papicons"; import { Client, DoubleAuthQuestions, DoubleAuthResult, Require2FA } from "@blockshub/blocksdirecte"; import { useTheme } from "@react-navigation/native"; import { router } from "expo-router"; @@ -8,47 +8,168 @@ import { Alert, Keyboard, KeyboardAvoidingView, - Modal, Platform, Pressable, View, } from "react-native"; -import Reanimated, { - FadeInDown, - FadeOutUp, - useSharedValue, - withTiming, -} from "react-native-reanimated"; +import { useSharedValue, withTiming } from "react-native-reanimated"; import { useSafeAreaInsets } from "react-native-safe-area-context"; -import OnboardingBackButton from "@/components/onboarding/OnboardingBackButton"; -import OnboardingInput from "@/components/onboarding/OnboardingInput"; -import OnboardingScrollingFlatList from "@/components/onboarding/OnboardingScrollingFlatList"; import { useAccountStore } from "@/stores/account"; import { Account, Services } from "@/stores/account/types"; -import { useAlert } from "@/ui/components/AlertProvider"; import AnimatedPressable from "@/ui/components/AnimatedPressable"; -import Button from "@/ui/components/Button"; +import { Dynamic } from "@/ui/components/Dynamic"; +import SheetModal from "@/ui/components/SheetModal"; import Stack from "@/ui/components/Stack"; -import Typography from "@/ui/components/Typography"; +import Button from "@/ui/new/Button"; +import Divider from "@/ui/new/Divider"; +import List from "@/ui/new/List"; +import Typography from "@/ui/new/Typography"; +import { PapillonZoomIn, PapillonZoomOut } from "@/ui/utils/Transition"; +import adjust from "@/utils/adjustColor"; import uuid from "@/utils/uuid/uuid"; import { ScrollView } from "react-native-gesture-handler"; import LoginView from "../../components/LoginView"; import { useHeaderHeight } from "@react-navigation/elements"; const ANIMATION_DURATION = 170; +const CHALLENGE_COLOR = "#E50052"; export const PlatformPressable = Platform.OS === 'android' ? Pressable : AnimatedPressable; -export default function EDLoginWithCredentials() { - const insets = useSafeAreaInsets(); +function EDDoubleAuthModal({ + question, + visible, + options, + selectedIndex, + submitting, + onClose, + onContinue, + onSelect, +}: { + question: string; + visible: boolean; + options: string[]; + selectedIndex: number | null; + submitting: boolean; + onClose: () => void; + onContinue: () => void; + onSelect: (index: number | null) => void; +}) { + const { t } = useTranslation(); const theme = useTheme(); const { colors } = theme; + const insets = useSafeAreaInsets(); - const alert = useAlert(); + const selectedBackground = adjust(CHALLENGE_COLOR, theme.dark ? -0.82 : 0.92); + const selectedBadgeBackground = CHALLENGE_COLOR + (theme.dark ? "22" : "18"); + + return ( + + + ( + + + {question} + + + + {t("ONBOARDING_DOUBLE_AUTH_DESCRIPTION")} + + + + )} + contentContainerStyle={{ + padding: 16, + flexGrow: 1, + gap: 10, + paddingTop: insets.top + 20, + paddingBottom: 20, + }} + style={{ flex: 1 }} + > + {options.map((option, index) => { + const isSelected = selectedIndex === index; + + return ( + { + if (!submitting) { + onSelect(isSelected ? null : index); + } + }} + style={{ + backgroundColor: isSelected ? selectedBackground : colors.card, + minHeight: 68, + }} + > + + + + {isSelected ? ( + + ) : ( + + {index + 1} + + )} + + + + + + {option} + + + ); + })} + + + +