mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-11 03:24:16 +00:00
use progress bar to show uploads stus
This commit is contained in:
parent
f8cd98d372
commit
4f78dc88f2
@ -207,6 +207,19 @@ const FileListItem = (props) => {
|
|||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<div className={classnames(
|
||||||
|
"fileListItem_progress",
|
||||||
|
{
|
||||||
|
["hidden"]: !isUploading,
|
||||||
|
}
|
||||||
|
)}>
|
||||||
|
<antd.Progress
|
||||||
|
percent={props.track.progress ?? 0}
|
||||||
|
status={props.track.status === "error" ? "exception" : (props.track.progress === 100 ? "success" : "active")}
|
||||||
|
showInfo={false}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="fileListItem_cover">
|
<div className="fileListItem_cover">
|
||||||
<img
|
<img
|
||||||
src={props.track.cover ?? props.track?.thumbnail}
|
src={props.track.cover ?? props.track?.thumbnail}
|
||||||
|
@ -136,6 +136,33 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.fileListItem_progress {
|
||||||
|
position: absolute;
|
||||||
|
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
.ant-progress-line {
|
||||||
|
margin: 0 !important;
|
||||||
|
padding: 0 !important;
|
||||||
|
|
||||||
|
width: 40%;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.hidden {
|
||||||
|
animation: hide 0.2s ease-in-out forwards;
|
||||||
|
animation-delay: 2s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.fileListItem_loadingIcon {
|
.fileListItem_loadingIcon {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
@ -155,6 +182,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.fileListItem_cover {
|
.fileListItem_cover {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
||||||
@ -337,8 +366,22 @@
|
|||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
|
|
||||||
background-color: black;
|
background-color: black;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes hide {
|
||||||
|
0% {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
99% {
|
||||||
|
opacity: 0;
|
||||||
|
width: fit-content;
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
width: 0px;
|
||||||
|
}
|
||||||
}
|
}
|
@ -161,9 +161,23 @@ export default class PlaylistCreatorSteps extends React.Component {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleFileProgress = (file, progress) => {
|
||||||
|
const trackList = this.state.trackList
|
||||||
|
|
||||||
|
const track = trackList.find((track) => track.uid === file.uid)
|
||||||
|
|
||||||
|
if (track) {
|
||||||
|
track.progress = progress
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
trackList
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
handleUploadTrack = async (req) => {
|
handleUploadTrack = async (req) => {
|
||||||
const response = await app.cores.remoteStorage.uploadFile(req.file, {
|
const response = await app.cores.remoteStorage.uploadFile(req.file, {
|
||||||
timeout: 2000
|
onProgress: this.handleFileProgress
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
antd.message.error(error)
|
antd.message.error(error)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user