From 22789ada943cc439d4689e9ca9f90a5ca6dd08fc Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Wed, 13 Feb 2019 15:48:40 +0000 Subject: [PATCH 1/3] Add sign in to top left menu for guests --- res/css/views/context_menus/_TopLeftMenu.scss | 4 ++++ res/img/feather-icons/sign-in.svg | 7 ++++++ .../views/context_menus/TopLeftMenu.js | 24 ++++++++++++++++--- src/i18n/strings/en_EN.json | 6 ++--- 4 files changed, 34 insertions(+), 7 deletions(-) create mode 100644 res/img/feather-icons/sign-in.svg diff --git a/res/css/views/context_menus/_TopLeftMenu.scss b/res/css/views/context_menus/_TopLeftMenu.scss index f305f0fae3..272a882051 100644 --- a/res/css/views/context_menus/_TopLeftMenu.scss +++ b/res/css/views/context_menus/_TopLeftMenu.scss @@ -35,6 +35,10 @@ limitations under the License. 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'); } diff --git a/res/img/feather-icons/sign-in.svg b/res/img/feather-icons/sign-in.svg new file mode 100644 index 0000000000..29235304a8 --- /dev/null +++ b/res/img/feather-icons/sign-in.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/components/views/context_menus/TopLeftMenu.js b/src/components/views/context_menus/TopLeftMenu.js index 1d58db3c49..56f5ba5c6f 100644 --- a/src/components/views/context_menus/TopLeftMenu.js +++ b/src/components/views/context_menus/TopLeftMenu.js @@ -20,11 +20,13 @@ 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.openSettings = this.openSettings.bind(this); + this.signIn = this.signIn.bind(this); this.signOut = this.signOut.bind(this); } @@ -41,6 +43,8 @@ export class TopLeftMenu extends React.Component { } render() { + const isGuest = MatrixClientPeg.get().isGuest(); + let homePageSection = null; if (this.hasHomePage()) { homePageSection = ; } + let signInOutSection; + if (isGuest) { + signInOutSection = ; + } else { + signInOutSection = ; + } + return
{homePageSection} - + {signInOutSection}
; } @@ -69,6 +82,11 @@ export class TopLeftMenu extends React.Component { this.closeMenu(); } + signIn() { + dis.dispatch({action: 'start_login'}); + this.closeMenu(); + } + signOut() { Modal.createTrackedDialog('Logout E2E Export', '', LogoutDialog); this.closeMenu(); diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 6c38d6e4f6..0d74a41710 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -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. This action is irreversible.": "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. This action is irreversible.", "Deactivating your account does not by default cause us to forget messages you have sent. If you would like us to forget your messages, please tick the box below.": "Deactivating your account does not by default cause us to forget messages you have sent. 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.", @@ -1203,6 +1202,7 @@ "Quote": "Quote", "Source URL": "Source URL", "Collapse Reply Thread": "Collapse Reply Thread", + "End-to-end encryption information": "End-to-end encryption information", "Failed to set Direct Message status of room": "Failed to set Direct Message status of room", "unknown error code": "unknown error code", "Failed to forget room %(errCode)s": "Failed to forget room %(errCode)s", @@ -1220,6 +1220,7 @@ "Set a new status...": "Set a new status...", "View Community": "View Community", "Hide": "Hide", + "Sign in": "Sign in", "Login": "Login", "powered by Matrix": "powered by Matrix", "Robot check is currently unavailable on desktop - please use a web browser": "Robot check is currently unavailable on desktop - please use a web browser", @@ -1250,7 +1251,6 @@ "Username": "Username", "Mobile phone number": "Mobile phone number", "Not sure of your password? Set a new one": "Not sure of your password? Set a new one", - "Sign in": "Sign in", "Sign in to %(serverName)s": "Sign in to %(serverName)s", "Change": "Change", "Sign in with": "Sign in with", @@ -1473,7 +1473,6 @@ "unencrypted": "unencrypted", "Decryption error": "Decryption error", "Session ID": "Session ID", - "End-to-end encryption information": "End-to-end encryption information", "Event information": "Event information", "Sender device information": "Sender device information", "Passphrases must match": "Passphrases must match", @@ -1534,7 +1533,6 @@ "If you didn't set the new recovery method, an attacker may be trying to access your account. Change your account password and set a new recovery method immediately in Settings.": "If you didn't set the new recovery method, an attacker may be trying to access your account. Change your account password and set a new recovery method immediately in Settings.", "This device is encrypting history using the new recovery method.": "This device is encrypting history using the new recovery method.", "Go to Settings": "Go to Settings", - "Setting up Secure Messages on this device will re-encrypt this device's message history with the new recovery method.": "Setting up Secure Messages on this device will re-encrypt this device's message history with the new recovery method.", "Set up Secure Messages": "Set up Secure Messages", "Recovery Method Removed": "Recovery Method Removed", "This device has detected that your recovery passphrase and key for Secure Messages have been removed.": "This device has detected that your recovery passphrase and key for Secure Messages have been removed.", From 116367fd692dac4fa9846adfb5e10e4910ddc71c Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Wed, 13 Feb 2019 16:13:32 +0000 Subject: [PATCH 2/3] Add welcome to top left menu for all --- res/css/views/context_menus/_TopLeftMenu.scss | 4 ++++ res/img/feather-icons/gift.svg | 1 + src/components/views/context_menus/TopLeftMenu.js | 10 ++++++++++ src/i18n/strings/en_EN.json | 1 + 4 files changed, 16 insertions(+) create mode 100644 res/img/feather-icons/gift.svg diff --git a/res/css/views/context_menus/_TopLeftMenu.scss b/res/css/views/context_menus/_TopLeftMenu.scss index 272a882051..b3ef703144 100644 --- a/res/css/views/context_menus/_TopLeftMenu.scss +++ b/res/css/views/context_menus/_TopLeftMenu.scss @@ -31,6 +31,10 @@ 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'); } diff --git a/res/img/feather-icons/gift.svg b/res/img/feather-icons/gift.svg new file mode 100644 index 0000000000..d2c14bd699 --- /dev/null +++ b/res/img/feather-icons/gift.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/components/views/context_menus/TopLeftMenu.js b/src/components/views/context_menus/TopLeftMenu.js index 56f5ba5c6f..8583f631f2 100644 --- a/src/components/views/context_menus/TopLeftMenu.js +++ b/src/components/views/context_menus/TopLeftMenu.js @@ -25,6 +25,8 @@ 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); @@ -65,6 +67,9 @@ export class TopLeftMenu extends React.Component { return
{homePageSection} +
    +
  • {_t("Welcome")}
  • +
  • {_t("Settings")}
@@ -77,6 +82,11 @@ 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(); diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 0d74a41710..5ae5fdae51 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1221,6 +1221,7 @@ "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 web browser": "Robot check is currently unavailable on desktop - please use a web browser", From ed0fc12f98c0554dd2566e9b18c34f8fc892987c Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Wed, 13 Feb 2019 16:17:40 +0000 Subject: [PATCH 3/3] Tweak stroke width --- res/img/feather-icons/gift.svg | 2 +- res/img/feather-icons/sign-in.svg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/res/img/feather-icons/gift.svg b/res/img/feather-icons/gift.svg index d2c14bd699..c225b50f9d 100644 --- a/res/img/feather-icons/gift.svg +++ b/res/img/feather-icons/gift.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/res/img/feather-icons/sign-in.svg b/res/img/feather-icons/sign-in.svg index 29235304a8..9fe617eee1 100644 --- a/res/img/feather-icons/sign-in.svg +++ b/res/img/feather-icons/sign-in.svg @@ -1,5 +1,5 @@ - +