diff --git a/res/css/structures/_GroupView.scss b/res/css/structures/_GroupView.scss index bfbc92ca05..4f33617344 100644 --- a/res/css/structures/_GroupView.scss +++ b/res/css/structures/_GroupView.scss @@ -62,6 +62,10 @@ limitations under the License. mask-image: url('$(res)/img/icons-share.svg'); } +.mx_GroupView_hostingSignup img { + margin-left: 5px; +} + .mx_GroupView_editable { border-bottom: 1px solid $strong-input-border-color ! important; min-width: 150px; diff --git a/res/css/views/context_menus/_TopLeftMenu.scss b/res/css/views/context_menus/_TopLeftMenu.scss index c15d12eb6a..113da004b8 100644 --- a/res/css/views/context_menus/_TopLeftMenu.scss +++ b/res/css/views/context_menus/_TopLeftMenu.scss @@ -15,17 +15,39 @@ limitations under the License. */ .mx_TopLeftMenu { - min-width: 180px; + min-width: 210px; border-radius: 4px; + .mx_TopLeftMenu_greyedText { + font-size: 12px; + opacity: 0.5; + } + + .mx_TopLeftMenu_upgradeLink { + font-size: 12px; + + img { + margin-left: 5px; + } + } + .mx_TopLeftMenu_section:not(:last-child) { border-bottom: 1px solid $menu-border-color; } - .mx_TopLeftMenu_section { - list-style: none; + .mx_TopLeftMenu_section_noIcon { + margin: 5px 0; + padding: 5px 20px 5px 15px; + + div:not(:first-child) { + margin-top: 5px; + } + } + + .mx_TopLeftMenu_section_withIcon { margin: 5px 0; padding: 0; + list-style: none; li.mx_TopLeftMenu_icon_home::after { mask-image: url('$(res)/img/feather-customised/home.svg'); diff --git a/res/css/views/settings/_ProfileSettings.scss b/res/css/views/settings/_ProfileSettings.scss index 5d85f80bfe..b2e449ac34 100644 --- a/res/css/views/settings/_ProfileSettings.scss +++ b/res/css/views/settings/_ProfileSettings.scss @@ -35,6 +35,14 @@ limitations under the License. margin-top: 0; } +.mx_ProfileSettings_hostingSignup { + margin-left: 20px; + + img { + margin-left: 5px; + } +} + .mx_ProfileSettings_avatar { width: 88px; height: 88px; diff --git a/src/components/structures/GroupView.js b/src/components/structures/GroupView.js index b80f49d051..dbca0fe5d1 100644 --- a/src/components/structures/GroupView.js +++ b/src/components/structures/GroupView.js @@ -21,6 +21,7 @@ import Promise from 'bluebird'; import MatrixClientPeg from '../../MatrixClientPeg'; import sdk from '../../index'; import dis from '../../dispatcher'; +import SdkConfig from '../../SdkConfig'; import { sanitizedHtmlNode } from '../../HtmlUtils'; import { _t, _td } from '../../languageHandler'; import AccessibleButton from '../views/elements/AccessibleButton'; @@ -816,6 +817,23 @@ export default React.createClass({ }); const header = this.state.editing ?

{ _t('Community Settings') }

:
; + + const hostingSignupLink = SdkConfig.get().hosting_signup_link; + let hostingSignup = null; + if (hostingSignupLink) { + hostingSignup =
+ {_t( + "Want more than a community? Get your own server", {}, + { + a: sub => {sub}, + }, + )} + + + +
+ } + const changeDelayWarning = this.state.editing && this.state.isUserPrivileged ?
{ _t( @@ -830,6 +848,7 @@ export default React.createClass({
:
; return
{ header } + { hostingSignup } { changeDelayWarning } { this._getJoinableNode() } { this._getLongDescriptionNode() } diff --git a/src/components/structures/TopLeftMenuButton.js b/src/components/structures/TopLeftMenuButton.js index 4e3f609c07..b68d3a95a0 100644 --- a/src/components/structures/TopLeftMenuButton.js +++ b/src/components/structures/TopLeftMenuButton.js @@ -68,17 +68,18 @@ export default class TopLeftMenuButton extends React.Component { } } - render() { - const fallbackUserId = MatrixClientPeg.get().getUserId(); - const profileInfo = this.state.profileInfo; - let name; + _getDisplayName() { if (MatrixClientPeg.get().isGuest()) { - name = _t("Guest"); - } else if (profileInfo) { - name = profileInfo.name; + return _t("Guest"); + } else if (this.state.profileInfo) { + return this.state.profileInfo.name; } else { - name = fallbackUserId; + return MatrixClientPeg.get().getUserId(); } + } + + render() { + const name = this._getDisplayName(); let nameElement; if (!this.props.collapsed) { nameElement =
@@ -89,9 +90,9 @@ export default class TopLeftMenuButton extends React.Component { return ( { this.setState({ menuDisplayed: false }); }, diff --git a/src/components/views/context_menus/TopLeftMenu.js b/src/components/views/context_menus/TopLeftMenu.js index e3d8ef8d91..a10c577f13 100644 --- a/src/components/views/context_menus/TopLeftMenu.js +++ b/src/components/views/context_menus/TopLeftMenu.js @@ -15,6 +15,7 @@ limitations under the License. */ import React from 'react'; +import PropTypes from 'prop-types'; import dis from '../../../dispatcher'; import { _t } from '../../../languageHandler'; import LogoutDialog from "../dialogs/LogoutDialog"; @@ -23,6 +24,12 @@ import SdkConfig from '../../../SdkConfig'; import MatrixClientPeg from '../../../MatrixClientPeg'; export class TopLeftMenu extends React.Component { + static propTypes = { + displayName: PropTypes.string.isRequired, + userId: PropTypes.string.isRequired, + onFinished: PropTypes.func, + }; + constructor() { super(); this.viewHomePage = this.viewHomePage.bind(this); @@ -46,27 +53,48 @@ export class TopLeftMenu extends React.Component { render() { const isGuest = MatrixClientPeg.get().isGuest(); + const hostingSignupLink = SdkConfig.get().hosting_signup_link; + let hostingSignup = null; + if (hostingSignupLink) { + hostingSignup =
+ {_t( + "Upgrade to your own domain", {}, + { + a: sub => {sub}, + }, + )} + + + +
+ } + let homePageSection = null; if (this.hasHomePage()) { - homePageSection =
    + homePageSection =
    • {_t("Home")}
    ; } let signInOutSection; if (isGuest) { - signInOutSection =
      + signInOutSection =
      • {_t("Sign in")}
      ; } else { - signInOutSection =
        + signInOutSection =
        • {_t("Sign out")}
        ; } return
        +
        +
        {this.props.displayName}
        +
        {this.props.userId}
        + {hostingSignup} +
        {homePageSection} -
          +
          • {_t("Settings")}
          {signInOutSection} diff --git a/src/components/views/settings/ProfileSettings.js b/src/components/views/settings/ProfileSettings.js index 1bb54d9361..3dc936d894 100644 --- a/src/components/views/settings/ProfileSettings.js +++ b/src/components/views/settings/ProfileSettings.js @@ -21,6 +21,7 @@ import Field from "../elements/Field"; import AccessibleButton from "../elements/AccessibleButton"; import classNames from 'classnames'; import {User} from "matrix-js-sdk"; +import SdkConfig from '../../../SdkConfig'; export default class ProfileSettings extends React.Component { constructor() { @@ -137,13 +138,32 @@ export default class ProfileSettings extends React.Component {
        ); + const hostingSignupLink = SdkConfig.get().hosting_signup_link; + let hostingSignup = null; + if (hostingSignupLink) { + hostingSignup = + {_t( + "Upgrade to your own domain", {}, + { + a: sub => {sub}, + }, + )} + + + + + } + return (
        -

        {this.state.userId}

        +

        + {this.state.userId} + {hostingSignup} +

        diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 19259c6341..7fa24c489d 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -502,6 +502,7 @@ "Phone Number": "Phone Number", "Profile picture": "Profile picture", "Upload profile picture": "Upload profile picture", + "Upgrade to your own domain": "Upgrade to your own domain", "Display Name": "Display Name", "Save": "Save", "Flair": "Flair", @@ -1315,6 +1316,7 @@ "Leave %(groupName)s?": "Leave %(groupName)s?", "Unable to leave community": "Unable to leave community", "Community Settings": "Community Settings", + "Want more than a community? Get your own server": "Want more than a community? Get your own server", "Changes made to your community name and avatar might not be seen by other users for up to 30 minutes.": "Changes made to your community name and avatar might not be seen by other users for up to 30 minutes.", "These rooms are displayed to community members on the community page. Community members can join the rooms by clicking on them.": "These rooms are displayed to community members on the community page. Community members can join the rooms by clicking on them.", "Featured Rooms:": "Featured Rooms:",