From cc453a048d50e57802bab9363b59c2189143b784 Mon Sep 17 00:00:00 2001 From: Asaad Mahmood Date: Tue, 8 Mar 2016 15:07:43 +0500 Subject: Multiple UI Improvements --- .../components/admin_console/license_settings.jsx | 7 +- web/react/components/channel_members_modal.jsx | 9 +- web/react/components/create_post.jsx | 10 +- web/react/components/file_attachment.jsx | 112 +--- web/react/components/file_upload.jsx | 10 +- web/react/components/get_link_modal.jsx | 23 +- web/react/components/invite_member_modal.jsx | 4 +- web/react/components/navbar_dropdown.jsx | 2 +- web/react/components/settings_sidebar.jsx | 4 - .../suggestion/search_suggestion_list.jsx | 2 +- web/react/components/team_general_tab.jsx | 4 +- web/react/components/team_import_tab.jsx | 5 +- web/react/components/team_members_dropdown.jsx | 2 +- web/react/components/team_settings_modal.jsx | 2 +- web/react/components/textbox.jsx | 51 +- web/react/components/user_list_row.jsx | 4 +- .../user_settings/user_settings_advanced.jsx | 10 +- .../user_settings/user_settings_developer.jsx | 10 +- .../user_settings/user_settings_display.jsx | 10 +- .../user_settings/user_settings_general.jsx | 10 +- .../user_settings/user_settings_integrations.jsx | 10 +- .../user_settings/user_settings_modal.jsx | 4 +- .../user_settings/user_settings_notifications.jsx | 10 +- .../user_settings/user_settings_security.jsx | 10 +- web/react/utils/text_formatting.jsx | 13 +- web/react/utils/utils.jsx | 33 +- web/sass-files/sass/partials/_base.scss | 30 ++ web/sass-files/sass/partials/_modal.scss | 2 +- web/sass-files/sass/partials/_post.scss | 35 +- web/sass-files/sass/partials/_post_right.scss | 6 + web/sass-files/sass/partials/_responsive.scss | 186 +++---- web/sass-files/sass/partials/_settings.scss | 599 +++++++++++---------- web/static/i18n/en.json | 16 +- web/static/i18n/es.json | 30 +- web/static/i18n/pt.json | 70 +-- 35 files changed, 693 insertions(+), 652 deletions(-) (limited to 'web') diff --git a/web/react/components/admin_console/license_settings.jsx b/web/react/components/admin_console/license_settings.jsx index fdbe912ef..d4dfa13f2 100644 --- a/web/react/components/admin_console/license_settings.jsx +++ b/web/react/components/admin_console/license_settings.jsx @@ -120,8 +120,7 @@ class LicenseSettings extends React.Component { expires: Utils.displayDate(parseInt(global.window.mm_license.ExpiresAt, 10)), ldap: global.window.mm_license.LDAP }} - defaultMessage='

This compiled release of Mattermost platform is provided under a commercial license - from Mattermost, Inc. based on your subscription level and is subject to the Terms of Service.

+ defaultMessage='

This compiled release of Mattermost platform is provided under a commercial license from Mattermost, Inc. based on your subscription level and is subject to the Terms of Service.

Your subscription details are as follows:

Name: {name}
Company or organization name: {company}
@@ -152,9 +151,7 @@ class LicenseSettings extends React.Component {

diff --git a/web/react/components/channel_members_modal.jsx b/web/react/components/channel_members_modal.jsx index 688ab7dd2..dc8e3baaf 100644 --- a/web/react/components/channel_members_modal.jsx +++ b/web/react/components/channel_members_modal.jsx @@ -44,6 +44,7 @@ export default class ChannelMembersModal extends React.Component { } getStateFromStores() { const extraInfo = ChannelStore.getCurrentExtraInfo(); + const profiles = UserStore.getActiveOnlyProfiles(); if (extraInfo.member_count !== extraInfo.members.length) { AsyncClient.getChannelExtraInfo(this.props.channel.id, -1); @@ -53,9 +54,8 @@ export default class ChannelMembersModal extends React.Component { }; } - // clone the member list since we mutate it later on const memberList = extraInfo.members.map((member) => { - return Object.assign({}, member); + return profiles[member.id]; }); function compareByUsername(a, b) { @@ -130,8 +130,8 @@ export default class ChannelMembersModal extends React.Component { onClick={this.handleRemove.bind(this, user)} > ); @@ -178,7 +178,6 @@ export default class ChannelMembersModal extends React.Component { this.props.onModalDismissed(); }} > - { - PostStore.storeDraft(data.channel_id, null); + PostStore.storeDraft(this.state.channelId, null); this.setState({messageText: '', submitting: false, postError: null, previews: [], serverError: null}); if (data.goto_location && data.goto_location.length > 0) { @@ -262,9 +262,7 @@ class CreatePost extends React.Component { message = err.message; } - if (clientId === -1) { - this.setState({serverError: message}); - } else { + if (clientId !== -1) { const draft = PostStore.getDraft(this.state.channelId); const index = draft.uploadsInProgress.indexOf(clientId); @@ -274,8 +272,10 @@ class CreatePost extends React.Component { PostStore.storeDraft(this.state.channelId, draft); - this.setState({uploadsInProgress: draft.uploadsInProgress, serverError: message}); + this.setState({uploadsInProgress: draft.uploadsInProgress}); } + + this.setState({serverError: message}); } removePreview(id) { const previews = Object.assign([], this.state.previews); diff --git a/web/react/components/file_attachment.jsx b/web/react/components/file_attachment.jsx index 810f90b13..6aeae638f 100644 --- a/web/react/components/file_attachment.jsx +++ b/web/react/components/file_attachment.jsx @@ -19,12 +19,10 @@ class FileAttachment extends React.Component { super(props); this.loadFiles = this.loadFiles.bind(this); - this.playGif = this.playGif.bind(this); - this.stopGif = this.stopGif.bind(this); this.addBackgroundImage = this.addBackgroundImage.bind(this); this.canSetState = false; - this.state = {fileSize: -1, mime: '', playing: false, loading: false, format: ''}; + this.state = {fileSize: -1}; } componentDidMount() { this.loadFiles(); @@ -95,42 +93,6 @@ class FileAttachment extends React.Component { return true; } - playGif(e, filename) { - var img = new Image(); - var fileUrl = utils.getFileUrl(filename); - - this.setState({loading: true}); - img.load(fileUrl); - img.onload = () => { - var state = {playing: true, loading: false}; - - switch (true) { - case img.width > img.height: - state.format = 'landscape'; - break; - case img.height > img.width: - state.format = 'portrait'; - break; - default: - state.format = 'quadrat'; - break; - } - - this.setState(state); - - // keep displaying background image for a short moment while browser is - // loading gif, to prevent white background flashing through - setTimeout(() => this.removeBackgroundImage.bind(this)(filename), 100); - }; - img.onError = () => this.setState({loading: false}); - - e.stopPropagation(); - } - stopGif(e, filename) { - this.setState({playing: false}); - this.addBackgroundImage(filename); - e.stopPropagation(); - } getFileInfoFromName(name) { var fileInfo = utils.splitFileLocation(name); @@ -164,74 +126,18 @@ class FileAttachment extends React.Component { var filename = this.props.filename; var fileInfo = utils.splitFileLocation(filename); - var fileUrl = utils.getFileUrl(filename); + var fileUrl = utils.getFileUrl(filename, true); var type = utils.getFileType(fileInfo.ext); - var playbackControls = ''; - var loadedFile = ''; - var loadingIndicator = ''; - if (this.state.mime === 'image/gif') { - playbackControls = ( -
this.playGif(e, filename)} - > - {"►"} -
- ); - } - if (this.state.playing) { - loadedFile = ( - - ); - playbackControls = ( + var thumbnail; + if (type === 'image') { + thumbnail = (
this.stopGif(e, filename)} - > - {"■"} -
- ); - } - if (this.state.loading) { - loadingIndicator = ( - ); - playbackControls = ''; - } - - var thumbnail; - if (type === 'image') { - if (this.state.playing) { - thumbnail = ( -
- {playbackControls} - {loadedFile} -
- ); - } else { - thumbnail = ( -
- {loadingIndicator} - {playbackControls} - {loadedFile} -
- ); - } } else { thumbnail =
; } @@ -242,7 +148,7 @@ class FileAttachment extends React.Component { filename, function success(data) { if (this.canSetState) { - this.setState({fileSize: parseInt(data.size, 10), mime: data.mime}); + this.setState({fileSize: parseInt(data.size, 10)}); } }.bind(this), function error() { diff --git a/web/react/components/file_upload.jsx b/web/react/components/file_upload.jsx index cb8ede51b..f8965e13e 100644 --- a/web/react/components/file_upload.jsx +++ b/web/react/components/file_upload.jsx @@ -108,12 +108,12 @@ class FileUpload extends React.Component { } } - handleChange() { - var element = $(ReactDOM.findDOMNode(this.refs.fileInput)); + handleChange(e) { + if (e.target.files.length > 0) { + this.uploadFiles(e.target.files); - this.uploadFiles(element.prop('files')); - - Utils.clearFileInput(element[0]); + Utils.clearFileInput(e.target); + } } handleDrop(e) { diff --git a/web/react/components/get_link_modal.jsx b/web/react/components/get_link_modal.jsx index 6a5c3b588..3309d690c 100644 --- a/web/react/components/get_link_modal.jsx +++ b/web/react/components/get_link_modal.jsx @@ -41,8 +41,6 @@ export default class GetLinkModal extends React.Component { } render() { - const userCreationEnabled = global.window.mm_config.EnableUserCreation === 'true'; - let helpText = null; if (this.props.helpText) { helpText = ( @@ -55,7 +53,7 @@ export default class GetLinkModal extends React.Component { } let copyLink = null; - if (userCreationEnabled && document.queryCommandSupported('copy')) { + if (document.queryCommandSupported('copy')) { copyLink = (