Skip to content

Commit 7828aae

Browse files
committed
Remove unnecessary imports and changes
Cleanup this implementation by removing unused imports, changes, and delta not relevant to the upgrade.
1 parent c8a2c78 commit 7828aae

File tree

7 files changed

+27
-14
lines changed

7 files changed

+27
-14
lines changed

app/src/components/common/PageHeader.tsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import React, { ReactNode, useCallback } from 'react';
1+
import React, { ReactNode } from 'react';
22
import { observer } from 'mobx-react-lite';
33
import styled from '@emotion/styled';
44
import { usePrefixedTranslation } from 'hooks';
55
import { ArrowLeft, Download, HeaderThree, HelpCircle } from '../base';
66
import Tip from './Tip';
7-
import { useStore } from 'store';
87

98
const Styled = {
109
Wrapper: styled.div`
@@ -45,7 +44,7 @@ const Styled = {
4544

4645
interface Props {
4746
title: ReactNode;
48-
showBackButton?: boolean;
47+
onBackClick?: () => void;
4948
backText?: string;
5049
onHelpClick?: () => void;
5150
exportTip?: string;
@@ -54,22 +53,20 @@ interface Props {
5453

5554
const PageHeader: React.FC<Props> = ({
5655
title,
57-
showBackButton,
56+
onBackClick,
5857
backText,
5958
onHelpClick,
6059
exportTip,
6160
onExportClick,
6261
}) => {
6362
const { l } = usePrefixedTranslation('cmps.common.PageHeader');
64-
const { appView } = useStore();
65-
const handleBack = useCallback(() => appView.showSettings(''), [appView]);
6663

6764
const { Wrapper, Left, Center, Right, BackLink } = Styled;
6865
return (
6966
<Wrapper>
7067
<Left>
71-
{showBackButton && (
72-
<BackLink onClick={handleBack}>
68+
{onBackClick && (
69+
<BackLink onClick={onBackClick}>
7370
<ArrowLeft />
7471
{backText}
7572
</BackLink>

app/src/components/layout/Layout.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import styled from '@emotion/styled';
55
import { useStore } from 'store';
66
import { Background, Menu } from 'components/base';
77
import Sidebar from './Sidebar';
8-
import { useLocation } from 'react-router-dom';
98

109
interface CollapsedProps {
1110
collapsed: boolean;

app/src/components/settings/BalanceSettings.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,18 @@ const BalanceModeItem: React.FC<{ mode: BalanceMode }> = observer(({ mode }) =>
3636

3737
const BalanceSettings: React.FC = () => {
3838
const { l } = usePrefixedTranslation('cmps.settings.BalanceSettings');
39+
const { appView } = useStore();
40+
41+
const handleBack = useCallback(() => appView.showSettings(''), [appView]);
3942

4043
const { Wrapper, Content } = Styled;
4144
return (
4245
<Wrapper>
43-
<PageHeader title={l('pageTitle')} backText={l('backText')} showBackButton />
46+
<PageHeader
47+
title={l('pageTitle')}
48+
backText={l('backText')}
49+
onBackClick={handleBack}
50+
/>
4451
<Content>
4552
<HeaderFour>{l('title')}</HeaderFour>
4653
<BalanceModeItem mode={BalanceMode.receive} />

app/src/components/settings/ExplorerSettings.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,11 @@ const ExplorerSettings: React.FC = () => {
9898
const { Wrapper, Content, Actions } = Styled;
9999
return (
100100
<Wrapper>
101-
<PageHeader title={l('pageTitle')} backText={l('backText')} showBackButton />
101+
<PageHeader
102+
title={l('pageTitle')}
103+
backText={l('backText')}
104+
onBackClick={handleBack}
105+
/>
102106
<Content>
103107
<ExplorerField
104108
label={l('bitcoinTxUrl')}

app/src/components/settings/GeneralSettings.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const Styled = {
1818

1919
const GeneralSettings: React.FC = () => {
2020
const { l } = usePrefixedTranslation('cmps.settings.GeneralSettings');
21-
const { appView, nodeStore, settingsStore } = useStore();
21+
const { appView, settingsStore, nodeStore } = useStore();
2222

2323
const handleUnit = useCallback(() => appView.showSettings('unit'), [appView]);
2424
const handleBalance = useCallback(() => appView.showSettings('balance'), [appView]);

app/src/components/settings/UnitSettings.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,16 @@ const UnitSettings: React.FC = () => {
3737
const { l } = usePrefixedTranslation('cmps.settings.UnitSettings');
3838
const { appView } = useStore();
3939

40+
const handleBack = useCallback(() => appView.showSettings(''), [appView]);
41+
4042
const { Wrapper, Content } = Styled;
4143
return (
4244
<Wrapper>
43-
<PageHeader title={l('pageTitle')} backText={l('backText')} showBackButton />
45+
<PageHeader
46+
title={l('pageTitle')}
47+
backText={l('backText')}
48+
onBackClick={handleBack}
49+
/>
4450
<Content>
4551
<UnitItem unit={Unit.sats} />
4652
<UnitItem unit={Unit.bits} />

app/src/store/views/appView.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default class AppView {
3131
get fullWidth() {
3232
return this._store.router.location.pathname === `${PUBLIC_URL}/pool`;
3333
}
34-
34+
3535
/** navigate to the specified route */
3636
goTo(route: string) {
3737
if (this._store.router.location.pathname !== route) {

0 commit comments

Comments
 (0)