Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement preview mockup selector #97

Merged
merged 7 commits into from
Aug 21, 2024

Conversation

YayunHuang
Copy link
Contributor

Ref: MUP-138, MUP-150

Screen.Recording.2024-08-20.at.5.11.07.PM.mov
Screen.Recording.2024-08-20.at.5.18.27.PM.mov

Copy link
Collaborator

@pkong-ds pkong-ds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not dive deep into code yet, but got some behavior wanna clarify:

  1. error handling might need to confirm with Hayley
    1. [Current] alert ?
    2. clear all images input for user, ask him to try again with some toast?
  2. (curious) How did you force errors?

@YayunHuang
Copy link
Contributor Author

@pkong-ds I just add throw Error() in preview_worker.js or web_worker.js to test

@@ -29,6 +29,8 @@ async def upload_single_image(origin_image, file_name):


async def upload_file():
from js import imageUpload

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why need to move import here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pkong-ds added comment in script

Since we will update imageUpload when calling this function,
need to re-import it to force update to new value
or we will always generate first uploaded image

Copy link
Collaborator

@pkong-ds pkong-ds Aug 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we will update imageUpload when calling this function,

😱 which line update imageUpload? I view a bit, couldn't see

public/scripts/models/image-upload.js Show resolved Hide resolved
Comment on lines 40 to 46
setTimeout(() => {
alert("Generation failed, please reload and try again later");
}, 100);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why need setTimeout? If wanna manipulate event loop orders, can add comment to specify which event this wanna be behind of?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can use async/await for this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@YayunHuang seems still using setTimeout

public/scripts/upload.js Outdated Show resolved Hide resolved
public/scripts/upload.js Outdated Show resolved Hide resolved
public/scripts/upload.js Outdated Show resolved Hide resolved
public/scripts/upload.js Show resolved Hide resolved
public/scripts/upload.js Outdated Show resolved Hide resolved
public/scripts/upload.js Outdated Show resolved Hide resolved
Comment on lines 446 to 449
setTimeout(() => {
itemNode.classList.remove("file-list-item--done");
itemNode.classList.add("file-list-item--loading");
}, 10);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why need setTimeout?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Timebox 30 min to remove progress bar, if not enough, open another issue for this

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems did not remove progress bar. let's open issue to remove those unused code?

@YayunHuang YayunHuang force-pushed the mup-138-preview-mockup-selector branch from 2beac95 to 9099b4b Compare August 21, 2024 08:54
@YayunHuang
Copy link
Contributor Author

@pkong-ds all updated, please review again, thanks

Comment on lines +167 to +171
// Avoiding read same image file
setTimeout(() => {
this._imageUploads.push(imageUpload);
window.viewModel.generatePreviewMockup(imageUpload);
}, i * 10);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why same image file will be read if without setTimeout?

@pkong-ds
Copy link
Collaborator

@YayunHuang 4 unresolved comments, but I tested a bit seems feature works fine. Lemme merge first, see if you wanna fix those later

@pkong-ds pkong-ds merged commit 509ab96 into oursky:main Aug 21, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants