Skip to content

Commit f29952b

Browse files
committed
refactor: dashboard modals; some other fixes after review;
1 parent 1f20f59 commit f29952b

File tree

22 files changed

+686
-146
lines changed

22 files changed

+686
-146
lines changed

packages/apps/staking/src/assets/styles/color-palette.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const colorPalette = {
2929
light: '#FFD54F',
3030
},
3131
error: {
32-
main: '#FFB300',
32+
main: '#fa2a75',
3333
light: '#F20D5F',
3434
},
3535
fog: {

packages/apps/staking/src/components/Amount/index.tsx

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { FC } from 'react';
2-
import { Box, Typography } from '@mui/material';
2+
import { Typography } from '@mui/material';
3+
4+
import { formatHmtAmount } from '../../utils/string';
35

46
type Props = {
57
amount: string | number;
@@ -21,18 +23,13 @@ const Amount: FC<Props> = ({ amount, isConnected, size = 'sm' }) => {
2123
}
2224

2325
return (
24-
<Box display="flex" gap={1.5} alignItems="baseline">
25-
<Typography
26-
variant="h3"
27-
fontWeight={size === 'sm' ? 400 : 600}
28-
fontSize={size === 'sm' ? 24 : 48}
29-
>
30-
{amount}
31-
</Typography>
32-
<Typography component="span" fontSize={size === 'sm' ? 20 : 34}>
33-
HMT
34-
</Typography>
35-
</Box>
26+
<Typography
27+
variant="h3"
28+
fontWeight={size === 'sm' ? 400 : 600}
29+
fontSize={size === 'sm' ? 24 : 48}
30+
>
31+
{formatHmtAmount(amount)}
32+
</Typography>
3633
);
3734
};
3835

packages/apps/staking/src/components/BalanceCard/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const BalanceCard: FC = () => {
2525
</CustomTooltip>
2626
<Box display="flex" flexDirection="column" alignItems="flex-start">
2727
<Typography variant="body1" color="primary">
28-
Wallet Balance
28+
Wallet Balance <strong>HMT</strong>
2929
</Typography>
3030
<Amount size="lg" amount={tokenBalance} isConnected={isConnected} />
3131
</Box>

packages/apps/staking/src/components/Header/index.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const DefaultHeader: FC = () => {
5252
display: 'flex',
5353
justifyContent: 'space-between',
5454
width: '100%',
55-
height: 82,
55+
height: { xs: 64, md: 82 },
5656
}}
5757
>
5858
<Link to="/" style={{ display: 'flex', alignItems: 'center' }}>
@@ -76,19 +76,20 @@ const DefaultHeader: FC = () => {
7676
alignItems="center"
7777
gap={2}
7878
>
79-
<NavLink href={import.meta.env.VITE_HEADER_LINK_DASHBOARD}>
80-
Staking Overview
81-
</NavLink>
79+
<NavLink href="/">Staking Overview</NavLink>
8280
<NavLink href="/kvstore">KV Store</NavLink>
83-
<NavLink href={import.meta.env.VITE_HEADER_LINK_DASHBOARD}>
81+
<NavLink href="https://dashboard.humanprotocol.org" target="_blank">
8482
Dashboard
8583
</NavLink>
86-
<NavLink href="https://humanprotocol.org">HUMAN Website</NavLink>
84+
<NavLink href="https://humanprotocol.org" target="_blank">
85+
HUMAN Website
86+
</NavLink>
8787
<Button
8888
size="medium"
8989
variant="outlined"
90+
disabled={!isConnected}
9091
sx={{ height: '100%' }}
91-
onClick={() => setStakeModalOpen(true)}
92+
onClick={() => isConnected && setStakeModalOpen(true)}
9293
>
9394
Stake HMT
9495
</Button>
@@ -135,6 +136,7 @@ const DefaultHeader: FC = () => {
135136
<CloseIcon />
136137
</IconButton>
137138
{isConnected && <Account />}
139+
{!isConnected && <ConnectWallet />}
138140
<MuiLink
139141
href={import.meta.env.VITE_HEADER_LINK_DASHBOARD}
140142
underline="none"

packages/apps/staking/src/components/LockedAmountCard/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const LockedAmountCard: FC = () => {
2727
</CustomTooltip>
2828
<Box display="flex" flexDirection="column">
2929
<Typography variant="body1" color="primary" mb={1}>
30-
Locked Amount
30+
Locked Amount <strong>HMT</strong>
3131
</Typography>
3232
<Amount size="sm" amount={lockedAmount} isConnected={isConnected} />
3333
</Box>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { FC } from 'react';
2+
import { Box, Typography } from '@mui/material';
3+
4+
import { colorPalette } from '../../assets/styles/color-palette';
5+
import { CloseIcon } from '../../icons';
6+
7+
const ModalError: FC = () => {
8+
return (
9+
<>
10+
<Box
11+
display="flex"
12+
justifyContent="center"
13+
alignItems="center"
14+
mb={2}
15+
p="3px"
16+
color={colorPalette.whiteBackground}
17+
bgcolor={colorPalette.error.main}
18+
borderRadius={100}
19+
>
20+
<CloseIcon sx={{ width: 34, height: 34 }} />
21+
</Box>
22+
<Typography variant="subtitle2" color={colorPalette.error.main}>
23+
An error occurred, please try again.
24+
</Typography>
25+
</>
26+
);
27+
};
28+
29+
export default ModalError;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { FC } from 'react';
2+
import { CircularProgress } from '@mui/material';
3+
4+
const ModalLoading: FC = () => {
5+
return <CircularProgress size={40} color="primary" />;
6+
};
7+
8+
export default ModalLoading;
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { FC, PropsWithChildren } from 'react';
2+
import { Box } from '@mui/material';
3+
4+
import { SuccessIcon } from '../../icons';
5+
import { colorPalette } from '../../assets/styles/color-palette';
6+
7+
const ModalSuccess: FC<PropsWithChildren> = ({ children }) => {
8+
return (
9+
<>
10+
<Box
11+
display="flex"
12+
justifyContent="center"
13+
alignItems="center"
14+
mb={2}
15+
p="3px"
16+
color={colorPalette.whiteBackground}
17+
bgcolor={colorPalette.success.main}
18+
borderRadius={100}
19+
>
20+
<SuccessIcon sx={{ width: 34, height: 34 }} />
21+
</Box>
22+
{children}
23+
</>
24+
);
25+
};
26+
27+
export default ModalSuccess;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import ModalLoading from './Loading';
2+
import ModalSuccess from './Success';
3+
import ModalError from './Error';
4+
5+
export { ModalLoading, ModalSuccess, ModalError };

packages/apps/staking/src/components/NetworkStatus/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,10 @@ const NetworkStatus: React.FC = () => {
3333
}
3434
label={
3535
<Typography
36-
variant="h6"
36+
variant="h3"
3737
sx={{
3838
padding: 0,
3939
fontWeight: 400,
40-
fontSize: 28,
4140
lineHeight: 1.5,
4241
color: theme.palette.primary.main,
4342
marginLeft: 1,

0 commit comments

Comments
 (0)