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 * as SchemaTable from "~/common/schema-table"; import { css } from "@emotion/react"; import Section from "~/components/core/Section"; import ScenePage from "~/components/core/ScenePage"; const STYLES_GROUP = css` padding: 24px; `; const STYLES_TARGET = css` position: fixed; top: -1; left: -1; height: 1px; width: 1px; overflow: hidden; visibility: hidden; `; const STYLES_QR_CODE = css` background: ${Constants.system.white}; border-radius: 4px; max-width: 188px; width: 100%; padding: 4px; border: 1px solid ${Constants.system.border}; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07); `; const STYLES_QR_CODE_IMAGE = css` display: block; margin: 0; padding: 0; width: 100%; `; const STYLES_CIRCLE_BUTTON = css` height: 48px; width: 48px; border-radius: 48px; display: inline-flex; align-items: center; justify-content: center; background: ${Constants.system.black}; color: ${Constants.system.white}; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07); cursor: pointer; `; const STYLES_ROW = css` display: flex; align-items: flex-start; justify-content: space-between; padding: 24px; `; const STYLES_TEXT = css` min-width: 5%; padding-top: 6px; width: 100%; `; const STYLES_FOCUS = css` font-size: ${Constants.typescale.lvl1}; font-family: ${Constants.font.medium}; overflow-wrap: break-word; width: 100%; strong { font-family: ${Constants.font.semiBold}; font-weight: 400; } `; const STYLES_FOCUS_EMPAHSIS = css` color: ${Constants.system.brand}; `; const STYLES_SUBTEXT = css` margin-top: 8px; font-size: 12px; `; const STYLES_ACTIONS = css` flex-shrink: 0; padding-left: 24px; `; const STYLES_ITEM = css` margin-top: 24px; display: inline-flex; flex-direction: column; max-width: 220px; margin-right: 32px; `; const STYLES_ITEM_CLICKABLE = css` margin-top: 24px; display: inline-flex; flex-direction: column; max-width: 180px; margin-right: 32px; transition: 200ms ease color; :hover { cursor: pointer; color: ${Constants.system.brand}; } `; const STYLES_ITEM_GROUP = css` display: flex; align-items: flex-start; justify-content: flex-start; `; export default class SceneWallet extends React.Component { state = { table_transaction: null, visible: false }; _handleChange = (e) => { this.setState({ [e.target.name]: e.target.value }); }; _handleWalletChange = (e) => { this.setState({ visible: false }); this.props.onSelectedChange(e); }; _handleMakeAddressVisible = () => { this.setState({ visible: !this.state.visible }); }; _handleCopy = (text) => { Strings.copyText(text); alert(`${text} Added to clipboard.`); }; render() { let addresses = {}; let lastAddress; this.props.viewer.addresses.forEach((a) => { addresses[a.address] = a; lastAddress = a.address; }); const currentAddress = this.props.selected.address ? addresses[this.props.selected.address] : addresses[lastAddress]; // TODO(jim): // Capture this state. if (!currentAddress) { return null; } let transactions = []; if (currentAddress.transactions) { transactions = [...currentAddress.transactions]; } return ( Wallet
{this.state.visible ? ( currentAddress.address ) : ( Hidden )}
Filecoin address
{currentAddress.name}{" "} {this.props.viewer.settings_cold_default_address === currentAddress.address ? ( (Primary) ) : null}
Filecoin address alias
{Strings.formatNumber(currentAddress.balance)}
Filecoin
{currentAddress.type}
Address type
this.props.onAction({ name: "Send Filecoin", type: "SIDEBAR", value: "SIDEBAR_WALLET_SEND_FUNDS", }) } > Send Filecoin
this._handleCopy(currentAddress.address)} >
); } }