• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

input-output-hk / lace / 8540545310

03 Apr 2024 01:54PM UTC coverage: 50.62% (-3.2%) from 53.839%
8540545310

push

github

985486
web-flow
fix: send alias during wallet creation (#1017)

* fix: send alias during wallet creation

* fix: properly position remove wallet event

* test(extension): unblock e2e tests

---------

Co-authored-by: januszjanus <janusz.janus@iohk.io>

2161 of 5325 branches covered (40.58%)

Branch coverage included in aggregate %.

5149 of 9116 relevant lines covered (56.48%)

52.15 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

26.09
/apps/browser-extension-wallet/src/components/MainMenu/DropdownMenuOverlay/DropdownMenuOverlay.tsx
1
import React, { ReactNode, useCallback, useState, VFC } from 'react';
70✔
2
import { Menu, MenuProps } from 'antd';
70✔
3
import {
70✔
4
  AddNewWalletLink,
5
  AddressBookLink,
6
  Links,
7
  LockWallet,
8
  NetworkChoise,
9
  Separator,
10
  SettingsLink,
11
  ThemeSwitcher,
12
  UserInfo
13
} from './components';
14
import styles from './DropdownMenuOverlay.module.scss';
70✔
15
import { NetworkInfo } from './components/NetworkInfo';
70✔
16
import { Sections } from './types';
70✔
17
import { PostHogAction } from '@providers/AnalyticsProvider/analyticsTracker';
70✔
18
import { WalletAccounts } from './components/WalletAccounts';
70✔
19
import { AddSharedWalletLink } from '@components/MainMenu/DropdownMenuOverlay/components/AddSharedWalletLink';
70✔
20
import { useWalletStore } from '@stores';
70✔
21
import classNames from 'classnames';
70✔
22
import { AnyBip32Wallet } from '@cardano-sdk/web-extension';
23
import { Wallet } from '@lace/cardano';
24

25
interface Props extends MenuProps {
26
  isPopup?: boolean;
27
  lockWalletButton?: ReactNode;
28
  topSection?: ReactNode;
29
  sendAnalyticsEvent?: (event: PostHogAction) => void;
30
}
31

32
export const DropdownMenuOverlay: VFC<Props> = ({
70✔
33
  isPopup,
34
  lockWalletButton = <LockWallet />,
×
35
  topSection,
36
  sendAnalyticsEvent,
×
37
  ...props
×
38
}): React.ReactElement => {
39
  const [currentSection, setCurrentSection] = useState<Sections>(Sections.Main);
×
40
  const { environmentName, setManageAccountsWallet } = useWalletStore();
×
41

42
  const openWalletAccounts = (wallet: AnyBip32Wallet<Wallet.WalletMetadata, Wallet.AccountMetadata>) => {
×
43
    setManageAccountsWallet(wallet);
×
44
    setCurrentSection(Sections.WalletAccounts);
×
45
  };
46

47
  const handleNetworkChoise = () => {
×
48
    setCurrentSection(Sections.NetworkInfo);
×
49
    sendAnalyticsEvent(PostHogAction.UserWalletProfileNetworkClick);
×
50
  };
51

52
  const goBackToMainSection = useCallback(() => setCurrentSection(Sections.Main), []);
×
53

54
  topSection = topSection ?? <UserInfo onOpenWalletAccounts={openWalletAccounts} />;
×
55

56
  return (
×
57
    <Menu {...props} className={styles.menuOverlay} data-testid="header-menu">
58
      {currentSection === Sections.Main && (
×
59
        <div
60
          className={classNames(
61
            isPopup ? styles.popUpContainer : styles.extendedContainer,
×
62
            environmentName === 'Mainnet' ? styles.popUpContainerHigher : styles.popUpContainerLower
×
63
          )}
64
        >
65
          {topSection}
66
          <Links>
67
            {process.env.USE_MULTI_WALLET === 'true' && (
×
68
              <AddNewWalletLink isPopup={isPopup} sendAnalyticsEvent={sendAnalyticsEvent} />
69
            )}
70
            {process.env.USE_SHARED_WALLET === 'true' && <AddSharedWalletLink isPopup={isPopup} />}
×
71
            <AddressBookLink />
72
            <SettingsLink />
73
            <Separator />
74
            <ThemeSwitcher isPopup={isPopup} />
75
            <NetworkChoise onClick={handleNetworkChoise} />
76
            {lockWalletButton && (
×
77
              <>
78
                <Separator /> {lockWalletButton}
79
              </>
80
            )}
81
          </Links>
82
        </div>
83
      )}
84
      {currentSection === Sections.NetworkInfo && <NetworkInfo onBack={goBackToMainSection} />}
×
85
      {currentSection === Sections.WalletAccounts && <WalletAccounts onBack={goBackToMainSection} isPopup={isPopup} />}
×
86
    </Menu>
87
  );
88
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc