Merge pull request #2509 from asaadmahmoodspin/ui-improvements

Multiple UI improvements
Этот коммит содержится в:
Joram Wilander
2016-03-23 16:02:36 -04:00
родитель 7af2e6f87a e60f6f3b13
Коммит 6ccef5caf5
19 изменённых файлов: 66 добавлений и 52 удалений

Просмотреть файл

@@ -2,7 +2,6 @@
// See License.txt for license information. // See License.txt for license information.
import $ from 'jquery'; import $ from 'jquery';
import ReactDOM from 'react-dom';
import {Modal} from 'react-bootstrap'; import {Modal} from 'react-bootstrap';
import LoadingScreen from './loading_screen.jsx'; import LoadingScreen from './loading_screen.jsx';
import AuditTable from './audit_table.jsx'; import AuditTable from './audit_table.jsx';
@@ -36,11 +35,8 @@ class AccessHistoryModal extends React.Component {
} }
onShow() { onShow() {
AsyncClient.getAudits(); AsyncClient.getAudits();
if (!Utils.isMobile()) {
if ($(window).width() > 768) { $('.modal-body').perfectScrollbar();
$(ReactDOM.findDOMNode(this.refs.modalBody)).css('max-height', $(window).height() - 200);
} else {
$(ReactDOM.findDOMNode(this.refs.modalBody)).css('max-height', $(window).height() - 150);
} }
} }
onHide() { onHide() {

Просмотреть файл

@@ -2,7 +2,6 @@
// See License.txt for license information. // See License.txt for license information.
import $ from 'jquery'; import $ from 'jquery';
import ReactDOM from 'react-dom';
import UserStore from 'stores/user_store.jsx'; import UserStore from 'stores/user_store.jsx';
import * as Client from 'utils/client.jsx'; import * as Client from 'utils/client.jsx';
import * as AsyncClient from 'utils/async_client.jsx'; import * as AsyncClient from 'utils/async_client.jsx';
@@ -56,11 +55,8 @@ export default class ActivityLogModal extends React.Component {
} }
onShow() { onShow() {
AsyncClient.getSessions(); AsyncClient.getSessions();
if (!Utils.isMobile()) {
if ($(window).width() > 768) { $('.modal-body').perfectScrollbar();
$(ReactDOM.findDOMNode(this.refs.modalBody)).css('max-height', $(window).height() - 200);
} else {
$(ReactDOM.findDOMNode(this.refs.modalBody)).css('max-height', $(window).height() - 150);
} }
} }
onHide() { onHide() {

Просмотреть файл

@@ -80,6 +80,7 @@ export default class ChannelHeader extends React.Component {
SearchStore.addSearchChangeListener(this.onListenerChange); SearchStore.addSearchChangeListener(this.onListenerChange);
PreferenceStore.addChangeListener(this.onListenerChange); PreferenceStore.addChangeListener(this.onListenerChange);
UserStore.addChangeListener(this.onListenerChange); UserStore.addChangeListener(this.onListenerChange);
$('.sidebar--left .dropdown-menu').perfectScrollbar();
} }
componentWillUnmount() { componentWillUnmount() {
ChannelStore.removeChangeListener(this.onListenerChange); ChannelStore.removeChangeListener(this.onListenerChange);

Просмотреть файл

@@ -1,7 +1,6 @@
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information. // See License.txt for license information.
import $ from 'jquery';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import * as utils from 'utils/utils.jsx'; import * as utils from 'utils/utils.jsx';
import Constants from 'utils/constants.jsx'; import Constants from 'utils/constants.jsx';
@@ -176,12 +175,6 @@ class InviteMemberModal extends React.Component {
}); });
} }
componentDidUpdate(prevProps, prevState) {
if (!prevState.show && this.state.show) {
$(ReactDOM.findDOMNode(this.refs.modalBody)).css('max-height', $(window).height() - 200);
}
}
addInviteFields() { addInviteFields() {
var count = this.state.idCount + 1; var count = this.state.idCount + 1;
var inviteIds = this.state.inviteIds; var inviteIds = this.state.inviteIds;

Просмотреть файл

@@ -1,6 +1,8 @@
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information. // See License.txt for license information.
import $ from 'jquery';
import UserStore from 'stores/user_store.jsx'; import UserStore from 'stores/user_store.jsx';
import {Popover, Overlay} from 'react-bootstrap'; import {Popover, Overlay} from 'react-bootstrap';
import * as Utils from 'utils/utils.jsx'; import * as Utils from 'utils/utils.jsx';
@@ -20,6 +22,10 @@ export default class PopoverListMembers extends React.Component {
this.closePopover = this.closePopover.bind(this); this.closePopover = this.closePopover.bind(this);
} }
componentDidUpdate() {
$('.member-list__popover .popover-content').perfectScrollbar();
}
componentWillMount() { componentWillMount() {
this.setState({showPopover: false}); this.setState({showPopover: false});
} }

Просмотреть файл

@@ -46,6 +46,9 @@ export default class RhsThread extends React.Component {
window.addEventListener('resize', this.handleResize); window.addEventListener('resize', this.handleResize);
this.mounted = true; this.mounted = true;
if (!Utils.isMobile()) {
$('.sidebar--right .post-right__scroll').perfectScrollbar();
}
} }
componentDidUpdate() { componentDidUpdate() {
if ($('.post-right__scroll')[0]) { if ($('.post-right__scroll')[0]) {

Просмотреть файл

@@ -61,6 +61,9 @@ export default class SearchResults extends React.Component {
UserStore.addChangeListener(this.onUserChange); UserStore.addChangeListener(this.onUserChange);
this.resize(); this.resize();
window.addEventListener('resize', this.handleResize); window.addEventListener('resize', this.handleResize);
if (!Utils.isMobile()) {
$('.sidebar--right .search-items-container').perfectScrollbar();
}
} }
shouldComponentUpdate(nextProps, nextState) { shouldComponentUpdate(nextProps, nextState) {

Просмотреть файл

@@ -163,6 +163,9 @@ export default class Sidebar extends React.Component {
componentDidUpdate() { componentDidUpdate() {
this.updateTitle(); this.updateTitle();
this.updateUnreadIndicators(); this.updateUnreadIndicators();
if (!Utils.isMobile()) {
$('.sidebar--left .nav-pills__container').perfectScrollbar();
}
} }
componentWillUnmount() { componentWillUnmount() {
window.removeEventListener('resize', this.handleResize); window.removeEventListener('resize', this.handleResize);

Просмотреть файл

@@ -5,6 +5,7 @@ import $ from 'jquery';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import SettingsSidebar from './settings_sidebar.jsx'; import SettingsSidebar from './settings_sidebar.jsx';
import TeamSettings from './team_settings.jsx'; import TeamSettings from './team_settings.jsx';
import * as Utils from 'utils/utils.jsx';
import {intlShape, injectIntl, defineMessages, FormattedMessage} from 'react-intl'; import {intlShape, injectIntl, defineMessages, FormattedMessage} from 'react-intl';
@@ -49,9 +50,16 @@ class TeamSettingsModal extends React.Component {
$('.modal-dialog.display--content').removeClass('display--content'); $('.modal-dialog.display--content').removeClass('display--content');
}, 500); }, 500);
}); });
if (!Utils.isMobile()) {
$('.settings-modal .settings-content').perfectScrollbar();
}
} }
updateTab(tab) { updateTab(tab) {
this.setState({activeTab: tab, activeSection: ''}); this.setState({activeTab: tab, activeSection: ''});
if (!Utils.isMobile()) {
$('.settings-modal .modal-body').scrollTop(0).perfectScrollbar('update');
}
} }
updateSection(section) { updateSection(section) {
this.setState({activeSection: section}); this.setState({activeSection: section});

Просмотреть файл

@@ -24,11 +24,16 @@ export default class UserList extends React.Component {
}); });
} else { } else {
content = ( content = (
<div key='no-users-found'> <div
<FormattedMessage key='no-users-found'
id='user_list.notFound' className='no-channel-message'
defaultMessage='No users found :(' >
/> <p className='primary-message'>
<FormattedMessage
id='user_list.notFound'
defaultMessage='No users found :('
/>
</p>
</div> </div>
); );
} }

Просмотреть файл

@@ -64,7 +64,6 @@ class UserSettingsModal extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.handleShow = this.handleShow.bind(this);
this.handleHide = this.handleHide.bind(this); this.handleHide = this.handleHide.bind(this);
this.handleHidden = this.handleHidden.bind(this); this.handleHidden = this.handleHidden.bind(this);
this.handleCollapse = this.handleCollapse.bind(this); this.handleCollapse = this.handleCollapse.bind(this);
@@ -95,24 +94,13 @@ class UserSettingsModal extends React.Component {
} }
componentDidMount() { componentDidMount() {
if (this.props.show) {
this.handleShow();
}
UserStore.addChangeListener(this.onUserChanged); UserStore.addChangeListener(this.onUserChanged);
} }
componentDidUpdate(prevProps) { componentDidUpdate() {
if (this.props.show && !prevProps.show) {
this.handleShow();
}
UserStore.removeChangeListener(this.onUserChanged); UserStore.removeChangeListener(this.onUserChanged);
} if (!Utils.isMobile()) {
$('.settings-modal .modal-body').perfectScrollbar();
handleShow() {
if ($(window).width() > 768) {
$(ReactDOM.findDOMNode(this.refs.modalBody)).css('max-height', $(window).height() - 200);
} else {
$(ReactDOM.findDOMNode(this.refs.modalBody)).css('max-height', $(window).height() - 50);
} }
} }
@@ -222,6 +210,10 @@ class UserSettingsModal extends React.Component {
active_section: '' active_section: ''
}); });
} }
if (!Utils.isMobile()) {
$('.settings-modal .modal-body').scrollTop(0).perfectScrollbar('update');
}
} }
updateSection(section, skipConfirm) { updateSection(section, skipConfirm) {

Просмотреть файл

@@ -53,8 +53,8 @@
"webpack": "webpack/webpack#master" "webpack": "webpack/webpack#master"
}, },
"scripts": { "scripts": {
"check": "eslint --ext \".jsx\" --ignore-pattern node_modules --quiet .", "check": "eslint --ext \".jsx\" --ignore-pattern node_modules --quiet .",
"build": "webpack", "build": "webpack",
"run": "webpack --progress --watch" "run": "webpack --progress --watch"
} }
} }

Просмотреть файл

@@ -2,6 +2,7 @@
// See License.txt for license information. // See License.txt for license information.
import $ from 'jquery'; import $ from 'jquery';
require('perfect-scrollbar/jquery')($);
import 'bootstrap/dist/css/bootstrap.css'; import 'bootstrap/dist/css/bootstrap.css';
import 'jasny-bootstrap/dist/css/jasny-bootstrap.css'; import 'jasny-bootstrap/dist/css/jasny-bootstrap.css';

Просмотреть файл

@@ -9,6 +9,7 @@
} }
.modal-body { .modal-body {
max-height: calc(90vh - 62px);
overflow: auto; overflow: auto;
padding: 20px 15px; padding: 20px 15px;

Просмотреть файл

@@ -134,6 +134,10 @@
@include alpha-property(background, $black, .1); @include alpha-property(background, $black, .1);
} }
a {
text-decoration: none;
}
.user__name { .user__name {
color: $white; color: $white;
} }

Просмотреть файл

@@ -89,7 +89,7 @@
&.info-popover { &.info-popover {
@include background-size(100% 100%); @include background-size(100% 100%);
background: url('../images/info__icon.png'); background-image: url('../images/info__icon.png');
cursor: pointer; cursor: pointer;
height: 19px; height: 19px;
position: relative; position: relative;

Просмотреть файл

@@ -1,7 +1,6 @@
@charset 'UTF-8'; @charset 'UTF-8';
.sidebar--left { .sidebar--left {
background: #fafafa;
border-right: $border-gray; border-right: $border-gray;
height: 100%; height: 100%;
left: 0; left: 0;

Просмотреть файл

@@ -10,12 +10,8 @@
width: 100%; width: 100%;
} }
.row {
margin: 0;
}
h3 { h3 {
border-bottom: 1px solid #ddd; border-bottom: 1px solid alpha-color($black, .1);
font-weight: 600; font-weight: 600;
margin: 1em 0; margin: 1em 0;
padding-bottom: .5em; padding-bottom: .5em;
@@ -75,11 +71,18 @@
width: 17px; width: 17px;
} }
&.divider {
@include alpha-property(background, $black, .1);
}
> a { > a {
&:hover, &:hover,
&.active,
&:focus { &:focus {
background-color: #eaeaea; @include alpha-property(background, $black, .1);
}
&.active {
background-color: transparent;
} }
} }

Просмотреть файл

@@ -687,7 +687,7 @@ export function applyTheme(theme) {
} }
if (theme.centerChannelBg) { if (theme.centerChannelBg) {
changeCss('.app__content, .markdown__table, .markdown__table tbody tr, .suggestion-list__content, .modal .modal-content, .modal .modal-back', 'background:' + theme.centerChannelBg, 1); changeCss('.app__content, .markdown__table, .markdown__table tbody tr, .suggestion-list__content, .modal .modal-content', 'background:' + theme.centerChannelBg, 1);
changeCss('#post-list .post-list-holder-by-time', 'background:' + theme.centerChannelBg, 1); changeCss('#post-list .post-list-holder-by-time', 'background:' + theme.centerChannelBg, 1);
changeCss('#post-create', 'background:' + theme.centerChannelBg, 1); changeCss('#post-create', 'background:' + theme.centerChannelBg, 1);
changeCss('.date-separator .separator__text, .new-separator .separator__text', 'background:' + theme.centerChannelBg, 1); changeCss('.date-separator .separator__text, .new-separator .separator__text', 'background:' + theme.centerChannelBg, 1);