Skip to content

Commit

Permalink
Use Send modal in portfolio links, remove beta tag
Browse files Browse the repository at this point in the history
  • Loading branch information
svk31 committed Jan 5, 2018
1 parent 2e86e7e commit 8e13af8
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 42 deletions.
1 change: 1 addition & 0 deletions app/assets/locales/locale-en.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"exchange": "Exchange",
"payments": "Send",
"payments_beta": "Send (Beta)",
"payments_legacy": "Send (legacy)",
"logout": "Logout",
"settings": "Settings",
"current": "Current Account",
Expand Down
26 changes: 13 additions & 13 deletions app/assets/stylesheets/components/_dashboard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ div.fm-container {
}

.SimpleTrade__copyIcon {
padding: 0.5rem;
padding: 0.5rem;
margin-right: 15px;
background-color: rgb(65, 116, 184);
}
Expand Down Expand Up @@ -185,7 +185,8 @@ div.fm-container {
#simple_withdraw_modal,
#simple_bridge_modal,
#simple_bridge_modal_ask,
#send_modal,
#send_modal_header,
#send_modal_portfolio,
#deposit_modal_new {
overflow: auto !important;
max-width: 500px;
Expand Down Expand Up @@ -234,19 +235,19 @@ div.input-wrapper {
.selectWrapper {
border-radius: 5px;
}
.copyIcon {
padding: 0.3rem;
.copyIcon {
padding: 0.3rem;
vertical-align: middle;
background-color: rgb(65, 116, 184);
}

.DepositModal {
.canvas {
padding-top: 1rem;
padding-left: 2rem;
padding-right: 2rem;
height: 650px;

.Modal__header {
text-align: center;
> img {
Expand All @@ -263,7 +264,7 @@ div.input-wrapper {
.Modal__body {
height: 90%;
}

.container-row {
padding-bottom: 1rem;
}
Expand All @@ -286,7 +287,7 @@ div.input-wrapper {
color: rgb(242, 242, 242);
background-color: rgb(245, 27, 27);
}

.deposit-directly {
text-align: center;
> p:nth-of-type(1) {
Expand All @@ -302,14 +303,14 @@ div.input-wrapper {
.deposit-info {
margin-left: 0.2rem;
overflow: "hidden";



> .maxDeposit {
font-weight: bold;
font-size: 0.9rem;
}

.deposit-details {
text-align: left;
> .copyIcon {
Expand All @@ -326,11 +327,10 @@ div.input-wrapper {
}
}
}


}
.close-button {
display: none;
}
}

10 changes: 5 additions & 5 deletions app/assets/stylesheets/components/_forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ div.account-image {
display: block;
flex: auto;
}
.tooltip{

.tooltip{
&:hover {
cursor:pointer;
}
}

.header-area {
margin-left: 3.5rem;
}
Expand Down Expand Up @@ -288,7 +288,7 @@ form.full-width {
}
}

#send_modal {
#send_modal_header, #send_modal_portfolio {
padding-left: 20px;
padding-right: 20px;
.right-label, .left-label {
Expand All @@ -304,7 +304,7 @@ form.full-width {
.account-select { width: 100%; }
}

#send_modal {
#send_modal_header, #send_modal_portfolio {
padding-left: 20px;
padding-right: 20px;
.right-label, .left-label {
Expand Down
21 changes: 16 additions & 5 deletions app/components/Account/AccountOverview.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import AccountOrders from "./AccountOrders";
import cnames from "classnames";
import TranslateWithLinks from "../Utility/TranslateWithLinks";
import { checkMarginStatus } from "common/accountHelper";
import SendModal from "../Modal/SendModal";

class AccountOverview extends React.Component {

Expand Down Expand Up @@ -173,7 +174,7 @@ class AccountOverview extends React.Component {

_showDepositModal(asset, e) {
e.preventDefault();
this.setState({depositAsset: asset}, () => {
this.setState({depositAsset: asset}, () => {
this.refs.deposit_modal_new.show();
});
}
Expand All @@ -197,6 +198,12 @@ class AccountOverview extends React.Component {
this.props.router.push(route);
}

triggerSend(asset) {
this.setState({send_asset: asset}, () => {
this.refs.send_modal.show();
});
}

_renderBalances(balanceList, optionalAssets, visible) {
const {core_asset} = this.props;
let {settings, hiddenAssets, orders} = this.props;
Expand Down Expand Up @@ -245,7 +252,7 @@ class AccountOverview extends React.Component {
<Link to={`/market/${asset.get("symbol")}_${preferredMarket}`}><Icon name="trade" className="icon-14px" /></Link> :
notCorePrefUnit ? <Link to={`/market/${asset.get("symbol")}_${preferredUnit}`}><Icon name="trade" className="icon-14px" /></Link> :
emptyCell;
transferLink = <Link to={`/transfer?asset=${asset.get("id")}`}><Icon name="transfer" className="icon-14px" /></Link>;
transferLink = <a onClick={this.triggerSend.bind(this, asset.get("id"))}><Icon name="transfer" className="icon-14px" /></a>;

let {isBitAsset, borrowModal, borrowLink} = renderBorrow(asset, this.props.account);

Expand All @@ -263,7 +270,7 @@ class AccountOverview extends React.Component {
!!this.props.backedCoins.get("OPEN", []).find(a => a.backingCoinType === thisAssetName[1]) ||
!!this.props.backedCoins.get("RUDEX", []).find(a => a.backingCoin === thisAssetName[1]) ||
asset.get("symbol") == "BTS";

const canDepositWithdraw = !!this.props.backedCoins.get("OPEN", []).find(a => a.symbol === asset.get("symbol"));
const canWithdraw = canDepositWithdraw && (hasBalance && balanceObject.get("balance") != 0);
const canBuy = !!this.props.bridgeCoins.get(symbol);
Expand Down Expand Up @@ -594,6 +601,10 @@ class AccountOverview extends React.Component {
{hiddenBalances.length ? <div className={cnames("inline-block", {inactive: !showHidden})} onClick={!showHidden ? this._toggleHiddenAssets.bind(this) : () => {}}>
<Translate content="account.show_hidden" />
</div> : null}

{/* Send Modal */}
<SendModal id="send_modal_portfolio" ref="send_modal" from_name={this.props.account.get("name")} asset_id={this.state.send_asset || "1.3.0"}/>

</div>

<table className="table dashboard-table table-hover">
Expand Down Expand Up @@ -703,7 +714,7 @@ class AccountOverview extends React.Component {
isDown={this.props.gatewayDown.get("OPEN")}
/>

{/* Withdraw Modal OLD
{/* Withdraw Modal OLD
<SimpleDepositWithdraw
ref="withdraw_modal"
action="withdraw"
Expand All @@ -721,7 +732,7 @@ class AccountOverview extends React.Component {
<DepositModal
ref="deposit_modal_new"
modalId="deposit_modal_new"
asset={this.state.depositAsset}
asset={this.state.depositAsset}
account={this.props.account.get("name")}
backedCoins={this.props.backedCoins}
/>
Expand Down
15 changes: 5 additions & 10 deletions app/components/Layout/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ class Header extends React.Component {
{!!createAccountLink ? null : <li className="column-hide-small">
<a style={{flexFlow: "row"}} onClick={this._showSend.bind(this)}>
<Icon size="1_5x" style={{position: "relative", top: 0, left: -8}} name="transfer"/>
<span><Translate content="header.payments_beta" /></span>
<span><Translate content="header.payments" /></span>
</a>
</li>}

Expand Down Expand Up @@ -394,19 +394,14 @@ class Header extends React.Component {

<li className={cnames({active: active.indexOf("/transfer") !== -1}, {disabled: !isMyAccount})} onClick={!isMyAccount ? () => {} : this._onNavigate.bind(this, "/transfer")}>
<div className="table-cell"><Icon size="2x" name="transfer" /></div>
<div className="table-cell"><Translate content="header.payments" /></div>
<div className="table-cell"><Translate content="header.payments_legacy" /></div>
</li>

{/* <li className={cnames({active: active.indexOf("/transfer") !== -1}, {disabled: !isMyAccount})} onClick={this._showSend.bind(this)}>
<div className="table-cell"><Icon size="2x" name="transfer" /></div>
<div className="table-cell"><Translate content="header.payments_beta" /></div>
</li> */}

<li className={cnames({active: active.indexOf("/deposit-withdraw") !== -1}, {disabled: !enableDepositWithdraw})} onClick={!enableDepositWithdraw ? () => {} : this._onNavigate.bind(this, "/deposit-withdraw")}>
<div className="table-cell"><Icon size="2x" name="deposit" /></div>
<div className="table-cell"><Translate content="gateway.deposit" /></div>
</li>

<li className={cnames({active: active.indexOf("/deposit-withdraw") !== -1}, {disabled: !enableDepositWithdraw})} onClick={!enableDepositWithdraw ? () => {} : this._showDeposit.bind(this)}>
<div className="table-cell"><Icon size="2x" name="deposit" /></div>
<div className="table-cell"><Translate content="modal.deposit.submit_beta" /></div>
Expand Down Expand Up @@ -480,12 +475,12 @@ class Header extends React.Component {
</div>
</div>
{/* Send modal */}
<SendModal ref="send_modal" from_name={currentAccount} />
<SendModal id="send_modal_header" ref="send_modal" from_name={currentAccount} />
{/* Deposit modal */}
<DepositModal
ref="deposit_modal_new"
modalId="deposit_modal_new"
asset="BTS"
asset="BTS"
account={currentAccount}
backedCoins={this.props.backedCoins}
/>
Expand Down
1 change: 0 additions & 1 deletion app/components/Modal/BaseModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class BaseModal extends React.Component {

render() {
const { props } = this;

return (
<Modal id={this.props.id} overlay={props.overlay} onClose={props.onClose} className={props.className} overlayClose={props.overlayClose}>
{!props.noCloseBtn && <Trigger close={props.id}>
Expand Down
27 changes: 19 additions & 8 deletions app/components/Modal/SendModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default class SendModal extends React.Component {

constructor(props) {
super(props);
this.state = SendModal.getInitialState();
this.state = this.getInitialState(props);

this.onTrxIncluded = this.onTrxIncluded.bind(this);

Expand All @@ -35,7 +35,7 @@ export default class SendModal extends React.Component {
this._checkBalance = this._checkBalance.bind(this);
};

static getInitialState() {
getInitialState() {
return {
from_name: "",
to_name: "",
Expand All @@ -59,14 +59,14 @@ export default class SendModal extends React.Component {

show() {
this.setState({open: true}, () => {
ZfApi.publish("send_modal", "open");
ZfApi.publish(this.props.id, "open");
});
this._initForm();
}

onClose() {
this.setState({open: false}, () => {
ZfApi.publish("send_modal", "close");
ZfApi.publish(this.props.id, "close");
});
this.setState({
from_name: "",
Expand Down Expand Up @@ -126,6 +126,17 @@ export default class SendModal extends React.Component {
if (!this.state.from_name) {
this.setState({from_name: currentAccount});
}

console.log("_initForm", this.props.asset_id, this.state.asset_id);
if (this.props.asset_id && this.state.asset_id !== this.props.asset_id) {
let asset = ChainStore.getAsset(this.props.asset_id);
if (asset) {
this.setState({
asset_id: this.props.asset_id,
asset
});
}
}
}

componentWillMount() {
Expand Down Expand Up @@ -411,11 +422,11 @@ export default class SendModal extends React.Component {

const logo = require("assets/logo-ico-blue.png");
let tabIndex = 1;
let greenAccounts = AccountStore.getState().linkedAccounts.toArray();

let greenAccounts = AccountStore.getState().linkedAccounts.toArray();

return (
<BaseModal id="send_modal" overlay={true} ref="send_modal">
<BaseModal id={this.props.id} className="send_modal" overlay={true}>
<div className="grid-block vertical no-overflow">
<div className="content-block" style={{textAlign: "center", textTransform: "none"}}>
<img style={{margin: 0, height: 70, marginBottom: 10}} src={logo} /><br />
Expand Down

0 comments on commit 8e13af8

Please sign in to comment.