-
Notifications
You must be signed in to change notification settings - Fork 580
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
Hide Toolbox in Minecraft Python Hour of Code #10234
Conversation
…youtOnly is true to minimize need for content edits
Nice. Thank you! |
@@ -22,6 +22,12 @@ namespace pxt.tutorial { | |||
simThemeJson | |||
} = computeBodyMetadata(body); | |||
|
|||
// For python HOC, hide the toolbox (we don't support flyoutOnly mode). | |||
if (pxt.BrowserUtils.useOldTutorialLayout() && language === "python" && metadata.flyoutOnly) { | |||
metadata.flyoutOnly = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is breaking the change that I made recently for getting rid of the icons for block snippets for flyoutOnly
tutorials, based on one of the screenshots you included. To get rid of the icon, I'm checking that the metadata has flyoutOnly
to true..
Line 387 in 4f68e8b
const hasCategories = !parent.state.tutorialOptions?.metadata?.flyoutOnly; |
Maybe add, on this line, a check for if
hideToolbox
is true as well, because that would also mean that the tutorial wouldn't have categories.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Made your suggested change and updated the screenshot.
… so we're not relying on its right border. Will send separate Minecraft repo change to add border to the workspaceHeader instead.
@@ -384,7 +384,7 @@ export class MarkedContent extends data.Component<MarkedContentProps, MarkedCont | |||
// Renders inline blocks, such as "||controller: Controller||". | |||
private renderInlineBlocks(content: HTMLElement) { | |||
const { parent } = this.props; | |||
const hasCategories = !parent.state.tutorialOptions?.metadata?.flyoutOnly; | |||
const hasCategories = !parent.state.tutorialOptions?.metadata?.flyoutOnly && !parent.state.tutorialOptions?.metadata?.hideToolbox; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making the change, I think this might fail in the blocks scenario now, though, since you said that the hideToolbox
flag is only being used in Monaco 😅.
const hasCategories = !parent.state.tutorialOptions?.metadata?.flyoutOnly && !parent.state.tutorialOptions?.metadata?.hideToolbox; | |
const hasCategories = !parent.state.tutorialOptions?.metadata?.flyoutOnly || !parent.state.tutorialOptions?.metadata?.hideToolbox; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it only has categories when both of these checks are false, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh you are totally right. Sorry about that!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, that looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice change!
Fixes
Fixes https://github.com/microsoft/pxt-minecraft/issues/2571
This adds a hideToolbox metadata field for tutorials (only supported for monaco at the moment, not sure it makes much sense in a blocks scenario). When present, the toolbox is not shown and the user actually has to type things out.
Fixes https://github.com/microsoft/pxt-minecraft/issues/2595
It also fixes a separate issue (that I initially thought was related to these changes but actually wasn't) with the workspace header, where it was always assuming we were in blocks mode. Now it accepts a property for the workspace id, which allows it to size everything correctly (thus, fixing the border).
flyoutOnly CSS
In our Minecraft css, we've evidently started using flyoutOnly as a de facto indicator for HOC tutorials, so I've had to include it even when hideToolbox is true (and flyoutOnly is false), otherwise all the styling disappears. Ideally, this css class would be refactored/renamed to something more generic, but I worry doing so will be a big, cross-repo change and could have unexpected side-effects, so I've left it for now.
Patch to avoid content changes
After chatting with Abhijith, it sounds like we don't want to require any content updates for the existing 2024 HOC tutorials, so I've added a quick patch setting hideToolbox to true automatically for python tutorials with the legacy layout and flyoutOnly set to true (actual flyoutOnly mode is not supported anyway).
Screenshot
Python:
Blocks mode unaffected:
Related change: https://github.com/microsoft/pxt-minecraft/pull/2596