about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/features/compose/components/publisher.js
diff options
context:
space:
mode:
authorRenaud Chaput <renchap@gmail.com>2023-02-25 14:34:32 +0100
committerClaire <claire.github-309c@sitedethib.com>2023-02-25 14:35:31 +0100
commit81ef21a0c802f1d905f37a2a818544a8b400793c (patch)
tree33043286868ca9efb627ed38accab03c756adbcb /app/javascript/flavours/glitch/features/compose/components/publisher.js
parent859eb01aacc27fa01a8d4063f26a5a1f81e5d3a9 (diff)
[Glitch] Rename JSX files with proper `.jsx` extension
Port 44a7d87cb1f5df953b6c14c16c59e2e4ead1bcb9 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
Diffstat (limited to 'app/javascript/flavours/glitch/features/compose/components/publisher.js')
-rw-r--r--app/javascript/flavours/glitch/features/compose/components/publisher.js99
1 files changed, 0 insertions, 99 deletions
diff --git a/app/javascript/flavours/glitch/features/compose/components/publisher.js b/app/javascript/flavours/glitch/features/compose/components/publisher.js
deleted file mode 100644
index 59254990b..000000000
--- a/app/javascript/flavours/glitch/features/compose/components/publisher.js
+++ /dev/null
@@ -1,99 +0,0 @@
-//  Package imports.
-import classNames from 'classnames';
-import PropTypes from 'prop-types';
-import React from 'react';
-import { defineMessages, injectIntl } from 'react-intl';
-import { length } from 'stringz';
-import ImmutablePureComponent from 'react-immutable-pure-component';
-
-//  Components.
-import Button from 'flavours/glitch/components/button';
-import Icon from 'flavours/glitch/components/icon';
-
-//  Utils.
-import { maxChars } from 'flavours/glitch/initial_state';
-
-//  Messages.
-const messages = defineMessages({
-  publish: {
-    defaultMessage: 'Publish',
-    id: 'compose_form.publish',
-  },
-  publishLoud: {
-    defaultMessage: '{publish}!',
-    id: 'compose_form.publish_loud',
-  },
-  saveChanges: { id: 'compose_form.save_changes', defaultMessage: 'Save changes' },
-});
-
-export default @injectIntl
-class Publisher extends ImmutablePureComponent {
-
-  static propTypes = {
-    countText: PropTypes.string,
-    disabled: PropTypes.bool,
-    intl: PropTypes.object.isRequired,
-    onSecondarySubmit: PropTypes.func,
-    onSubmit: PropTypes.func,
-    privacy: PropTypes.oneOf(['direct', 'private', 'unlisted', 'public']),
-    sideArm: PropTypes.oneOf(['none', 'direct', 'private', 'unlisted', 'public']),
-    isEditing: PropTypes.bool,
-  };
-
-  handleSubmit = () => {
-    this.props.onSubmit();
-  };
-
-  render () {
-    const { countText, disabled, intl, onSecondarySubmit, privacy, sideArm, isEditing } = this.props;
-
-    const diff = maxChars - length(countText || '');
-    const computedClass = classNames('compose-form__publish', {
-      disabled: disabled,
-      over: diff < 0,
-    });
-
-    const privacyIcons = { direct: 'envelope', private: 'lock', public: 'globe', unlisted: 'unlock' };
-
-    let publishText;
-    if (isEditing) {
-      publishText = intl.formatMessage(messages.saveChanges);
-    } else if (privacy === 'private' || privacy === 'direct') {
-      const iconId = privacyIcons[privacy];
-      publishText = (
-        <span>
-          <Icon id={iconId} /> {intl.formatMessage(messages.publish)}
-        </span>
-      );
-    } else {
-      publishText = privacy !== 'unlisted' ? intl.formatMessage(messages.publishLoud, { publish: intl.formatMessage(messages.publish) }) : intl.formatMessage(messages.publish);
-    }
-
-    return (
-      <div className={computedClass}>
-        {sideArm && !isEditing && sideArm !== 'none' ? (
-          <div className='compose-form__publish-button-wrapper'>
-            <Button
-              className='side_arm'
-              disabled={disabled}
-              onClick={onSecondarySubmit}
-              style={{ padding: null }}
-              text={<Icon id={privacyIcons[sideArm]} />}
-              title={`${intl.formatMessage(messages.publish)}: ${intl.formatMessage({ id: `privacy.${sideArm}.short` })}`}
-            />
-          </div>
-        ) : null}
-        <div className='compose-form__publish-button-wrapper'>
-          <Button
-            className='primary'
-            text={publishText}
-            title={`${intl.formatMessage(messages.publish)}: ${intl.formatMessage({ id: `privacy.${privacy}.short` })}`}
-            onClick={this.handleSubmit}
-            disabled={disabled}
-          />
-        </div>
-      </div>
-    );
-  }
-
-}