Skip to content

Conversation

@chrisgarrity
Copy link
Contributor

Resolves

In some uses of gui (e.g. ChromeOS/Android), the app will handle changing language and file management. So the menu should be customizable to show or hide the language and file menus along with allowing a gui consumer to provide an alternate logo.

Proposed Changes

Adds canChangeLanguage, canManageFiles and logo props to the gui and menubar. The menus default to true, and the default scratch-logo is shown if no logo is provided.

Test Coverage

Current tests pass. The current menu bar integration test will use the default config. Is there a good way to add a test for the options to hide the menus?

Browser Coverage

Check the OS/browser combinations tested (At least 2)

Mac

  • Chrome
  • Firefox
  • Safari

Windows

  • Chrome
  • Firefox
  • Edge

Chromebook

  • Chrome

iPad

  • Safari

Android Tablet

  • Chrome

@chrisgarrity chrisgarrity assigned rschamp and unassigned paulkaplan Jul 16, 2019
Copy link
Contributor

@rschamp rschamp left a comment

Choose a reason for hiding this comment

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

Tested it out and it looks good! I think we should use a default prop for logo, but everything else is just a suggestion.

})}
draggable={false}
src={scratchLogo}
src={this.props.logo ? this.props.logo : scratchLogo}
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like scratchLogo should be the default of the logo prop.

<MenuItem
className={className}
onClick={loadProject}
onClick={this.handleSaveToComputer(downloadProjectCallback)}
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a note — I know you didn't name this. This method name is misleading since it looks like an error. I would expect onClick="{this.handleSaveToComputer}, i.e. set the onClick handler to that method. But instead this is a function that returns a handler, so the name should probably reflect that.

Show or hide the language and file menus.
Show alternate logo if GUI is initialized with a different file.
* add scratchLogo as default for logo prop
* prefer `{featureAllowed && (<Component />)} over ternary operator with a null ‘else’
* renamed `handleSaveToComputer` as `getSaveToComputerHandler` to more clearly represent what it’s doing (returning a function to be the handler)
* renamed the parameter that is the function to handle clicking on the load project menu item (also updated the comments in `SBFileUploader`)
@paulkaplan
Copy link
Contributor

@chrisgarrity looks like this PR didn't allow these options to be passed in from the container, so this can't be used externally

@chrisgarrity
Copy link
Contributor Author

@paulkaplan aargh - yes, forgot to add the props to the gui container and pass them through.

@chrisgarrity
Copy link
Contributor Author

@paulkaplan on second look, the GUI container passes everything not explicitly called out to the component as {...componentProps}, so just adding the props to guiProps in the android index.jsx will pass them through. (I have a version that does it) However, it adds a new svg file to the android webpack that requires the file-loader.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants