2020-04-09 00:29:13 +03:00
|
|
|
import * as React from "react";
|
|
|
|
import * as Strings from "~/common/strings";
|
|
|
|
import * as Constants from "~/common/constants";
|
|
|
|
import * as SVG from "~/components/system/svg";
|
|
|
|
import * as System from "~/components/system";
|
|
|
|
|
|
|
|
import { css } from "@emotion/react";
|
|
|
|
|
|
|
|
const STYLES_FOCUS = css`
|
|
|
|
font-size: ${Constants.typescale.lvl1};
|
2020-07-02 11:24:14 +03:00
|
|
|
font-family: ${Constants.font.medium};
|
2020-04-09 00:29:13 +03:00
|
|
|
overflow-wrap: break-word;
|
|
|
|
width: 100%;
|
|
|
|
|
|
|
|
strong {
|
2020-07-02 11:24:14 +03:00
|
|
|
font-family: ${Constants.font.semiBold};
|
2020-04-09 00:29:13 +03:00
|
|
|
font-weight: 400;
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
const STYLES_SUBTEXT = css`
|
|
|
|
margin-top: 8px;
|
|
|
|
font-size: 12px;
|
|
|
|
`;
|
|
|
|
|
|
|
|
const STYLES_ITEM = css`
|
|
|
|
margin-top: 16px;
|
|
|
|
`;
|
|
|
|
|
|
|
|
export default class SidebarCreatePaymentChannel extends React.Component {
|
|
|
|
state = { address: "", amount: "" };
|
|
|
|
|
|
|
|
_handleSubmit = () => {
|
|
|
|
alert("TODO: Create a new payment channel");
|
|
|
|
this.props.onSubmit({});
|
|
|
|
};
|
|
|
|
|
|
|
|
_handleCancel = () => {
|
|
|
|
this.props.onCancel();
|
|
|
|
};
|
|
|
|
|
|
|
|
_handleChange = (e) => {
|
|
|
|
this.setState({ [e.target.name]: e.target.value });
|
|
|
|
};
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<React.Fragment>
|
2020-07-02 11:24:14 +03:00
|
|
|
<System.P style={{ fontFamily: Constants.font.semiBold }}>
|
2020-04-09 00:29:13 +03:00
|
|
|
Create a payment channel
|
|
|
|
</System.P>
|
|
|
|
|
2020-07-05 09:13:13 +03:00
|
|
|
<System.SelectMenu
|
|
|
|
full
|
2020-04-09 00:29:13 +03:00
|
|
|
containerStyle={{ marginTop: 24 }}
|
|
|
|
name="address"
|
|
|
|
label="From"
|
|
|
|
value={this.props.selected.address}
|
|
|
|
category="address"
|
|
|
|
onChange={this.props.onSelectedChange}
|
|
|
|
options={this.props.viewer.addresses}
|
2020-07-16 05:45:23 +03:00
|
|
|
/>
|
2020-04-09 00:29:13 +03:00
|
|
|
|
|
|
|
<System.Input
|
|
|
|
containerStyle={{ marginTop: 24 }}
|
|
|
|
label="To"
|
|
|
|
name="address"
|
|
|
|
value={this.state.address}
|
|
|
|
onChange={this._handleChange}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<System.Input
|
|
|
|
containerStyle={{ marginTop: 24 }}
|
|
|
|
label="Amount (Filecoin)"
|
|
|
|
name="amount"
|
|
|
|
value={this.state.amount}
|
|
|
|
onChange={this._handleChange}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<div css={STYLES_ITEM}>
|
|
|
|
<div css={STYLES_FOCUS}>2 FIL</div>
|
|
|
|
<div css={STYLES_SUBTEXT}>Transaction Fee</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div css={STYLES_ITEM}>
|
|
|
|
<div css={STYLES_FOCUS}>2</div>
|
|
|
|
<div css={STYLES_SUBTEXT}>Total Filecoin</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<System.ButtonPrimaryFull
|
|
|
|
style={{ marginTop: 48 }}
|
|
|
|
onClick={this._handleSubmit}
|
|
|
|
>
|
|
|
|
Send
|
|
|
|
</System.ButtonPrimaryFull>
|
|
|
|
</React.Fragment>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|