diff --git a/webapp/src/containers/TokensPage/components/CreateToken/index.tsx b/webapp/src/containers/TokensPage/components/CreateToken/index.tsx new file mode 100644 index 000000000..dcb35acc0 --- /dev/null +++ b/webapp/src/containers/TokensPage/components/CreateToken/index.tsx @@ -0,0 +1,86 @@ +import React, { useState } from 'react'; +import { connect } from 'react-redux'; +import { RouteComponentProps } from 'react-router-dom'; +import { TabContent, TabPane } from 'reactstrap'; + +import DCTDistribution from './DCTDistribution'; +import CreateDCT from './CreateDCT'; +import { createToken } from '../../reducer'; +import { CREATE_DCT, DCT_DISTRIBUTION } from '../../../../constants'; + +interface CreateTokenProps extends RouteComponentProps { + createToken: (tokenData) => void; +} + +const CreateToken: React.FunctionComponent = ( + props: CreateTokenProps +) => { + const [activeTab, setActiveTab] = useState(CREATE_DCT); + const [formState, setFormState] = useState({ + nameLabel: '', + tickerSymbol: '', + divisibility: '8', + initialSupply: '', + mintingSupport: 'no', + optionalFinalSupplyLimit: '', + tradable: 'no', + }); + const [csvData, setCsvData] = React.useState([]); + + const { createToken } = props; + + const handleSubmit = () => { + const tokenData = { ...formState, collateralAddresses: csvData }; + createToken(tokenData); + }; + + const handleChange = (e) => { + setFormState({ + ...formState, + [e.target.name]: e.target.value, + }); + }; + + const handleActiveTab = (active: string) => { + setActiveTab(active); + }; + + return ( + + +
+ +
+
+ +
+ +
+
+
+ ); +}; + +const mapStateToProps = (state) => { + const { tokens } = state; + return { + isTokenCreating: tokens.isTokenCreating, + createdTokenData: tokens.createdTokenData, + isErrorCreatingToken: tokens.isErrorCreatingToken, + }; +}; + +const mapDispatchToProps = { + createToken: (tokenData) => createToken({ tokenData }), +}; + +export default connect(mapStateToProps, mapDispatchToProps)(CreateToken);