Skip to content

Commit 1bc62f0

Browse files
przemyslaw-wlodekoldGreg5Lucaslgobbi-atixbslabiak
authored
Merge main into feat/sanchonet (#763)
* feat(staking): maintenance 24 Nov 2023 (#754) * feat(staking): maintenance 24 Nov 2023 * [LW-9151] Edit account name component (#746) * feat(ui): input component * feat(extension): edit account drawer * feat(extension): add unit test * feat: rename input component * feat(ui): use pseudo parameters * feat(ui): input width * feat(ui): input disabled style * feat(extension): add ui package * feat: update lock file * feat(ui): remove redundant styles * feat(extension): [LW-5806] update Minting transaction display from dapps (#608) * feat: identify minting txs from dapps and display proper UI to confirm refs: LW-5806 * feat(extension): update dapp transaction styling * refactor(extension,core): fix sonarcloud quality checks * ci(core): add @lace/ui to dependencies * test(extension): add mocks in ConfirmTransaction.test.tsx * test(extension): remove leftover from local testing * refactor(core): add missing newline at end of file --------- Co-authored-by: przemyslaw.wlodek <[email protected]> * test(extension): maintenance 27 nov (#757) * test(extension): maintenance nov 27 * test(extension): clear failed request test logs * test(extension): add real time console test logging, remove unnecessary logs * test(extension): update wdio version * test(extension): add node option env variable for e2e github runs * test(extension): move node options to e2e test sections * test(extension): increase max-old-space-size * test(extension): downgrade wdio to stable version, remove node env variable * feat(staking): [LW-6437, LW-8877] past epochs rewards chart (#718) --------- Co-authored-by: refi93 <[email protected]> Co-authored-by: przemyslaw.wlodek <[email protected]> Co-authored-by: januszjanus <[email protected]> * feat(extension): track manual re-sync and hd wallet discovery (#712) * feat(staking): [LW-8929, LW-8777] apply pool search also to selected pools (#706) --------- Co-authored-by: refi93 <[email protected]> * feat(staking,common): enable manageDelegation CTA from pool details (#720) Co-authored-by: przemyslaw.wlodek <[email protected]> * feat(staking): load multi-delegation for HW wallets (#686) --------- Signed-off-by: Kamil Džurman <[email protected]> Co-authored-by: Rafael Korbaš <[email protected]> Co-authored-by: januszjanus <[email protected]> Co-authored-by: przemyslaw.wlodek <[email protected]> * test(extension): test maintenance 29 Nov - fix Dapp e2e (#760) * feat(extension): [LW-9028] Add wallet concepts to menu (#742) * feat(extension): update dropdown menu with new wallet component * feat(extension): add add new wallet option to profile dropdown * refactor(ui): add test id * refactor(extension): add test id for multi wallet * refactor(extension): increase button width to match figma * refactor(extension): remove copy address tooltip from multi-wallet menu it em * refactor(extension): align top navigation buttons with side panel * refactor(extension): update the expand button styling * refactor(extension): update network pill and expand button styling * refactor(extension): update network pill border radius * refactor(extension): limit network pill change to popup only * fix(extension): fix moving left side bar * refactor(extension,core,cardano): post-merge fixes * chore(extension): fix unit tests + rename * chore(extension): fix unit tests and mocks * chore(extension): remove TODO comments * chore(core): review comments --------- Signed-off-by: Kamil Džurman <[email protected]> Co-authored-by: Janusz Janus <[email protected]> Co-authored-by: Lucas <[email protected]> Co-authored-by: Leonel Gobbi <[email protected]> Co-authored-by: bslabiak <[email protected]> Co-authored-by: Tomek Marciniak <[email protected]> Co-authored-by: refi93 <[email protected]> Co-authored-by: Kamil Džurman <[email protected]> Co-authored-by: Lukasz Jagiela <[email protected]> Co-authored-by: Renan Valentin <[email protected]>
1 parent 595aafe commit 1bc62f0

File tree

111 files changed

+2349
-706
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+2349
-706
lines changed

apps/browser-extension-wallet/.env.defaults

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ USE_DIFFERENT_MNEMONIC_LENGTHS=true
1818
USE_NFT_FOLDERS=true
1919
USE_MULTI_CURRENCY=true
2020
USE_HIDE_MY_BALANCE=true
21-
USE_MULTI_DELEGATION_STAKING=true
21+
USE_MULTI_DELEGATION_STAKING_LEDGER=false
22+
USE_MULTI_DELEGATION_STAKING_TREZOR=false
2223
USE_ADA_HANDLE=true
2324
USE_DATA_CHECK=false
2425
USE_POSTHOG_ANALYTICS=true
@@ -27,6 +28,7 @@ USE_MULTI_DELEGATION_STAKING_ACTIVITY=false
2728

2829
USE_POSTHOG_ANALYTICS_FOR_OPTED_OUT=false
2930
USE_MATOMO_ANALYTICS_FOR_OPTED_OUT=false
31+
USE_MULTI_WALLET=false
3032

3133
# In App URLs
3234
CATALYST_GOOGLE_PLAY_URL=https://play.google.com/store/apps/details?id=io.iohk.vitvoting

apps/browser-extension-wallet/.env.example

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ USE_DIFFERENT_MNEMONIC_LENGTHS=true
1818
USE_NFT_FOLDERS=true
1919
USE_MULTI_CURRENCY=true
2020
USE_HIDE_MY_BALANCE=true
21-
USE_MULTI_DELEGATION_STAKING=true
21+
USE_MULTI_DELEGATION_STAKING_LEDGER=false
22+
USE_MULTI_DELEGATION_STAKING_TREZOR=false
2223
USE_ADA_HANDLE=true
2324
USE_HANDLE_AB=false
2425
USE_DATA_CHECK=false

apps/browser-extension-wallet/src/components/DropdownMenu/DropdownMenu.module.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,7 @@
4545
transform: rotateX(180deg);
4646
}
4747
}
48+
49+
.profileDropdownTrigger {
50+
flex-shrink: 0;
51+
}

apps/browser-extension-wallet/src/components/DropdownMenu/DropdownMenu.tsx

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import { useWalletStore } from '@src/stores';
1111
import { UserAvatar } from '../MainMenu/DropdownMenuOverlay/components';
1212
import { useAnalyticsContext } from '@providers';
1313
import { PostHogAction } from '@providers/AnalyticsProvider/analyticsTracker';
14+
import { ProfileDropdown } from '@lace/ui';
15+
import { useGetHandles } from '@hooks';
16+
import { getAssetImageUrl } from '@src/utils/get-asset-image-url';
1417

1518
export interface DropdownMenuProps {
1619
isPopup?: boolean;
@@ -20,6 +23,8 @@ export const DropdownMenu = ({ isPopup }: DropdownMenuProps): React.ReactElement
2023
const analytics = useAnalyticsContext();
2124
const { walletInfo } = useWalletStore();
2225
const [open, setOpen] = useState(false);
26+
const [handle] = useGetHandles();
27+
const handleImage = handle?.profilePic;
2328
const Chevron = isPopup ? ChevronSmall : ChevronNormal;
2429

2530
const sendAnalyticsEvent = (event: PostHogAction) => {
@@ -41,20 +46,39 @@ export const DropdownMenu = ({ isPopup }: DropdownMenuProps): React.ReactElement
4146
placement="bottomRight"
4247
trigger={['click']}
4348
>
44-
<Button
45-
variant="outlined"
46-
color="secondary"
47-
className={cn(styles.avatarBtn, { [styles.open]: open })}
48-
data-testid="header-menu-button"
49-
>
50-
<span className={cn(styles.content, { [styles.isPopup]: isPopup })}>
51-
<UserAvatar walletName={walletInfo.name} isPopup={isPopup} />
52-
<Chevron
53-
className={cn(styles.chevron, { [styles.open]: open })}
54-
data-testid={`chevron-${open ? 'up' : 'down'}`}
49+
{process.env.USE_MULTI_WALLET === 'true' ? (
50+
<div className={styles.profileDropdownTrigger}>
51+
<ProfileDropdown.Trigger
52+
title={walletInfo.name}
53+
subtitle="Account #0"
54+
profile={
55+
handleImage
56+
? {
57+
fallback: walletInfo.name,
58+
imageSrc: getAssetImageUrl(handleImage)
59+
}
60+
: undefined
61+
}
62+
type="cold"
63+
id="menu"
5564
/>
56-
</span>
57-
</Button>
65+
</div>
66+
) : (
67+
<Button
68+
variant="outlined"
69+
color="secondary"
70+
className={cn(styles.avatarBtn, { [styles.open]: open })}
71+
data-testid="header-menu-button"
72+
>
73+
<span className={cn(styles.content, { [styles.isPopup]: isPopup })}>
74+
<UserAvatar walletName={walletInfo.name} isPopup={isPopup} />
75+
<Chevron
76+
className={cn(styles.chevron, { [styles.open]: open })}
77+
data-testid={`chevron-${open ? 'up' : 'down'}`}
78+
/>
79+
</span>
80+
</Button>
81+
)}
5882
</Dropdown>
5983
);
6084
};

apps/browser-extension-wallet/src/components/ExpandButton/ExpandButton.module.scss

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,21 @@
3636
}
3737
}
3838

39+
.multiWallet {
40+
max-width: size_unit(6);
41+
width: size_unit(6);
42+
height: size_unit(6);
43+
border-radius: size_unit(2);
44+
flex-shrink: 0;
45+
46+
&:hover {
47+
max-width: size_unit(6);
48+
width: size_unit(6);
49+
gap: 0px;
50+
padding: 0;
51+
}
52+
}
53+
3954
.text {
4055
color: var(--text-color-secondary);
4156
white-space: nowrap;
Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
1-
import React from 'react';
1+
/* eslint-disable react/no-multi-comp */
2+
import React, { ReactNode } from 'react';
23
import ExpandIcon from '../../assets/icons/expand.component.svg';
4+
import classnames from 'classnames';
5+
import { Tooltip } from 'antd';
36

47
import styles from './ExpandButton.module.scss';
58

9+
const RenderTooltipIfMultiWallet = ({ children, label }: { children: ReactNode; label: string }) => {
10+
if (process.env.USE_MULTI_WALLET === 'true') {
11+
return <Tooltip title={label}>{children}</Tooltip>;
12+
}
13+
14+
return <>{children}</>;
15+
};
16+
617
export const ExpandButton = ({ label, onClick }: { label: string; onClick: () => void }): React.ReactElement => (
7-
<a onClick={onClick} href="#" className={styles.button} data-testid="expand-button">
8-
<ExpandIcon className={styles.icon} />
9-
<span className={styles.text}>{label}</span>
10-
</a>
18+
<RenderTooltipIfMultiWallet label={label}>
19+
<a
20+
onClick={onClick}
21+
href="#"
22+
className={classnames(styles.button, {
23+
[styles.multiWallet]: process.env.USE_MULTI_WALLET === 'true'
24+
})}
25+
data-testid="expand-button"
26+
>
27+
<ExpandIcon className={styles.icon} />
28+
{process.env.USE_MULTI_WALLET !== 'true' && <span className={styles.text}>{label}</span>}
29+
</a>
30+
</RenderTooltipIfMultiWallet>
1131
);

apps/browser-extension-wallet/src/components/MainMenu/DropdownMenuOverlay/DropdownMenuOverlay.module.scss

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
.userInfoWrapper {
1818
display: flex;
1919
flex-direction: column;
20-
padding: 10px size_unit(2) size_unit(2.75);
2120
gap: size_unit(2);
2221

2322
.userInfo {
@@ -50,6 +49,14 @@
5049
}
5150
}
5251

52+
.singleWalletWrapper {
53+
padding: 10px size_unit(2) size_unit(2.75);
54+
}
55+
56+
.multiWalletWrapper {
57+
padding-bottom: size_unit(2.75);
58+
}
59+
5360
.walletStatusInfo {
5461
cursor: default;
5562
display: flex;

apps/browser-extension-wallet/src/components/MainMenu/DropdownMenuOverlay/DropdownMenuOverlay.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import {
88
ThemeSwitcher,
99
LockWallet,
1010
UserInfo,
11-
NetworkChoise
11+
NetworkChoise,
12+
AddNewWalletLink
1213
} from './components';
1314
import styles from './DropdownMenuOverlay.module.scss';
1415
import { NetworkInfo } from './components/NetworkInfo';
@@ -42,6 +43,7 @@ export const DropdownMenuOverlay: VFC<Props> = ({
4243
<>
4344
{topSection}
4445
<Links>
46+
{process.env.USE_MULTI_WALLET === 'true' && <AddNewWalletLink />}
4547
<AddressBookLink isPopup={isPopup} />
4648
<SettingsLink />
4749
<Separator />
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import React from 'react';
2+
import { walletRoutePaths } from '@routes';
3+
import { Menu } from 'antd';
4+
import { useTranslation } from 'react-i18next';
5+
import { Link } from 'react-router-dom';
6+
import styles from '../DropdownMenuOverlay.module.scss';
7+
8+
const handleOnClicked = (): void => void 0;
9+
10+
export const AddNewWalletLink = (): React.ReactElement => {
11+
const { t } = useTranslation();
12+
13+
return (
14+
<Link to={walletRoutePaths.newWallet.home} onClick={handleOnClicked}>
15+
<Menu.Item data-testid="header-menu-new-wallet" className={styles.menuItem}>
16+
<a>{t('browserView.sideMenu.links.addNewWallet')}</a>
17+
</Menu.Item>
18+
</Link>
19+
);
20+
};

apps/browser-extension-wallet/src/components/MainMenu/DropdownMenuOverlay/components/UserInfo.tsx

Lines changed: 46 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import { UserAvatar } from './UserAvatar';
1111
import { useGetHandles } from '@hooks';
1212
import { useAnalyticsContext } from '@providers';
1313
import { PostHogAction } from '@providers/AnalyticsProvider/analyticsTracker';
14+
import { ProfileDropdown } from '@lace/ui';
15+
import { getAssetImageUrl } from '@src/utils/get-asset-image-url';
1416

1517
const ADRESS_FIRST_PART_LENGTH = 10;
1618
const ADRESS_LAST_PART_LENGTH = 5;
@@ -36,6 +38,7 @@ export const UserInfo = ({ avatarVisible = true }: UserInfoProps): React.ReactEl
3638
const walletName = addEllipsis(walletInfo.name.toString(), WALLET_NAME_MAX_LENGTH, 0);
3739
const [handle] = useGetHandles();
3840
const handleName = handle?.nftMetadata?.name;
41+
const handleImage = handle?.profilePic;
3942

4043
const handleOnAddressCopy = () => {
4144
toast.notify({ duration: TOAST_DEFAULT_DURATION, text: t('general.clipboard.copiedToClipboard') });
@@ -44,29 +47,51 @@ export const UserInfo = ({ avatarVisible = true }: UserInfoProps): React.ReactEl
4447

4548
return (
4649
<Menu.ItemGroup className={classnames(styles.menuItem, styles.borderBottom)} data-testid="header-menu-user-info">
47-
<div className={styles.userInfoWrapper}>
50+
<div
51+
className={classnames(styles.userInfoWrapper, {
52+
[styles.singleWalletWrapper]: process.env.USE_MULTI_WALLET !== 'true',
53+
[styles.multiWalletWrapper]: process.env.USE_MULTI_WALLET === 'true'
54+
})}
55+
>
4856
<CopyToClipboard text={handleName || walletAddress}>
49-
<AntdTooltip
50-
overlayInnerStyle={overlayInnerStyle}
51-
placement="top"
52-
title={
53-
<span className={styles.tooltip}>
54-
{handleName ? t('settings.copyHandle') : t('settings.copyAddress')}
55-
</span>
56-
}
57-
>
58-
<div className={styles.userInfo} onClick={handleOnAddressCopy}>
59-
{avatarVisible && <UserAvatar walletName={walletName} />}
60-
<div className={styles.userMeta} data-testid="header-menu-user-details">
61-
<p className={styles.walletName} data-testid="header-menu-wallet-name">
62-
{walletName}
63-
</p>
64-
<p className={styles.walletAddress} data-testid="header-menu-wallet-address">
65-
{handleName || shortenedWalletAddress}
66-
</p>
57+
{process.env.USE_MULTI_WALLET === 'true' ? (
58+
<ProfileDropdown.WalletOption
59+
title={walletInfo.name}
60+
subtitle="Account #0"
61+
id={walletName}
62+
profile={
63+
handleImage
64+
? {
65+
fallback: walletInfo.name,
66+
imageSrc: getAssetImageUrl(handleImage)
67+
}
68+
: undefined
69+
}
70+
type="cold"
71+
/>
72+
) : (
73+
<AntdTooltip
74+
overlayInnerStyle={overlayInnerStyle}
75+
placement="top"
76+
title={
77+
<span className={styles.tooltip}>
78+
{handleName ? t('settings.copyHandle') : t('settings.copyAddress')}
79+
</span>
80+
}
81+
>
82+
<div className={styles.userInfo} onClick={handleOnAddressCopy}>
83+
{avatarVisible && <UserAvatar walletName={walletName} />}
84+
<div className={styles.userMeta} data-testid="header-menu-user-details">
85+
<p className={styles.walletName} data-testid="header-menu-wallet-name">
86+
{walletName}
87+
</p>
88+
<p className={styles.walletAddress} data-testid="header-menu-wallet-address">
89+
{handleName || shortenedWalletAddress}
90+
</p>
91+
</div>
6792
</div>
68-
</div>
69-
</AntdTooltip>
93+
</AntdTooltip>
94+
)}
7095
</CopyToClipboard>
7196
<div className={styles.walletStatusInfo}>
7297
<WalletStatusContainer />

0 commit comments

Comments
 (0)