Skip to content

Commit

Permalink
Merge develop into master (#69)
Browse files Browse the repository at this point in the history
* move vault refresh button to settings page (#68)

Co-authored-by: borgvin <[email protected]>

* fix onshore max calculation (courtesy of neac) (#67)

Co-authored-by: borgvin <[email protected]>

---------

Co-authored-by: goshiz <[email protected]>
Co-authored-by: borgvin <[email protected]>
  • Loading branch information
3 people authored May 16, 2024
1 parent 792f19d commit d604239
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 60 deletions.
12 changes: 1 addition & 11 deletions client/src/platforms/desktop/components/navigation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
OptionsIcon,
OptionsList,
OptionsSVG,
Scan,
} from "./styles";

import { closeWallet } from "shared/actions/walletSession";
Expand All @@ -33,8 +32,6 @@ import Cell from "./cell";
import Link from "./link";
import Tab from "./tab";

import { showModal } from "shared/actions/modal";
import { MODAL_TYPE } from "shared/reducers/modal";
import { isConnected } from "shared/core/havend";

interface NavigationProps {
Expand All @@ -49,7 +46,6 @@ interface NavigationProps {
basicActive: boolean;
advancedActive: boolean;
startedResync: boolean;
showModal: (modalType: MODAL_TYPE) => void;
syncState: SyncState;
connected: boolean;
restoreHeight: number;
Expand Down Expand Up @@ -137,10 +133,6 @@ class Navigation extends Component<NavigationProps, any> {
});
};

refreshVault = () => {
this.props.showModal(MODAL_TYPE.RescanBC);
};

render() {
const auth = this.props.isLoggedIn;
const { current_network } = this.state;
Expand Down Expand Up @@ -253,7 +245,6 @@ class Navigation extends Component<NavigationProps, any> {
body="Refresh Height"
label={this.props.restoreHeight}
/>
<Scan onClick={this.refreshVault}>Refresh Vault</Scan>
</>
)}
</>
Expand All @@ -278,6 +269,5 @@ const mapStateToProps = (state: DesktopAppState) => ({
});

export const NavigationDesktop = connect(mapStateToProps, {
logout: closeWallet,
showModal,
logout: closeWallet
})(Navigation);
16 changes: 0 additions & 16 deletions client/src/platforms/desktop/components/navigation/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,6 @@ export const Container = styled.header`
border-bottom: 1px solid ${(props) => props.theme.body.border};
`;

export const Scan = styled.div`
font-size: 13px;
border-radius: 4px;
margin: 8px;
height: 36px;
background: ${(props) => props.theme.button.primary};
color: ${(props) => props.theme.button.primary_label};
display: flex;
align-items: center;
justify-content: center;
&:hover {
cursor: pointer;
}
`;

export const Haven = styled.div`
color: ${(props) => props.theme.type.primary};
font-size: 20px;
Expand Down
23 changes: 22 additions & 1 deletion client/src/platforms/desktop/pages/_wallet/settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import Body from "shared/components/_layout/body";
import Header from "shared/components/_layout/header";
import Form from "shared/components/_inputs/form";
import Theme from "shared/components/_inputs/theme";
import { showModal } from "shared/actions/modal";
import { MODAL_TYPE } from "shared/reducers/modal";
// For the miner
import { selectisLocalNode } from "platforms/desktop/reducers/selectedNode";
import { DesktopAppState } from "platforms/desktop/reducers";
Expand All @@ -24,6 +26,7 @@ import {
import { HavenNodeSetting } from "platforms/desktop/pages/_wallet/settings/node/nodeSetting";
import { Container } from "./styles";
import DoubleFooter from "shared/components/_inputs/double_footer";
import Footer from "shared/components/_inputs/footer";

type ThemeOption = { theme: string; value: string };
type BalanceOption = { ticker: string; value: string; code: string };
Expand All @@ -46,6 +49,7 @@ interface SettingsProps {
title: string;
description: string;
localNode: boolean;
showModal: (modalType: MODAL_TYPE) => void;
}

const options: ThemeOption[] = [
Expand Down Expand Up @@ -131,6 +135,10 @@ class SettingsDesktopPage extends Component<SettingsProps, any> {
this.props.downloadTransfers("csv");
};

refreshVault = () => {
this.props.showModal(MODAL_TYPE.RescanBC);
};

handleChange = (event: any) => {
const name = event.target.name;
const value = event.target.value;
Expand Down Expand Up @@ -185,6 +193,18 @@ class SettingsDesktopPage extends Component<SettingsProps, any> {
rightOnClick={this.downloadTxCsv}
/>
</Container>
<Header
title="Refresh Vault"
description="Use this option to resolve issues with transactions not displaying correctly in the vault"
/>
<Container>
<Footer
label={"Refresh Vault"}
disabled={false}
loading={false}
onClick={this.refreshVault}
/>
</Container>
</Body>
);
}
Expand All @@ -201,5 +221,6 @@ export const SettingsDesktop = connect(mapStateToProps, {
startMining,
stopMining,
miningStatus,
downloadTransfers
downloadTransfers,
showModal
})(SettingsDesktopPage);
12 changes: 1 addition & 11 deletions client/src/platforms/web/components/navigation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
OptionsList,
OptionsSVG,
Arr,
Scan,
Arrow,
} from "./styles.js";
import Buttons from "./buttons/index.js";
Expand All @@ -28,8 +27,6 @@ import { HavenAppState } from "platforms/desktop/reducers/index.js";
import Cell from "./cell";
import Link from "./link";
import Tab from "./tab";
import { showModal } from "shared/actions/modal";
import { MODAL_TYPE } from "shared/reducers/modal";
import { closeWallet } from "shared/actions/walletSession";
import { XBalances } from "shared/reducers/xBalance";
import Search from "../../../../shared/components/search/index.js";
Expand All @@ -48,7 +45,6 @@ interface NavigationProps {
activeWallet: string | undefined;
startedResync: boolean;
balances: XBalances;
showModal: (modalType: MODAL_TYPE) => void;
}

class Navigation extends Component<NavigationProps, {}> {
Expand Down Expand Up @@ -119,10 +115,6 @@ class Navigation extends Component<NavigationProps, {}> {
});
};

refreshVault = () => {
this.props.showModal(MODAL_TYPE.RescanBC);
};

render() {
const auth = this.props.isLoggedIn;
// @ts-ignore
Expand Down Expand Up @@ -232,7 +224,6 @@ class Navigation extends Component<NavigationProps, {}> {
body="Refresh Height"
label={this.props.restoreHeight}
/>
<Scan onClick={this.refreshVault}>Refresh Vault</Scan>
</>
)}
</>
Expand All @@ -256,6 +247,5 @@ const mapStateToProps = (state: WebAppState) => ({
});

export const NavigationWeb = connect(mapStateToProps, {
logout: closeWallet,
showModal,
logout: closeWallet
})(Navigation);
17 changes: 0 additions & 17 deletions client/src/platforms/web/components/navigation/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,6 @@ export const Container = styled.header`
border-bottom: 1px solid ${(props) => props.theme.body.border};
`;

export const Scan = styled.div`
font-size: 13px;
border-radius: 4px;
margin: 8px;
height: 36px;
background: ${(props) => props.theme.button.primary};
color: ${(props) => props.theme.button.primary_label};
display: flex;
align-items: center;
justify-content: center;
font-family: Inter-Regular;
&:hover {
cursor: pointer;
}
`;

export const Label = styled.div`
font-family: Inter-Regular;
text-align: center;
Expand Down
4 changes: 2 additions & 2 deletions client/src/shared/pages/_wallet/exchange/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ class Exchange extends Component<ExchangeProps, ExchangeState> {
switch (txType) {

case TxType.Shore:
stateUpdate = fromTicker === Ticker.XHV ? {fromAmount: amount} : {toAmount: amount};
setToAmount = fromTicker === Ticker.XHV ? true : false;
stateUpdate = {fromAmount: amount};
setToAmount = true;
break;
case TxType.Xasset:
stateUpdate = fromTicker === Ticker.xUSD ? {fromAmount: amount} : {toAmount: amount};
Expand Down
17 changes: 15 additions & 2 deletions client/src/shared/pages/_wallet/settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,22 @@ import RevealSeed from "../../../components/_inputs/revealSeed";
import Form from "../../../components/_inputs/form";
import Theme from "../../../components/_inputs/theme";
import DoubleFooter from "../../../components/_inputs/double_footer";
import Footer from "../../../components/_inputs/footer";
import { Container } from "./styles";
import { storeKeyFileToDisk } from "platforms/web/actions/storage";
import { HavenAppState } from "platforms/desktop/reducers";
import { IKeys } from "typings";
import { isTemporaryWallet as selectIsTemporaryWallet } from "shared/reducers/walletSession";
import { selectSyncState } from "shared/reducers/chain";
import { SyncState } from "shared/types/types";
import { showModal } from "shared/actions/modal";
import { MODAL_TYPE } from "shared/reducers/modal";

import {downloadTransfers} from "shared/actions/transferHistory";

// Address parts
import { AddressEntry } from "shared/reducers/address";
import { writeText } from "vendor/clipboard/clipboard-polyfill";
import { showModal } from "../../../actions/modal";
import { MODAL_TYPE } from "../../../reducers/modal";
import { selectSelectedAddress } from "../../../reducers/address";
import { setSelectedAddress } from "shared/actions/address";
import AddressDropdown from "../../../components/_inputs/addresses_dropdown/index.js";
Expand Down Expand Up @@ -326,6 +327,18 @@ class SettingsPage extends Component<SettingsProps, SettingsState> {
rightOnClick={this.toggleVisibility}
/>
</Container>
<Header
title="Refresh Vault"
description="Use this option to resolve issues with transactions not displaying correctly in the vault"
/>
<Container>
<Footer
label={"Refresh Vault"}
disabled={false}
loading={false}
onClick={this.refreshVault}
/>
</Container>
</Body>
);
}
Expand Down

0 comments on commit d604239

Please sign in to comment.