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

user session #3

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
15 changes: 15 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"immutable": "3.8.2",
"intl": "1.2.5",
"js-base64": "2.4.9",
"jwt-decode": "^4.0.0",
"keymirror": "0.1.1",
"lodash.bindall": "4.4.0",
"lodash.debounce": "4.0.8",
Expand Down
6 changes: 3 additions & 3 deletions src/components/gui/gui.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class GUIComponent extends React.Component {
loading,
logo,
renderLogin,
modalChooseExtensionAlreadyBeenOpened,
isExtensionModalAlreadyOpened,
onClickAbout,
onClickAccountNav,
onCloseAccountNav,
Expand Down Expand Up @@ -407,7 +407,7 @@ GUIComponent.propTypes = {
isShared: PropTypes.bool,
loading: PropTypes.bool,
logo: PropTypes.string,
modalChooseExtensionAlreadyBeenOpened: PropTypes.bool,
isExtensionModalAlreadyOpened: PropTypes.bool,
onShowExtension: PropTypes.func,
onActivateCostumesTab: PropTypes.func,
onActivateSoundsTab: PropTypes.func,
Expand Down Expand Up @@ -466,7 +466,7 @@ const mapStateToProps = state => {
// This is the button's mode, as opposed to the actual current state
stageSizeMode: state.scratchGui.stageSize.stageSize,
projectId: state.scratchGui.projectState.projectId,
modalChooseExtensionAlreadyBeenOpened: state.scratchGui.modalChooseExtensionAlreadyBeenOpened
isExtensionModalAlreadyOpened: state.scratchGui.isExtensionModalAlreadyOpened
}
};

Expand Down
4 changes: 0 additions & 4 deletions src/components/menu-bar/login-dropdown.css

This file was deleted.

82 changes: 0 additions & 82 deletions src/components/menu-bar/login-dropdown.jsx

This file was deleted.

138 changes: 23 additions & 115 deletions src/components/menu-bar/menu-bar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {MenuItem, MenuSection} from '../menu/menu.jsx';
import ProjectTitleInput from './project-title-input.jsx';
import AuthorInfo from './author-info.jsx';
import AccountNav from '../../containers/account-nav.jsx';
import LoginDropdown from './login-dropdown.jsx';
import SB3Downloader from '../../containers/sb3-downloader.jsx';
import DeletionRestorer from '../../containers/deletion-restorer.jsx';
import TurboMode from '../../containers/turbo-mode.jsx';
Expand Down Expand Up @@ -632,127 +631,36 @@ class MenuBar extends React.Component {
<SaveStatus />
)}
</div>
{this.props.sessionExists ? (
this.props.username ? (
// ************ user is logged in ************
<React.Fragment>
<a href="/mystuff/">
<div
className={classNames(
styles.menuBarItem,
styles.hoverable,
styles.mystuffButton
)}
>
<img
className={styles.mystuffIcon}
src={mystuffIcon}
/>
</div>
</a>
<AccountNav
className={classNames(
styles.menuBarItem,
styles.hoverable,
{[styles.active]: this.props.accountMenuOpen}
)}
isOpen={this.props.accountMenuOpen}
isRtl={this.props.isRtl}
menuBarMenuClassName={classNames(styles.menuBarMenu)}
onClick={this.props.onClickAccount}
onClose={this.props.onRequestCloseAccount}
onLogOut={this.props.onLogOut}
/>
</React.Fragment>
) : (
// ********* user not logged in, but a session exists
// ********* so they can choose to log in
<React.Fragment>
<div
className={classNames(
styles.menuBarItem,
styles.hoverable
)}
key="join"
onMouseUp={this.props.onOpenRegistration}
>
<FormattedMessage
defaultMessage="Join Scratch"
description="Link for creating a Scratch account"
id="gui.menuBar.joinScratch"
/>
</div>
{this.props.sessionExists &&
<React.Fragment>
<a href="/mystuffa/">
<div
className={classNames(
styles.menuBarItem,
styles.hoverable
styles.hoverable,
styles.mystuffButton
)}
key="login"
onMouseUp={this.props.onClickLogin}
>
<FormattedMessage
defaultMessage="Sign in"
description="Link for signing in to your Scratch account"
id="gui.menuBar.signIn"
/>
<LoginDropdown
className={classNames(styles.menuBarMenu)}
isOpen={this.props.loginMenuOpen}
isRtl={this.props.isRtl}
renderLogin={this.props.renderLogin}
onClose={this.props.onRequestCloseLogin}
<img
className={styles.mystuffIcon}
src={mystuffIcon}
/>
</div>
</React.Fragment>
)
) : (
// ******** no login session is available, so don't show login stuff
<React.Fragment>
{this.props.showComingSoon ? (
<React.Fragment>
<MenuBarItemTooltip id="mystuff">
<div
className={classNames(
styles.menuBarItem,
styles.hoverable,
styles.mystuffButton
)}
>
<img
className={styles.mystuffIcon}
src={mystuffIcon}
/>
</div>
</MenuBarItemTooltip>
<MenuBarItemTooltip
id="account-nav"
place={this.props.isRtl ? 'right' : 'left'}
>
<div
className={classNames(
styles.menuBarItem,
styles.hoverable,
styles.accountNavMenu
)}
>
{/* hide user icon for first release */}
{/* <img
className={styles.profileIcon}
src={profileIcon}
/> */}
<span>
{'username'}
</span>
<img
className={styles.dropdownCaretIcon}
src={dropdownCaret}
/>
</div>
</MenuBarItemTooltip>
</React.Fragment>
) : []}
</React.Fragment>
)}
</a>
<AccountNav
className={classNames(
styles.menuBarItem,
styles.hoverable,
{[styles.active]: this.props.accountMenuOpen}
)}
isOpen={this.props.accountMenuOpen}
isRtl={this.props.isRtl}
menuBarMenuClassName={classNames(styles.menuBarMenu)}
onClick={this.props.onClickAccount}
onClose={this.props.onRequestCloseAccount}
onLogOut={this.props.onLogOut}
/>
</React.Fragment>}
</div>

{aboutButton}
Expand Down
1 change: 1 addition & 0 deletions src/config/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const BASE_API_URL = "http://adventure-lab-cms.docker.amazee.io";
Loading