Skip to content

Commit

Permalink
Ui improvements (#5755)
Browse files Browse the repository at this point in the history
* PLT-5816 - Flagged posts tooltip fix

* PLT-5766 - Link previews appearing outside the box

* PLT-5795 - Fixing alignment user list in channel

* PLT-5818 - Reset password error not aligned

* PLT-5837 - Adjusting image preview max height

* PLT-5778 - Updating word break for paragraphs

* PLT-5848 - Updating label for file error

* PLT-5846 - Markdown tables extra border on mobile

* PLT-5662 - Pinned post UI improvement

* Fixing eslint error

* Updating tooltip eslint issue

* PLT-5832 - Removing error styling on labels
  • Loading branch information
asaadmahmood authored and jwilander committed Mar 17, 2017
1 parent 6f87438 commit bfae88e
Show file tree
Hide file tree
Showing 14 changed files with 76 additions and 56 deletions.
2 changes: 1 addition & 1 deletion webapp/components/admin_console/reset_password_modal.jsx
Expand Up @@ -61,7 +61,7 @@ class ResetPasswordModal extends React.Component {

if (this.state.serverError) {
urlClass += ' has-error';
serverError = <div className='form-group has-error'><p className='input__help error'>{this.state.serverError}</p></div>;
serverError = <div className='has-error'><p className='input__help error'>{this.state.serverError}</p></div>;
}

let title;
Expand Down
4 changes: 1 addition & 3 deletions webapp/components/audio_video_preview.jsx
Expand Up @@ -94,7 +94,6 @@ export default class AudioVideoPreview extends React.Component {
<video
key={this.props.fileInfo.id}
ref='video'
style={{maxHeight: this.props.maxHeight}}
data-setup='{}'
controls='controls'
width={width}
Expand All @@ -111,6 +110,5 @@ export default class AudioVideoPreview extends React.Component {

AudioVideoPreview.propTypes = {
fileInfo: React.PropTypes.object.isRequired,
fileUrl: React.PropTypes.string.isRequired,
maxHeight: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.number]).isRequired
fileUrl: React.PropTypes.string.isRequired
};
27 changes: 19 additions & 8 deletions webapp/components/channel_header.jsx
Expand Up @@ -241,7 +241,10 @@ export default class ChannelHeader extends React.Component {
);

const flaggedTooltip = (
<Tooltip id='flaggedTooltip'>
<Tooltip
id='flaggedTooltip'
className='text-nowrap'
>
<FormattedMessage
id='channel_header.flagged'
defaultMessage='Flagged Posts'
Expand Down Expand Up @@ -676,19 +679,27 @@ export default class ChannelHeader extends React.Component {
headerText = channel.header;
}

const toggleFavoriteTooltip = (
<Tooltip id='favoriteTooltip'>
{this.state.isFavorite ?
let toggleFavoriteTooltip;
if (this.state.isFavorite) {
toggleFavoriteTooltip = (
<Tooltip id='favoriteTooltip'>
<FormattedMessage
id='channelHeader.removeFromFavorites'
defaultMessage='Remove from Favorites'
/> :
/>
</Tooltip>
);
} else {
toggleFavoriteTooltip = (
<Tooltip id='favoriteTooltip'>
<FormattedMessage
id='channelHeader.addToFavorites'
defaultMessage='Add to Favorites'
/>}
</Tooltip>
);
/>
</Tooltip>
);
}

const toggleFavorite = (
<OverlayTrigger
delayShow={Constants.OVERLAY_TIME_DELAY}
Expand Down
Expand Up @@ -32,7 +32,6 @@ export default class PostAttachmentOpenGraph extends React.Component {
this.onImageLoad = this.onImageLoad.bind(this);
this.onImageError = this.onImageError.bind(this);
this.truncateText = this.truncateText.bind(this);
this.setImageWidth = this.setImageWidth.bind(this);
}

IMAGE_LOADED = {
Expand Down Expand Up @@ -75,20 +74,16 @@ export default class PostAttachmentOpenGraph extends React.Component {

componentDidMount() {
OpenGraphStore.addUrlDataChangeListener(this.onOpenGraphMetadataChange);
this.setImageWidth();
window.addEventListener('resize', this.setImageWidth);
}

componentDidUpdate() {
if (this.props.childComponentDidUpdateFunction) {
this.props.childComponentDidUpdateFunction();
}
this.setImageWidth();
}

componentWillUnmount() {
OpenGraphStore.removeUrlDataChangeListener(this.onOpenGraphMetadataChange);
window.removeEventListener('resize', this.setImageWidth);
}

onOpenGraphMetadataChange(url) {
Expand Down Expand Up @@ -163,9 +158,6 @@ export default class PostAttachmentOpenGraph extends React.Component {
return (
<div
className='attachment__image__container--openraph'
style={{
width: (this.imageDimentions.height * this.imageRatio) + this.smallImageContainerLeftPadding
}} // Initially set the width accordinly to max image heigh, ie 80px. Later on it would be modified according to actul height of image.
ref={(div) => {
this.smallImageContainer = div;
}}
Expand Down Expand Up @@ -216,20 +208,6 @@ export default class PostAttachmentOpenGraph extends React.Component {
return element;
}

setImageWidth() {
if (
this.state.imageLoaded === this.IMAGE_LOADED.YES &&
this.smallImageContainer &&
this.smallImageElement
) {
this.smallImageContainer.style.width = (
(this.smallImageElement.offsetHeight * this.imageRatio) +
this.smallImageContainerLeftPadding +
'px'
);
}
}

truncateText(text, maxLength = this.textMaxLenght, ellipsis = this.textEllipsis) {
if (text.length > maxLength) {
return text.substring(0, maxLength - ellipsis.length) + ellipsis;
Expand Down
5 changes: 4 additions & 1 deletion webapp/components/search_bar.jsx
Expand Up @@ -216,7 +216,10 @@ export default class SearchBar extends React.Component {
);

const flaggedTooltip = (
<Tooltip id='flaggedTooltip'>
<Tooltip
id='flaggedTooltip'
className='text-nowrap'
>
<FormattedMessage
id='channel_header.flagged'
defaultMessage='Flagged Posts'
Expand Down
12 changes: 3 additions & 9 deletions webapp/components/view_image.jsx
Expand Up @@ -185,15 +185,13 @@ export default class ViewImageModal extends React.Component {
<ImagePreview
fileInfo={fileInfo}
fileUrl={fileUrl}
maxHeight={this.state.imgHeight}
/>
);
} else if (fileType === 'video' || fileType === 'audio') {
content = (
<AudioVideoPreview
fileInfo={fileInfo}
fileUrl={fileUrl}
maxHeight={this.state.imgHeight}
/>
);
} else if (PDFPreview.supports(fileInfo)) {
Expand Down Expand Up @@ -344,7 +342,7 @@ LoadingImagePreview.propTypes = {
loading: React.PropTypes.string
};

function ImagePreview({fileInfo, fileUrl, maxHeight}) {
function ImagePreview({fileInfo, fileUrl}) {
let previewUrl;
if (fileInfo.has_preview_image) {
previewUrl = FileStore.getFilePreviewUrl(fileInfo.id);
Expand All @@ -359,16 +357,12 @@ function ImagePreview({fileInfo, fileUrl, maxHeight}) {
rel='noopener noreferrer'
download={true}
>
<img
style={{maxHeight}}
src={previewUrl}
/>
<img src={previewUrl}/>
</a>
);
}

ImagePreview.propTypes = {
fileInfo: React.PropTypes.object.isRequired,
fileUrl: React.PropTypes.string.isRequired,
maxHeight: React.PropTypes.number.isRequired
fileUrl: React.PropTypes.string.isRequired
};
2 changes: 1 addition & 1 deletion webapp/sass/components/_modal.scss
Expand Up @@ -345,7 +345,7 @@
}

img {
max-height: 100%;
max-height: calc(100vh - 200px);
max-width: 100%;
}

Expand Down
9 changes: 9 additions & 0 deletions webapp/sass/components/_popover.scss
Expand Up @@ -209,6 +209,15 @@
.more-modal__row {
min-height: inherit;
}

.more-modal__details {
line-height: 32px;
}

.more-modal__actions {
line-height: 31px;
margin: 0;
}
}

.popover-content {
Expand Down
6 changes: 6 additions & 0 deletions webapp/sass/components/_tooltip.scss
Expand Up @@ -7,6 +7,12 @@
padding: 3px 10px 4px;
word-break: break-word;
}

&.text-nowrap {
.tooltip-inner {
white-space: nowrap;
}
}
}

#webrtcTooltip {
Expand Down
5 changes: 4 additions & 1 deletion webapp/sass/layout/_forms.scss
Expand Up @@ -62,14 +62,17 @@

.has-error {
.help-block,
.control-label,
.radio,
.checkbox,
.radio-inline,
.checkbox-inline {
color: $red;
}

.control-label {
color: inherit;
}

&.radio,
&.checkbox,
&.radio-inline,
Expand Down
6 changes: 3 additions & 3 deletions webapp/sass/layout/_headers.scss
Expand Up @@ -9,10 +9,10 @@

.member-popover__trigger,
.pinned-posts-button {
cursor: pointer;
display: inline-block;
margin-left: 7px;
min-width: 30px;
cursor: pointer;
margin-left: 10px;
text-align: center;
white-space: nowrap;

Expand Down Expand Up @@ -65,7 +65,7 @@
}

&:last-child {
padding-right: 8px;
padding-right: 6px;
width: 8.9%;
}
}
Expand Down
10 changes: 9 additions & 1 deletion webapp/sass/layout/_post.scss
Expand Up @@ -359,6 +359,10 @@
}

.post-create__container {
label {
font-weight: normal;
}

form {
margin: 0 auto;
padding: .5em 15px 0;
Expand Down Expand Up @@ -523,6 +527,7 @@
.col__reply {
min-width: 0;
}

.dropdown {
margin-right: 0;
}
Expand Down Expand Up @@ -749,6 +754,7 @@
line-height: 1.6em;
margin: 0;
white-space: pre-wrap;
word-break: break-word;
}

.post__header--info {
Expand Down Expand Up @@ -786,7 +792,7 @@

.flag-icon__container {
left: 36px;
margin-left: 5px;
margin-left: 7px;
position: absolute;
top: 8px;
}
Expand Down Expand Up @@ -1358,6 +1364,8 @@

.post__pinned-badge {
margin-left: 7px;
position: relative;
top: -1px;
}

.permalink-text {
Expand Down
16 changes: 11 additions & 5 deletions webapp/sass/layout/_webhooks.scss
Expand Up @@ -41,6 +41,7 @@
&.attachment--opengraph {
max-width: 800px;
}

.attachment__content {
border-radius: 4px;
border-style: solid;
Expand Down Expand Up @@ -71,16 +72,18 @@
&.attachment__container--danger {
border-left-color: #e40303;
}

&.attachment__container--opengraph {
display: table;
table-layout: fixed;
width: 100%;
margin: 0;
padding-bottom: 13px;
width: 100%;

div {
margin: 0;
}
}

.sitename {
color: #A3A3A3;
}
Expand All @@ -89,8 +92,8 @@
.attachment__body__wrap {
&.attachment__body__wrap--opengraph {
display: table-cell;
width: 100%;
vertical-align: top;
width: 100%;
}
}

Expand All @@ -104,6 +107,7 @@
&.attachment__body--no_thumb {
width: 100%;
}

&.attachment__body--opengraph {
float: none;
padding-right: 0;
Expand Down Expand Up @@ -142,6 +146,7 @@
margin-top: 10px;
max-height: 200px;
max-width: 400px;
width: 100%;

&.loading {
height: 150px;
Expand All @@ -164,16 +169,17 @@

&.has-link {
color: #2f81b7;
text-overflow: ellipsis;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

&.attachment__title--opengraph {
height: auto;
word-wrap: break-word;

&.is-url {
word-break: break-all
word-break: break-all;
}
}
}
Expand Down

0 comments on commit bfae88e

Please sign in to comment.