import { Row, Col, Card, Typography, Upload, Space } from 'antd' import IonIcon from '@sentre/antd-ionicon' import { useRootDispatch, RootDispatch } from 'store' import { installManifest } from 'store/register.reducer' import { installApp } from 'store/user.reducer' import { useWalletAddress } from 'hooks/useWallet' const Sandbox = () => { const dispatch = useRootDispatch() const walletAddress = useWalletAddress() const upload = async (file: File) => { const reader = new FileReader() reader.onload = async (e) => { const data: ComponentManifest = JSON.parse(e.target?.result as string) const manifest: DAppManifest = { ...data, author: { ...data.author, walletAddress }, createdAt: new Date().toISOString(), updatedAt: new Date().toISOString(), } try { await dispatch(installManifest(manifest)).unwrap() await dispatch(installApp(manifest.appId)).unwrap() return window.notify({ type: 'success', description: 'The DApp has been added to your workspace.', }) } catch (er: any) { return window.notify({ type: 'warning', description: er.message }) } } reader.readAsText(file) return false } return ( Sandbox null} className="sandbox" > Drop the DApp's manifest here ) } export default Sandbox