@@ -1,32 +1,35 @@
1import React, { useCallback, useEffect, useMemo, useState } from 'react';
1import React, { useCallback, useEffect, useMemo, useState } from 'react';
3import ActivateView from './ActivateView';
3import ActivateView from './ActivateView';
4−import ActivateHeader from './ActivateHeader';
4+import { FadeableActivateHeader as ActivateHeader } from './ActivateHeader';
5import { MasterKey } from './MasterKey';
5import { MasterKey } from './MasterKey';
6−import { Box, Button, Icon } from '@tlon/indigo-react';
6+import { Box, Icon } from '@tlon/indigo-react';
7−import ActivateParagraph from './ActivateParagraph';
7+import { FadeableActivateParagraph as ActivateParagraph } from './ActivateParagraph';
8−import { ActivateSteps } from './ActivateSteps';
8+import { FadeableActivateSteps as ActivateSteps } from './ActivateSteps';
9import { useActivateFlow } from './ActivateFlow';
9import { useActivateFlow } from './ActivateFlow';
10import { timeout } from 'lib/timeout';
10import { timeout } from 'lib/timeout';
11import { useLocalRouter } from 'lib/LocalRouter';
11import { useLocalRouter } from 'lib/LocalRouter';
12+import { FadeableActivateButton as ActivateButton } from './ActivateButton';
13const MasterKeyReveal = () => {
14const MasterKeyReveal = () => {
14− const { isFaded, setIsFaded } = useActivateFlow();
15+ const { isIn, setIsIn } = useActivateFlow();
15 const { push, names } = useLocalRouter();
16 const { push, names } = useLocalRouter();
17+ const [showMasterKey, setShowMasterKey] = useState<boolean>(false);
18+ const [triggerAnimation, setTriggerAnimation] = useState<boolean>(false);
17 const goToDownload = useCallback(() => {
20 const goToDownload = useCallback(() => {
18 push(names.DOWNLOAD);
21 push(names.DOWNLOAD);
19 }, [names.DOWNLOAD, push]);
22 }, [names.DOWNLOAD, push]);
21 const onRevealClick = useCallback(async () => {
24 const onRevealClick = useCallback(async () => {
22− setIsFaded(false);
25+ setShowMasterKey(true);
23 await timeout(500); // Pause for UI fade animation
26 await timeout(500); // Pause for UI fade animation
24 goToDownload();
27 goToDownload();
25− }, [goToDownload, setIsFaded]);
28+ }, [goToDownload]);
27 const header = useMemo(() => {
30 const header = useMemo(() => {
28− return (
31+ return triggerAnimation ? (
29− <Box className={isFaded ? 'faded-in' : 'faded-out'}>
32+ <Box>
30 <ActivateHeader copy={'Here is your Master Key.'} />
33 <ActivateHeader copy={'Here is your Master Key.'} />
31 <ActivateParagraph
34 <ActivateParagraph
@@ -34,49 +37,37 @@ const MasterKeyReveal = () => {
38− }, [isFaded]);
41+ }, [triggerAnimation]);
40 const footer = useMemo(() => {
43 const footer = useMemo(() => {
41− return (
44+ return triggerAnimation ? (
44− flexDirection="column"
47− className={isFaded ? 'faded-in' : 'faded-out'}
48− justifyContent="flex-end">
50− onClick={onRevealClick}
45+ <ActivateButton onClick={onRevealClick}>
51− backgroundColor="black"
46+ <Icon
47+ display="inline-block"
52 color={'white'}
50 color={'white'}
59− display="inline-block"
64− Reveal
52+ Reveal
65− </Button>
53+ </ActivateButton>
68− }, [isFaded, onRevealClick]);
55+ }, [onRevealClick, triggerAnimation]);
70− const onViewTransition = useCallback(async () => {
57+ const delayedFadeIn = useCallback(async () => {
71− await timeout(500); // Pause for UI fade animation
58+ setTimeout(() => {
72− setIsFaded(true);
59+ setTriggerAnimation(true);
73− await timeout(500); // Pause for UI fade animation
60+ setIsIn(true);
74− }, [setIsFaded]);
61+ }, 1200);
76 useEffect(() => {
64 useEffect(() => {
77− // Fade in content
65+ delayedFadeIn();
78− onViewTransition();
66+
79− }, [onViewTransition]);
67+ return () => {
70+ }, [delayedFadeIn, setIsIn]);
@@ -95,15 +86,11 @@ const MasterKeyReveal = () => {
95 width={'80%'}
86 width={'80%'}
96 height={'min-content'}
87 height={'min-content'}
97 justifyContent={'center'}>
88 justifyContent={'center'}>
98− <MasterKey paused={true} />
89+ <MasterKey />
101 </ActivateView>
92 </ActivateView>
102− <ActivateSteps
93+ {triggerAnimation && <ActivateSteps currentStep={0} totalSteps={4} />}
105− className={isFaded ? 'faded-in' : 'faded-out'}