cleanup JS imports and other minor stuff

This commit is contained in:
fef 2022-12-01 23:30:39 +01:00 committed by Jeremy Kescher
parent 01cc5133e0
commit ef97a35161
No known key found for this signature in database
GPG key ID: 80A419A7A613DFA4
12 changed files with 14 additions and 45 deletions

View file

@ -430,14 +430,12 @@ export const addReactionRequest = (statusId, name) => ({
type: REACTION_ADD_REQUEST, type: REACTION_ADD_REQUEST,
id: statusId, id: statusId,
name, name,
skipLoading: true,
}); });
export const addReactionSuccess = (statusId, name) => ({ export const addReactionSuccess = (statusId, name) => ({
type: REACTION_ADD_SUCCESS, type: REACTION_ADD_SUCCESS,
id: statusId, id: statusId,
name, name,
skipLoading: true,
}); });
export const addReactionFail = (statusId, name, error) => ({ export const addReactionFail = (statusId, name, error) => ({
@ -445,7 +443,6 @@ export const addReactionFail = (statusId, name, error) => ({
id: statusId, id: statusId,
name, name,
error, error,
skipLoading: true,
}); });
export const removeReaction = (statusId, name) => (dispatch, getState) => { export const removeReaction = (statusId, name) => (dispatch, getState) => {
@ -462,19 +459,16 @@ export const removeReactionRequest = (statusId, name) => ({
type: REACTION_REMOVE_REQUEST, type: REACTION_REMOVE_REQUEST,
id: statusId, id: statusId,
name, name,
skipLoading: true,
}); });
export const removeReactionSuccess = (statusId, name) => ({ export const removeReactionSuccess = (statusId, name) => ({
type: REACTION_REMOVE_SUCCESS, type: REACTION_REMOVE_SUCCESS,
id: statusId, id: statusId,
name, name,
skipLoading: true,
}); });
export const removeReactionFail = (statusId, name) => ({ export const removeReactionFail = (statusId, name) => ({
type: REACTION_REMOVE_FAIL, type: REACTION_REMOVE_FAIL,
id: statusId, id: statusId,
name, name,
skipLoading: true,
}); });

View file

@ -1,7 +1,7 @@
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';
import { reduceMotion } from '../initial_state'; import { autoPlayGif, reduceMotion } from '../initial_state';
import spring from 'react-motion/lib/spring'; import spring from 'react-motion/lib/spring';
import TransitionMotion from 'react-motion/lib/TransitionMotion'; import TransitionMotion from 'react-motion/lib/TransitionMotion';
import classNames from 'classnames'; import classNames from 'classnames';
@ -9,7 +9,6 @@ import React from 'react';
import unicodeMapping from '../features/emoji/emoji_unicode_mapping_light'; import unicodeMapping from '../features/emoji/emoji_unicode_mapping_light';
import AnimatedNumber from './animated_number'; import AnimatedNumber from './animated_number';
import { assetHost } from '../utils/config'; import { assetHost } from '../utils/config';
import { autoPlayGif } from '../initial_state';
export default class StatusReactions extends ImmutablePureComponent { export default class StatusReactions extends ImmutablePureComponent {
@ -101,19 +100,12 @@ class Reaction extends ImmutablePureComponent {
render() { render() {
const { reaction } = this.props; const { reaction } = this.props;
let shortCode = reaction.get('name');
if (unicodeMapping[shortCode]) {
shortCode = unicodeMapping[shortCode].shortCode;
}
return ( return (
<button <button
className={classNames('reactions-bar__item', { active: reaction.get('me') })} className={classNames('reactions-bar__item', { active: reaction.get('me') })}
onClick={this.handleClick} onClick={this.handleClick}
onMouseEnter={this.handleMouseEnter} onMouseEnter={this.handleMouseEnter}
onMouseLeave={this.handleMouseLeave} onMouseLeave={this.handleMouseLeave}
title={`:${shortCode}:`}
style={this.props.style} style={this.props.style}
> >
<span className='reactions-bar__item__emoji'> <span className='reactions-bar__item__emoji'>

View file

@ -37,7 +37,6 @@ const messages = defineMessages({
unlisted: { id: 'privacy.unlisted.short', defaultMessage: 'Unlisted' }, unlisted: { id: 'privacy.unlisted.short', defaultMessage: 'Unlisted' },
private: { id: 'privacy.private.short', defaultMessage: 'Followers only' }, private: { id: 'privacy.private.short', defaultMessage: 'Followers only' },
direct: { id: 'privacy.direct.short', defaultMessage: 'Mentioned people only' }, direct: { id: 'privacy.direct.short', defaultMessage: 'Mentioned people only' },
enter_amount_prompt: { id: 'settings.enter_amount_prompt', defaultMessage: 'Enter an amount' },
}); });
class LocalSettingsPage extends PureComponent { class LocalSettingsPage extends PureComponent {

View file

@ -22,21 +22,20 @@ export default class LocalSettingsPageItem extends PureComponent {
})), })),
settings: ImmutablePropTypes.map.isRequired, settings: ImmutablePropTypes.map.isRequired,
placeholder: PropTypes.string, placeholder: PropTypes.string,
number: PropTypes.bool,
disabled: PropTypes.bool, disabled: PropTypes.bool,
}; };
handleChange = e => { handleChange = e => {
const { target } = e; const { target } = e;
const { item, onChange, options, placeholder, number } = this.props; const { item, onChange, options, placeholder } = this.props;
if (options && options.length > 0) onChange(item, target.value); if (options && options.length > 0) onChange(item, target.value);
else if (placeholder) onChange(item, number ? parseInt(target.value) : target.value); else if (placeholder) onChange(item, target.value);
else onChange(item, target.checked); else onChange(item, target.checked);
}; };
render () { render () {
const { handleChange } = this; const { handleChange } = this;
const { settings, item, id, inputProps, options, children, dependsOn, dependsOnNot, placeholder, number, disabled } = this.props; const { settings, item, id, inputProps, options, children, dependsOn, dependsOnNot, placeholder, disabled } = this.props;
let enabled = !disabled; let enabled = !disabled;
if (dependsOn) { if (dependsOn) {
@ -80,7 +79,7 @@ export default class LocalSettingsPageItem extends PureComponent {
</fieldset> </fieldset>
</div> </div>
); );
} else if (placeholder || number) { } else if (placeholder) {
return ( return (
<div className='glitch local-settings__page__item string'> <div className='glitch local-settings__page__item string'>
<label htmlFor={id}> <label htmlFor={id}>
@ -88,7 +87,7 @@ export default class LocalSettingsPageItem extends PureComponent {
<p> <p>
<input <input
id={id} id={id}
type={number ? 'number' : 'text'} type='text'
value={settings.getIn(item)} value={settings.getIn(item)}
placeholder={placeholder} placeholder={placeholder}
onChange={handleChange} onChange={handleChange}

View file

@ -17,7 +17,7 @@ import { Icon } from 'flavours/glitch/components/icon';
import MediaGallery from 'flavours/glitch/components/media_gallery'; import MediaGallery from 'flavours/glitch/components/media_gallery';
import PictureInPicturePlaceholder from 'flavours/glitch/components/picture_in_picture_placeholder'; import PictureInPicturePlaceholder from 'flavours/glitch/components/picture_in_picture_placeholder';
import StatusContent from 'flavours/glitch/components/status_content'; import StatusContent from 'flavours/glitch/components/status_content';
import StatusReactions from '../../../components/status_reactions'; import StatusReactions from 'flavours/glitch/components/status_reactions';
import VisibilityIcon from 'flavours/glitch/components/status_visibility_icon'; import VisibilityIcon from 'flavours/glitch/components/status_visibility_icon';
import PollContainer from 'flavours/glitch/containers/poll_container'; import PollContainer from 'flavours/glitch/containers/poll_container';
import Audio from 'flavours/glitch/features/audio'; import Audio from 'flavours/glitch/features/audio';

View file

@ -55,7 +55,7 @@ import StatusContainer from 'flavours/glitch/containers/status_container';
import BundleColumnError from 'flavours/glitch/features/ui/components/bundle_column_error'; import BundleColumnError from 'flavours/glitch/features/ui/components/bundle_column_error';
import Column from 'flavours/glitch/features/ui/components/column'; import Column from 'flavours/glitch/features/ui/components/column';
import { boostModal, favouriteModal, deleteModal } from 'flavours/glitch/initial_state'; import { boostModal, favouriteModal, deleteModal } from 'flavours/glitch/initial_state';
import { makeGetStatus, makeGetPictureInPicture } from 'flavours/glitch/selectors'; import { makeCustomEmojiMap, makeGetStatus, makeGetPictureInPicture } from 'flavours/glitch/selectors';
import { autoUnfoldCW } from 'flavours/glitch/utils/content_warning'; import { autoUnfoldCW } from 'flavours/glitch/utils/content_warning';
import ColumnHeader from '../../components/column_header'; import ColumnHeader from '../../components/column_header';
@ -64,8 +64,6 @@ import { attachFullscreenListener, detachFullscreenListener, isFullscreen } from
import ActionBar from './components/action_bar'; import ActionBar from './components/action_bar';
import DetailedStatus from './components/detailed_status'; import DetailedStatus from './components/detailed_status';
import { makeCustomEmojiMap } from '../../selectors';
const messages = defineMessages({ const messages = defineMessages({
deleteConfirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' }, deleteConfirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' },
deleteMessage: { id: 'confirmations.delete.message', defaultMessage: 'Are you sure you want to delete this status?' }, deleteMessage: { id: 'confirmations.delete.message', defaultMessage: 'Are you sure you want to delete this status?' },

View file

@ -62,6 +62,7 @@
* @property {boolean} limited_federation_mode * @property {boolean} limited_federation_mode
* @property {string} locale * @property {string} locale
* @property {string | null} mascot * @property {string | null} mascot
* @property {number} max_reactions
* @property {string=} me * @property {string=} me
* @property {string=} moved_to_account_id * @property {string=} moved_to_account_id
* @property {string=} owner * @property {string=} owner
@ -81,6 +82,7 @@
* @property {boolean} use_blurhash * @property {boolean} use_blurhash
* @property {boolean=} use_pending_items * @property {boolean=} use_pending_items
* @property {string} version * @property {string} version
* @property {number} visible_reactions
* @property {boolean} translation_enabled * @property {boolean} translation_enabled
* @property {string} status_page_url * @property {string} status_page_url
* @property {boolean} system_emoji_font * @property {boolean} system_emoji_font
@ -134,7 +136,6 @@ export const mascot = getMeta('mascot');
export const maxReactions = (initialState && initialState.max_reactions) || 1; export const maxReactions = (initialState && initialState.max_reactions) || 1;
export const me = getMeta('me'); export const me = getMeta('me');
export const movedToAccountId = getMeta('moved_to_account_id'); export const movedToAccountId = getMeta('moved_to_account_id');
export const visibleReactions = getMeta('visible_reactions');
export const owner = getMeta('owner'); export const owner = getMeta('owner');
export const profile_directory = getMeta('profile_directory'); export const profile_directory = getMeta('profile_directory');
export const reduceMotion = getMeta('reduce_motion'); export const reduceMotion = getMeta('reduce_motion');

View file

@ -450,14 +450,12 @@ export const addReactionRequest = (statusId, name) => ({
type: REACTION_ADD_REQUEST, type: REACTION_ADD_REQUEST,
id: statusId, id: statusId,
name, name,
skipLoading: true,
}); });
export const addReactionSuccess = (statusId, name) => ({ export const addReactionSuccess = (statusId, name) => ({
type: REACTION_ADD_SUCCESS, type: REACTION_ADD_SUCCESS,
id: statusId, id: statusId,
name, name,
skipLoading: true,
}); });
export const addReactionFail = (statusId, name, error) => ({ export const addReactionFail = (statusId, name, error) => ({
@ -465,7 +463,6 @@ export const addReactionFail = (statusId, name, error) => ({
id: statusId, id: statusId,
name, name,
error, error,
skipLoading: true,
}); });
export const removeReaction = (statusId, name) => (dispatch, getState) => { export const removeReaction = (statusId, name) => (dispatch, getState) => {
@ -482,19 +479,16 @@ export const removeReactionRequest = (statusId, name) => ({
type: REACTION_REMOVE_REQUEST, type: REACTION_REMOVE_REQUEST,
id: statusId, id: statusId,
name, name,
skipLoading: true,
}); });
export const removeReactionSuccess = (statusId, name) => ({ export const removeReactionSuccess = (statusId, name) => ({
type: REACTION_REMOVE_SUCCESS, type: REACTION_REMOVE_SUCCESS,
id: statusId, id: statusId,
name, name,
skipLoading: true,
}); });
export const removeReactionFail = (statusId, name) => ({ export const removeReactionFail = (statusId, name) => ({
type: REACTION_REMOVE_FAIL, type: REACTION_REMOVE_FAIL,
id: statusId, id: statusId,
name, name,
skipLoading: true,
}); });

View file

@ -1,7 +1,7 @@
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';
import { reduceMotion } from '../initial_state'; import { autoPlayGif, reduceMotion } from '../initial_state';
import spring from 'react-motion/lib/spring'; import spring from 'react-motion/lib/spring';
import TransitionMotion from 'react-motion/lib/TransitionMotion'; import TransitionMotion from 'react-motion/lib/TransitionMotion';
import classNames from 'classnames'; import classNames from 'classnames';
@ -9,7 +9,6 @@ import React from 'react';
import unicodeMapping from '../features/emoji/emoji_unicode_mapping_light'; import unicodeMapping from '../features/emoji/emoji_unicode_mapping_light';
import AnimatedNumber from './animated_number'; import AnimatedNumber from './animated_number';
import { assetHost } from '../utils/config'; import { assetHost } from '../utils/config';
import { autoPlayGif } from '../initial_state';
export default class StatusReactions extends ImmutablePureComponent { export default class StatusReactions extends ImmutablePureComponent {
@ -101,19 +100,12 @@ class Reaction extends ImmutablePureComponent {
render() { render() {
const { reaction } = this.props; const { reaction } = this.props;
let shortCode = reaction.get('name');
if (unicodeMapping[shortCode]) {
shortCode = unicodeMapping[shortCode].shortCode;
}
return ( return (
<button <button
className={classNames('reactions-bar__item', { active: reaction.get('me') })} className={classNames('reactions-bar__item', { active: reaction.get('me') })}
onClick={this.handleClick} onClick={this.handleClick}
onMouseEnter={this.handleMouseEnter} onMouseEnter={this.handleMouseEnter}
onMouseLeave={this.handleMouseLeave} onMouseLeave={this.handleMouseLeave}
title={`:${shortCode}:`}
style={this.props.style} style={this.props.style}
> >
<span className='reactions-bar__item__emoji'> <span className='reactions-bar__item__emoji'>

View file

@ -12,7 +12,7 @@ import { AnimatedNumber } from 'mastodon/components/animated_number';
import EditedTimestamp from 'mastodon/components/edited_timestamp'; import EditedTimestamp from 'mastodon/components/edited_timestamp';
import { Icon } from 'mastodon/components/icon'; import { Icon } from 'mastodon/components/icon';
import PictureInPicturePlaceholder from 'mastodon/components/picture_in_picture_placeholder'; import PictureInPicturePlaceholder from 'mastodon/components/picture_in_picture_placeholder';
import StatusReactions from '../../../components/status_reactions'; import StatusReactions from 'mastodon/components/status_reactions';
import { Avatar } from '../../../components/avatar'; import { Avatar } from '../../../components/avatar';
import { DisplayName } from '../../../components/display_name'; import { DisplayName } from '../../../components/display_name';

View file

@ -63,7 +63,7 @@ import ColumnHeader from '../../components/column_header';
import { textForScreenReader, defaultMediaVisibility } from '../../components/status'; import { textForScreenReader, defaultMediaVisibility } from '../../components/status';
import StatusContainer from '../../containers/status_container'; import StatusContainer from '../../containers/status_container';
import { boostModal, deleteModal } from '../../initial_state'; import { boostModal, deleteModal } from '../../initial_state';
import { makeGetStatus, makeGetPictureInPicture } from '../../selectors'; import { makeCustomEmojiMap, makeGetStatus, makeGetPictureInPicture } from '../../selectors';
import Column from '../ui/components/column'; import Column from '../ui/components/column';
import { attachFullscreenListener, detachFullscreenListener, isFullscreen } from '../ui/util/fullscreen'; import { attachFullscreenListener, detachFullscreenListener, isFullscreen } from '../ui/util/fullscreen';

View file

@ -61,6 +61,7 @@
* @property {boolean} limited_federation_mode * @property {boolean} limited_federation_mode
* @property {string} locale * @property {string} locale
* @property {string | null} mascot * @property {string | null} mascot
* @property {number} max_reactions
* @property {string=} me * @property {string=} me
* @property {string=} moved_to_account_id * @property {string=} moved_to_account_id
* @property {string=} owner * @property {string=} owner
@ -117,7 +118,6 @@ export const mascot = getMeta('mascot');
export const maxReactions = (initialState && initialState.max_reactions) || 1; export const maxReactions = (initialState && initialState.max_reactions) || 1;
export const me = getMeta('me'); export const me = getMeta('me');
export const movedToAccountId = getMeta('moved_to_account_id'); export const movedToAccountId = getMeta('moved_to_account_id');
export const visibleReactions = getMeta('visible_reactions');
export const owner = getMeta('owner'); export const owner = getMeta('owner');
export const profile_directory = getMeta('profile_directory'); export const profile_directory = getMeta('profile_directory');
export const reduceMotion = getMeta('reduce_motion'); export const reduceMotion = getMeta('reduce_motion');