New addon: Download project from project page
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
@Samq64 Nice catch with it needing to be added back 👍
Tested on an unshared project.
@WorldLanguages done
I added a spinner to show that something is happening, which is helpful when you try to download bigger projects.
When clicking the button while the project is still loading this happens:
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?
When clicking the button while the project is still loading this happens:
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.
hey @Samq64 how's this? it blocks the clicks until the project is loaded...
(im using my phone data for this, thats how much it matters to me)
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.
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
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.
I'll do those when I get home (also what does lgtm mean)
@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 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)
Ideally the button would only be added after the project finishes loading but before it starts.