Changeset View
Changeset View
Standalone View
Standalone View
web/cashtab/src/components/Tokens/CreateTokenForm.js
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | const handleNewTokenTickerInput = e => { | ||||
const { value } = e.target; | const { value } = e.target; | ||||
// validation | // validation | ||||
setNewTokenTickerIsValid(isValidTokenTicker(value)); | setNewTokenTickerIsValid(isValidTokenTicker(value)); | ||||
setNewTokenTicker(value); | setNewTokenTicker(value); | ||||
}; | }; | ||||
// New Token Decimals | // New Token Decimals | ||||
const [newTokenDecimals, setNewTokenDecimals] = useState(0); | const [newTokenDecimals, setNewTokenDecimals] = useState(0); | ||||
const [newTokenDecimalsIsValid, setNewTokenDecimalsIsValid] = useState( | const [newTokenDecimalsIsValid, setNewTokenDecimalsIsValid] = | ||||
true, | useState(true); | ||||
); | |||||
const handleNewTokenDecimalsInput = e => { | const handleNewTokenDecimalsInput = e => { | ||||
const { value } = e.target; | const { value } = e.target; | ||||
// validation | // validation | ||||
setNewTokenDecimalsIsValid(isValidTokenDecimals(value)); | setNewTokenDecimalsIsValid(isValidTokenDecimals(value)); | ||||
// Also validate the supply here if it has not yet been set | // Also validate the supply here if it has not yet been set | ||||
if (newTokenInitialQtyIsValid !== null) { | if (newTokenInitialQtyIsValid !== null) { | ||||
setNewTokenInitialQtyIsValid( | setNewTokenInitialQtyIsValid( | ||||
isValidTokenInitialQty(value, newTokenDecimals), | isValidTokenInitialQty(value, newTokenDecimals), | ||||
); | ); | ||||
} | } | ||||
setNewTokenDecimals(value); | setNewTokenDecimals(value); | ||||
}; | }; | ||||
// New Token Initial Quantity | // New Token Initial Quantity | ||||
const [newTokenInitialQty, setNewTokenInitialQty] = useState(''); | const [newTokenInitialQty, setNewTokenInitialQty] = useState(''); | ||||
const [newTokenInitialQtyIsValid, setNewTokenInitialQtyIsValid] = useState( | const [newTokenInitialQtyIsValid, setNewTokenInitialQtyIsValid] = | ||||
null, | useState(null); | ||||
); | |||||
const handleNewTokenInitialQtyInput = e => { | const handleNewTokenInitialQtyInput = e => { | ||||
const { value } = e.target; | const { value } = e.target; | ||||
// validation | // validation | ||||
setNewTokenInitialQtyIsValid( | setNewTokenInitialQtyIsValid( | ||||
isValidTokenInitialQty(value, newTokenDecimals), | isValidTokenInitialQty(value, newTokenDecimals), | ||||
); | ); | ||||
setNewTokenInitialQty(value); | setNewTokenInitialQty(value); | ||||
}; | }; | ||||
// New Token document URL | // New Token document URL | ||||
const [newTokenDocumentUrl, setNewTokenDocumentUrl] = useState(''); | const [newTokenDocumentUrl, setNewTokenDocumentUrl] = useState(''); | ||||
// Start with this as true, field is not required | // Start with this as true, field is not required | ||||
const [ | const [newTokenDocumentUrlIsValid, setNewTokenDocumentUrlIsValid] = | ||||
newTokenDocumentUrlIsValid, | useState(true); | ||||
setNewTokenDocumentUrlIsValid, | |||||
] = useState(true); | |||||
const handleNewTokenDocumentUrlInput = e => { | const handleNewTokenDocumentUrlInput = e => { | ||||
const { value } = e.target; | const { value } = e.target; | ||||
// validation | // validation | ||||
setNewTokenDocumentUrlIsValid(isValidTokenDocumentUrl(value)); | setNewTokenDocumentUrlIsValid(isValidTokenDocumentUrl(value)); | ||||
setNewTokenDocumentUrl(value); | setNewTokenDocumentUrl(value); | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 116 Lines • ▼ Show 20 Lines | return ( | ||||
<> | <> | ||||
<TokenCollapse | <TokenCollapse | ||||
collapsible={disabled ? 'disabled' : true} | collapsible={disabled ? 'disabled' : true} | ||||
disabled={disabled} | disabled={disabled} | ||||
style={{ | style={{ | ||||
marginBottom: '24px', | marginBottom: '24px', | ||||
}} | }} | ||||
> | > | ||||
<Panel header="Create Token" key="1"> | <Panel header="Create eToken" key="1"> | ||||
<AntdFormWrapper> | <AntdFormWrapper> | ||||
<Form | <Form | ||||
size="small" | size="small" | ||||
style={{ | style={{ | ||||
width: 'auto', | width: 'auto', | ||||
}} | }} | ||||
> | > | ||||
<Form.Item | <Form.Item | ||||
▲ Show 20 Lines • Show All 120 Lines • ▼ Show 20 Lines | return ( | ||||
</Form.Item> | </Form.Item> | ||||
</Form> | </Form> | ||||
</AntdFormWrapper> | </AntdFormWrapper> | ||||
<SmartButton | <SmartButton | ||||
onClick={() => setShowConfirmCreateToken(true)} | onClick={() => setShowConfirmCreateToken(true)} | ||||
disabled={!tokenGenesisDataIsValid} | disabled={!tokenGenesisDataIsValid} | ||||
> | > | ||||
<PlusSquareOutlined /> | <PlusSquareOutlined /> | ||||
Create Token | Create eToken | ||||
</SmartButton> | </SmartButton> | ||||
</Panel> | </Panel> | ||||
</TokenCollapse> | </TokenCollapse> | ||||
</> | </> | ||||
</> | </> | ||||
); | ); | ||||
}; | }; | ||||
Show All 22 Lines |