2020-08-28 09:57:04 +03:00
|
|
|
import * as React from "react";
|
|
|
|
import * as Strings from "~/common/strings";
|
|
|
|
import * as Constants from "~/common/constants";
|
|
|
|
import * as Actions from "~/common/actions";
|
2020-09-05 02:15:29 +03:00
|
|
|
import * as SVG from "~/common/svg";
|
2020-08-28 09:57:04 +03:00
|
|
|
import * as System from "~/components/system";
|
|
|
|
|
|
|
|
import { css } from "@emotion/react";
|
2020-09-12 01:25:33 +03:00
|
|
|
import { dispatchCustomEvent } from "~/common/custom-events";
|
2020-08-28 09:57:04 +03:00
|
|
|
|
|
|
|
export default class SidebarFilecoinArchive extends React.Component {
|
2020-09-18 04:18:42 +03:00
|
|
|
state = { response: null };
|
2020-09-09 20:56:35 +03:00
|
|
|
|
2020-08-28 09:57:04 +03:00
|
|
|
async componentDidMount() {}
|
|
|
|
|
|
|
|
_handleMakeDeal = async () => {
|
|
|
|
const response = await Actions.archive();
|
2020-09-09 20:56:35 +03:00
|
|
|
|
2020-09-18 04:18:42 +03:00
|
|
|
alert("A new Filecoin deal is being processed.");
|
2020-08-28 09:57:04 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
_handleSubmit = async (e) => {
|
|
|
|
if (e) {
|
|
|
|
e.persist();
|
|
|
|
}
|
|
|
|
|
|
|
|
this.props.onSidebarLoading(true);
|
|
|
|
await this._handleMakeDeal();
|
2020-09-09 20:56:35 +03:00
|
|
|
await this.props.onRehydrate();
|
|
|
|
this.props.onSidebarLoading(false);
|
2020-08-28 09:57:04 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
_handleCancel = () => {
|
|
|
|
this.props.onCancel();
|
|
|
|
};
|
|
|
|
|
|
|
|
_handleChange = (e) => {
|
|
|
|
this.setState({ [e.target.name]: e.target.value });
|
|
|
|
};
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<React.Fragment>
|
2020-09-08 02:28:50 +03:00
|
|
|
<System.P
|
|
|
|
style={{
|
|
|
|
fontFamily: Constants.font.semiBold,
|
|
|
|
fontSize: Constants.typescale.lvl3,
|
|
|
|
}}
|
|
|
|
>
|
2020-08-28 09:57:04 +03:00
|
|
|
Make Filecoin storage deal
|
|
|
|
</System.P>
|
|
|
|
|
|
|
|
<System.P style={{ marginTop: 24 }}>
|
|
|
|
This will archive all of your data onto the Filecoin Network.
|
|
|
|
</System.P>
|
|
|
|
|
|
|
|
<System.ButtonPrimary
|
|
|
|
full
|
|
|
|
style={{ marginTop: 48 }}
|
|
|
|
onClick={this._handleSubmit}
|
|
|
|
loading={this.props.sidebarLoading}
|
|
|
|
>
|
|
|
|
Make storage deal
|
|
|
|
</System.ButtonPrimary>
|
2020-09-09 20:56:35 +03:00
|
|
|
|
2020-09-18 04:18:42 +03:00
|
|
|
{this.state.response ? (
|
|
|
|
<div style={{ whiteSpace: "pre-wrap", marginTop: 48 }}>
|
|
|
|
{JSON.stringify(this.state.response, null, 2)}
|
|
|
|
</div>
|
|
|
|
) : null}
|
2020-08-28 09:57:04 +03:00
|
|
|
</React.Fragment>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|