Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2628 from jryans/adjust-top-left-menu
Browse files Browse the repository at this point in the history
Adjust top left menu items
  • Loading branch information
jryans authored Feb 13, 2019
2 parents d6dcae3 + ed0fc12 commit 694a59a
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 4 deletions.
8 changes: 8 additions & 0 deletions res/css/views/context_menus/_TopLeftMenu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,18 @@ limitations under the License.
mask-image: url('$(res)/img/feather-icons/home.svg');
}

li.mx_TopLeftMenu_icon_welcome::after {
mask-image: url('$(res)/img/feather-icons/gift.svg');
}

li.mx_TopLeftMenu_icon_settings::after {
mask-image: url('$(res)/img/feather-icons/settings.svg');
}

li.mx_TopLeftMenu_icon_signin::after {
mask-image: url('$(res)/img/feather-icons/sign-in.svg');
}

li.mx_TopLeftMenu_icon_signout::after {
mask-image: url('$(res)/img/feather-icons/sign-out.svg');
}
Expand Down
1 change: 1 addition & 0 deletions res/img/feather-icons/gift.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions res/img/feather-icons/sign-in.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 30 additions & 2 deletions src/components/views/context_menus/TopLeftMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@ import { _t } from '../../../languageHandler';
import LogoutDialog from "../dialogs/LogoutDialog";
import Modal from "../../../Modal";
import SdkConfig from '../../../SdkConfig';
import MatrixClientPeg from '../../../MatrixClientPeg';

export class TopLeftMenu extends React.Component {
constructor() {
super();
this.viewHomePage = this.viewHomePage.bind(this);
this.viewWelcomePage = this.viewWelcomePage.bind(this);
this.openSettings = this.openSettings.bind(this);
this.signIn = this.signIn.bind(this);
this.signOut = this.signOut.bind(this);
}

Expand All @@ -41,21 +45,35 @@ export class TopLeftMenu extends React.Component {
}

render() {
const isGuest = MatrixClientPeg.get().isGuest();

let homePageSection = null;
if (this.hasHomePage()) {
homePageSection = <ul className="mx_TopLeftMenu_section">
<li className="mx_TopLeftMenu_icon_home" onClick={this.viewHomePage}>{_t("Home")}</li>
</ul>;
}

let signInOutSection;
if (isGuest) {
signInOutSection = <ul className="mx_TopLeftMenu_section">
<li className="mx_TopLeftMenu_icon_signin" onClick={this.signIn}>{_t("Sign in")}</li>
</ul>;
} else {
signInOutSection = <ul className="mx_TopLeftMenu_section">
<li className="mx_TopLeftMenu_icon_signout" onClick={this.signOut}>{_t("Sign out")}</li>
</ul>;
}

return <div className="mx_TopLeftMenu">
{homePageSection}
<ul className="mx_TopLeftMenu_section">
<li className="mx_TopLeftMenu_icon_settings" onClick={this.openSettings}>{_t("Settings")}</li>
<li className="mx_TopLeftMenu_icon_welcome" onClick={this.viewWelcomePage}>{_t("Welcome")}</li>
</ul>
<ul className="mx_TopLeftMenu_section">
<li className="mx_TopLeftMenu_icon_signout" onClick={this.signOut}>{_t("Sign out")}</li>
<li className="mx_TopLeftMenu_icon_settings" onClick={this.openSettings}>{_t("Settings")}</li>
</ul>
{signInOutSection}
</div>;
}

Expand All @@ -64,11 +82,21 @@ export class TopLeftMenu extends React.Component {
this.closeMenu();
}

viewWelcomePage() {
dis.dispatch({action: 'view_welcome_page'});
this.closeMenu();
}

openSettings() {
dis.dispatch({action: 'view_user_settings'});
this.closeMenu();
}

signIn() {
dis.dispatch({action: 'start_login'});
this.closeMenu();
}

signOut() {
Modal.createTrackedDialog('Logout E2E Export', '', LogoutDialog);
this.closeMenu();
Expand Down
4 changes: 2 additions & 2 deletions src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,6 @@
"Continue With Encryption Disabled": "Continue With Encryption Disabled",
"Unknown error": "Unknown error",
"Incorrect password": "Incorrect password",
"Deactivate Account": "Deactivate Account",
"This will make your account permanently unusable. You will not be able to log in, and no one will be able to re-register the same user ID. This will cause your account to leave all rooms it is participating in, and it will remove your account details from your identity server. <b>This action is irreversible.</b>": "This will make your account permanently unusable. You will not be able to log in, and no one will be able to re-register the same user ID. This will cause your account to leave all rooms it is participating in, and it will remove your account details from your identity server. <b>This action is irreversible.</b>",
"Deactivating your account <b>does not by default cause us to forget messages you have sent.</b> If you would like us to forget your messages, please tick the box below.": "Deactivating your account <b>does not by default cause us to forget messages you have sent.</b> If you would like us to forget your messages, please tick the box below.",
"Message visibility in Matrix is similar to email. Our forgetting your messages means that messages you have sent will not be shared with any new or unregistered users, but registered users who already have access to these messages will still have access to their copy.": "Message visibility in Matrix is similar to email. Our forgetting your messages means that messages you have sent will not be shared with any new or unregistered users, but registered users who already have access to these messages will still have access to their copy.",
Expand Down Expand Up @@ -1221,6 +1220,8 @@
"Set a new status...": "Set a new status...",
"View Community": "View Community",
"Hide": "Hide",
"Sign in": "Sign in",
"Welcome": "Welcome",
"Login": "Login",
"powered by Matrix": "powered by Matrix",
"Robot check is currently unavailable on desktop - please use a <a>web browser</a>": "Robot check is currently unavailable on desktop - please use a <a>web browser</a>",
Expand Down Expand Up @@ -1251,7 +1252,6 @@
"Username": "Username",
"Mobile phone number": "Mobile phone number",
"Not sure of your password? <a>Set a new one</a>": "Not sure of your password? <a>Set a new one</a>",
"Sign in": "Sign in",
"Sign in to %(serverName)s": "Sign in to %(serverName)s",
"Change": "Change",
"Sign in with": "Sign in with",
Expand Down

0 comments on commit 694a59a

Please sign in to comment.