Skip to content

Commit

Permalink
Update changes
Browse files Browse the repository at this point in the history
  • Loading branch information
iamonuwa committed Jul 19, 2019
1 parent 2b2a682 commit e9138d1
Show file tree
Hide file tree
Showing 9 changed files with 104 additions and 97 deletions.
18 changes: 17 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export default class App extends Component {
sendKey: "",
alert: null,
loadingTitle:'loading...',
title: this.props.t,
title: props.t('title'),
extraHeadroom:0,
balance: 0.00,
vendors: {},
Expand Down Expand Up @@ -931,6 +931,22 @@ export default class App extends Component {
)
}

if (view.includes("loader_")) {
const network = view.replace("loader_");
return (
<div>
<div
style={{zIndex:1,position:"relative",color:"#dddddd"}}>

<NavCard
title={"Sending..."}
goBack={this.goBack.bind(this)} />
</div>
<Loader loaderImage={LOADERIMAGE} network={network} />
</div>
);
}

const sendByScan = (
<SendByScan
parseAndCleanPath={this.parseAndCleanPath.bind(this)}
Expand Down
25 changes: 13 additions & 12 deletions src/components/Bity.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@ class Bity extends Component {
}

async componentDidMount() {
const { changeAlert } = this.props;
const { changeAlert, t } = this.props;

this.refs.name.focus();
try {
await this.getMinAmount();
} catch (err) {
changeAlert("warning", this.props.t("offramp.errors.bity_connection"));
changeAlert("warning", t("offramp.errors.bity_connection"));
}
}

Expand All @@ -121,7 +121,8 @@ class Bity extends Component {
web3,
changeView,
setReceipt,
changeAlert
changeAlert,
t
} = this.props;
let { amount } = this.state.fields;

Expand All @@ -141,7 +142,7 @@ class Bity extends Component {
address
);
} catch (err) {
changeAlert("warning", this.props.t("offramp.errors.bity_connection"));
changeAlert("warning", t("offramp.errors.bity_connection"));
return;
}

Expand All @@ -159,7 +160,7 @@ class Bity extends Component {
} catch (err) {
changeAlert(
"warning",
this.props.t("offramp.errors.ethgasstation_connection")
t("offramp.errors.ethgasstation_connection")
);
return;
}
Expand Down Expand Up @@ -204,7 +205,7 @@ class Bity extends Component {
from: address,
amount: amount.value,
result: receipt,
message: this.props.t("offramp.success")
message: t("offramp.success")
};
setReceipt(receiptObj);
changeView("receipt");
Expand Down Expand Up @@ -280,7 +281,7 @@ class Bity extends Component {
}

validate(input) {
const { address } = this.props;
const { address, t } = this.props;
return () => {
const { fields } = this.state;
let newFields;
Expand All @@ -290,7 +291,7 @@ class Bity extends Component {
name: {
value: name,
valid: name !== "",
message: name === "" ? this.props.t("offramp.required") : null
message: name === "" ? t("offramp.required") : null
}
});
} else if (input === "IBAN") {
Expand All @@ -302,10 +303,10 @@ class Bity extends Component {
valid = true;
} else if (validReason === "country") {
valid = false;
message = this.props.t("offramp.country_not_supported");
message = t("offramp.country_not_supported");
} else {
valid = false;
message = this.props.t("offramp.iban_incorrect");
message = t("offramp.iban_incorrect");
}
newFields = Object.assign(fields, {
IBAN: {
Expand Down Expand Up @@ -334,12 +335,12 @@ class Bity extends Component {
let valid, message;
if (amount < min) {
valid = false;
message = `${this.props.t(
message = `${t(
"offramp.amount_too_small"
)} $${MIN_AMOUNT_DOLLARS}.`;
} else if (amount > max) {
valid = false;
message = this.props.t("offramp.amount_too_big");
message = t("offramp.amount_too_big");
} else {
valid = true;
}
Expand Down
31 changes: 15 additions & 16 deletions src/components/Exchange.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ class Exchange extends React.Component {
xdaiMetaAccount: xdaiMetaAccount,
daiToXdaiMode: false,
ethToDaiMode: false,
loaderBarStatusText: this.props.t('loading'),
loaderBarStatusText: props.t('loading'),
loaderBarStartTime:Date.now(),
loaderBarPercent: 2,
loaderBarColor: "#aaaaaa",
gwei: 5,
maxWithdrawlAmount: 0.00,
withdrawalExplanation: this.props.t('exchange.withdrawal_explanation'),
withdrawalExplanation: props.t('exchange.withdrawal_explanation'),
gettingGas:false,
}

Expand Down Expand Up @@ -723,9 +723,8 @@ class Exchange extends React.Component {
}
}
render() {
const { address } = this.props;
const { address, t } = this.props;
let {daiToXdaiMode,ethToDaiMode } = this.state
const { t } = this.props

let ethCancelButton = <BorderButton className="btn-cancel" onClick={()=>{
this.setState({ethToDaiAmount:"",ethToDaiMode:false})
Expand All @@ -748,7 +747,7 @@ class Exchange extends React.Component {
let adjustedFontSize = Math.round((Math.min(document.documentElement.clientWidth,600)/600)*24)
let adjustedTop = Math.round((Math.min(document.documentElement.clientWidth,600)/600)*-20)+9

let daiToXdaiDisplay = this.props.t('loading')
let daiToXdaiDisplay = t('loading')

//console.log("daiToXdaiMode",daiToXdaiMode)
if(daiToXdaiMode==="sending" || daiToXdaiMode==="withdrawing" || daiToXdaiMode==="depositing"){
Expand Down Expand Up @@ -821,7 +820,7 @@ class Exchange extends React.Component {
loaderBarPercent:0,
loaderBarStartTime: Date.now(),
loaderBarClick:()=>{
alert(this.props.t('exchange.go_to_etherscan'))
alert(t('exchange.go_to_etherscan'))
}
})

Expand All @@ -835,7 +834,7 @@ class Exchange extends React.Component {
loaderBarColor:"#4ab3f5",
loaderBarStatusText:"Waiting for bridge...",
loaderBarClick:()=>{
alert(this.props.t('exchange.idk'))
alert(t('exchange.idk'))
}
})
})
Expand Down Expand Up @@ -1011,7 +1010,7 @@ class Exchange extends React.Component {
)
}

let ethToDaiDisplay = this.props.t('loading')
let ethToDaiDisplay = t('loading')

if(ethToDaiMode==="sending" || ethToDaiMode==="depositing" || ethToDaiMode==="withdrawing"){
ethToDaiDisplay = (
Expand Down Expand Up @@ -1097,11 +1096,11 @@ class Exchange extends React.Component {
this.setState({
ethToDaiMode:"depositing",
loaderBarColor:"#3efff8",
loaderBarStatusText: this.props.t('exchange.calculate_gas_price'),
loaderBarStatusText: t('exchange.calculate_gas_price'),
loaderBarPercent:0,
loaderBarStartTime: Date.now(),
loaderBarClick:()=>{
alert(this.props.t('exchange.go_to_etherscan'))
alert(t('exchange.go_to_etherscan'))
}
})

Expand All @@ -1123,7 +1122,7 @@ class Exchange extends React.Component {
loaderBarColor:"#4ab3f5",
loaderBarStatusText:"Waiting for 🦄 exchange...",
loaderBarClick:()=>{
alert(this.props.t('exchange.idk'))
alert(t('exchange.idk'))
}
})
}
Expand Down Expand Up @@ -1207,11 +1206,11 @@ class Exchange extends React.Component {
this.setState({
ethToDaiMode:"withdrawing",
loaderBarColor:"#3efff8",
loaderBarStatusText: this.props.t('exchange.calculate_gas_price'),
loaderBarStatusText: t('exchange.calculate_gas_price'),
loaderBarPercent:0,
loaderBarStartTime: Date.now(),
loaderBarClick:()=>{
alert(this.props.t('exchange.go_to_etherscan'))
alert(t('exchange.go_to_etherscan'))
}
})

Expand Down Expand Up @@ -1350,7 +1349,7 @@ class Exchange extends React.Component {
loaderBarColor:"#42ceb2",
loaderBarStatusText:"Approving 🦄 exchange...",
loaderBarClick:()=>{
alert(this.props.t('exchange.idk'))
alert(t('exchange.idk'))
}
})

Expand All @@ -1368,7 +1367,7 @@ class Exchange extends React.Component {
loaderBarColor:"#4ab3f5",
loaderBarStatusText:"Sending funds to 🦄 Exchange...",
loaderBarClick:()=>{
alert(this.props.t('exchange.idk'))
alert(t('exchange.idk'))
}
})

Expand All @@ -1391,7 +1390,7 @@ class Exchange extends React.Component {
loaderBarColor:"#4ab3f5",
loaderBarStatusText:"Sending funds to 🦄 Exchange...",
loaderBarClick:()=>{
alert(this.props.t('exchange.idk'))
alert(t('exchange.idk'))
}
})

Expand Down
56 changes: 23 additions & 33 deletions src/components/MainCard.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,29 @@
import React from "react";
import { Flex, Icon, Box } from "rimble-ui";
import { Translation } from "react-i18next";
import { withTranslation } from "react-i18next";
import { PrimaryButton } from "./Buttons";

export default ({ changeView }) => {
let sendButtons = (
<Translation>
{(t, { i18n }) => (
// eslint-disable-next-line no-unused-expressions
<Box>
<Flex mx={-2}>
<Box width={[1, 1 / 2, 1 / 2]} m={2}>
<PrimaryButton width={1} onClick={() => changeView("receive")}>
<Flex alignItems="center">
<Icon name="CenterFocusWeak" mr={2} />
{t("main_card.receive")}
</Flex>
</PrimaryButton>
</Box>
<Box width={[1, 1 / 2, 1 / 2]} m={2}>
<PrimaryButton
width={1}
onClick={() => changeView("send_to_address")}
>
<Flex alignItems="center">
<Icon name="Send" mr={2} />
{t("main_card.send")}
</Flex>
</PrimaryButton>
</Box>
const MainCard = ({ changeView, t }) => (
<Box>
<Flex mx={-2}>
<Box width={[1, 1 / 2, 1 / 2]} m={2}>
<PrimaryButton width={1} onClick={() => changeView("receive")}>
<Flex alignItems="center">
<Icon name="CenterFocusWeak" mr={2} />
{t("main_card.receive")}
</Flex>
</Box>
)}
</Translation>
);
</PrimaryButton>
</Box>
<Box width={[1, 1 / 2, 1 / 2]} m={2}>
<PrimaryButton width={1} onClick={() => changeView("send_to_address")}>
<Flex alignItems="center">
<Icon name="Send" mr={2} />
{t("main_card.send")}
</Flex>
</PrimaryButton>
</Box>
</Flex>
</Box>
);

return sendButtons;
};
export default withTranslation()(MainCard);
4 changes: 2 additions & 2 deletions src/components/MoreButtons.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { Flex, Icon, Box } from "rimble-ui";
import { BorderButton } from "./Buttons";
import { withTranslation } from "react-i18next";

function MoreButtons ({
const MoreButtons = ({
isVendor,
changeView,
expertMode,
t
}) {
}) => {
let exchangeButton;

if (!isVendor) {
Expand Down
5 changes: 3 additions & 2 deletions src/components/Receive.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ class Receive extends React.Component {
changeAlert,
changeView,
currencyDisplay,
t
} = this.props

return (
<div>
<div>
<CopyToClipboard text={address} onCopy={() => {
changeAlert({type: 'success', message: this.props.t('receive.address_copied')})
changeAlert({type: 'success', message: t('receive.address_copied')})
}}>
<Box>
<Flex flexDirection={'column'} alignItems={'center'} p={3} border={1} borderColor={'grey'} borderRadius={1}>
Expand Down Expand Up @@ -64,7 +65,7 @@ class Receive extends React.Component {
<div name="theVeryBottom" className="text-center bottom-text">
<span style={{padding:10}}>
<a href="#" style={{color:"#FFFFFF"}} onClick={()=>{this.props.goBack()}}>
<i className="fas fa-times"/> {this.props.t('cancel')}
<i className="fas fa-times"/> {t('cancel')}
</a>
</span>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/RequestFunds.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class RequestFunds extends React.Component {

render() {
let { canRequest, message, amount, requested } = this.state;
let {currencyDisplay,view,buttonStyle,ERC20TOKEN,address, changeView, t} = this.props
let {currencyDisplay, view, buttonStyle, ERC20TOKEN, address, changeView, t} = this.props
if(requested){

let url = window.location.protocol+"//"+window.location.hostname
Expand Down
4 changes: 2 additions & 2 deletions src/components/SendToAddress.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class SendToAddress extends React.Component {

send = async () => {
let { toAddress, amount } = this.state;
let { address, convertCurrency, currencyDisplay } = this.props
let { address, convertCurrency, currencyDisplay, t } = this.props

const displayCurrency = getStoredValue("currency", address);
amount = convertCurrency(amount, `USD/${displayCurrency}`);
Expand Down Expand Up @@ -238,7 +238,7 @@ class SendToAddress extends React.Component {
})
}
}else{
this.props.changeAlert({type: 'warning', message: this.props.t('send_to_address.error')})
this.props.changeAlert({type: 'warning', message: t('send_to_address.error')})
}
};

Expand Down
Loading

0 comments on commit e9138d1

Please sign in to comment.