about summary refs log tree commit diff
path: root/app/javascript/mastodon/features/compose/components/upload.js
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2022-03-22 09:48:12 +0100
committerGitHub <noreply@github.com>2022-03-22 09:48:12 +0100
commit4e9855e09aa4cc2720fed262ffaa6e0c94cf5688 (patch)
tree38b8c382c506b56b170dc43600f579cf7ed2a14f /app/javascript/mastodon/features/compose/components/upload.js
parent69f9dc4f4eed9211a0a4ff55c18f64c99165a9e0 (diff)
Add hint about missing media attachment description in web UI (#17845)
Diffstat (limited to 'app/javascript/mastodon/features/compose/components/upload.js')
-rw-r--r--app/javascript/mastodon/features/compose/components/upload.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/javascript/mastodon/features/compose/components/upload.js b/app/javascript/mastodon/features/compose/components/upload.js
index 1289d6b94..706824dc7 100644
--- a/app/javascript/mastodon/features/compose/components/upload.js
+++ b/app/javascript/mastodon/features/compose/components/upload.js
@@ -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>