Browse Source

Add hint about missing media attachment description in web UI (#17845)

closed-social-glitch-2
Eugen Rochko 2 years ago
committed by GitHub
parent
commit
4e9855e09a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 49 deletions
  1. +7
    -2
      app/javascript/mastodon/features/compose/components/upload.js
  2. +13
    -47
      app/javascript/styles/mastodon/components.scss

+ 7
- 2
app/javascript/mastodon/features/compose/components/upload.js View File

@ -5,7 +5,6 @@ import Motion from '../../ui/util/optional_motion';
import spring from 'react-motion/lib/spring';
import ImmutablePureComponent from 'react-immutable-pure-component';
import { FormattedMessage } from 'react-intl';
import classNames from 'classnames';
import Icon from 'mastodon/components/icon';
export default class Upload extends ImmutablePureComponent {
@ -43,10 +42,16 @@ export default class Upload extends ImmutablePureComponent {
<Motion defaultStyle={{ scale: 0.8 }} style={{ scale: spring(1, { stiffness: 180, damping: 12 }) }}>
{({ scale }) => (
<div className='compose-form__upload-thumbnail' style={{ transform: `scale(${scale})`, backgroundImage: `url(${media.get('preview_url')})`, backgroundPosition: `${x}% ${y}%` }}>
<div className={classNames('compose-form__upload__actions', { active: true })}>
<div className='compose-form__upload__actions'>
<button className='icon-button' onClick={this.handleUndoClick}><Icon id='times' /> <FormattedMessage id='upload_form.undo' defaultMessage='Delete' /></button>
{!isEditingStatus && (<button className='icon-button' onClick={this.handleFocalPointClick}><Icon id='pencil' /> <FormattedMessage id='upload_form.edit' defaultMessage='Edit' /></button>)}
</div>
{(media.get('description') || '').length === 0 && (
<div className='compose-form__upload__warning'>
<button className='icon-button' onClick={this.handleFocalPointClick}><Icon id='info-circle' /> <FormattedMessage id='upload_form.description_missing' defaultMessage='No description added' /></button>
</div>
)}
</div>
)}
</Motion>

+ 13
- 47
app/javascript/styles/mastodon/components.scss View File

@ -596,30 +596,24 @@
display: flex;
align-items: flex-start;
justify-content: space-between;
opacity: 0;
transition: opacity .1s ease;
}
.icon-button {
flex: 0 1 auto;
color: $secondary-text-color;
font-size: 14px;
font-weight: 500;
padding: 10px;
font-family: inherit;
&:hover,
&:focus,
&:active {
color: lighten($secondary-text-color, 7%);
}
}
.icon-button {
flex: 0 1 auto;
color: $secondary-text-color;
font-size: 14px;
font-weight: 500;
padding: 10px;
font-family: inherit;
&.active {
opacity: 1;
&:hover,
&:focus,
&:active {
color: lighten($secondary-text-color, 7%);
}
}
&-description {
&__warning {
position: absolute;
z-index: 2;
bottom: 0;
@ -627,34 +621,6 @@
right: 0;
box-sizing: border-box;
background: linear-gradient(0deg, rgba($base-shadow-color, 0.8) 0, rgba($base-shadow-color, 0.35) 80%, transparent);
padding: 10px;
opacity: 0;
transition: opacity .1s ease;
textarea {
background: transparent;
color: $secondary-text-color;
border: 0;
padding: 0;
margin: 0;
width: 100%;
font-family: inherit;
font-size: 14px;
font-weight: 500;
&:focus {
color: $white;
}
&::placeholder {
opacity: 0.75;
color: $secondary-text-color;
}
}
&.active {
opacity: 1;
}
}
}

Loading…
Cancel
Save