Skip to content

Commit 62aec0d

Browse files
committed
pool+ui: add "preview" badge to Pool page title and nav menu
1 parent bfd1477 commit 62aec0d

File tree

4 files changed

+47
-19
lines changed

4 files changed

+47
-19
lines changed

app/src/components/base/shared.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,27 @@ export const Pill = styled.span`
2525
border-radius: 40px;
2626
`;
2727

28-
export const Badge = styled.span`
28+
export const Badge = styled.span<{ muted?: boolean }>`
2929
display: inline-block;
3030
margin-left: 10px;
3131
font-family: ${props => props.theme.fonts.open.light};
3232
font-size: ${props => props.theme.sizes.xxs};
33+
font-weight: 700;
3334
color: ${props => props.theme.colors.pink};
3435
border: 1px solid ${props => props.theme.colors.pink};
3536
border-radius: 4px;
3637
padding: 3px 5px 5px;
3738
text-transform: lowercase;
3839
line-height: 1;
3940
letter-spacing: 1.8px;
41+
42+
${props =>
43+
props.muted &&
44+
`
45+
color: ${props.theme.colors.gray};
46+
border: 1px solid ${props.theme.colors.gray};
47+
48+
`}
4049
`;
4150

4251
export const Section = styled.section`

app/src/components/layout/NavMenu.tsx

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import { observer } from 'mobx-react-lite';
33
import { usePrefixedTranslation } from 'hooks';
44
import { useStore } from 'store';
5-
import { HeaderFour } from 'components/base';
5+
import { Badge, HeaderFour } from 'components/base';
66
import { styled } from 'components/theme';
77

88
const Styled = {
@@ -18,7 +18,7 @@ const Styled = {
1818
font-size: ${props => props.theme.sizes.xs};
1919
margin-right: -17px;
2020
21-
span {
21+
> span {
2222
display: block;
2323
height: 50px;
2424
line-height: 50px;
@@ -34,7 +34,7 @@ const Styled = {
3434
}
3535
}
3636
37-
&.active span {
37+
&.active > span {
3838
border-left: 3px solid ${props => props.theme.colors.offWhite};
3939
background-color: ${props => props.theme.colors.blue};
4040
@@ -45,19 +45,28 @@ const Styled = {
4545
`,
4646
};
4747

48-
const NavItem: React.FC<{ page: string; onClick: () => void }> = observer(
49-
({ page, onClick }) => {
50-
const { l } = usePrefixedTranslation('cmps.layout.NavMenu');
51-
const { router } = useStore();
52-
const className = router.location.pathname === `/${page}` ? 'active' : '';
48+
const NavItem: React.FC<{
49+
page: string;
50+
preview?: boolean;
51+
onClick: () => void;
52+
}> = observer(({ page, preview, onClick }) => {
53+
const { l } = usePrefixedTranslation('cmps.layout.NavMenu');
54+
const { router } = useStore();
55+
const className = router.location.pathname === `/${page}` ? 'active' : '';
5356

54-
return (
55-
<Styled.NavItem className={className}>
56-
<span onClick={onClick}>{l(page)}</span>
57-
</Styled.NavItem>
58-
);
59-
},
60-
);
57+
return (
58+
<Styled.NavItem className={className}>
59+
<span onClick={onClick}>
60+
{l(page)}
61+
{preview && (
62+
<sup>
63+
<Badge muted>{l('common.preview')}</Badge>
64+
</sup>
65+
)}
66+
</span>
67+
</Styled.NavItem>
68+
);
69+
});
6170

6271
const NavMenu: React.FC = () => {
6372
const { l } = usePrefixedTranslation('cmps.layout.NavMenu');
@@ -70,7 +79,7 @@ const NavMenu: React.FC = () => {
7079
<Nav>
7180
<NavItem page="loop" onClick={appView.goToLoop} />
7281
<NavItem page="history" onClick={appView.goToHistory} />
73-
<NavItem page="pool" onClick={appView.goToPool} />
82+
<NavItem page="pool" preview onClick={appView.goToPool} />
7483
<NavItem page="settings" onClick={appView.goToSettings} />
7584
</Nav>
7685
</>

app/src/components/pool/PoolPage.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { useEffect } from 'react';
22
import { observer } from 'mobx-react-lite';
33
import { usePrefixedTranslation } from 'hooks';
44
import { useStore } from 'store';
5-
import { Column, Row } from 'components/base';
5+
import { Badge, Column, Row } from 'components/base';
66
import PageHeader from 'components/common/PageHeader';
77
import { styled } from 'components/theme';
88
import AccountSection from './AccountSection';
@@ -52,11 +52,20 @@ const PoolPage: React.FC = () => {
5252
};
5353
}, [accountStore, orderStore, batchStore]);
5454

55+
const title = (
56+
<>
57+
{l('pageTitle')}
58+
<sup>
59+
<Badge muted>{l('common.preview')}</Badge>
60+
</sup>
61+
</>
62+
);
63+
5564
const { Wrapper, Row, Col } = Styled;
5665
return (
5766
<Wrapper>
5867
<PageHeader
59-
title={l('pageTitle')}
68+
title={title}
6069
exportTip={l('exportTip')}
6170
onExportClick={orderStore.exportLeases}
6271
/>

app/src/i18n/locales/en-US.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"common.weeks_plural": "weeks",
1515
"common.months": "month",
1616
"common.months_plural": "months",
17+
"common.preview": "preview",
1718
"enums.BalanceMode.receive": "Receiving",
1819
"enums.BalanceMode.send": "Sending",
1920
"enums.BalanceMode.routing": "Routing",

0 commit comments

Comments
 (0)