import * as React from "react"; import * as Actions from "~/common/actions"; import * as System from "~/components/system"; import { css } from "@emotion/react"; import ScenePage from "~/components/core/ScenePage"; const STYLES_GROUP = css` display: flex; align-items: center; justify-content: space-between; `; const STYLES_SUBGROUP = css` padding-left: 24px; `; const STYLES_LEFT = css` flex-shrink: 0; padding: 12px 0 0 0; min-width: 480px; `; const STYLES_RIGHT = css` min-width: 10%; padding-left: 48px; padding-top: 24px; width: 100%; `; export default class SceneSettings extends React.Component { _deferredSave = null; _handleSave = async () => { await Actions.setDefaultConfig({ config: { hot: { enabled: this.props.viewer.settings_cold_enabled, allowUnfreeze: this.props.viewer.settings_hot_allow_unfreeze, ipfs: { addTimeout: this.props.viewer.settings_hot_ipfs_add_timeout, }, }, cold: { enabled: this.props.viewer.settings_cold_enabled, filecoin: { addr: this.props.viewer.settings_cold_default_address, dealMinDuration: this.props.viewer.settings_cold_default_duration, repFactor: this.props.viewer .settings_cold_default_replication_factor, excludedMinersList: this.props.viewer .settings_cold_default_excluded_miners, trustedMinersList: this.props.viewer .settings_cold_default_trusted_miners, maxPrice: this.props.viewer.settings_cold_default_max_price, renew: { enabled: this.props.viewer.settings_cold_default_auto_renew, threshold: this.props.viewer .settings_cold_default_auto_renew_max_price, }, }, }, }, }); }; _handleChange = (e) => { window.clearTimeout(this._deferredSave); this._deferredSave = null; this.props.onViewerChange(e); this._deferredSave = window.setTimeout(async () => { await this._handleSave(); }, 2000); }; render() { let addresses = {}; this.props.viewer.addresses.forEach((a) => { addresses[a.address] = a; }); const currentAddress = addresses[this.props.viewer.settings_cold_default_address]; return ( Settings Storage defaults
{this.props.viewer.settings_cold_enabled ? (
{currentAddress ? currentAddress.name : "None"} Enable auto renew for Filecoin Network deals.
) : null}
{this.props.viewer.settings_hot_enabled ? (
IPFS allow unfreeze setting description.
) : null}
); } } /* {SELECT_MENU_MAP[this.props.viewer.settings_deal_country]} */