Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
c9af7bc
feat(staking): maintenance 24 Nov 2023 (#754)
oldGreg5 Nov 27, 2023
d4415a2
[LW-9151] Edit account name component (#746)
Nov 27, 2023
8ab805f
feat(extension): [LW-5806] update Minting transaction display from da…
lgobbi-atix Nov 28, 2023
22cbd6f
test(extension): maintenance 27 nov (#757)
bslabiak Nov 28, 2023
5b71918
feat(staking): [LW-6437, LW-8877] past epochs rewards chart (#718)
mrcnk Nov 28, 2023
4020bc9
feat(extension): track manual re-sync and hd wallet discovery (#712)
refi93 Nov 28, 2023
8d37af2
feat(staking): [LW-8929, LW-8777] apply pool search also to selected …
xdzurman Nov 28, 2023
660082b
feat(staking,common): enable manageDelegation CTA from pool details (…
xdzurman Nov 28, 2023
b4d0f4d
feat(staking): load multi-delegation for HW wallets (#686)
xdzurman Nov 28, 2023
fd87199
test(extension): test maintenance 29 Nov - fix Dapp e2e (#760)
ljagiela Nov 29, 2023
7421e8f
feat(extension): [LW-9028] Add wallet concepts to menu (#742)
renanvalentin Nov 29, 2023
19ca42f
Merge remote-tracking branch 'origin/main' into chore/lw-9215-merge-m…
przemyslaw-wlodek Nov 30, 2023
e844729
refactor(extension,core,cardano): post-merge fixes
przemyslaw-wlodek Nov 29, 2023
fe41b54
chore(extension): fix unit tests + rename
przemyslaw-wlodek Nov 30, 2023
5566b3b
chore(extension): fix unit tests and mocks
przemyslaw-wlodek Nov 30, 2023
401b155
chore(extension): remove TODO comments
przemyslaw-wlodek Dec 1, 2023
d2af775
chore(core): review comments
przemyslaw-wlodek Dec 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion apps/browser-extension-wallet/.env.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ USE_DIFFERENT_MNEMONIC_LENGTHS=true
USE_NFT_FOLDERS=true
USE_MULTI_CURRENCY=true
USE_HIDE_MY_BALANCE=true
USE_MULTI_DELEGATION_STAKING=true
USE_MULTI_DELEGATION_STAKING_LEDGER=false
USE_MULTI_DELEGATION_STAKING_TREZOR=false
USE_ADA_HANDLE=true
USE_DATA_CHECK=false
USE_POSTHOG_ANALYTICS=true
Expand All @@ -27,6 +28,7 @@ USE_MULTI_DELEGATION_STAKING_ACTIVITY=false

USE_POSTHOG_ANALYTICS_FOR_OPTED_OUT=false
USE_MATOMO_ANALYTICS_FOR_OPTED_OUT=false
USE_MULTI_WALLET=false

# In App URLs
CATALYST_GOOGLE_PLAY_URL=https://play.google.com/store/apps/details?id=io.iohk.vitvoting
Expand Down
3 changes: 2 additions & 1 deletion apps/browser-extension-wallet/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ USE_DIFFERENT_MNEMONIC_LENGTHS=true
USE_NFT_FOLDERS=true
USE_MULTI_CURRENCY=true
USE_HIDE_MY_BALANCE=true
USE_MULTI_DELEGATION_STAKING=true
USE_MULTI_DELEGATION_STAKING_LEDGER=false
USE_MULTI_DELEGATION_STAKING_TREZOR=false
USE_ADA_HANDLE=true
USE_HANDLE_AB=false
USE_DATA_CHECK=false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,7 @@
transform: rotateX(180deg);
}
}

.profileDropdownTrigger {
flex-shrink: 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import { useWalletStore } from '@src/stores';
import { UserAvatar } from '../MainMenu/DropdownMenuOverlay/components';
import { useAnalyticsContext } from '@providers';
import { PostHogAction } from '@providers/AnalyticsProvider/analyticsTracker';
import { ProfileDropdown } from '@lace/ui';
import { useGetHandles } from '@hooks';
import { getAssetImageUrl } from '@src/utils/get-asset-image-url';

export interface DropdownMenuProps {
isPopup?: boolean;
Expand All @@ -20,6 +23,8 @@ export const DropdownMenu = ({ isPopup }: DropdownMenuProps): React.ReactElement
const analytics = useAnalyticsContext();
const { walletInfo } = useWalletStore();
const [open, setOpen] = useState(false);
const [handle] = useGetHandles();
const handleImage = handle?.profilePic;
const Chevron = isPopup ? ChevronSmall : ChevronNormal;

const sendAnalyticsEvent = (event: PostHogAction) => {
Expand All @@ -41,20 +46,39 @@ export const DropdownMenu = ({ isPopup }: DropdownMenuProps): React.ReactElement
placement="bottomRight"
trigger={['click']}
>
<Button
variant="outlined"
color="secondary"
className={cn(styles.avatarBtn, { [styles.open]: open })}
data-testid="header-menu-button"
>
<span className={cn(styles.content, { [styles.isPopup]: isPopup })}>
<UserAvatar walletName={walletInfo.name} isPopup={isPopup} />
<Chevron
className={cn(styles.chevron, { [styles.open]: open })}
data-testid={`chevron-${open ? 'up' : 'down'}`}
{process.env.USE_MULTI_WALLET === 'true' ? (
<div className={styles.profileDropdownTrigger}>
<ProfileDropdown.Trigger
title={walletInfo.name}
subtitle="Account #0"
profile={
handleImage
? {
fallback: walletInfo.name,
imageSrc: getAssetImageUrl(handleImage)
}
: undefined
}
type="cold"
id="menu"
/>
</span>
</Button>
</div>
) : (
<Button
variant="outlined"
color="secondary"
className={cn(styles.avatarBtn, { [styles.open]: open })}
data-testid="header-menu-button"
>
<span className={cn(styles.content, { [styles.isPopup]: isPopup })}>
<UserAvatar walletName={walletInfo.name} isPopup={isPopup} />
<Chevron
className={cn(styles.chevron, { [styles.open]: open })}
data-testid={`chevron-${open ? 'up' : 'down'}`}
/>
</span>
</Button>
)}
</Dropdown>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,21 @@
}
}

.multiWallet {
max-width: size_unit(6);
width: size_unit(6);
height: size_unit(6);
border-radius: size_unit(2);
flex-shrink: 0;

&:hover {
max-width: size_unit(6);
width: size_unit(6);
gap: 0px;
padding: 0;
}
}

.text {
color: var(--text-color-secondary);
white-space: nowrap;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,31 @@
import React from 'react';
/* eslint-disable react/no-multi-comp */
import React, { ReactNode } from 'react';
import ExpandIcon from '../../assets/icons/expand.component.svg';
import classnames from 'classnames';
import { Tooltip } from 'antd';

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

const RenderTooltipIfMultiWallet = ({ children, label }: { children: ReactNode; label: string }) => {
if (process.env.USE_MULTI_WALLET === 'true') {
return <Tooltip title={label}>{children}</Tooltip>;
}

return <>{children}</>;
};

export const ExpandButton = ({ label, onClick }: { label: string; onClick: () => void }): React.ReactElement => (
<a onClick={onClick} href="#" className={styles.button} data-testid="expand-button">
<ExpandIcon className={styles.icon} />
<span className={styles.text}>{label}</span>
</a>
<RenderTooltipIfMultiWallet label={label}>
<a
onClick={onClick}
href="#"
className={classnames(styles.button, {
[styles.multiWallet]: process.env.USE_MULTI_WALLET === 'true'
})}
data-testid="expand-button"
>
<ExpandIcon className={styles.icon} />
{process.env.USE_MULTI_WALLET !== 'true' && <span className={styles.text}>{label}</span>}
</a>
</RenderTooltipIfMultiWallet>
);
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
.userInfoWrapper {
display: flex;
flex-direction: column;
padding: 10px size_unit(2) size_unit(2.75);
gap: size_unit(2);

.userInfo {
Expand Down Expand Up @@ -50,6 +49,14 @@
}
}

.singleWalletWrapper {
padding: 10px size_unit(2) size_unit(2.75);
}

.multiWalletWrapper {
padding-bottom: size_unit(2.75);
}

.walletStatusInfo {
cursor: default;
display: flex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import {
ThemeSwitcher,
LockWallet,
UserInfo,
NetworkChoise
NetworkChoise,
AddNewWalletLink
} from './components';
import styles from './DropdownMenuOverlay.module.scss';
import { NetworkInfo } from './components/NetworkInfo';
Expand Down Expand Up @@ -42,6 +43,7 @@ export const DropdownMenuOverlay: VFC<Props> = ({
<>
{topSection}
<Links>
{process.env.USE_MULTI_WALLET === 'true' && <AddNewWalletLink />}
<AddressBookLink isPopup={isPopup} />
<SettingsLink />
<Separator />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from 'react';
import { walletRoutePaths } from '@routes';
import { Menu } from 'antd';
import { useTranslation } from 'react-i18next';
import { Link } from 'react-router-dom';
import styles from '../DropdownMenuOverlay.module.scss';

const handleOnClicked = (): void => void 0;

export const AddNewWalletLink = (): React.ReactElement => {
const { t } = useTranslation();

return (
<Link to={walletRoutePaths.newWallet.home} onClick={handleOnClicked}>
<Menu.Item data-testid="header-menu-new-wallet" className={styles.menuItem}>
<a>{t('browserView.sideMenu.links.addNewWallet')}</a>
</Menu.Item>
</Link>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { UserAvatar } from './UserAvatar';
import { useGetHandles } from '@hooks';
import { useAnalyticsContext } from '@providers';
import { PostHogAction } from '@providers/AnalyticsProvider/analyticsTracker';
import { ProfileDropdown } from '@lace/ui';
import { getAssetImageUrl } from '@src/utils/get-asset-image-url';

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

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

return (
<Menu.ItemGroup className={classnames(styles.menuItem, styles.borderBottom)} data-testid="header-menu-user-info">
<div className={styles.userInfoWrapper}>
<div
className={classnames(styles.userInfoWrapper, {
[styles.singleWalletWrapper]: process.env.USE_MULTI_WALLET !== 'true',
[styles.multiWalletWrapper]: process.env.USE_MULTI_WALLET === 'true'
})}
>
<CopyToClipboard text={handleName || walletAddress}>
<AntdTooltip
overlayInnerStyle={overlayInnerStyle}
placement="top"
title={
<span className={styles.tooltip}>
{handleName ? t('settings.copyHandle') : t('settings.copyAddress')}
</span>
}
>
<div className={styles.userInfo} onClick={handleOnAddressCopy}>
{avatarVisible && <UserAvatar walletName={walletName} />}
<div className={styles.userMeta} data-testid="header-menu-user-details">
<p className={styles.walletName} data-testid="header-menu-wallet-name">
{walletName}
</p>
<p className={styles.walletAddress} data-testid="header-menu-wallet-address">
{handleName || shortenedWalletAddress}
</p>
{process.env.USE_MULTI_WALLET === 'true' ? (
<ProfileDropdown.WalletOption
title={walletInfo.name}
subtitle="Account #0"
id={walletName}
profile={
handleImage
? {
fallback: walletInfo.name,
imageSrc: getAssetImageUrl(handleImage)
}
: undefined
}
type="cold"
/>
) : (
<AntdTooltip
overlayInnerStyle={overlayInnerStyle}
placement="top"
title={
<span className={styles.tooltip}>
{handleName ? t('settings.copyHandle') : t('settings.copyAddress')}
</span>
}
>
<div className={styles.userInfo} onClick={handleOnAddressCopy}>
{avatarVisible && <UserAvatar walletName={walletName} />}
<div className={styles.userMeta} data-testid="header-menu-user-details">
<p className={styles.walletName} data-testid="header-menu-wallet-name">
{walletName}
</p>
<p className={styles.walletAddress} data-testid="header-menu-wallet-address">
{handleName || shortenedWalletAddress}
</p>
</div>
</div>
</div>
</AntdTooltip>
</AntdTooltip>
)}
</CopyToClipboard>
<div className={styles.walletStatusInfo}>
<WalletStatusContainer />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ export * from './UserInfo';
export * from './UserAvatar';
export * from './NetworkChoise';
export * from './NetworkInfo';
export * from './AddNewWalletLink';
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,12 @@
}
}
}

.multiWallet {
flex-wrap: wrap;
}

.multiWalletNetworkPillBox {
width: 100%;
margin-bottom: 12px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import styles from './MainHeader.module.scss';
import LaceLogoMark from '../../assets/branding/lace-logo-mark.component.svg';
import { useTranslation } from 'react-i18next';
import { walletRoutePaths } from '@routes';
import classNames from 'classnames';

import { DropdownMenu } from '@components/DropdownMenu';
import { ExpandButton } from '@components/ExpandButton';
Expand All @@ -30,15 +31,24 @@ export const MainHeader = (): React.ReactElement => {

return (
<div className={styles.header} data-testid="header-container">
<div className={styles.content}>
<div
className={classNames(styles.content, {
[styles.multiWallet]: process.env.USE_MULTI_WALLET === 'true'
})}
>
{process.env.USE_MULTI_WALLET === 'true' && (
<div className={styles.multiWalletNetworkPillBox}>
<NetworkPill isPopup />
</div>
)}
<Link
className={styles.linkLogo}
to={walletRoutePaths.assets}
data-testid="header-logo"
onClick={() => analytics.sendEventToPostHog(PostHogAction.WalletLaceClick)}
>
<LaceLogoMark className={styles.logo} />
<NetworkPill />
{process.env.USE_MULTI_WALLET !== 'true' && <NetworkPill />}
</Link>
<div className={styles.controls}>
<ExpandButton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,10 @@
}
}
}

.multiWallet {
width: 100%;
text-align: center;
margin-left: 0px;
border-radius: size_unit(1);
}
Loading