From 81ef21a0c802f1d905f37a2a818544a8b400793c Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Sat, 25 Feb 2023 14:34:32 +0100 Subject: [Glitch] Rename JSX files with proper `.jsx` extension Port 44a7d87cb1f5df953b6c14c16c59e2e4ead1bcb9 to glitch-soc Signed-off-by: Claire --- .../features/subscribed_languages_modal/index.js | 125 --------------------- .../features/subscribed_languages_modal/index.jsx | 125 +++++++++++++++++++++ 2 files changed, 125 insertions(+), 125 deletions(-) delete mode 100644 app/javascript/flavours/glitch/features/subscribed_languages_modal/index.js create mode 100644 app/javascript/flavours/glitch/features/subscribed_languages_modal/index.jsx (limited to 'app/javascript/flavours/glitch/features/subscribed_languages_modal') diff --git a/app/javascript/flavours/glitch/features/subscribed_languages_modal/index.js b/app/javascript/flavours/glitch/features/subscribed_languages_modal/index.js deleted file mode 100644 index 35083503c..000000000 --- a/app/javascript/flavours/glitch/features/subscribed_languages_modal/index.js +++ /dev/null @@ -1,125 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import ImmutablePureComponent from 'react-immutable-pure-component'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import { connect } from 'react-redux'; -import { createSelector } from 'reselect'; -import { is, List as ImmutableList, Set as ImmutableSet } from 'immutable'; -import { languages as preloadedLanguages } from 'flavours/glitch/initial_state'; -import Option from 'flavours/glitch/features/report/components/option'; -import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; -import IconButton from 'flavours/glitch/components/icon_button'; -import Button from 'flavours/glitch/components/button'; -import { followAccount } from 'flavours/glitch/actions/accounts'; - -const messages = defineMessages({ - close: { id: 'lightbox.close', defaultMessage: 'Close' }, -}); - -const getAccountLanguages = createSelector([ - (state, accountId) => state.getIn(['timelines', `account:${accountId}`, 'items'], ImmutableList()), - state => state.get('statuses'), -], (statusIds, statuses) => - new ImmutableSet(statusIds.map(statusId => statuses.get(statusId)).filter(status => !status.get('reblog')).map(status => status.get('language')))); - -const mapStateToProps = (state, { accountId }) => ({ - acct: state.getIn(['accounts', accountId, 'acct']), - availableLanguages: getAccountLanguages(state, accountId), - selectedLanguages: ImmutableSet(state.getIn(['relationships', accountId, 'languages']) || ImmutableList()), -}); - -const mapDispatchToProps = (dispatch, { accountId }) => ({ - - onSubmit (languages) { - dispatch(followAccount(accountId, { languages })); - }, - -}); - -export default @connect(mapStateToProps, mapDispatchToProps) -@injectIntl -class SubscribedLanguagesModal extends ImmutablePureComponent { - - static propTypes = { - accountId: PropTypes.string.isRequired, - acct: PropTypes.string.isRequired, - availableLanguages: ImmutablePropTypes.setOf(PropTypes.string), - selectedLanguages: ImmutablePropTypes.setOf(PropTypes.string), - onClose: PropTypes.func.isRequired, - languages: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.string)), - intl: PropTypes.object.isRequired, - submit: PropTypes.func.isRequired, - }; - - static defaultProps = { - languages: preloadedLanguages, - }; - - state = { - selectedLanguages: this.props.selectedLanguages, - }; - - handleLanguageToggle = (value, checked) => { - const { selectedLanguages } = this.state; - - if (checked) { - this.setState({ selectedLanguages: selectedLanguages.add(value) }); - } else { - this.setState({ selectedLanguages: selectedLanguages.delete(value) }); - } - }; - - handleSubmit = () => { - this.props.onSubmit(this.state.selectedLanguages.toArray()); - this.props.onClose(); - }; - - renderItem (value) { - const language = this.props.languages.find(language => language[0] === value); - const checked = this.state.selectedLanguages.includes(value); - - if (!language) { - return null; - } - - return ( -