Skip to content

Commit

Permalink
Merge branch 'move-and-register-page-refactor' of github.com:Outblock…
Browse files Browse the repository at this point in the history
…/FRW-Extension into move-and-register-page-refactor

# Conflicts:
#	src/ui/FRWComponent/LandingPages/AllSet.tsx
#	src/ui/views/LandingPages/Welcome/Register/SetPassword.tsx
  • Loading branch information
zzggo committed Dec 17, 2024
2 parents b28ef8a + ac1a718 commit ddfa4d2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 20 deletions.
22 changes: 6 additions & 16 deletions src/ui/FRWComponent/LandingPages/AllSet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,21 @@ import React, { useCallback, useEffect } from 'react';

import { storage } from 'background/webapi';
import AllSetIcon from 'ui/FRWAssets/svg/allset.svg';
import { useWallet, mixpanelBrowserService } from 'ui/utils';
import { useWallet } from 'ui/utils';

interface AllSetProps {
handleClick: () => void;
variant?: 'register' | 'recover' | 'sync' | 'add';
}

const AllSet = ({ handleClick, variant = 'register' }: AllSetProps) => {
const wallet = useWallet();
const usewallet = useWallet();

const loadScript = useCallback(async () => {
if (variant === 'register') {
await wallet.getCadenceScripts();
await usewallet.getCadenceScripts();
}
}, [wallet, variant]);

const trackAccountRecovered = useCallback(async () => {
if (variant === 'register') {
mixpanelBrowserService.track('account_recovered', {
address: (await wallet.getMainAddress()) || '',
mechanism: 'multi-backup',
methods: [],
});
}
}, [wallet, variant]);
}, [usewallet, variant]);

useEffect(() => {
const removeTempPass = () => {
Expand All @@ -39,12 +29,12 @@ const AllSet = ({ handleClick, variant = 'register' }: AllSetProps) => {

if (variant === 'register') {
loadScript().then(() => {
trackAccountRecovered();
usewallet.trackAccountRecovered();
});
} else if (variant === 'add') {
removeTempPass();
}
}, [variant, loadScript, trackAccountRecovered]);
}, [variant, loadScript, usewallet]);

const getMessage = () => {
if (variant === 'recover') {
Expand Down
4 changes: 1 addition & 3 deletions src/ui/views/LandingPages/Welcome/Register/SetPassword.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from '@/ui/FRWComponent/LandingPages/SetPassword';
import SlideRelative from '@/ui/FRWComponent/SlideRelative';
import { type AccountKey } from 'background/service/networkModel';
import { useWallet, saveIndex, mixpanelBrowserService } from 'ui/utils';
import { useWallet, saveIndex } from 'ui/utils';

import CheckCircleIcon from '../../../../../components/iconfont/IconCheckmark';
import CancelIcon from '../../../../../components/iconfont/IconClose';
Expand Down Expand Up @@ -126,8 +126,6 @@ const SetPassword = ({ handleClick, mnemonic, username, setExPassword, tempPassw

await saveIndex(username);
const accountKey = getAccountKey(mnemonic);
// track the time until account_created is called
mixpanelBrowserService.time('account_created');
wallet.openapi
.register(accountKey, username)
.then((response) => {
Expand Down
3 changes: 2 additions & 1 deletion src/ui/views/LandingPages/Welcome/Sync/SyncQr.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,8 @@ const SyncQr = ({
};

createWeb3Wallet();
}, [_subscribeToEvents, currentNetwork, onSessionConnected, sendRequest]);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

return (
<>
Expand Down

0 comments on commit ddfa4d2

Please sign in to comment.