2020-07-07 08:35:49 +03:00
|
|
|
import * as React from "react";
|
|
|
|
import * as Constants from "~/common/constants";
|
|
|
|
|
2020-07-21 03:05:45 +03:00
|
|
|
import { Input } from "~/components/system/components/Input";
|
2020-08-02 22:17:13 +03:00
|
|
|
import { SelectMenu } from "~/components/system/components/SelectMenus";
|
2020-07-21 03:05:45 +03:00
|
|
|
import { CheckBox } from "~/components/system/components/CheckBox";
|
2020-08-02 22:17:13 +03:00
|
|
|
import { ButtonPrimary } from "~/components/system/components/Buttons";
|
2020-11-04 20:55:48 +03:00
|
|
|
import { css } from "@emotion/core";
|
2020-07-07 08:35:49 +03:00
|
|
|
|
|
|
|
const SELECT_MENU_OPTIONS = [
|
|
|
|
{ value: "1", name: "BLS" },
|
|
|
|
{ value: "2", name: "SECP256K1" },
|
|
|
|
// { value: '3', name: 'MULTISIG' },
|
|
|
|
];
|
|
|
|
|
|
|
|
const SELECT_MENU_MAP = {
|
|
|
|
"1": "BLS",
|
|
|
|
"2": "SECP256K1",
|
|
|
|
// '3': 'MULTISIG',
|
|
|
|
};
|
|
|
|
|
|
|
|
const SELECT_MENU_SAVE_STRINGS = {
|
|
|
|
"1": "bls",
|
|
|
|
"2": "secp256k1",
|
|
|
|
};
|
|
|
|
|
|
|
|
const STYLES_CONTAINER = css`
|
2020-07-10 08:03:37 +03:00
|
|
|
font-family: ${Constants.font.text};
|
|
|
|
box-sizing: border-box;
|
2020-07-07 08:35:49 +03:00
|
|
|
padding: 24px;
|
|
|
|
border-radius: 4px;
|
|
|
|
background-color: ${Constants.system.white};
|
|
|
|
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
|
|
|
|
border: 1px solid ${Constants.system.border};
|
|
|
|
max-width: 320px;
|
|
|
|
width: 100%;
|
|
|
|
`;
|
|
|
|
|
|
|
|
export class CreateFilecoinAddress extends React.Component {
|
|
|
|
state = { name: "", type: "1", makeDefault: false };
|
|
|
|
|
|
|
|
_handleChange = (e) => {
|
|
|
|
this.setState({ [e.target.name]: e.target.value });
|
|
|
|
};
|
|
|
|
|
|
|
|
_handleSubmit = () => {
|
|
|
|
this.props.onSubmit({
|
|
|
|
name: this.state.name,
|
|
|
|
type: SELECT_MENU_SAVE_STRINGS[this.state.type],
|
|
|
|
makeDefault: this.state.makeDefault,
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<div css={STYLES_CONTAINER}>
|
2020-07-20 10:07:21 +03:00
|
|
|
<Input
|
2020-07-07 08:35:49 +03:00
|
|
|
label="Address name"
|
|
|
|
name="name"
|
|
|
|
value={this.state.name}
|
|
|
|
onChange={this._handleChange}
|
|
|
|
/>
|
|
|
|
|
2020-07-20 10:07:21 +03:00
|
|
|
<SelectMenu
|
2020-07-07 08:35:49 +03:00
|
|
|
full
|
|
|
|
containerStyle={{ marginTop: 24 }}
|
|
|
|
name="type"
|
|
|
|
label="Address type"
|
|
|
|
value={this.state.type}
|
|
|
|
category="type adresss"
|
|
|
|
onChange={this._handleChange}
|
|
|
|
options={SELECT_MENU_OPTIONS}
|
2020-07-20 10:07:21 +03:00
|
|
|
/>
|
2020-07-07 08:35:49 +03:00
|
|
|
|
2020-07-20 10:07:21 +03:00
|
|
|
<CheckBox
|
2020-07-07 08:35:49 +03:00
|
|
|
style={{ marginTop: 24 }}
|
|
|
|
name="default"
|
|
|
|
value={this.state.default}
|
|
|
|
onChange={this._handleChange}
|
|
|
|
>
|
|
|
|
Make this wallet the default
|
2020-07-20 10:07:21 +03:00
|
|
|
</CheckBox>
|
2020-07-07 08:35:49 +03:00
|
|
|
|
2020-11-04 20:55:48 +03:00
|
|
|
<ButtonPrimary full style={{ marginTop: 48 }} onClick={this._handleSubmit}>
|
2020-07-07 08:35:49 +03:00
|
|
|
Create address
|
2020-08-02 22:17:13 +03:00
|
|
|
</ButtonPrimary>
|
2020-07-07 08:35:49 +03:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|