ScratchAddons icon indicating copy to clipboard operation
ScratchAddons copied to clipboard

New addon: Download project from project page

Open Jazza-231 opened this issue 2 years ago • 2 comments

Resolves issue in my brain and I think a few times its been suggested in community server

Changes

Adds button to download the sb3 from the project page

Reason for changes

yes

Tests

Works fine on brave

I would like to get opinions on how it should be styled, colour, just icon, etc, bc its a bit wide rn

Jazza-231 avatar Dec 06 '23 07:12 Jazza-231

@Samq64 Nice catch with it needing to be added back 👍

Jazza-231 avatar Dec 07 '23 07:12 Jazza-231

Tested on an unshared project.

DNin01 avatar Dec 08 '23 21:12 DNin01

@WorldLanguages done

Jazza-231 avatar Mar 02 '24 08:03 Jazza-231

I added a spinner to show that something is happening, which is helpful when you try to download bigger projects.

Download project

Jazza-231 avatar Mar 02 '24 09:03 Jazza-231

When clicking the button while the project is still loading this happens: Screenshot_20240302_083836 Ideally the button would only be added after the project finishes loading but before it starts.

Aw shit... Uhm is there a Redux event for when it's finished loading or a pre-existing way to detect that? If not, what should I do, look for a green flag or something?

Jazza-231 avatar Mar 02 '24 13:03 Jazza-231

When clicking the button while the project is still loading this happens: Screenshot_20240302_083836 Ideally the button would only be added after the project finishes loading but before it starts.

Aw shit... Uhm is there a Redux event for when it's finished loading or a pre-existing way to detect that? If not, what should I do, look for a green flag or something?

@CST1229 gave it to me on the Dev Discord. The whole line would be:

await redux.waitForState((state) => state.scratchGui.projectState.loadingState.startsWith("SHOWING"));

He also said

vm.runtime.on("PROJECT_LOADED", () => {
  /*...*/
})

Should work.

Samq64 avatar Mar 02 '24 14:03 Samq64

hey @Samq64 how's this? it blocks the clicks until the project is loaded... Download project 2

(im using my phone data for this, thats how much it matters to me)

Jazza-231 avatar Mar 02 '24 15:03 Jazza-231

hey @Samq64 how's this? it blocks the clicks until the project is loaded...

Personally, I would dim/gray out the button while the project is loading instead of saying "Loading…". Scratch's Remix button works this way.

DNin01 avatar Mar 02 '24 20:03 DNin01

hey @Samq64 how's this? it blocks the clicks until the project is loaded...

Personally, I would dim/gray out the button while the project is loading instead of saying "Loading…". Scratch's Remix button works this way.

Alright, I'll do that

Jazza-231 avatar Mar 03 '24 02:03 Jazza-231

I was going to say just import the styles at the top of the CSS and add the class with JS but then I realized it's a :before so it's not that simple.

Samq64 avatar Mar 03 '24 12:03 Samq64

I'll do those when I get home (also what does lgtm mean)

Jazza-231 avatar Mar 23 '24 04:03 Jazza-231

@Jazza-231 Any other comments?

I added a line you removed back in to add the button while the project is not yet loaded

Jazza-231 avatar Mar 23 '24 07:03 Jazza-231

what does lgtm mean

Looks good to me

BroJac5246 avatar Mar 23 '24 17:03 BroJac5246

what does lgtm mean

Looks good to me

Oh lol fsr i was thinking "lets get this merged"

Jazza-231 avatar Mar 24 '24 02:03 Jazza-231

@Jazza-231 Any other comments?

I added a line you removed back in to add the button while the project is not yet loaded

Well, it's not ideal as the button won't be added if it's the editor instead of the project page, but it will work anyway, and will not log any errors. (appendToSharedSpace returns false if the element wasn't added, it doesn't log or throw any errors)

WorldLanguages avatar Mar 24 '24 22:03 WorldLanguages