Skip to content

Commit 2261b82

Browse files
fixes/redesign (#1193)
2 parents 86905b9 + ade4a2a commit 2261b82

File tree

33 files changed

+246
-224
lines changed

33 files changed

+246
-224
lines changed

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"typescriptreact"
2727
],
2828
"editor.codeActionsOnSave": {
29-
"source.fixAll.eslint": true
29+
"source.fixAll.eslint": "explicit"
3030
},
3131
"css.validate": false,
3232
"less.validate": false,

src/components/HydrogenBalance/HydrogenBalance.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import SideButtonLink from '../sideButtonLink/SideButtonLink';
33
import { routes } from 'src/routes';
44
import IconsNumber from '../IconsNumber/IconsNumber';
55

6-
function HydrogenBalance({ address }) {
6+
function HydrogenBalance({ address, isVertical }) {
77
const { totalAmountInLiquid } = useGetBalanceBostrom(address);
88

99
return (
@@ -14,7 +14,7 @@ function HydrogenBalance({ address }) {
1414
<IconsNumber
1515
value={totalAmountInLiquid.currentCap}
1616
type="hydrogen"
17-
isVertical
17+
isVertical={isVertical}
1818
/>
1919
</SideButtonLink>
2020
);

src/components/IconsNumber/IconsNumber.module.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
.wrapper {
2+
display: flex;
3+
align-items: center;
4+
white-space: nowrap;
5+
}
6+
17
.icon {
28
display: flex;
39
flex-direction: row;

src/components/IconsNumber/IconsNumber.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export default function IconsNumber({ value, type, isVertical }: Props) {
6363
});
6464

6565
return (
66-
<>
66+
<span className={styles.wrapper}>
6767
{number}{' '}
6868
<Tooltip
6969
tooltip={
@@ -77,6 +77,6 @@ export default function IconsNumber({ value, type, isVertical }: Props) {
7777
{i}
7878
</div>
7979
</Tooltip>
80-
</>
80+
</span>
8181
);
8282
}

src/components/actionBar/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import { CHAIN_ID } from 'src/constants/config';
1313
import ButtonIcon from '../buttons/ButtonIcon';
1414
import styles from './styles.module.scss';
1515
import Button from '../btnGrd';
16-
import { createPortal } from 'react-dom';
1716

1817
const back = require('../../image/arrow-left-img.svg');
1918

src/components/index.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
11
import {
2-
JsonTransaction,
32
TransactionSubmitted,
43
Confirmed,
5-
ConnectLadger,
6-
Cyberlink,
74
StartStageSearchActionBar,
85
Delegate,
96
ActionBarSend,
10-
GovernanceStartStageActionBar,
11-
CommunityPool,
12-
TextProposal,
137
RewardsDelegators,
148
ReDelegate,
159
TransactionError,
1610
ActionBarContentText,
17-
CheckAddressInfo,
18-
GovernanceChangeParam,
19-
GovernanceSoftwareUpgrade,
2011
ConnectAddress,
2112
} from './ledger/stageActionBar';
2213
import Account from './account/account';

src/components/ledger/stageActionBar.jsx

Lines changed: 41 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import LocalizedStrings from 'react-localization';
22
import { Link } from 'react-router-dom';
3-
import { ActionBar, Pane, Text } from '@cybercongress/gravity';
4-
3+
import { Pane, Text } from '@cybercongress/gravity';
54
import { BondStatus } from 'cosmjs-types/cosmos/staking/v1beta1/staking';
65
import { useBackend } from 'src/contexts/backend/backend';
76
import { CHAIN_ID, BASE_DENOM } from 'src/constants/config';
87
import { KEY_TYPE } from 'src/pages/Keys/types';
9-
108
import { ContainetLedger } from './container';
119
import { Dots } from '../ui/Dots';
1210
import Account from '../account/account';
@@ -17,7 +15,7 @@ import { i18n } from '../../i18n/en';
1715

1816
import Button from '../btnGrd';
1917
import { InputNumber, Input } from '../Input';
20-
import ActionBarContainer from '../actionBar';
18+
import ActionBar from '../actionBar';
2119
import ButtonIcon from '../buttons/ButtonIcon';
2220
import { Color } from '../LinearGradientContainer/LinearGradientContainer';
2321
import AddFileButton from '../buttons/AddFile/AddFile';
@@ -28,12 +26,6 @@ const imgSecrets = require('../../image/secrets_icon.png');
2826

2927
const T = new LocalizedStrings(i18n);
3028

31-
// const toPascalCase = (str) =>
32-
// str
33-
// .match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[a-zA-Z0-9]+/g)
34-
// .map((cht) => cht.charAt(0).toUpperCase() + cht.substr(1).toLowerCase())
35-
// .join('');
36-
3729
export function ActionBarContentText({ children, ...props }) {
3830
return (
3931
<Pane
@@ -50,54 +42,50 @@ export function ActionBarContentText({ children, ...props }) {
5042
);
5143
}
5244

45+
// const toPascalCase = (str) =>
46+
// str
47+
// .match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[a-zA-Z0-9]+/g)
48+
// .map((cht) => cht.charAt(0).toUpperCase() + cht.substr(1).toLowerCase())
49+
// .join('');
50+
5351
export function TransactionSubmitted() {
5452
return (
5553
<ActionBar>
56-
<ActionBarContentText>
57-
Please wait while we confirm the transaction on the blockchain{' '}
58-
<Dots big />
59-
</ActionBarContentText>
54+
Please wait while we confirm the transaction on the blockchain{' '}
55+
<Dots big />
6056
</ActionBar>
6157
);
6258
}
6359

6460
export function Confirmed({ txHash, txHeight, cosmos, onClickBtnClose }) {
6561
return (
66-
<ActionBar>
67-
<ActionBarContentText display="inline">
68-
<Pane display="inline">Transaction</Pane>{' '}
69-
{cosmos ? (
70-
<LinkWindow to={`https://www.mintscan.io/txs/${txHash}`}>
71-
{trimString(txHash, 6, 6)}
72-
</LinkWindow>
73-
) : (
74-
<Link to={`/network/bostrom/tx/${txHash}`}>
75-
{trimString(txHash, 6, 6)}
76-
</Link>
77-
)}{' '}
78-
{txHeight && (
79-
<Pane display="inline">
80-
was included in the block <br /> at height{' '}
81-
{formatNumber(parseFloat(txHeight))}
82-
</Pane>
83-
)}
84-
</ActionBarContentText>
85-
<Button style={{ margin: '0 10px' }} onClick={onClickBtnClose}>
86-
Fuck Google
87-
</Button>
62+
<ActionBar button={{ text: ' Fuck Google', onClick: onClickBtnClose }}>
63+
<Pane display="inline">Transaction</Pane>{' '}
64+
{cosmos ? (
65+
<LinkWindow to={`https://www.mintscan.io/txs/${txHash}`}>
66+
{trimString(txHash, 6, 6)}
67+
</LinkWindow>
68+
) : (
69+
<Link to={`/network/bostrom/tx/${txHash}`}>
70+
{trimString(txHash, 6, 6)}
71+
</Link>
72+
)}{' '}
73+
{txHeight && (
74+
<Pane display="inline">
75+
was included in the block <br /> at height{' '}
76+
{formatNumber(parseFloat(txHeight))}
77+
</Pane>
78+
)}
8879
</ActionBar>
8980
);
9081
}
9182

9283
export function TransactionError({ onClickBtn, errorMessage }) {
9384
return (
94-
<ActionBar>
95-
<ActionBarContentText display="block">
96-
Message Error: {errorMessage}
97-
</ActionBarContentText>
98-
<Button style={{ margin: '0 10px' }} onClick={onClickBtn}>
99-
{T.actionBar.confirmedTX.continue}
100-
</Button>
85+
<ActionBar
86+
button={{ text: T.actionBar.confirmedTX.continue, onClick: onClickBtn }}
87+
>
88+
Message Error: {errorMessage}
10189
</ActionBar>
10290
);
10391
}
@@ -118,7 +106,7 @@ export function StartStageSearchActionBar({
118106
const { isIpfsInitialized } = useBackend();
119107
return (
120108
// use NodeIsLoadingButton component
121-
<ActionBarContainer
109+
<ActionBar
122110
button={{
123111
disabled: !isIpfsInitialized || !contentHash.length,
124112
onClick: onClickBtn,
@@ -166,7 +154,7 @@ export function StartStageSearchActionBar({
166154
/>
167155
</Pane>
168156
</Pane>
169-
</ActionBarContainer>
157+
</ActionBar>
170158
);
171159
}
172160

@@ -226,7 +214,7 @@ export function Delegate({
226214
available,
227215
}) {
228216
return (
229-
<ActionBarContainer
217+
<ActionBar
230218
onClickBack={onClickBack}
231219
button={{
232220
text: T.actionBar.delegate.generate,
@@ -253,7 +241,7 @@ export function Delegate({
253241
<Text marginLeft={10} fontSize="16px" color="#fff">
254242
{BASE_DENOM.toUpperCase()}
255243
</Text>
256-
</ActionBarContainer>
244+
</ActionBar>
257245
);
258246
}
259247

@@ -270,7 +258,7 @@ export function ReDelegate({
270258
onClickBack,
271259
}) {
272260
return (
273-
<ActionBarContainer
261+
<ActionBar
274262
onClickBack={onClickBack}
275263
button={{
276264
text: T.actionBar.delegate.generate,
@@ -315,7 +303,7 @@ export function ReDelegate({
315303
</option>
316304
))}
317305
</select>
318-
</ActionBarContainer>
306+
</ActionBar>
319307
);
320308
}
321309

@@ -329,7 +317,7 @@ export function ActionBarSend({
329317
onClickBack,
330318
}) {
331319
return (
332-
<ActionBarContainer
320+
<ActionBar
333321
onClickBack={onClickBack}
334322
button={{
335323
text: 'Generate Tx',
@@ -352,7 +340,7 @@ export function ActionBarSend({
352340
autoFocus={false}
353341
/>
354342
</div>
355-
</ActionBarContainer>
343+
</ActionBar>
356344
);
357345
}
358346

@@ -413,7 +401,7 @@ export function ConnectAddress({
413401
onClickBack,
414402
}) {
415403
return (
416-
<ActionBarContainer
404+
<ActionBar
417405
button={{
418406
disabled: !selectNetwork || !selectMethod,
419407
text: selectMethod === KEY_TYPE.secrets ? 'Add' : 'Connect',
@@ -462,6 +450,6 @@ export function ConnectAddress({
462450
text={CHAIN_ID}
463451
/>
464452
</Pane>
465-
</ActionBarContainer>
453+
</ActionBar>
466454
);
467455
}

src/containers/application/Header/CurrentApp/CurrentApp.module.scss

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -61,25 +61,6 @@
6161
position: relative;
6262
}
6363

64-
.networkBtnImgIconMenu {
65-
position: absolute;
66-
top: 50%;
67-
left: 50%;
68-
transition: 0.2s;
69-
transform: translate(-50%, -50%) rotate(-90deg);
70-
71-
&Close {
72-
transform: translate(-50%, -50%) rotate(0deg);
73-
}
74-
75-
div {
76-
width: 35px;
77-
height: 5px;
78-
background-color: black;
79-
margin: 6px 0;
80-
}
81-
}
82-
8364
.btnContainerText {
8465
border: none;
8566
font-size: 16px;

src/containers/application/Header/CurrentApp/CurrentApp.tsx

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { useMemo } from 'react';
2-
import cx from 'classnames';
1+
import { useMemo, useState } from 'react';
32
import { Link, useLocation } from 'react-router-dom';
43
import { routes } from 'src/routes';
54
import { CHAIN_ID } from 'src/constants/config';
@@ -12,21 +11,32 @@ import styles from './CurrentApp.module.scss';
1211
import { selectNetworkImg } from '../../../../utils/utils';
1312
import ChainInfo from './ui/ChainInfo/ChainInfo';
1413
import findSelectAppByUrl from './utils/findSelectAppByUrl';
14+
import AppSideBar from './ui/AppSideBar/AppSideBar';
15+
import { menuButtonId } from './utils/const';
1516

16-
export const menuButtonId = 'menu-button';
17-
18-
function CurrentApp({ onClickOpenMenu, openMenu }) {
17+
function CurrentApp() {
1918
const mediaQuery = useMediaQuery('(min-width: 768px)');
2019
const location = useLocation();
2120
const address = useAppSelector(selectCurrentAddress);
2221
const { passport } = usePassportByAddress(address);
22+
const [openMenu, setOpenMenu] = useState(true);
2323

2424
const getRoute = useMemo(() => {
2525
const { pathname } = location;
2626

2727
return findSelectAppByUrl(pathname, passport, address);
2828
}, [location, address, passport]);
2929

30+
const toggleMenu = (newState: boolean) => {
31+
setOpenMenu(newState);
32+
};
33+
34+
const closeMenu = () => {
35+
toggleMenu(false);
36+
};
37+
38+
const toggleMenuFc = useMemo(() => () => toggleMenu(!openMenu), [openMenu]);
39+
3040
return (
3141
<>
3242
<div className={styles.buttonWrapper}>
@@ -45,9 +55,15 @@ function CurrentApp({ onClickOpenMenu, openMenu }) {
4555
</div>
4656

4757
{getRoute && getRoute[0] && (
48-
<div className={cx(styles.containerSubItems, styles.tooltipContainer)}>
49-
<SubMenu selectedApp={getRoute[0]} closeMenu={onClickOpenMenu} />
50-
</div>
58+
<AppSideBar
59+
menuProps={{
60+
isOpen: mediaQuery || openMenu,
61+
toggleMenu: toggleMenuFc,
62+
closeMenu,
63+
}}
64+
>
65+
<SubMenu selectedApp={getRoute[0]} closeMenu={closeMenu} />
66+
</AppSideBar>
5167
)}
5268
</>
5369
);

0 commit comments

Comments
 (0)