diff --git a/packages/siaviewnode-client/pages/index.tsx b/packages/siaviewnode-client/pages/index.tsx index 8e4865de..71a90248 100644 --- a/packages/siaviewnode-client/pages/index.tsx +++ b/packages/siaviewnode-client/pages/index.tsx @@ -7,9 +7,14 @@ import { Typography, CardActions, Button, - makeStyles + makeStyles, + AppBar, + Tabs, + Tab } from "@material-ui/core" import Dropzone from "../src/components/Dropzone" +import { useState } from "react" +import { TabPanel } from "../src/components/TabPanel" const useStyles = makeStyles({ card: { @@ -30,14 +35,18 @@ const useStyles = makeStyles({ const Index = () => { const classes = useStyles({}) - const bull = • + const [value, setValue] = useState(0) + + const handleChange = (event, newValue) => { + setValue(newValue) + } return ( <> - Sia View Node + Sia View Node @@ -47,19 +56,35 @@ const Index = () => { - - - - + + + - Drop Your File Here: - - - - + + + + + + + + + + + + + + + + + + + + + > ) diff --git a/packages/siaviewnode-client/src/components/Dropzone.tsx b/packages/siaviewnode-client/src/components/Dropzone.tsx index 07b41d04..de511f27 100644 --- a/packages/siaviewnode-client/src/components/Dropzone.tsx +++ b/packages/siaviewnode-client/src/components/Dropzone.tsx @@ -25,34 +25,23 @@ function MyDropzone() { acceptedFiles => { setLoading(true) const file = R.head(acceptedFiles) - const fd = new FormData(formRef.current) - const fileName = R.compose(splitFilename, pName)(file) + const url = API_ENDPOINT + "/linkfile/upload" + console.log("file is", file) - const url = API_ENDPOINT + "/siafile" - - // formRef.current.submit() - - // fetch(url, { - // method: "POST", - // body: fd, - // credentials: "include" - // }) - // .then(res => { - // return res.headers - // }) - // .then(headers => { - // console.log("WE OUT HERE BOYS", document.cookie) - // fetch(API_ENDPOINT + "/siafile/download", { - // credentials: "include" - // }) - // .then(res => res.blob()) - // .then(blob => saveAs(blob, fileName)) - // // saveAs(API_ENDPOINT + "/siafile/download", fileName) - // }) - // .catch(e => { - // console.log("error is", e) - // setLoading(false) - // }) + fetch(url, { + method: "POST", + body: file + }) + .then(res => { + return res.json() + }) + .then(data => { + console.log("WE OUT HERE BOYS", data) + }) + .catch(e => { + console.log("error is", e) + setLoading(false) + }) }, [loading, setLoading, error, setError, formRef] ) @@ -62,18 +51,15 @@ function MyDropzone() { return ( - - - Download - + + {isDragActive ? ( + Drop file here ... + ) : ( + Drag 'n' drop a file here, or click to select a file + )} ) diff --git a/packages/siaviewnode-server/src/main.ts b/packages/siaviewnode-server/src/main.ts index e557edf4..1ab2b18d 100644 --- a/packages/siaviewnode-server/src/main.ts +++ b/packages/siaviewnode-server/src/main.ts @@ -64,11 +64,8 @@ export class Server { }) ) this.app.post("/siafile", this.postSiaFile) - this.app.get("/siafile/download", this.downloadSiaFile) } - private async downloadSiaFile(req, res) {} - private async postSiaFile( req: express.Request & any, res: express.Response
Drop file here ...
Drag 'n' drop a file here, or click to select a file