diff --git a/res/css/views/context_menus/_TopLeftMenu.scss b/res/css/views/context_menus/_TopLeftMenu.scss index 18463da824..f305f0fae3 100644 --- a/res/css/views/context_menus/_TopLeftMenu.scss +++ b/res/css/views/context_menus/_TopLeftMenu.scss @@ -27,6 +27,10 @@ limitations under the License. margin: 5px 0; padding: 0; + li.mx_TopLeftMenu_icon_home::after { + mask-image: url('$(res)/img/feather-icons/home.svg'); + } + li.mx_TopLeftMenu_icon_settings::after { mask-image: url('$(res)/img/feather-icons/settings.svg'); } diff --git a/res/img/feather-icons/home.svg b/res/img/feather-icons/home.svg new file mode 100644 index 0000000000..7bb31b23dc --- /dev/null +++ b/res/img/feather-icons/home.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 87b277215b..8459db684c 100644 --- a/src/components/views/context_menus/TopLeftMenu.js +++ b/src/components/views/context_menus/TopLeftMenu.js @@ -1,5 +1,5 @@ /* -Copyright 2018 New Vector Ltd +Copyright 2018, 2019 New Vector Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ import dis from '../../../dispatcher'; import { _t } from '../../../languageHandler'; import LogoutDialog from "../dialogs/LogoutDialog"; import Modal from "../../../Modal"; +import SdkConfig from '../../../SdkConfig'; export class TopLeftMenu extends React.Component { constructor() { @@ -27,8 +28,28 @@ export class TopLeftMenu extends React.Component { this.signOut = this.signOut.bind(this); } + hasHomePage() { + const config = SdkConfig.get(); + const pagesConfig = config.pages; + if (pagesConfig) { + return !!pagesConfig.homeUrl; + } + // This is a deprecated config option for the home page + // (despite the name, given we also now have a welcome + // page, which is not the same). + return !!config.welcomePageUrl; + } + render() { + let homePageSection = null; + if (this.hasHomePage()) { + homePageSection = ; + } + return
+ {homePageSection} @@ -38,6 +59,11 @@ export class TopLeftMenu extends React.Component {
; } + viewHomePage() { + dis.dispatch({action: 'view_home_page'}); + this.closeMenu(); + } + openSettings() { dis.dispatch({action: 'view_user_settings'}); this.closeMenu();