-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update video uploading page (#23)
* feat: add update video * fix: routing issue
- Loading branch information
Showing
11 changed files
with
659 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { useDropzone } from "react-dropzone"; | ||
import * as React from "react"; | ||
import { Box, CircularProgress, Stack, Typography } from "@mui/material"; | ||
|
||
type DropzoneProps = { | ||
file?: File; | ||
onFile: (file: File) => void; | ||
accept: string; | ||
loading: boolean; | ||
}; | ||
|
||
export function Dropzone(props: DropzoneProps) { | ||
const { getRootProps, getInputProps, isDragActive } = useDropzone({ | ||
onDrop: (acceptedFiles) => props.onFile(acceptedFiles[0]), | ||
}); | ||
const ref = React.useRef<HTMLInputElement>(null); | ||
|
||
return ( | ||
<div | ||
{...getRootProps()} | ||
style={{ | ||
width: "100%", | ||
height: 400, | ||
border: "1px dashed rgba(145, 158, 171, 0.32)", | ||
cursor: "pointer", | ||
borderRadius: 16, | ||
}} | ||
onClick={() => { | ||
ref.current?.click(); | ||
}} | ||
> | ||
<Box | ||
display={"flex"} | ||
justifyContent={"center"} | ||
alignItems={"center"} | ||
height={"100%"} | ||
width={"100%"} | ||
position={"relative"} | ||
> | ||
<Box> | ||
<Typography> | ||
{props.file ? props.file.name : "Drag file here or click to upload"} | ||
</Typography> | ||
</Box> | ||
{props.loading && ( | ||
<Box | ||
position={"absolute"} | ||
right={"50%"} | ||
top={"48%"} | ||
display={"flex"} | ||
justifyContent={"center"} | ||
alignItems={"center"} | ||
> | ||
<CircularProgress /> | ||
</Box> | ||
)} | ||
</Box> | ||
<input {...getInputProps()} ref={ref} accept={props.accept} /> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// @flow | ||
import * as React from "react"; | ||
import { styled } from "@mui/material/styles"; | ||
import VideoLibraryIcon from "@mui/icons-material/VideoLibrary"; | ||
import { Box, LinearProgress, Stack, Typography } from "@mui/material"; | ||
import prettyBytes from "pretty-bytes"; | ||
|
||
type Props = { | ||
progress: number; | ||
title: string; | ||
currentUploadBytes: number; | ||
totalUploadBytes: number; | ||
}; | ||
|
||
export const StyledProgressBar = styled(LinearProgress)(({ theme }) => ({ | ||
height: 100, | ||
color: "#1F94FF", | ||
backgroundColor: "#EFF1F3", | ||
borderRadius: 16, | ||
})); | ||
|
||
export function ProgressBar(props: Props) { | ||
return ( | ||
<Box position={"relative"}> | ||
<StyledProgressBar value={props.progress} variant={"determinate"} /> | ||
<Stack | ||
direction={"row"} | ||
position={"absolute"} | ||
top={"10%"} | ||
left={"10%"} | ||
spacing={4} | ||
> | ||
<VideoLibraryIcon sx={{ height: 60, width: 60, color: "#CECECE" }} /> | ||
<Stack justifyContent={"center"}> | ||
<Typography fontSize={14} color={"#CECECE"} fontWeight={"bold"}> | ||
{props.title} | ||
</Typography> | ||
<Typography fontSize={14} color={"#CECECE"}> | ||
{props.progress}% ({prettyBytes(props.currentUploadBytes)} / | ||
{prettyBytes(props.totalUploadBytes)}) | ||
</Typography> | ||
</Stack> | ||
</Stack> | ||
</Box> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
af3ce0c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
video-trading – ./
video-trading-git-main-etherdata-blockchain.vercel.app
video-trading-etherdata-blockchain.vercel.app
video-trading.vercel.app
www.video2.trade
video2.trade