Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
6bd9a8a
fix(account): change styling & add aeur tag
admrid May 10, 2019
ac8fb47
fix(Balance): delete unnec lines
admrid May 10, 2019
9497b67
fix(accpuntInfo): add currency tag & change styling
admrid May 14, 2019
2134360
fix(accpuntInfo): change styling of watchAsset btn
admrid May 14, 2019
418f356
fix(travis.yml): add runrecord to check test errors
admrid May 14, 2019
c4015a7
fix(travis.yml): change runrecord to run
admrid May 14, 2019
8f33ce1
fix(cypress): change tests to work w currency tags
admrid May 15, 2019
c3e5f92
fix(cypress): test
admrid May 15, 2019
f4286e8
fix(topNav, accountInfo): add currency tabs & styling etc.
admrid May 15, 2019
c61a689
fix(topNav, accountInfo): add minor styling changes
admrid May 15, 2019
328925f
fix(topNav, accountInfo): add copy func to acc address
admrid May 15, 2019
e5e9593
Merge branch 'staging' into aeurtag
phraktle May 15, 2019
5593641
fix(topNav, accountInfo): fix noscroll
admrid May 16, 2019
799bf3e
fix(topNav, sideNav, navigation): add cursor pointer
admrid May 16, 2019
4f85de9
Merge branch 'aeurtag' of https://github.com/Augmint/augmint-web into…
admrid May 16, 2019
e7634c7
fix(topNav): minor style fixes
admrid May 16, 2019
34a61be
fix(topNav): add Balance label
admrid May 16, 2019
ccfa677
fix(topNav, userBalances): minor css tweaks & change userBalance init…
admrid May 16, 2019
31c38ef
fix(Balance): add acc address & minor style fixies
admrid May 17, 2019
e1d4777
Merge branch 'staging' into aeurtag
phraktle May 17, 2019
d903ff9
Merge branch 'staging' into aeurtag
phraktle May 18, 2019
8a24144
feat(accountAddress, Balance): add acc copy feat to Balance module
admrid May 21, 2019
3a426a1
Merge branch 'staging' into aeurtag
admrid May 22, 2019
986f8a5
fix(accountAddress): convert to class component
admrid May 22, 2019
af3247c
fix(accountAddress): make it statful
admrid May 23, 2019
c489665
feat(button): add variations to button
admrid May 27, 2019
e0b83d4
feat(Balance): make it deploy ready
admrid May 28, 2019
9aa5182
fix(accountAddress): make logic better
admrid May 28, 2019
4c79c23
Merge branch 'staging' into aeurtag
admrid May 28, 2019
2cd666d
feat(NetworkAlert): add component
admrid May 29, 2019
739bd75
feat(augmintToken): add BTN to link to /under-the-hood
admrid May 29, 2019
87e06c4
feat(topNav): delete network link
admrid May 29, 2019
5ba8bbd
Merge branch 'aeurtag' of https://github.com/Augmint/augmint-web into…
admrid May 29, 2019
62870df
fix(topNav): change ETH decimals back to 4
admrid May 29, 2019
bccbc7e
fix(cypress): add btn to test
admrid May 29, 2019
66e7a8a
fix(Balance): set previous layout for this PR
admrid May 29, 2019
4f78902
Merge branch 'staging' into aeurtag
phraktle May 30, 2019
cbc7fe5
Merge branch 'staging' into aeurtag
phraktle May 30, 2019
fb0caa8
feat(topNav): minor style changes
admrid May 30, 2019
f4a48d2
Merge branch 'aeurtag' of https://github.com/Augmint/augmint-web into…
admrid May 30, 2019
13a0711
feat(topNav): minor style tweaks
admrid May 30, 2019
3eb90f7
feat(topNav): make Victor happy & delete unnec styling
admrid May 31, 2019
1fc442a
fix(topNav): pushing pixels one final time
admrid May 31, 2019
96461ac
fix(Balance): change displayed ETH decimals to default(5)
admrid Jun 3, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cypress/integration/augmintbasic.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe("Augmint base", function() {
it("Under the hood", function() {
cy.get("[data-testid=reservesMenuLink]").click();
cy.get("[data-testid=underTheHoodLink]").click();

cy.get("[data-testid=baseInfoLink]").click();
Expand Down
14 changes: 7 additions & 7 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,22 +132,22 @@ Cypress.Commands.add("getUserEthBalance", (account, options = {}) => {
Cypress.Commands.add("assertUserAEurBalanceOnUI", (balance, options = {}) => {
cy.get("[data-testid=accountInfoBlock]").should("not.have.class", "loading");

const decimals = 2;
const fmt = new Intl.NumberFormat("en", { minimumFractionDigits: decimals, maximumFractionDigits: decimals });

cy.get("[data-testid=userAEurBalance]")
.invoke("text")
.should("equal", balance.toFixed(2));
.should("equal", fmt.format(balance) + " A€");
});

// assert user balance on UI.
Cypress.Commands.add("assertUserEthBalanceOnUI", (_expectedEth, decimals = 12, options = {}) => {
const expectedEth = Number(_expectedEth.toFixed(decimals));
Cypress.Commands.add("assertUserEthBalanceOnUI", (_expectedEth, decimals = 13, options = {}) => {
const fmt = new Intl.NumberFormat("en", { minimumFractionDigits: decimals, maximumFractionDigits: decimals });
cy.get("[data-testid=accountInfoBlock]").should("not.have.class", "loading");

cy.get("[data-testid=userEthBalance]")
.invoke("text")
.should(val => {
// TODO: this throws a lot of console warnings
expect(Number(val)).to.be.approximately(expectedEth, 1 / 10 ** decimals);
});
.should("contain", fmt.format(_expectedEth));
});

// issue AEUR to account
Expand Down
5 changes: 0 additions & 5 deletions src/assets/images/close-black.svg

This file was deleted.

3 changes: 3 additions & 0 deletions src/assets/images/close-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
136 changes: 103 additions & 33 deletions src/components/accountAddress/index.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,39 @@
import React from "react";
import Icon from "components/augmint-ui/icon";
import Button from "components/augmint-ui/button";

import { shortAccountAddresConverter } from "utils/converter";
import { StyledContainer, StyledClicked, StyledHint } from "./styles";

export default function AccountAddress(props) {
const { address, showCopyIcon, title, shortAddress } = props;
const _title = title !== undefined ? title : "Account: ";

function copyAddress(e) {
let element = e.target;
if (element.attributes.name && element.attributes.name.nodeValue === "copy") {
element = element.parentElement;
}
element.classList.add("clicked");
import { StyledContainer, StyledClicked, StyledHint, StyledHintBtn } from "./styles";

export default class AccountAddress extends React.Component {
constructor(props) {
super(props);
this.showHint = this.showHint.bind(this);
this.hideHint = this.hideHint.bind(this);
this.copyAddress = this.copyAddress.bind(this);
this.state = {
showHint: false
};
}

showHint(timeout) {
this.setState({ showHint: true });
this.copyAddress();
timeout &&
setTimeout(() => {
this.hideHint();
}, 2000);
}

hideHint() {
this.setState({
showHint: false
});
}

copyAddress(e) {
const el = document.createElement("textarea");
el.value = address;
el.value = this.props.address;
el.setAttribute("readonly", "");
el.style.position = "absolute";
el.style.left = "-9999px";
Expand All @@ -25,25 +43,77 @@ export default function AccountAddress(props) {
document.body.removeChild(el);
}

function removeClicked(e) {
let element = e.target;
if (element.attributes.name && element.attributes.name.nodeValue === "copy") {
element = element.parentElement;
}
element.classList.remove("clicked");
}
render() {
const { address, showCopyIcon, title, shortAddress, className, showCopyLink } = this.props;
const _title = title !== undefined ? title : "Account: ";
const _className = this.state.showHint ? className + " showHint" : className;
const ShortAddress = () => _title + (shortAddress === true ? shortAccountAddresConverter(address) : address);

const ContainerWBtn = () => {
return (
<StyledContainer className={className + " container"}>
<ShortAddress />
{showCopyIcon && (
<Icon
name="copy"
style={{ paddingLeft: 5 }}
onClick={e => this.showHint(true)}
onMouseLeave={e => this.hideHint()}
/>
)}
<Button
content="Copy"
data-testid="loansToCollectButton"
onClick={e => this.showHint(true)}
icon="copy"
labelposition="left"
iconsize="small"
style={{ marginTop: "10px", marginBottom: "20px" }}
className="ghost naked icon left"
/>
<Button
content="Copy"
data-testid="loansToCollectButton"
onClick={e => this.showHint(true)}
icon="copy"
labelposition="left"
style={{ marginBottom: "20px" }}
className="grey icon left"
/>
<StyledHintBtn className={_className} id="StyledHinBtn">
<Icon name="check" style={{ marginRight: "5px", color: "green" }} />
Copied!
</StyledHintBtn>
</StyledContainer>
);
};

return (
<StyledContainer onClick={copyAddress} onMouseLeave={removeClicked}>
{_title + (shortAddress === true ? shortAccountAddresConverter(address) : address)}
{showCopyIcon && (
<Icon name="copy" style={{ paddingLeft: 5 }} onClick={copyAddress} onMouseLeave={removeClicked} />
)}
<StyledHint>
<StyledClicked>
<Icon name="check" />
</StyledClicked>
</StyledHint>
</StyledContainer>
);
const ContainerWHint = () => {
return (
<StyledContainer
onClick={e => this.showHint(true)}
onMouseLeave={e => this.hideHint()}
className={_className}
id="StyledContainer"
>
<ShortAddress />
{showCopyIcon && (
<Icon
name="copy"
style={{ paddingLeft: 5 }}
onClick={e => this.showHint(true)}
onMouseLeave={e => this.hideHint()}
/>
)}
<StyledHint>
<StyledClicked>
<Icon name="check" />
</StyledClicked>
</StyledHint>
</StyledContainer>
);
};

return <div>{showCopyLink ? <ContainerWBtn /> : <ContainerWHint />}</div>;
}
}
56 changes: 53 additions & 3 deletions src/components/accountAddress/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,26 @@ export const StyledHint = styled.span`
&::after {
content: "Click to copy!";
}

&.noHint {
display: none;
}
`;

export const StyledContainer = styled.div`
cursor: pointer;
display: inline-block;
font-weight: 400;

&.container {
position: relative;
}

&.noClick {
cursor: default;
}

&.clicked ${StyledClicked} {
&.showHint ${StyledClicked} {
display: inline-block;
padding-right: 5px;
}
Expand All @@ -34,12 +47,49 @@ export const StyledContainer = styled.div`
display: block;
}

&.clicked:hover ${StyledHint} {
&.showHint:hover ${StyledHint} {
display: block;

&::after {
color: ${theme.colors.darkGreen};
color: ${theme.colors.lightGreen};
content: "Copied!";
}
}

&.breakToLines {
&.onMobile {
@media (max-width: 600px) {
display: block;
max-width: 260px;
}
}
&.always {
display: block;
max-width: 210px;
margin: auto;
}
}

&.bold {
font-weight: 700;
}

&.font {
font-family: ${theme.typography.fontFamilies.currency};
}
`;

export const StyledHintBtn = styled.div`
font-family: ${theme.typography.fontFamilies.default};
display: none;

&.showHint {
display: block;
background-color: white;
border-radius: 3px;
padding: 10px 20px;
position: absolute;
left: 45px;
top: 42px;
}
`;
43 changes: 33 additions & 10 deletions src/components/accountInfo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ import { Link } from "react-router-dom";
import { ConnectionStatus } from "components/MsgPanels";
import AccountAddress from "components/accountAddress";
import { StyledAccountInfo, StyledAccountDiv, StyledAccInfoLink } from "./styles";
import { AEUR, ETH } from "components/augmint-ui/currencies";
import { ETHEUR } from "utils/constants";
import Icon from "components/augmint-ui/icon";
import WatchAssetButton from "components/watchAssetButton.js";
import WatchAssetButton from "components/watchAssetButton";
import { default as theme } from "styles/theme";

export class AccountInfo extends React.Component {
render() {
Expand Down Expand Up @@ -33,27 +36,47 @@ export class AccountInfo extends React.Component {
>
<ConnectionStatus contract={augmintToken} />
<StyledAccountDiv>
Account address:
<div style={{ margin: "0px" }}>
<span style={{ fontWeight: "normal" }}>Account address:</span>
<div
style={{
margin: "0px",
fontFamily: theme.typography.fontFamilies.currency,
overflowWrap: "break-word"
}}
>
<AccountAddress
address={data.account.address}
showCopyIcon="true"
title=""
style={{ fontWeight: "lighter" }}
className={"breakToLines onMobile bold"}
/>
</div>
</StyledAccountDiv>
<br />
<StyledAccountDiv>
Balance:
<div style={{ margin: "0px" }}>
ETH: <span data-testid={!hideTestId && "userEthBalance"}>{data.account.ethBalance}</span>
<span style={{ fontWeight: "normal" }}>Balance:</span>
<div>
<AEUR
amount={data.account.tokenBalance}
data-testid={!hideTestId && "userAEurBalance"}
style={{ fontFamily: theme.typography.fontFamilies.currency }}
/>
</div>
<div>
A-EUR: <span data-testid={!hideTestId && "userAEurBalance"}>{data.account.tokenBalance}</span>
<ETH
amount={data.account.ethBalance}
data-testid={!hideTestId && "userEthBalance"}
decimals={15}
style={{ fontFamily: theme.typography.fontFamilies.currency }}
/>
</div>
</StyledAccountDiv>
<StyledAccountDiv className="accInfoDetail">€/ETH {data.rates.info.ethFiatRate}</StyledAccountDiv>
<StyledAccountDiv className="accInfoDetail">
<span style={{ fontWeight: "normal" }}>{ETHEUR}: </span>
<span style={{ fontFamily: theme.typography.fontFamilies.currency, fontWeight: "700" }}>
{data.rates.info.ethFiatRate}
</span>
</StyledAccountDiv>
<StyledAccInfoLink
title="Under the hood"
to="/under-the-hood"
Expand All @@ -63,7 +86,7 @@ export class AccountInfo extends React.Component {
{data.web3Connect.network.name}
</StyledAccInfoLink>

<WatchAssetButton />
<WatchAssetButton className={"accInfo"} />

{showMyAccountLink && <Link to="/account">More details</Link>}
</StyledAccountInfo>
Expand Down
Loading