Skip to content

Commit

Permalink
Remove progress bar related script
Browse files Browse the repository at this point in the history
  • Loading branch information
YayunHuang committed Aug 21, 2024
1 parent 5f75f03 commit 9099b4b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 72 deletions.
40 changes: 0 additions & 40 deletions public/scripts/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,13 +368,6 @@ function appendInitialFileListItem(fileUlid, filename) {
`<p class="file-list-item__hint d-none"></p>`,
);

fileInfoNode.insertAdjacentHTML(
"beforeend",
`<div class="file-list-item__progress-bar-border">
<div class="file-list-item__progress-bar-fill"></div>
</div>`,
);

return fileListNode.appendChild(itemNode);
}

Expand All @@ -385,9 +378,6 @@ function removeAllFileListItems() {

function updateFileListItem(itemNode, imageUpload) {
const hintNode = itemNode.querySelector(".file-list-item__hint");
const progressFillNode = itemNode.querySelector(
".file-list-item__progress-bar-fill",
);
const previewNode = itemNode.querySelector(".file-list-item__preview-state");

// clear previous state
Expand All @@ -399,12 +389,6 @@ function updateFileListItem(itemNode, imageUpload) {
// NOTE: do not remove progress state immediately so the progress bar can proceed to 100% before being removed
// "file-list-item--progress"
);
progressFillNode.classList.remove(
"file-list-item__progress-bar-fill--30",
"file-list-item__progress-bar-fill--60",
"file-list-item__progress-bar-fill--90",
"file-list-item__progress-bar-fill--100",
);
previewNode.classList.remove(
"file-list-item__preview_selected",
"file-list-item__preview_non_selected",
Expand Down Expand Up @@ -490,30 +474,6 @@ function updateFileListItem(itemNode, imageUpload) {
} else if (shouldShowAspectRatioWarning) {
hintNode.innerText = `Uploaded file dimension (${imageDim.width} × ${imageDim.height} pixels) differs from ideal (${recommendDim.width} × ${recommendDim.height} pixels).`;
}
// update progress bar
if (
imageUpload.isProcessingState ||
imageUpload.isSuccessState ||
imageUpload.isGeneratingMockupState
) {
progressFillNode.classList.add("file-list-item__progress-bar-fill--30");
switch (imageUpload.state) {
case ImageUploadState.ReadyForRead:
progressFillNode.classList.add("file-list-item__progress-bar-fill--60");
break;
case ImageUploadState.Reading:
progressFillNode.classList.add("file-list-item__progress-bar-fill--90");
break;
case ImageUploadState.ReadSuccess:
case ImageUploadState.GeneratingPreview:
progressFillNode.classList.add(
"file-list-item__progress-bar-fill--100",
);
break;
default:
break;
}
}

// update preview button
if (imageUpload.isSuccessState) {
Expand Down
32 changes: 0 additions & 32 deletions src/styles/upload.css
Original file line number Diff line number Diff line change
Expand Up @@ -475,38 +475,6 @@ main {
color: var(--gray-3);
}

.file-list-item__progress-bar-border {
display: none;
margin: 5px 0 0 0;
width: 100%;
height: 6px;
background: rgba(0, 0, 0, 0.1);
border-radius: 30px;
overflow: hidden;
}
.file-list-item--progress .file-list-item__progress-bar-border {
display: block;
}

.file-list-item__progress-bar-fill {
width: 0;
height: 100%;
background: var(--green-3);
transition: width 1s ease-in-out;
}
.file-list-item__progress-bar-fill--30 {
width: 30%;
}
.file-list-item__progress-bar-fill--60 {
width: 60%;
}
.file-list-item__progress-bar-fill--90 {
width: 90%;
}
.file-list-item__progress-bar-fill--100 {
width: 100%;
}

.color-section {
margin: 20px 0 0 0;
}
Expand Down

0 comments on commit 9099b4b

Please sign in to comment.