Skip to content

Commit c9b86e7

Browse files
committed
SD-98: UI Improvements
1 parent 9169485 commit c9b86e7

File tree

11 files changed

+63
-34
lines changed

11 files changed

+63
-34
lines changed

src/domains/chains/components/ChainIcon.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
import styled, { css } from 'styled-components';
22

3+
import supportedChains from 'src/domains/chains/utils/supportedChains';
34
import useChain from 'src/domains/chains/utils/useChain';
45
import vars from 'src/domains/styling/utils/vars';
56

67
type Props = {
78
chainId: number | string,
89
size?: number,
910
className?: string,
10-
isTestnet?: boolean,
1111
};
12-
const ChainIcon = ({ chainId, size = 16, className, isTestnet }: Props) => {
12+
const { testnet } = supportedChains;
13+
14+
const ChainIcon = ({ chainId, size = 16, className }: Props) => {
1315
const { ChainIcon } = useChain(chainId) ?? {};
16+
const isTestnet = testnet.some(c => c.id === chainId);
1417

1518
return (
1619
<Container
17-
$isTestnet={!!isTestnet}
20+
$isTestnet={isTestnet}
1821
style={{ height: size, width: size, borderRadius: size * 0.25 }}
1922
className={className}
2023
>

src/domains/chains/components/ChainSelector.tsx

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,18 @@ const ChainSelector = () => {
2121
const chainConfig = useChain();
2222
const isLargeScreen = useMediaQuery(`(min-width: ${BREAKPOINTS.sm})`);
2323
const { switchNetwork } = useAppKitNetwork();
24-
const isSelectedChainTestnet = testnet.some(c => c.id === chainConfig?.id);
2524

26-
const renderOption = (chain: Definition) => {
27-
const isTestnet = testnet.some(c => c.id === chain.id);
28-
29-
return {
30-
onClick: () => void switchNetwork(chain),
31-
text:
25+
const renderOption = (chain: Definition) => ({
26+
onClick: () => void switchNetwork(chain),
27+
text:
3228
(
3329
<Option>
34-
<ChainIcon size={20} chainId={chain.id} isTestnet={isTestnet} />
30+
<ChainIcon size={20} chainId={chain.id} />
3531
<p>{chain.name}</p>
3632
{chainConfig?.id === chain.id && <CIcon size={20} icon="CheckmarkRegular" />}
3733
</Option>
3834
),
39-
};
40-
};
35+
});
4136

4237
return (
4338
<StyledSelectBox
@@ -50,24 +45,21 @@ const ChainSelector = () => {
5045
<StyledButton variant="secondary">
5146
{chainConfig ? (
5247
<ButtonLeftContent>
53-
<ChainIcon chainId={chainConfig.id} size={24} isTestnet={isSelectedChainTestnet} />
48+
<ChainIcon chainId={chainConfig.id} size={24} />
5449
{isLargeScreen && chainConfig.name}
5550
</ButtonLeftContent>
5651
) : (
5752
'Select Network'
5853
)}
59-
<ChevronIcon icon="ChevronLeft" />
54+
<CIcon icon="Chevron" color={vars('--color-neutral-foreground-3-rest')} />
55+
<UnderLine />
6056
</StyledButton>
6157
</StyledSelectBox>
6258
);
6359
};
6460

6561
export default ChainSelector;
6662

67-
const ChevronIcon = styled(CIcon)`
68-
transform: rotate(180deg);
69-
`;
70-
7163
const ButtonLeftContent = styled.div`
7264
display: flex;
7365
align-items: center;
@@ -81,6 +73,8 @@ const StyledSelectBox = styled(SelectBox)`
8173
const StyledButton = styled(Button)`
8274
display: flex;
8375
76+
position: relative;
77+
8478
align-items: center;
8579
justify-content: space-between;
8680
gap: ${vars('--spacing-s')};
@@ -90,6 +84,7 @@ const StyledButton = styled(Button)`
9084
9185
background: ${vars('--color-neutral-background-1-rest')};
9286
border-color: ${vars('--color-neutral-stroke-2-rest')};
87+
overflow: hidden;
9388
9489
${typography.web.body1};
9590
@@ -110,3 +105,14 @@ const Option = styled.div`
110105
margin-left: auto;
111106
}
112107
`;
108+
109+
const UnderLine = styled.div`
110+
position: absolute;
111+
left: 0;
112+
bottom: 0;
113+
114+
height: 1px;
115+
width: 100%;
116+
117+
background: ${vars('--color-neutral-stroke-2-rest')};
118+
`;

src/domains/misc/components/CIcon/icons.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import ChatHelp from './icons/chatHelp.svg?react';
2323
import CheckmarkCircle from './icons/checkmarkCircle.svg?react';
2424
import CheckmarkRegular from './icons/checkmarkRegular.svg?react';
2525
import CheckmarkStarburst from './icons/checkmarkStarburst.svg?react';
26+
import Chevron from './icons/chevron.svg?react';
2627
import ChevronDoubleDownRegular from './icons/chevronDoubleDownRegular.svg?react';
2728
import ChevronLeft from './icons/chevronLeft.svg?react';
2829
import ClipboardPaste from './icons/clipboardPaste.svg?react';
@@ -94,6 +95,7 @@ export const icons = {
9495
CheckmarkCircle,
9596
CheckmarkRegular,
9697
CheckmarkStarburst,
98+
Chevron,
9799
ChevronDoubleDownRegular,
98100
ChevronLeft,
99101
ClipboardPaste,
Lines changed: 4 additions & 0 deletions
Loading

src/domains/misc/components/Layout/Navigation.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const tabsConfig = [
77
{
88
key: 'shield',
99
label: 'Shielded Account',
10-
routeNames: ['Shielded-Account'],
10+
routeNames: ['Shielded-Account', 'Shielded-Account-With-Chain'],
1111
onClick: () => void router.push('Shielded-Account'),
1212
},
1313
{
@@ -25,7 +25,7 @@ type Props = {
2525
};
2626

2727
const Navigation = (props: Props) => {
28-
const route = router.useRoute(['Shielded-Account']);
28+
const route = router.useRoute(['Shielded-Account', 'Shielded-Account-With-Chain']);
2929

3030
const selectedTab = tabsConfig.find(tabConfig => tabConfig.routeNames.includes(route?.name as never));
3131

src/domains/misc/components/Layout/TopBar/NavBox.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ export const UserCanvas = styled(Canvas)`
108108
padding-inline: ${vars('--spacing-s')};
109109
border: 1px solid transparent;
110110
transition: all ${transitionTime};
111+
height: 100%;
111112
112113
@media (width <= ${BREAKPOINTS.lg}) { /* stylelint-disable-line media-query-no-invalid */
113114
border-bottom-left-radius: ${vars('--spacing-l')};

src/domains/misc/components/Layout/TopBar/TopBar.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,17 @@ const TopBar = () => {
3535
{isConnected ? (
3636
<AccountManager>
3737
<ChainSelector />
38+
<Divider />
3839
<AccountDetails>
3940
<AccountIcon />
4041
{address && formatAddress(address)}
41-
<Button
42+
<PowerButton
4243
variant="transparent"
4344
leftIcon="Power"
4445
size="small"
4546
onClick={() => void disconnect()}
4647
>
47-
</Button>
48+
</PowerButton>
4849
</AccountDetails>
4950
</AccountManager>
5051
) : (
@@ -93,3 +94,13 @@ const AccountManager = styled.div`
9394
const AccountIcon = styled(UserIcon)`
9495
margin-right: ${vars('--spacing-s')};
9596
`;
97+
98+
const Divider = styled.div`
99+
width: 1px;
100+
background: ${vars('--color-neutral-stroke-2-rest')};
101+
height: 54px;
102+
`;
103+
104+
const PowerButton = styled(Button)`
105+
color: ${vars('--color-neutral-foreground-2-rest')};
106+
`;

src/domains/shielder/components/AccountTypeSelector/AccountTypeSelector.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@ const BalanceName = styled.div`
100100
background: inherit;
101101
`;
102102

103-
const AdditionalInfo = styled.p`
103+
const AdditionalInfo = styled.div`
104104
display: flex;
105105
align-items: center;
106-
padding-right: ${vars('--spacing-l')};
106+
padding-right: ${vars('--spacing-xs')};
107107
`;
108108

109109
const Checked = styled(CheckmarkChecked)`

src/domains/shielder/components/Activity/Activity.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const Activity = () => {
3434
const timestamp = tx.submitTimestamp ?? tx.completedTimestamp;
3535
if (!timestamp) return acc;
3636

37-
const dateString = dayjs(Number(timestamp)).format('MMM D');
37+
const dateString = dayjs(Number(timestamp)).format('MMM, DD');
3838

3939
const existingTransactions = acc[dateString] ?? [];
4040

src/domains/shielder/components/Shielder.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,12 @@ useState<keyof typeof TABS>('tokens');
9898
) : (
9999
<>
100100
{selectedAccountType === 'public' && (
101-
<InfoBox>
102-
<CIcon icon="Info" size={20} />
103-
<p>Tokens that can be moved to shielded account:</p>
104-
</InfoBox>
101+
<WithPadding>
102+
<InfoBox>
103+
<CIcon icon="Info" size={20} />
104+
<p>Tokens that can be moved to shielded account:</p>
105+
</InfoBox>
106+
</WithPadding>
105107
)}
106108
<TokensWrapper>
107109
<TokenList tokens={tokens} />
@@ -167,7 +169,7 @@ const InfoBox = styled.div`
167169
display: flex;
168170
align-items: center;
169171
gap: ${vars('--spacing-s')};
170-
padding-left: ${vars('--spacing-s')};
172+
padding-left: ${vars('--spacing-xs')};
171173
color: ${vars('--color-neutral-foreground-3-rest')};
172174
${typography.web.body1Strong};
173175
`;

0 commit comments

Comments
 (0)