Skip to content

Commit e723838

Browse files
chore: add logo to modals initiated by accounts menu (#1536)
* chore: add logo to modals initiated by accounts menu * chore: Add hover effect (#1538) --------- Co-authored-by: Amir Ekbatanifard <[email protected]>
1 parent dfe9156 commit e723838

File tree

7 files changed

+88
-75
lines changed

7 files changed

+88
-75
lines changed

packages/extension-polkagate/src/fullscreen/accountDetails/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@ import { BN } from '@polkadot/util';
1717
import { AccountContext, ActionContext, Warning } from '../../components';
1818
import { useAccountAssets, useBalances, useCurrency, useFullscreen, useInfo, usePrices, useTranslation } from '../../hooks';
1919
import { getValue } from '../../popup/account/util';
20-
import ExportAccountModal from '../../popup/export/ExportAccountModal';
21-
import ForgetAccountModal from '../../popup/forgetAccount/ForgetAccountModal';
2220
import HistoryModal from '../../popup/history/modal/HistoryModal';
2321
import { AccountLabel } from '../../popup/home/AccountLabel';
24-
import DeriveAccountModal from '../../popup/newAccount/deriveAccount/modal/DeriveAccountModal';
2522
import ReceiveModal from '../../popup/receive/ReceiveModal';
26-
import RenameModal from '../../popup/rename/RenameModal';
2723
import { ASSET_HUBS, GOVERNANCE_CHAINS, STAKING_CHAINS } from '../../util/constants';
2824
import getParentNameSuri from '../../util/getParentNameSuri';
2925
import { getPriceIdByChainName } from '../../util/utils';
3026
import { FullScreenHeader } from '../governance/FullScreenHeader';
3127
import Bread from '../partials/Bread';
28+
import DeriveAccountModal from '../partials/DeriveAccountModal';
29+
import ExportAccountModal from '../partials/ExportAccountModal';
30+
import ForgetAccountModal from '../partials/ForgetAccountModal';
31+
import RenameModal from '../partials/RenameAccountModal';
3232
import { Title } from '../sendFund/InputPage';
3333
import { openOrFocusTab } from './components/CommonTasks';
3434
import ReservedDisplayBalance from './components/ReservedDisplayBalance';
@@ -62,7 +62,7 @@ export default function AccountDetails (): React.ReactElement {
6262
const onAction = useContext(ActionContext);
6363
const accountAssets = useAccountAssets(address);
6464
const pricesInCurrency = usePrices();
65-
65+
6666
const [refreshNeeded, setRefreshNeeded] = useState<boolean>(false);
6767
const [assetIdOnAssetHub, setAssetIdOnAssetHub] = useState<number>();
6868
const [selectedAsset, setSelectedAsset] = useState<FetchedBalance>();

packages/extension-polkagate/src/fullscreen/homeFullScreen/partials/AccountInformationForHome.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ import { ActionContext, Identicon, Identity, OptionalCopyButton, ShortAddress2 }
2020
import { nFormatter } from '../../../components/FormatPrice';
2121
import { useCurrency, useIdentity, useInfo, usePrices, useTranslation } from '../../../hooks';
2222
import { showAccount, tieAccount } from '../../../messaging';
23-
import ExportAccountModal from '../../../popup/export/ExportAccountModal';
24-
import ForgetAccountModal from '../../../popup/forgetAccount/ForgetAccountModal';
25-
import DeriveAccountModal from '../../../popup/newAccount/deriveAccount/modal/DeriveAccountModal';
26-
import RenameModal from '../../../popup/rename/RenameModal';
2723
import { amountToHuman } from '../../../util/utils';
2824
import AccountIconsFs from '../../accountDetails/components/AccountIconsFs';
2925
import { EyeIconFullScreen } from '../../accountDetails/components/AccountInformationForDetails';
3026
import AOC from '../../accountDetails/components/AOC';
3127
import { openOrFocusTab } from '../../accountDetails/components/CommonTasks';
28+
import DeriveAccountModal from '../../partials/DeriveAccountModal';
29+
import ExportAccountModal from '../../partials/ExportAccountModal';
30+
import ForgetAccountModal from '../../partials/ForgetAccountModal';
31+
import RenameModal from '../../partials/RenameAccountModal';
3232
import FullScreenAccountMenu from './FullScreenAccountMenu';
3333

3434
interface AddressDetailsProps {
@@ -65,7 +65,7 @@ const AccountButton = ({ icon, onClick, text }: AccountButtonType) => {
6565
);
6666
};
6767

68-
const AccountTotal = ({ currencySign, hideNumbers, totalBalance }: {currencySign: string | undefined, hideNumbers: boolean|undefined, totalBalance: number | undefined}) => {
68+
const AccountTotal = ({ currencySign, hideNumbers, totalBalance }: { currencySign: string | undefined, hideNumbers: boolean | undefined, totalBalance: number | undefined }) => {
6969
const theme = useTheme();
7070
const { t } = useTranslation();
7171

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
// Copyright 2019-2024 @polkadot/extension-polkagate authors & contributors
22
// SPDX-License-Identifier: Apache-2.0
3-
// @ts-nocheck
43

54
/* eslint-disable react/jsx-max-props-per-line */
65

7-
import { Close as CloseIcon } from '@mui/icons-material';
8-
import { Grid, Typography, useTheme } from '@mui/material';
6+
import { Typography } from '@mui/material';
97
import React, { useCallback, useContext, useState } from 'react';
108

11-
import { ActionContext } from '../../../../components';
12-
import { useAccount, useTranslation } from '../../../../hooks';
13-
import { deriveAccount } from '../../../../messaging';
14-
import { DraggableModal } from '../../../../fullscreen/governance/components/DraggableModal';
15-
import CreateNewDerivedAccount from './CreateNewDerivedAccount';
16-
import SelectParent from './SelectParent';
9+
import { ActionContext } from '../../components';
10+
import { useAccount, useTranslation } from '../../hooks';
11+
import { deriveAccount } from '../../messaging';
12+
import CreateNewDerivedAccount from '../../popup/newAccount/deriveAccount/modal/CreateNewDerivedAccount';
13+
import SelectParent from '../../popup/newAccount/deriveAccount/modal/SelectParent';
14+
import { DraggableModal } from '../governance/components/DraggableModal';
15+
import SimpleModalTitle from './SimpleModalTitle';
1716

1817
interface Props {
1918
parentAddress?: string | undefined;
@@ -33,10 +32,9 @@ interface ConfirmState {
3332
parentPassword: string;
3433
}
3534

36-
function DeriveModal({ parentAddress, setDisplayPopup }: Props): React.ReactElement<Props> {
35+
function DeriveModal ({ parentAddress, setDisplayPopup }: Props): React.ReactElement<Props> {
3736
const { t } = useTranslation();
3837
const onAction = useContext(ActionContext);
39-
const theme = useTheme();
4038

4139
const [isBusy, setIsBusy] = useState(false);
4240
const [account, setAccount] = useState<null | PathState>(null);
@@ -96,16 +94,11 @@ function DeriveModal({ parentAddress, setDisplayPopup }: Props): React.ReactElem
9694
return (
9795
<DraggableModal onClose={onClose} open>
9896
<>
99-
<Grid alignItems='center' container justifyContent='space-between' pt='5px'>
100-
<Grid item>
101-
<Typography fontSize='22px' fontWeight={700}>
102-
{t<string>('Derive Account')}
103-
</Typography>
104-
</Grid>
105-
<Grid item>
106-
<CloseIcon onClick={onClose} sx={{ color: 'primary.main', cursor: 'pointer', stroke: theme.palette.primary.main, strokeWidth: 1.5 }} />
107-
</Grid>
108-
</Grid>
97+
<SimpleModalTitle
98+
onClose={onClose}
99+
title={t('Derive Account')}
100+
vaadinIcon='road-branch'
101+
/>
109102
<Typography fontSize='14px' fontWeight={300} m='25px auto' textAlign='left'>
110103
{t<string>('A derived account inherits the recovery phrase from its parent, but has a unique derivation path.')}
111104
</Typography>

packages/extension-polkagate/src/popup/export/ExportAccountModal.tsx renamed to packages/extension-polkagate/src/fullscreen/partials/ExportAccountModal.tsx

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33

44
/* eslint-disable react/jsx-max-props-per-line */
55

6-
import { Close as CloseIcon } from '@mui/icons-material';
7-
import { Grid, Typography, useTheme } from '@mui/material';
6+
import { Grid, useTheme } from '@mui/material';
87
import { saveAs } from 'file-saver';
98
import React, { useCallback, useState } from 'react';
109

1110
import { ButtonWithCancel, NewAddress, Password, Warning, WrongPasswordAlert } from '../../components';
12-
import { DraggableModal } from '../../fullscreen/governance/components/DraggableModal';
1311
import useTranslation from '../../hooks/useTranslation';
1412
import { exportAccount } from '../../messaging';
13+
import { DraggableModal } from '../governance/components/DraggableModal';
14+
import SimpleModalTitle from './SimpleModalTitle';
1515

1616
interface Props {
1717
address: string;
@@ -53,16 +53,11 @@ export default function ExportAccountModal ({ address, setDisplayPopup }: Props)
5353
return (
5454
<DraggableModal onClose={backToAccount} open>
5555
<>
56-
<Grid alignItems='center' container justifyContent='space-between' pt='5px'>
57-
<Grid item>
58-
<Typography fontSize='22px' fontWeight={700}>
59-
{t<string>('Export Account')}
60-
</Typography>
61-
</Grid>
62-
<Grid item>
63-
<CloseIcon onClick={backToAccount} sx={{ color: 'primary.main', cursor: 'pointer', stroke: theme.palette.primary.main, strokeWidth: 1.5 }} />
64-
</Grid>
65-
</Grid>
56+
<SimpleModalTitle
57+
onClose={backToAccount}
58+
title={t('Export Account')}
59+
vaadinIcon='download-alt'
60+
/>
6661
{isPasswordError &&
6762
<WrongPasswordAlert />
6863
}
@@ -82,7 +77,7 @@ export default function ExportAccountModal ({ address, setDisplayPopup }: Props)
8277
<Grid container item sx={{ '> div': { width: '87.5%' }, bottom: '75px', position: 'absolute' }}>
8378
<Password
8479
isError={isPasswordError}
85-
label={t<string>('Password for this account')}
80+
label={t('Password for this account')}
8681
onChange={onPassChange}
8782
onEnter={_onExportButtonClick}
8883
/>
@@ -93,7 +88,7 @@ export default function ExportAccountModal ({ address, setDisplayPopup }: Props)
9388
_onClick={_onExportButtonClick}
9489
_onClickCancel={backToAccount}
9590
disabled={pass.length === 0 || !!isPasswordError}
96-
text={t<string>('Export')}
91+
text={t('Export')}
9792
/>
9893
</Grid>
9994
</>

packages/extension-polkagate/src/popup/forgetAccount/ForgetAccountModal.tsx renamed to packages/extension-polkagate/src/fullscreen/partials/ForgetAccountModal.tsx

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55

66
import type { AccountJson } from '@polkadot/extension-base/background/types';
77

8-
import { Close as CloseIcon } from '@mui/icons-material';
9-
import { Grid, Typography, useTheme } from '@mui/material';
8+
import { Grid, useTheme } from '@mui/material';
109
import React, { useCallback, useContext, useEffect, useState } from 'react';
1110

1211
import { AccountsStore } from '@polkadot/extension-base/stores';
1312
import keyring from '@polkadot/ui-keyring';
1413
import { cryptoWaitReady } from '@polkadot/util-crypto';
1514

1615
import { ActionContext, ButtonWithCancel, Checkbox2 as Checkbox, NewAddress, Password, Warning, WrongPasswordAlert } from '../../components';
17-
import { DraggableModal } from '../../fullscreen/governance/components/DraggableModal';
1816
import { useAlerts, useTranslation } from '../../hooks';
1917
import { forgetAccount, getAuthList, removeAuthorization, updateAuthorization } from '../../messaging';
18+
import { DraggableModal } from '../governance/components/DraggableModal';
19+
import SimpleModalTitle from './SimpleModalTitle';
2020

2121
interface Props {
2222
account: AccountJson;
@@ -103,16 +103,11 @@ export default function ForgetAccountModal ({ account, setDisplayPopup }: Props)
103103
return (
104104
<DraggableModal onClose={backToAccount} open>
105105
<>
106-
<Grid alignItems='center' container justifyContent='space-between' pt='5px'>
107-
<Grid item>
108-
<Typography fontSize='22px' fontWeight={700}>
109-
{t('Forget Account')}
110-
</Typography>
111-
</Grid>
112-
<Grid item>
113-
<CloseIcon onClick={backToAccount} sx={{ color: 'primary.main', cursor: 'pointer', stroke: theme.palette.primary.main, strokeWidth: 1.5 }} />
114-
</Grid>
115-
</Grid>
106+
<SimpleModalTitle
107+
onClose={backToAccount}
108+
title={t('Forget Account')}
109+
vaadinIcon='file-remove'
110+
/>
116111
{isPasswordError &&
117112
<WrongPasswordAlert />
118113
}

packages/extension-polkagate/src/popup/rename/RenameModal.tsx renamed to packages/extension-polkagate/src/fullscreen/partials/RenameAccountModal.tsx

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,25 @@
11
// Copyright 2019-2024 @polkadot/extension-polkagate authors & contributors
22
// SPDX-License-Identifier: Apache-2.0
3-
// @ts-nocheck
43

54
/* eslint-disable react/jsx-max-props-per-line */
65

7-
import { Close as CloseIcon } from '@mui/icons-material';
8-
import { Grid, Typography, useTheme } from '@mui/material';
6+
import { Grid } from '@mui/material';
97
import React, { useCallback, useMemo, useState } from 'react';
108

119
import { ButtonWithCancel, NewAddress } from '../../components';
1210
import { useAccountName, useTranslation } from '../../hooks';
1311
import { editAccount } from '../../messaging';
1412
import { Name } from '../../partials';
15-
import { DraggableModal } from '../../fullscreen/governance/components/DraggableModal';
13+
import { DraggableModal } from '../governance/components/DraggableModal';
14+
import SimpleModalTitle from './SimpleModalTitle';
1615

1716
interface Props {
1817
address: string;
1918
setDisplayPopup: React.Dispatch<React.SetStateAction<number | undefined>>;
2019
}
2120

22-
export default function RenameModal({ address, setDisplayPopup }: Props): React.ReactElement {
21+
export default function RenameModal ({ address, setDisplayPopup }: Props): React.ReactElement {
2322
const { t } = useTranslation();
24-
const theme = useTheme();
2523
const accountName = useAccountName(address);
2624

2725
const [newName, setNewName] = useState<string | undefined>();
@@ -50,16 +48,11 @@ export default function RenameModal({ address, setDisplayPopup }: Props): React.
5048
return (
5149
<DraggableModal onClose={backToAccount} open>
5250
<>
53-
<Grid alignItems='center' container justifyContent='space-between' pt='5px'>
54-
<Grid item>
55-
<Typography fontSize='22px' fontWeight={700}>
56-
{t<string>('Rename Account')}
57-
</Typography>
58-
</Grid>
59-
<Grid item>
60-
<CloseIcon onClick={backToAccount} sx={{ color: 'primary.main', cursor: 'pointer', stroke: theme.palette.primary.main, strokeWidth: 1.5 }} />
61-
</Grid>
62-
</Grid>
51+
<SimpleModalTitle
52+
onClose={backToAccount}
53+
title={t('Rename Account')}
54+
vaadinIcon='edit'
55+
/>
6356
<NewAddress
6457
address={address}
6558
name={changedName}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright 2019-2024 @polkadot/extension-polkagate authors & contributors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
/* eslint-disable react/jsx-max-props-per-line */
5+
6+
import { Close as CloseIcon } from '@mui/icons-material';
7+
import { Divider, Grid, IconButton, Typography, useTheme } from '@mui/material';
8+
import React from 'react';
9+
10+
import { VaadinIcon } from '../../components';
11+
12+
interface Props {
13+
onClose: () => void;
14+
title: string;
15+
vaadinIcon: string;
16+
}
17+
18+
export default function SimpleModalTitle ({ onClose, title, vaadinIcon }: Props): React.ReactElement {
19+
const theme = useTheme();
20+
21+
return (
22+
<Grid alignItems='center' container justifyContent='space-between' pt='5px'>
23+
<Grid alignItems='center' container item justifyContent='flex-start' width='fit-content'>
24+
<VaadinIcon icon={`vaadin:${vaadinIcon}`} style={{ color: `${theme.palette.text.primary}`, height: '22px', marginRight: '10px' }} />
25+
<Typography display='contents' fontSize='22px' fontWeight={700}>
26+
{title}
27+
</Typography>
28+
</Grid>
29+
<Grid item>
30+
<IconButton onClick={onClose}>
31+
<CloseIcon sx={{ color: 'primary.main', cursor: 'pointer', stroke: theme.palette.primary.main, strokeWidth: 1.5 }} />
32+
</IconButton>
33+
</Grid>
34+
<Divider sx={{ mt: '5px', width: '100%' }} />
35+
</Grid>
36+
);
37+
}

0 commit comments

Comments
 (0)