Move final tutorial tip to RHS menu on mobile
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
da686718a5
Коммит
26ccc478e1
@@ -3,19 +3,19 @@
|
|||||||
|
|
||||||
import $ from 'jquery';
|
import $ from 'jquery';
|
||||||
import NavbarDropdown from './navbar_dropdown.jsx';
|
import NavbarDropdown from './navbar_dropdown.jsx';
|
||||||
import TutorialTip from './tutorial/tutorial_tip.jsx';
|
|
||||||
|
|
||||||
import PreferenceStore from 'stores/preference_store.jsx';
|
import PreferenceStore from 'stores/preference_store.jsx';
|
||||||
|
|
||||||
|
import * as Utils from 'utils/utils.jsx';
|
||||||
import Constants from 'utils/constants.jsx';
|
import Constants from 'utils/constants.jsx';
|
||||||
|
|
||||||
import {FormattedHTMLMessage} from 'react-intl';
|
|
||||||
|
|
||||||
const Preferences = Constants.Preferences;
|
const Preferences = Constants.Preferences;
|
||||||
const TutorialSteps = Constants.TutorialSteps;
|
const TutorialSteps = Constants.TutorialSteps;
|
||||||
|
|
||||||
import {Tooltip, OverlayTrigger} from 'react-bootstrap';
|
import {Tooltip, OverlayTrigger} from 'react-bootstrap';
|
||||||
|
|
||||||
|
import {createMenuTip} from 'components/tutorial/tutorial_tip.jsx';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
export default class SidebarHeader extends React.Component {
|
export default class SidebarHeader extends React.Component {
|
||||||
@@ -36,7 +36,7 @@ export default class SidebarHeader extends React.Component {
|
|||||||
getStateFromStores() {
|
getStateFromStores() {
|
||||||
const tutorialStep = PreferenceStore.getInt(Preferences.TUTORIAL_STEP, this.props.currentUser.id, 999);
|
const tutorialStep = PreferenceStore.getInt(Preferences.TUTORIAL_STEP, this.props.currentUser.id, 999);
|
||||||
|
|
||||||
return {showTutorialTip: tutorialStep === TutorialSteps.MENU_POPOVER};
|
return {showTutorialTip: tutorialStep === TutorialSteps.MENU_POPOVER && !Utils.isMobile()};
|
||||||
}
|
}
|
||||||
onPreferenceChange() {
|
onPreferenceChange() {
|
||||||
this.setState(this.getStateFromStores());
|
this.setState(this.getStateFromStores());
|
||||||
@@ -49,33 +49,6 @@ export default class SidebarHeader extends React.Component {
|
|||||||
}
|
}
|
||||||
$('.team__header').find('.dropdown-toggle').dropdown('toggle');
|
$('.team__header').find('.dropdown-toggle').dropdown('toggle');
|
||||||
}
|
}
|
||||||
createTutorialTip() {
|
|
||||||
const screens = [];
|
|
||||||
|
|
||||||
screens.push(
|
|
||||||
<div>
|
|
||||||
<FormattedHTMLMessage
|
|
||||||
id='sidebar_header.tutorial'
|
|
||||||
defaultMessage='<h4>Main Menu</h4>
|
|
||||||
<p>The <strong>Main Menu</strong> is where you can <strong>Invite New Members</strong>, access your <strong>Account Settings</strong> and set your <strong>Theme Color</strong>.</p>
|
|
||||||
<p>Team administrators can also access their <strong>Team Settings</strong> from this menu.</p><p>System administrators will find a <strong>System Console</strong> option to administrate the entire system.</p>'
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
onClick={this.toggleDropdown}
|
|
||||||
>
|
|
||||||
<TutorialTip
|
|
||||||
ref='tip'
|
|
||||||
placement='right'
|
|
||||||
screens={screens}
|
|
||||||
overlayClass='tip-overlay--header'
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
render() {
|
render() {
|
||||||
var me = this.props.currentUser;
|
var me = this.props.currentUser;
|
||||||
var profilePicture = null;
|
var profilePicture = null;
|
||||||
@@ -95,7 +68,7 @@ export default class SidebarHeader extends React.Component {
|
|||||||
|
|
||||||
let tutorialTip = null;
|
let tutorialTip = null;
|
||||||
if (this.state.showTutorialTip) {
|
if (this.state.showTutorialTip) {
|
||||||
tutorialTip = this.createTutorialTip();
|
tutorialTip = createMenuTip(this.toggleDropdown);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -4,12 +4,20 @@
|
|||||||
import TeamMembersModal from './team_members_modal.jsx';
|
import TeamMembersModal from './team_members_modal.jsx';
|
||||||
import ToggleModalButton from './toggle_modal_button.jsx';
|
import ToggleModalButton from './toggle_modal_button.jsx';
|
||||||
import UserSettingsModal from './user_settings/user_settings_modal.jsx';
|
import UserSettingsModal from './user_settings/user_settings_modal.jsx';
|
||||||
|
|
||||||
import UserStore from 'stores/user_store.jsx';
|
import UserStore from 'stores/user_store.jsx';
|
||||||
|
import PreferenceStore from 'stores/preference_store.jsx';
|
||||||
|
|
||||||
import * as GlobalActions from 'action_creators/global_actions.jsx';
|
import * as GlobalActions from 'action_creators/global_actions.jsx';
|
||||||
import * as Utils from 'utils/utils.jsx';
|
import * as Utils from 'utils/utils.jsx';
|
||||||
|
import Constants from 'utils/constants.jsx';
|
||||||
|
|
||||||
|
const Preferences = Constants.Preferences;
|
||||||
|
const TutorialSteps = Constants.TutorialSteps;
|
||||||
|
|
||||||
import {FormattedMessage} from 'react-intl';
|
import {FormattedMessage} from 'react-intl';
|
||||||
import {Link} from 'react-router';
|
import {Link} from 'react-router';
|
||||||
|
import {createMenuTip} from 'components/tutorial/tutorial_tip.jsx';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
@@ -17,9 +25,30 @@ export default class SidebarRightMenu extends React.Component {
|
|||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.state = {
|
this.onPreferenceChange = this.onPreferenceChange.bind(this);
|
||||||
showUserSettingsModal: false
|
|
||||||
};
|
const state = this.getStateFromStores();
|
||||||
|
state.showUserSettingsModal = false;
|
||||||
|
|
||||||
|
this.state = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
PreferenceStore.addChangeListener(this.onPreferenceChange);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
PreferenceStore.removeChangeListener(this.onPreferenceChange);
|
||||||
|
}
|
||||||
|
|
||||||
|
getStateFromStores() {
|
||||||
|
const tutorialStep = PreferenceStore.getInt(Preferences.TUTORIAL_STEP, UserStore.getCurrentId(), 999);
|
||||||
|
|
||||||
|
return {showTutorialTip: tutorialStep === TutorialSteps.MENU_POPOVER && Utils.isMobile()};
|
||||||
|
}
|
||||||
|
|
||||||
|
onPreferenceChange() {
|
||||||
|
this.setState(this.getStateFromStores());
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@@ -158,6 +187,12 @@ export default class SidebarRightMenu extends React.Component {
|
|||||||
</li>
|
</li>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let tutorialTip = null;
|
||||||
|
if (this.state.showTutorialTip) {
|
||||||
|
tutorialTip = createMenuTip((e) => e.preventDefault(), true);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className='sidebar--menu'
|
className='sidebar--menu'
|
||||||
@@ -173,6 +208,7 @@ export default class SidebarRightMenu extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className='nav-pills__container'>
|
<div className='nav-pills__container'>
|
||||||
|
{tutorialTip}
|
||||||
<ul className='nav nav-pills nav-stacked'>
|
<ul className='nav nav-pills nav-stacked'>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import * as AsyncClient from 'utils/async_client.jsx';
|
|||||||
|
|
||||||
import Constants from 'utils/constants.jsx';
|
import Constants from 'utils/constants.jsx';
|
||||||
|
|
||||||
import {FormattedMessage} from 'react-intl';
|
import {FormattedMessage, FormattedHTMLMessage} from 'react-intl';
|
||||||
|
|
||||||
const Preferences = Constants.Preferences;
|
const Preferences = Constants.Preferences;
|
||||||
|
|
||||||
@@ -166,3 +166,38 @@ TutorialTip.propTypes = {
|
|||||||
placement: React.PropTypes.string.isRequired,
|
placement: React.PropTypes.string.isRequired,
|
||||||
overlayClass: React.PropTypes.string
|
overlayClass: React.PropTypes.string
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export function createMenuTip(toggleFunc, onBottom) {
|
||||||
|
const screens = [];
|
||||||
|
|
||||||
|
screens.push(
|
||||||
|
<div>
|
||||||
|
<FormattedHTMLMessage
|
||||||
|
id='sidebar_header.tutorial'
|
||||||
|
defaultMessage='<h4>Main Menu</h4>
|
||||||
|
<p>The <strong>Main Menu</strong> is where you can <strong>Invite New Members</strong>, access your <strong>Account Settings</strong> and set your <strong>Theme Color</strong>.</p>
|
||||||
|
<p>Team administrators can also access their <strong>Team Settings</strong> from this menu.</p><p>System administrators will find a <strong>System Console</strong> option to administrate the entire system.</p>'
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
|
let placement = 'right';
|
||||||
|
let arrow = 'left';
|
||||||
|
if (onBottom) {
|
||||||
|
placement = 'bottom';
|
||||||
|
arrow = 'up';
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
onClick={toggleFunc}
|
||||||
|
>
|
||||||
|
<TutorialTip
|
||||||
|
ref='tip'
|
||||||
|
placement={placement}
|
||||||
|
screens={screens}
|
||||||
|
overlayClass={'tip-overlay--header--' + arrow}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.tip-overlay--header {
|
&.tip-overlay--header--left {
|
||||||
margin: 10px 0 0 10px;
|
margin: 10px 0 0 10px;
|
||||||
|
|
||||||
.arrow {
|
.arrow {
|
||||||
@@ -62,6 +62,18 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.tip-overlay--header--bottom {
|
||||||
|
margin-top: -10px;
|
||||||
|
|
||||||
|
.arrow {
|
||||||
|
border-top-width: 0;
|
||||||
|
border-bottom-color: $white;
|
||||||
|
top: -10px;
|
||||||
|
left: 50%;
|
||||||
|
margin-left: -10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&.tip-overlay--chat {
|
&.tip-overlay--chat {
|
||||||
margin-top: -10px;
|
margin-top: -10px;
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user