From 140aa6b054bb73b10a33bda17090453dd550267a Mon Sep 17 00:00:00 2001 From: fusagiko / takayamaki <24884114+takayamaki@users.noreply.github.com> Date: Sun, 7 May 2023 16:10:58 +0900 Subject: [PATCH 01/44] Rewrite VerifiedBadge component as function component (#24892) --- .../mastodon/components/account.jsx | 2 +- .../mastodon/components/verified_badge.jsx | 25 ------------------- .../mastodon/components/verified_badge.tsx | 14 +++++++++++ 3 files changed, 15 insertions(+), 26 deletions(-) delete mode 100644 app/javascript/mastodon/components/verified_badge.jsx create mode 100644 app/javascript/mastodon/components/verified_badge.tsx diff --git a/app/javascript/mastodon/components/account.jsx b/app/javascript/mastodon/components/account.jsx index 0e2295e3a..6a0682e9c 100644 --- a/app/javascript/mastodon/components/account.jsx +++ b/app/javascript/mastodon/components/account.jsx @@ -151,7 +151,7 @@ class Account extends ImmutablePureComponent { const firstVerifiedField = account.get('fields').find(item => !!item.get('verified_at')); if (firstVerifiedField) { - verification = <>· ; + verification = <>· ; } return ( diff --git a/app/javascript/mastodon/components/verified_badge.jsx b/app/javascript/mastodon/components/verified_badge.jsx deleted file mode 100644 index 3d878d5dd..000000000 --- a/app/javascript/mastodon/components/verified_badge.jsx +++ /dev/null @@ -1,25 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import Icon from 'mastodon/components/icon'; - -class VerifiedBadge extends React.PureComponent { - - static propTypes = { - link: PropTypes.string.isRequired, - verifiedAt: PropTypes.string.isRequired, - }; - - render () { - const { link } = this.props; - - return ( - - - - - ); - } - -} - -export default VerifiedBadge; \ No newline at end of file diff --git a/app/javascript/mastodon/components/verified_badge.tsx b/app/javascript/mastodon/components/verified_badge.tsx new file mode 100644 index 000000000..78686b521 --- /dev/null +++ b/app/javascript/mastodon/components/verified_badge.tsx @@ -0,0 +1,14 @@ +import React from 'react'; +import { Icon } from './icon'; + +type Props = { + link: string; +}; +export const VerifiedBadge: React.FC = ({ link }) => ( + + + + +); + +export default VerifiedBadge; From 6fdbee240cbfa8d9068e9b5d0f43e6717186742a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=9F=E3=81=84=E3=81=A1=20=E3=81=B2?= Date: Mon, 8 May 2023 15:26:02 +0900 Subject: [PATCH 02/44] Rewrite as FC (#24901) --- app/javascript/mastodon/components/{check.jsx => check.tsx} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename app/javascript/mastodon/components/{check.jsx => check.tsx} (89%) diff --git a/app/javascript/mastodon/components/check.jsx b/app/javascript/mastodon/components/check.tsx similarity index 89% rename from app/javascript/mastodon/components/check.jsx rename to app/javascript/mastodon/components/check.tsx index 2fd0af740..3a4a11320 100644 --- a/app/javascript/mastodon/components/check.jsx +++ b/app/javascript/mastodon/components/check.tsx @@ -1,6 +1,6 @@ import React from 'react'; -const Check = () => ( +export const Check: React.FC = () => ( From 490ccbf40b06e97f59f09253b0d2e9d613cf353d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=9F=E3=81=84=E3=81=A1=20=E3=81=B2?= Date: Mon, 8 May 2023 18:12:13 +0900 Subject: [PATCH 03/44] Rewrite as FC (#24903) --- ...{not_signed_in_indicator.jsx => not_signed_in_indicator.tsx} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename app/javascript/mastodon/components/{not_signed_in_indicator.jsx => not_signed_in_indicator.tsx} (86%) diff --git a/app/javascript/mastodon/components/not_signed_in_indicator.jsx b/app/javascript/mastodon/components/not_signed_in_indicator.tsx similarity index 86% rename from app/javascript/mastodon/components/not_signed_in_indicator.jsx rename to app/javascript/mastodon/components/not_signed_in_indicator.tsx index b440c6be2..0df90ddbf 100644 --- a/app/javascript/mastodon/components/not_signed_in_indicator.jsx +++ b/app/javascript/mastodon/components/not_signed_in_indicator.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { FormattedMessage } from 'react-intl'; -const NotSignedInIndicator = () => ( +export const NotSignedInIndicator: React.FC = () => (
From a65d2d10458fcb6c1c36fa6dd52b8f64d12ce50d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=9F=E3=81=84=E3=81=A1=20=E3=81=B2?= Date: Mon, 8 May 2023 18:12:44 +0900 Subject: [PATCH 04/44] Rewrite Image component as function component (#24893) --- app/javascript/mastodon/components/image.jsx | 33 -------------------- app/javascript/mastodon/components/image.tsx | 27 ++++++++++++++++ 2 files changed, 27 insertions(+), 33 deletions(-) delete mode 100644 app/javascript/mastodon/components/image.jsx create mode 100644 app/javascript/mastodon/components/image.tsx diff --git a/app/javascript/mastodon/components/image.jsx b/app/javascript/mastodon/components/image.jsx deleted file mode 100644 index 6e81ddf08..000000000 --- a/app/javascript/mastodon/components/image.jsx +++ /dev/null @@ -1,33 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import Blurhash from './blurhash'; -import classNames from 'classnames'; - -export default class Image extends React.PureComponent { - - static propTypes = { - src: PropTypes.string, - srcSet: PropTypes.string, - blurhash: PropTypes.string, - className: PropTypes.string, - }; - - state = { - loaded: false, - }; - - handleLoad = () => this.setState({ loaded: true }); - - render () { - const { src, srcSet, blurhash, className } = this.props; - const { loaded } = this.state; - - return ( -
- {blurhash && } - -
- ); - } - -} diff --git a/app/javascript/mastodon/components/image.tsx b/app/javascript/mastodon/components/image.tsx new file mode 100644 index 000000000..9b4d60225 --- /dev/null +++ b/app/javascript/mastodon/components/image.tsx @@ -0,0 +1,27 @@ +import React, { useCallback, useState } from 'react'; +import Blurhash from './blurhash'; +import classNames from 'classnames'; + +type Props = { + src: string; + srcSet?: string; + blurhash?: string; + className?: string; +} + +export const Image: React.FC = ({ src, srcSet, blurhash, className }) => { + const [loaded, setLoaded] = useState(false); + + const handleLoad = useCallback(() => { + setLoaded(true); + }, [setLoaded]); + + return ( +
+ {blurhash && } + +
+ ); +}; + +export default Image; From 76264e3fe86d1ac3c9f6d91290e77db8d9272d1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=9F=E3=81=84=E3=81=A1=20=E3=81=B2?= Date: Mon, 8 May 2023 18:12:53 +0900 Subject: [PATCH 05/44] Rewrite RadioButton component as FC (#24897) --- .../mastodon/components/radio_button.jsx | 35 ------------------- .../mastodon/components/radio_button.tsx | 30 ++++++++++++++++ 2 files changed, 30 insertions(+), 35 deletions(-) delete mode 100644 app/javascript/mastodon/components/radio_button.jsx create mode 100644 app/javascript/mastodon/components/radio_button.tsx diff --git a/app/javascript/mastodon/components/radio_button.jsx b/app/javascript/mastodon/components/radio_button.jsx deleted file mode 100644 index 0496fa286..000000000 --- a/app/javascript/mastodon/components/radio_button.jsx +++ /dev/null @@ -1,35 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import classNames from 'classnames'; - -export default class RadioButton extends React.PureComponent { - - static propTypes = { - value: PropTypes.string.isRequired, - checked: PropTypes.bool, - name: PropTypes.string.isRequired, - onChange: PropTypes.func.isRequired, - label: PropTypes.node.isRequired, - }; - - render () { - const { name, value, checked, onChange, label } = this.props; - - return ( - - ); - } - -} diff --git a/app/javascript/mastodon/components/radio_button.tsx b/app/javascript/mastodon/components/radio_button.tsx new file mode 100644 index 000000000..9ba098f78 --- /dev/null +++ b/app/javascript/mastodon/components/radio_button.tsx @@ -0,0 +1,30 @@ +import React from 'react'; +import classNames from 'classnames'; + +type Props = { + value: string; + checked: boolean; + name: string; + onChange: (event: React.ChangeEvent) => void; + label: React.ReactNode; +}; + +export const RadioButton: React.FC = ({ name, value, checked, onChange, label }) => { + return ( + + ); +}; + +export default RadioButton; From 7c1305b3a4ce0ee39aa923a1f1ac604794265b0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=9F=E3=81=84=E3=81=A1=20=E3=81=B2?= Date: Mon, 8 May 2023 18:28:36 +0900 Subject: [PATCH 06/44] Add TypeScript support for `mastodon` alias and image imports (#24895) --- .../mastodon/components/hashtag.jsx | 2 -- app/javascript/types/image.d.ts | 34 +++++++++++++++++++ tsconfig.json | 13 +++++-- 3 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 app/javascript/types/image.d.ts diff --git a/app/javascript/mastodon/components/hashtag.jsx b/app/javascript/mastodon/components/hashtag.jsx index 254fae2fe..d03b1a45a 100644 --- a/app/javascript/mastodon/components/hashtag.jsx +++ b/app/javascript/mastodon/components/hashtag.jsx @@ -5,9 +5,7 @@ import { FormattedMessage } from 'react-intl'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { Link } from 'react-router-dom'; -// @ts-expect-error import ShortNumber from 'mastodon/components/short_number'; -// @ts-expect-error import Skeleton from 'mastodon/components/skeleton'; import classNames from 'classnames'; diff --git a/app/javascript/types/image.d.ts b/app/javascript/types/image.d.ts new file mode 100644 index 000000000..8bd6ab028 --- /dev/null +++ b/app/javascript/types/image.d.ts @@ -0,0 +1,34 @@ +declare module '*.avif' { + const path: string; + export default path; +} + +declare module '*.gif' { + const path: string; + export default path; +} + +declare module '*.jpg' { + const path: string; + export default path; +} + +declare module '*.jpg' { + const path: string; + export default path; +} + +declare module '*.png' { + const path: string; + export default path; +} + +declare module '*.svg' { + const path: string; + export default path; +} + +declare module '*.webp' { + const path: string; + export default path; +} diff --git a/tsconfig.json b/tsconfig.json index 505b19d89..09cea2a75 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,7 +7,16 @@ "noEmit": true, "strict": true, "esModuleInterop": true, - "skipLibCheck": true + "skipLibCheck": true, + "baseUrl": "./", + "paths": { + "mastodon": ["app/javascript/mastodon"], + "mastodon/*": ["app/javascript/mastodon/*"] + } }, - "include": ["app/javascript/mastodon", "app/javascript/packs"] + "include": [ + "app/javascript/mastodon", + "app/javascript/packs", + "app/javascript/types" + ] } From 5bc8e2d1fdc3f1b1a0b9af5aed762d44e048250c Mon Sep 17 00:00:00 2001 From: fusagiko / takayamaki <24884114+takayamaki@users.noreply.github.com> Date: Mon, 8 May 2023 22:10:21 +0900 Subject: [PATCH 07/44] Use LayoutType from is_mobile in actions/app (#24863) --- app/javascript/mastodon/actions/app.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/javascript/mastodon/actions/app.ts b/app/javascript/mastodon/actions/app.ts index 0acfbfae7..50fd317a6 100644 --- a/app/javascript/mastodon/actions/app.ts +++ b/app/javascript/mastodon/actions/app.ts @@ -1,10 +1,11 @@ import { createAction } from '@reduxjs/toolkit'; +import type { LayoutType } from '../is_mobile'; export const focusApp = createAction('APP_FOCUS'); export const unfocusApp = createAction('APP_UNFOCUS'); type ChangeLayoutPayload = { - layout: 'mobile' | 'single-column' | 'multi-column'; + layout: LayoutType; }; export const changeLayout = createAction('APP_LAYOUT_CHANGE'); From 9818f342735d1765baa281aaeeab2f60b8d049fe Mon Sep 17 00:00:00 2001 From: fusagiko / takayamaki <24884114+takayamaki@users.noreply.github.com> Date: Mon, 8 May 2023 22:12:12 +0900 Subject: [PATCH 08/44] Rewrite Domain component as function component (#24896) --- app/javascript/mastodon/components/domain.jsx | 43 ------------------- app/javascript/mastodon/components/domain.tsx | 42 ++++++++++++++++++ .../mastodon/containers/domain_container.jsx | 2 +- 3 files changed, 43 insertions(+), 44 deletions(-) delete mode 100644 app/javascript/mastodon/components/domain.jsx create mode 100644 app/javascript/mastodon/components/domain.tsx diff --git a/app/javascript/mastodon/components/domain.jsx b/app/javascript/mastodon/components/domain.jsx deleted file mode 100644 index 85ebdbde9..000000000 --- a/app/javascript/mastodon/components/domain.jsx +++ /dev/null @@ -1,43 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import IconButton from './icon_button'; -import { defineMessages, injectIntl } from 'react-intl'; -import ImmutablePureComponent from 'react-immutable-pure-component'; - -const messages = defineMessages({ - unblockDomain: { id: 'account.unblock_domain', defaultMessage: 'Unblock domain {domain}' }, -}); - -class Account extends ImmutablePureComponent { - - static propTypes = { - domain: PropTypes.string, - onUnblockDomain: PropTypes.func.isRequired, - intl: PropTypes.object.isRequired, - }; - - handleDomainUnblock = () => { - this.props.onUnblockDomain(this.props.domain); - }; - - render () { - const { domain, intl } = this.props; - - return ( -
-
- - {domain} - - -
- -
-
-
- ); - } - -} - -export default injectIntl(Account); diff --git a/app/javascript/mastodon/components/domain.tsx b/app/javascript/mastodon/components/domain.tsx new file mode 100644 index 000000000..6cb8f7b8f --- /dev/null +++ b/app/javascript/mastodon/components/domain.tsx @@ -0,0 +1,42 @@ +import React, { useCallback } from 'react'; +import IconButton from './icon_button'; +import { InjectedIntl, defineMessages, injectIntl } from 'react-intl'; + +const messages = defineMessages({ + unblockDomain: { + id: 'account.unblock_domain', + defaultMessage: 'Unblock domain {domain}', + }, +}); + +type Props = { + domain: string; + onUnblockDomain: (domain: string) => void; + intl: InjectedIntl; +}; +const _Domain: React.FC = ({ domain, onUnblockDomain, intl }) => { + const handleDomainUnblock = useCallback(() => { + onUnblockDomain(domain); + }, [domain, onUnblockDomain]); + + return ( +
+
+ + {domain} + + +
+ +
+
+
+ ); +}; + +export const Domain = injectIntl(_Domain); diff --git a/app/javascript/mastodon/containers/domain_container.jsx b/app/javascript/mastodon/containers/domain_container.jsx index 8a8ba1df1..419d5d29f 100644 --- a/app/javascript/mastodon/containers/domain_container.jsx +++ b/app/javascript/mastodon/containers/domain_container.jsx @@ -2,7 +2,7 @@ import React from 'react'; import { connect } from 'react-redux'; import { blockDomain, unblockDomain } from '../actions/domain_blocks'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import Domain from '../components/domain'; +import { Domain } from '../components/domain'; import { openModal } from '../actions/modal'; const messages = defineMessages({ From 89269e4b713e3291a5c8c29b8d2e7b950b60eb35 Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Tue, 9 May 2023 03:07:13 +0200 Subject: [PATCH 09/44] Mark `wheel` events on scrollable list as passive (#24914) --- app/javascript/mastodon/components/scrollable_list.jsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/javascript/mastodon/components/scrollable_list.jsx b/app/javascript/mastodon/components/scrollable_list.jsx index 57bc88121..3f4e4a59c 100644 --- a/app/javascript/mastodon/components/scrollable_list.jsx +++ b/app/javascript/mastodon/components/scrollable_list.jsx @@ -8,6 +8,7 @@ import IntersectionObserverWrapper from '../features/ui/util/intersection_observ import { throttle } from 'lodash'; import { List as ImmutableList } from 'immutable'; import classNames from 'classnames'; +import { supportsPassiveEvents } from 'detect-passive-events'; import { attachFullscreenListener, detachFullscreenListener, isFullscreen } from '../features/ui/util/fullscreen'; import LoadingIndicator from './loading_indicator'; import { connect } from 'react-redux'; @@ -236,10 +237,10 @@ class ScrollableList extends PureComponent { attachScrollListener () { if (this.props.bindToDocument) { document.addEventListener('scroll', this.handleScroll); - document.addEventListener('wheel', this.handleWheel); + document.addEventListener('wheel', this.handleWheel, supportsPassiveEvents ? { passive: true } : undefined); } else { this.node.addEventListener('scroll', this.handleScroll); - this.node.addEventListener('wheel', this.handleWheel); + this.node.addEventListener('wheel', this.handleWheel, supportsPassiveEvents ? { passive: true } : undefined); } } From 955179fc55f2db2694ab2d1e98d5ae82af430571 Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Tue, 9 May 2023 03:08:47 +0200 Subject: [PATCH 10/44] Dont use CommonJS (`require`, `module.exports`) anywhere (#24913) --- .eslintrc.js | 17 ++++++++++ app/javascript/mastodon/common.js | 2 +- .../features/emoji/emoji_compressed.js | 2 ++ .../features/emoji/emoji_mart_data_light.js | 8 +++-- .../features/emoji/emoji_mart_search_light.js | 2 +- .../emoji/emoji_unicode_mapping_light.js | 15 +++++---- .../mastodon/features/emoji/emoji_utils.js | 2 +- .../features/emoji/unicode_to_filename.js | 3 ++ .../features/emoji/unicode_to_unified_name.js | 3 ++ app/javascript/mastodon/main.jsx | 3 +- app/javascript/mastodon/performance.js | 4 +-- .../service_worker/web_push_locales.js | 3 ++ app/javascript/packs/admin.jsx | 5 ++- app/javascript/packs/mailer.js | 2 +- app/javascript/packs/public.jsx | 32 +++++++++++-------- app/javascript/packs/share.jsx | 15 +++++---- package.json | 2 +- 17 files changed, 79 insertions(+), 41 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 8394d98b9..c888671ce 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -102,6 +102,7 @@ module.exports = { { vars: 'all', args: 'after-used', + destructuredArrayIgnorePattern: '^_', ignoreRestSiblings: true, }, ], @@ -208,6 +209,9 @@ module.exports = { ], }, ], + 'import/no-amd': 'error', + 'import/no-commonjs': 'error', + 'import/no-import-module-exports': 'error', 'import/no-webpack-loader-syntax': 'error', 'promise/always-return': 'off', @@ -255,6 +259,7 @@ module.exports = { '*.config.js', '.*rc.js', 'ide-helper.js', + 'config/webpack/**/*', ], env: { @@ -264,6 +269,10 @@ module.exports = { parserOptions: { sourceType: 'script', }, + + rules: { + 'import/no-commonjs': 'off', + }, }, { files: [ @@ -298,5 +307,13 @@ module.exports = { jest: true, }, }, + { + files: [ + 'streaming/**/*', + ], + rules: { + 'import/no-commonjs': 'off', + }, + }, ], }; diff --git a/app/javascript/mastodon/common.js b/app/javascript/mastodon/common.js index 8f3505303..0ec844934 100644 --- a/app/javascript/mastodon/common.js +++ b/app/javascript/mastodon/common.js @@ -1,7 +1,7 @@ import Rails from '@rails/ujs'; +import 'font-awesome/css/font-awesome.css'; export function start() { - require('font-awesome/css/font-awesome.css'); require.context('../images/', true); try { diff --git a/app/javascript/mastodon/features/emoji/emoji_compressed.js b/app/javascript/mastodon/features/emoji/emoji_compressed.js index 6a402f2d4..e1bee1655 100644 --- a/app/javascript/mastodon/features/emoji/emoji_compressed.js +++ b/app/javascript/mastodon/features/emoji/emoji_compressed.js @@ -1,3 +1,5 @@ +/* eslint-disable import/no-commonjs -- + We need to use CommonJS here due to preval */ // @preval // http://www.unicode.org/Public/emoji/5.0/emoji-test.txt // This file contains the compressed version of the emoji data from diff --git a/app/javascript/mastodon/features/emoji/emoji_mart_data_light.js b/app/javascript/mastodon/features/emoji/emoji_mart_data_light.js index 49813537d..000aeb0de 100644 --- a/app/javascript/mastodon/features/emoji/emoji_mart_data_light.js +++ b/app/javascript/mastodon/features/emoji/emoji_mart_data_light.js @@ -1,8 +1,10 @@ // The output of this module is designed to mimic emoji-mart's // "data" object, such that we can use it for a light version of emoji-mart's // emojiIndex.search functionality. -const { unicodeToUnifiedName } = require('./unicode_to_unified_name'); -const [ shortCodesToEmojiData, skins, categories, short_names ] = require('./emoji_compressed'); +import { unicodeToUnifiedName } from './unicode_to_unified_name'; +import emojiCompressed from './emoji_compressed'; + +const [ shortCodesToEmojiData, skins, categories, short_names ] = emojiCompressed; const emojis = {}; @@ -33,7 +35,7 @@ Object.keys(shortCodesToEmojiData).forEach((shortCode) => { }; }); -module.exports = { +export { emojis, skins, categories, diff --git a/app/javascript/mastodon/features/emoji/emoji_mart_search_light.js b/app/javascript/mastodon/features/emoji/emoji_mart_search_light.js index 70694ab6d..83e154b0b 100644 --- a/app/javascript/mastodon/features/emoji/emoji_mart_search_light.js +++ b/app/javascript/mastodon/features/emoji/emoji_mart_search_light.js @@ -1,7 +1,7 @@ // This code is largely borrowed from: // https://github.com/missive/emoji-mart/blob/5f2ffcc/src/utils/emoji-index.js -import data from './emoji_mart_data_light'; +import * as data from './emoji_mart_data_light'; import { getData, getSanitizedData, uniq, intersect } from './emoji_utils'; let originalPool = {}; diff --git a/app/javascript/mastodon/features/emoji/emoji_unicode_mapping_light.js b/app/javascript/mastodon/features/emoji/emoji_unicode_mapping_light.js index 1a38fde23..30fbd9e34 100644 --- a/app/javascript/mastodon/features/emoji/emoji_unicode_mapping_light.js +++ b/app/javascript/mastodon/features/emoji/emoji_unicode_mapping_light.js @@ -2,14 +2,17 @@ // (i.e. the svg filename) and a shortCode intended to be shown // as a "title" attribute in an HTML element (aka tooltip). +import emojiCompressed from './emoji_compressed'; + +import { unicodeToFilename } from './unicode_to_filename'; + const [ shortCodesToEmojiData, - skins, // eslint-disable-line @typescript-eslint/no-unused-vars - categories, // eslint-disable-line @typescript-eslint/no-unused-vars - short_names, // eslint-disable-line @typescript-eslint/no-unused-vars + _skins, + _categories, + _short_names, emojisWithoutShortCodes, -] = require('./emoji_compressed'); -const { unicodeToFilename } = require('./unicode_to_filename'); +] = emojiCompressed; // decompress const unicodeMapping = {}; @@ -32,4 +35,4 @@ Object.keys(shortCodesToEmojiData).forEach((shortCode) => { }); emojisWithoutShortCodes.forEach(emojiMapData => processEmojiMapData(emojiMapData)); -module.exports = unicodeMapping; +export default unicodeMapping; diff --git a/app/javascript/mastodon/features/emoji/emoji_utils.js b/app/javascript/mastodon/features/emoji/emoji_utils.js index be793526d..83bcc9d82 100644 --- a/app/javascript/mastodon/features/emoji/emoji_utils.js +++ b/app/javascript/mastodon/features/emoji/emoji_utils.js @@ -1,7 +1,7 @@ // This code is largely borrowed from: // https://github.com/missive/emoji-mart/blob/5f2ffcc/src/utils/index.js -import data from './emoji_mart_data_light'; +import * as data from './emoji_mart_data_light'; const buildSearch = (data) => { const search = []; diff --git a/app/javascript/mastodon/features/emoji/unicode_to_filename.js b/app/javascript/mastodon/features/emoji/unicode_to_filename.js index c75c4cd7d..3395c7717 100644 --- a/app/javascript/mastodon/features/emoji/unicode_to_filename.js +++ b/app/javascript/mastodon/features/emoji/unicode_to_filename.js @@ -1,3 +1,6 @@ +/* eslint-disable import/no-commonjs -- + We need to use CommonJS here as its imported into a preval file (`emoji_compressed.js`) */ + // taken from: // https://github.com/twitter/twemoji/blob/47732c7/twemoji-generator.js#L848-L866 exports.unicodeToFilename = (str) => { diff --git a/app/javascript/mastodon/features/emoji/unicode_to_unified_name.js b/app/javascript/mastodon/features/emoji/unicode_to_unified_name.js index d29550f12..108b91122 100644 --- a/app/javascript/mastodon/features/emoji/unicode_to_unified_name.js +++ b/app/javascript/mastodon/features/emoji/unicode_to_unified_name.js @@ -1,3 +1,6 @@ +/* eslint-disable import/no-commonjs -- + We need to use CommonJS here as its imported into a preval file (`emoji_compressed.js`) */ + function padLeft(str, num) { while (str.length < num) { str = '0' + str; diff --git a/app/javascript/mastodon/main.jsx b/app/javascript/mastodon/main.jsx index 88a205dd2..d8654aded 100644 --- a/app/javascript/mastodon/main.jsx +++ b/app/javascript/mastodon/main.jsx @@ -5,8 +5,7 @@ import Mastodon from 'mastodon/containers/mastodon'; import { store } from 'mastodon/store/configureStore'; import { me } from 'mastodon/initial_state'; import ready from 'mastodon/ready'; - -const perf = require('mastodon/performance'); +import * as perf from 'mastodon/performance'; /** * @returns {Promise} diff --git a/app/javascript/mastodon/performance.js b/app/javascript/mastodon/performance.js index 95cf962d6..42849c82b 100644 --- a/app/javascript/mastodon/performance.js +++ b/app/javascript/mastodon/performance.js @@ -2,9 +2,8 @@ // Tools for performance debugging, only enabled in development mode. // Open up Chrome Dev Tools, then Timeline, then User Timing to see output. // Also see config/webpack/loaders/mark.js for the webpack loader marks. -// -let marky; +import * as marky from 'marky'; if (process.env.NODE_ENV === 'development') { if (typeof performance !== 'undefined' && performance.setResourceTimingBufferSize) { @@ -13,7 +12,6 @@ if (process.env.NODE_ENV === 'development') { performance.setResourceTimingBufferSize(Infinity); } - marky = require('marky'); // allows us to easily do e.g. ReactPerf.printWasted() while debugging //window.ReactPerf = require('react-addons-perf'); //window.ReactPerf.start(); diff --git a/app/javascript/mastodon/service_worker/web_push_locales.js b/app/javascript/mastodon/service_worker/web_push_locales.js index 7d713cd37..3912f75c7 100644 --- a/app/javascript/mastodon/service_worker/web_push_locales.js +++ b/app/javascript/mastodon/service_worker/web_push_locales.js @@ -1,3 +1,6 @@ +/* eslint-disable import/no-commonjs -- + We need to use CommonJS here as its imported into a preval file (`emoji_compressed.js`) */ + /* @preval */ const fs = require('fs'); diff --git a/app/javascript/packs/admin.jsx b/app/javascript/packs/admin.jsx index 038e9b434..99e903eef 100644 --- a/app/javascript/packs/admin.jsx +++ b/app/javascript/packs/admin.jsx @@ -1,6 +1,8 @@ import './public-path'; import { delegate } from '@rails/ujs'; import ready from '../mastodon/ready'; +import React from 'react'; +import ReactDOM from 'react-dom'; const setAnnouncementEndsAttributes = (target) => { const valid = target?.value && target?.validity?.valid; @@ -223,9 +225,6 @@ ready(() => { setAnnouncementEndsAttributes(announcementStartsAt); } - const React = require('react'); - const ReactDOM = require('react-dom'); - [].forEach.call(document.querySelectorAll('[data-admin-component]'), element => { const componentName = element.getAttribute('data-admin-component'); const { locale, ...componentProps } = JSON.parse(element.getAttribute('data-props')); diff --git a/app/javascript/packs/mailer.js b/app/javascript/packs/mailer.js index a4b6d5446..a2ad5e73a 100644 --- a/app/javascript/packs/mailer.js +++ b/app/javascript/packs/mailer.js @@ -1,3 +1,3 @@ -require('../styles/mailer.scss'); +import '../styles/mailer.scss'; require.context('../icons'); diff --git a/app/javascript/packs/public.jsx b/app/javascript/packs/public.jsx index 3e832c509..21c52fc12 100644 --- a/app/javascript/packs/public.jsx +++ b/app/javascript/packs/public.jsx @@ -1,13 +1,24 @@ import './public-path'; -import escapeTextContentForBrowser from 'escape-html'; import loadPolyfills from '../mastodon/load_polyfills'; -import ready from '../mastodon/ready'; import { start } from '../mastodon/common'; + +import escapeTextContentForBrowser from 'escape-html'; +import ready from '../mastodon/ready'; import loadKeyboardExtensions from '../mastodon/load_keyboard_extensions'; import 'cocoon-js-vanilla'; import axios from 'axios'; import { throttle } from 'lodash'; import { defineMessages } from 'react-intl'; +import * as IntlMessageFormat from 'intl-messageformat'; +import { timeAgoString } from '../mastodon/components/relative_timestamp'; +import { delegate } from '@rails/ujs'; +import * as emojify from '../mastodon/features/emoji/emoji'; +import { getLocale } from '../mastodon/locales'; +import React from 'react'; +import ReactDOM from 'react-dom'; +import { createBrowserHistory } from 'history'; + +start(); const messages = defineMessages({ usernameTaken: { id: 'username.taken', defaultMessage: 'That username is taken. Try another' }, @@ -15,8 +26,6 @@ const messages = defineMessages({ passwordDoesNotMatch: { id: 'password_confirmation.mismatching', defaultMessage: 'Password confirmation does not match' }, }); -start(); - window.addEventListener('message', e => { const data = e.data || {}; @@ -33,16 +42,8 @@ window.addEventListener('message', e => { }); }); -function main() { - const IntlMessageFormat = require('intl-messageformat').default; - const { timeAgoString } = require('../mastodon/components/relative_timestamp'); - const { delegate } = require('@rails/ujs'); - const emojify = require('../mastodon/features/emoji/emoji').default; - const { getLocale } = require('../mastodon/locales'); +function loaded() { const { localeData } = getLocale(); - const React = require('react'); - const ReactDOM = require('react-dom'); - const { createBrowserHistory } = require('history'); const scrollToDetailedStatus = () => { const history = createBrowserHistory(); @@ -341,6 +342,11 @@ function main() { }); } + +function main() { + ready(loaded); +} + loadPolyfills() .then(main) .then(loadKeyboardExtensions) diff --git a/app/javascript/packs/share.jsx b/app/javascript/packs/share.jsx index 1225d7b52..97c3c7b0e 100644 --- a/app/javascript/packs/share.jsx +++ b/app/javascript/packs/share.jsx @@ -1,23 +1,26 @@ import './public-path'; import loadPolyfills from '../mastodon/load_polyfills'; import { start } from '../mastodon/common'; +import ready from '../mastodon/ready'; +import ComposeContainer from '../mastodon/containers/compose_container'; +import React from 'react'; +import ReactDOM from 'react-dom'; start(); function loaded() { - const ComposeContainer = require('../mastodon/containers/compose_container').default; - const React = require('react'); - const ReactDOM = require('react-dom'); const mountNode = document.getElementById('mastodon-compose'); - if (mountNode !== null) { - const props = JSON.parse(mountNode.getAttribute('data-props')); + if (mountNode) { + const attr = mountNode.getAttribute('data-props'); + if(!attr) return; + + const props = JSON.parse(attr); ReactDOM.render(, mountNode); } } function main() { - const ready = require('../mastodon/ready').default; ready(loaded); } diff --git a/package.json b/package.json index 199c95669..f5d7dd09f 100644 --- a/package.json +++ b/package.json @@ -76,6 +76,7 @@ "jsdom": "^21.1.2", "lodash": "^4.17.21", "mark-loader": "^0.1.6", + "marky": "^1.2.5", "mini-css-extract-plugin": "^1.6.2", "mkdirp": "^2.1.6", "npmlog": "^7.0.1", @@ -192,7 +193,6 @@ "jest": "^29.5.0", "jest-environment-jsdom": "^29.5.0", "lint-staged": "^13.2.2", - "marky": "^1.2.5", "prettier": "^2.8.8", "raf": "^3.4.1", "react-intl-translations-manager": "^5.0.3", From d9b93bd15e508bd19896950ca5c5d356e7e402d4 Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Tue, 9 May 2023 03:09:11 +0200 Subject: [PATCH 11/44] Enforce React Rules of Hooks with eslint (#24911) --- .eslintrc.js | 2 ++ app/javascript/mastodon/actions/streaming.js | 2 ++ .../compose/containers/emoji_picker_dropdown_container.js | 1 + .../compose/containers/language_dropdown_container.js | 1 + package.json | 1 + yarn.lock | 5 +++++ 6 files changed, 12 insertions(+) diff --git a/.eslintrc.js b/.eslintrc.js index c888671ce..b4d5efd0e 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -4,6 +4,7 @@ module.exports = { extends: [ 'eslint:recommended', 'plugin:react/recommended', + 'plugin:react-hooks/recommended', 'plugin:jsx-a11y/recommended', 'plugin:import/recommended', 'plugin:promise/recommended', @@ -284,6 +285,7 @@ module.exports = { 'eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:react/recommended', + 'plugin:react-hooks/recommended', 'plugin:jsx-a11y/recommended', 'plugin:import/recommended', 'plugin:import/typescript', diff --git a/app/javascript/mastodon/actions/streaming.js b/app/javascript/mastodon/actions/streaming.js index 41cb99e2d..7831f261e 100644 --- a/app/javascript/mastodon/actions/streaming.js +++ b/app/javascript/mastodon/actions/streaming.js @@ -52,8 +52,10 @@ export const connectTimelineStream = (timelineId, channelName, params = {}, opti /** * @param {function(Function, Function): void} fallback */ + const useFallback = fallback => { fallback(dispatch, () => { + // eslint-disable-next-line react-hooks/rules-of-hooks -- this is not a react hook pollingId = setTimeout(() => useFallback(fallback), 20000 + randomUpTo(20000)); }); }; diff --git a/app/javascript/mastodon/features/compose/containers/emoji_picker_dropdown_container.js b/app/javascript/mastodon/features/compose/containers/emoji_picker_dropdown_container.js index 5ec937a39..9d9a59c41 100644 --- a/app/javascript/mastodon/features/compose/containers/emoji_picker_dropdown_container.js +++ b/app/javascript/mastodon/features/compose/containers/emoji_picker_dropdown_container.js @@ -72,6 +72,7 @@ const mapDispatchToProps = (dispatch, { onPickEmoji }) => ({ }, onPickEmoji: emoji => { + // eslint-disable-next-line react-hooks/rules-of-hooks -- this is not a react hook dispatch(useEmoji(emoji)); if (onPickEmoji) { diff --git a/app/javascript/mastodon/features/compose/containers/language_dropdown_container.js b/app/javascript/mastodon/features/compose/containers/language_dropdown_container.js index 2a040a13f..5560fe609 100644 --- a/app/javascript/mastodon/features/compose/containers/language_dropdown_container.js +++ b/app/javascript/mastodon/features/compose/containers/language_dropdown_container.js @@ -26,6 +26,7 @@ const mapDispatchToProps = dispatch => ({ }, onClose (value) { + // eslint-disable-next-line react-hooks/rules-of-hooks -- this is not a react hook dispatch(useLanguage(value)); }, diff --git a/package.json b/package.json index f5d7dd09f..76deabc26 100644 --- a/package.json +++ b/package.json @@ -189,6 +189,7 @@ "eslint-plugin-jsx-a11y": "~6.7.1", "eslint-plugin-promise": "~6.1.1", "eslint-plugin-react": "~7.32.2", + "eslint-plugin-react-hooks": "^4.6.0", "husky": "^8.0.3", "jest": "^29.5.0", "jest-environment-jsdom": "^29.5.0", diff --git a/yarn.lock b/yarn.lock index 00c6a6480..3114f26a3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5125,6 +5125,11 @@ eslint-plugin-promise@~6.1.1: resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-6.1.1.tgz#269a3e2772f62875661220631bd4dafcb4083816" integrity sha512-tjqWDwVZQo7UIPMeDReOpUgHCmCiH+ePnVT+5zVapL0uuHnegBUs2smM13CzOs2Xb5+MHMRFTs9v24yjba4Oig== +eslint-plugin-react-hooks@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.0.tgz#4c3e697ad95b77e93f8646aaa1630c1ba607edd3" + integrity sha512-oFc7Itz9Qxh2x4gNHStv3BqJq54ExXmfC+a1NjAta66IAN87Wu0R/QArgIS9qKzX3dXKPI9H5crl9QchNMY9+g== + eslint-plugin-react@~7.32.2: version "7.32.2" resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.32.2.tgz#e71f21c7c265ebce01bcbc9d0955170c55571f10" From 64ec41d89c28f29ef4fad5353ae887705011c8d3 Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Tue, 9 May 2023 03:10:04 +0200 Subject: [PATCH 12/44] Make Webpack fail on failed imports (#24908) --- config/webpack/shared.js | 1 + 1 file changed, 1 insertion(+) diff --git a/config/webpack/shared.js b/config/webpack/shared.js index 78f660cfc..037243965 100644 --- a/config/webpack/shared.js +++ b/config/webpack/shared.js @@ -64,6 +64,7 @@ module.exports = { module: { rules: Object.keys(rules).map(key => rules[key]), + strictExportPresence: true, }, plugins: [ From c8181eb0a41c4f5c1655d4e400cab071aee4182a Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Tue, 9 May 2023 03:11:56 +0200 Subject: [PATCH 13/44] Enforce stricter rules for Typescript files (#24910) --- .eslintrc.js | 6 ++++++ app/javascript/mastodon/actions/markers.js | 2 +- app/javascript/mastodon/actions/notifications.js | 2 +- app/javascript/mastodon/actions/timelines.js | 2 +- app/javascript/mastodon/compare_id.ts | 2 +- .../mastodon/components/__tests__/avatar-test.jsx | 2 +- .../components/__tests__/avatar_overlay-test.jsx | 2 +- app/javascript/mastodon/components/account.jsx | 8 ++++---- app/javascript/mastodon/components/animated_number.tsx | 2 -- app/javascript/mastodon/components/attachment_list.jsx | 2 +- app/javascript/mastodon/components/avatar.tsx | 2 -- .../mastodon/components/avatar_composite.jsx | 2 +- app/javascript/mastodon/components/avatar_overlay.tsx | 2 -- app/javascript/mastodon/components/blurhash.tsx | 10 ++++++---- app/javascript/mastodon/components/check.tsx | 2 -- .../mastodon/components/column_back_button.jsx | 2 +- .../mastodon/components/column_back_button_slim.jsx | 2 +- app/javascript/mastodon/components/column_header.jsx | 2 +- .../mastodon/components/dismissable_banner.jsx | 2 +- app/javascript/mastodon/components/domain.tsx | 2 +- app/javascript/mastodon/components/dropdown_menu.jsx | 2 +- .../mastodon/components/edited_timestamp/index.jsx | 4 ++-- app/javascript/mastodon/components/gifv.tsx | 2 -- app/javascript/mastodon/components/icon.tsx | 2 -- app/javascript/mastodon/components/icon_button.tsx | 2 +- app/javascript/mastodon/components/icon_with_badge.tsx | 4 +--- app/javascript/mastodon/components/image.tsx | 4 +--- app/javascript/mastodon/components/inline_account.jsx | 2 +- app/javascript/mastodon/components/load_gap.jsx | 2 +- app/javascript/mastodon/components/media_gallery.jsx | 4 ++-- .../mastodon/components/not_signed_in_indicator.tsx | 2 -- .../components/picture_in_picture_placeholder.jsx | 2 +- app/javascript/mastodon/components/poll.jsx | 4 ++-- app/javascript/mastodon/components/radio_button.tsx | 2 -- .../mastodon/components/relative_timestamp.tsx | 4 +++- app/javascript/mastodon/components/server_banner.jsx | 2 +- app/javascript/mastodon/components/status.jsx | 8 ++++---- .../mastodon/components/status_action_bar.jsx | 2 +- app/javascript/mastodon/components/status_content.jsx | 2 +- app/javascript/mastodon/components/verified_badge.tsx | 2 -- app/javascript/mastodon/features/about/index.jsx | 4 ++-- .../account/components/follow_request_note.jsx | 2 +- .../mastodon/features/account/components/header.jsx | 6 +++--- .../features/account_gallery/components/media_item.jsx | 4 ++-- .../account_timeline/components/moved_note.jsx | 2 +- app/javascript/mastodon/features/audio/index.jsx | 4 ++-- .../compose/components/autosuggest_account.jsx | 2 +- .../features/compose/components/compose_form.jsx | 2 +- .../features/compose/components/navigation_bar.jsx | 4 ++-- .../features/compose/components/poll_button.jsx | 2 +- .../mastodon/features/compose/components/poll_form.jsx | 4 ++-- .../features/compose/components/privacy_dropdown.jsx | 4 ++-- .../features/compose/components/reply_indicator.jsx | 4 ++-- .../mastodon/features/compose/components/search.jsx | 2 +- .../features/compose/components/search_results.jsx | 2 +- .../mastodon/features/compose/components/upload.jsx | 2 +- .../features/compose/components/upload_button.jsx | 2 +- .../features/compose/components/upload_progress.jsx | 2 +- app/javascript/mastodon/features/compose/index.jsx | 2 +- .../direct_timeline/components/conversation.jsx | 4 ++-- .../features/directory/components/account_card.jsx | 2 +- app/javascript/mastodon/features/directory/index.jsx | 2 +- .../mastodon/features/explore/components/story.jsx | 2 +- app/javascript/mastodon/features/favourites/index.jsx | 2 +- .../mastodon/features/filters/select_filter.jsx | 2 +- .../follow_requests/components/account_authorize.jsx | 4 ++-- .../getting_started/components/announcements.jsx | 6 +++--- .../mastodon/features/hashtag_timeline/index.jsx | 2 +- .../mastodon/features/home_timeline/index.jsx | 4 ++-- .../mastodon/features/interaction_modal/index.jsx | 2 +- .../features/list_adder/components/account.jsx | 2 +- .../mastodon/features/list_adder/components/list.jsx | 4 ++-- .../features/list_editor/components/account.jsx | 4 ++-- .../features/list_editor/components/edit_list_form.jsx | 2 +- .../features/list_editor/components/search.jsx | 2 +- .../mastodon/features/list_timeline/index.jsx | 4 ++-- .../notifications/components/clear_column_button.jsx | 2 +- .../features/notifications/components/filter_bar.jsx | 2 +- .../notifications/components/follow_request.jsx | 4 ++-- .../features/notifications/components/notification.jsx | 2 +- .../components/notifications_permission_banner.jsx | 4 ++-- .../features/notifications/components/report.jsx | 4 ++-- .../mastodon/features/notifications/index.jsx | 6 +++--- .../onboarding/components/progress_indicator.jsx | 4 ++-- .../mastodon/features/onboarding/components/step.jsx | 6 +++--- app/javascript/mastodon/features/onboarding/share.jsx | 4 ++-- .../features/picture_in_picture/components/footer.jsx | 2 +- .../features/picture_in_picture/components/header.jsx | 4 ++-- app/javascript/mastodon/features/reblogs/index.jsx | 2 +- .../mastodon/features/report/components/option.jsx | 2 +- .../features/report/components/status_check_box.jsx | 6 +++--- .../mastodon/features/status/components/action_bar.jsx | 2 +- .../mastodon/features/status/components/card.jsx | 4 ++-- .../features/status/components/detailed_status.jsx | 6 +++--- app/javascript/mastodon/features/status/index.jsx | 2 +- .../features/subscribed_languages_modal/index.jsx | 2 +- .../mastodon/features/ui/components/actions_modal.jsx | 2 +- .../mastodon/features/ui/components/boost_modal.jsx | 6 +++--- .../features/ui/components/bundle_modal_error.jsx | 2 +- .../mastodon/features/ui/components/column_header.jsx | 2 +- .../mastodon/features/ui/components/column_link.jsx | 2 +- .../features/ui/components/compare_history_modal.jsx | 4 ++-- .../mastodon/features/ui/components/embed_modal.jsx | 2 +- .../mastodon/features/ui/components/filter_modal.jsx | 2 +- .../features/ui/components/focal_point_modal.jsx | 4 ++-- .../ui/components/follow_requests_column_link.jsx | 2 +- .../mastodon/features/ui/components/header.jsx | 2 +- .../mastodon/features/ui/components/image_modal.jsx | 2 +- .../mastodon/features/ui/components/media_modal.jsx | 6 +++--- .../ui/components/notifications_counter_icon.js | 2 +- .../mastodon/features/ui/components/report_modal.jsx | 2 +- .../mastodon/features/ui/components/zoomable_image.jsx | 2 +- app/javascript/mastodon/features/video/index.jsx | 4 ++-- app/javascript/mastodon/reducers/compose.js | 2 +- app/javascript/mastodon/reducers/contexts.js | 2 +- app/javascript/mastodon/reducers/conversations.js | 2 +- app/javascript/mastodon/reducers/index.js | 4 ++-- app/javascript/mastodon/reducers/missed_updates.ts | 2 +- app/javascript/mastodon/reducers/notifications.js | 2 +- app/javascript/mastodon/reducers/settings.js | 2 +- app/javascript/mastodon/reducers/timelines.js | 2 +- app/javascript/mastodon/uuid.ts | 2 +- app/javascript/types/image.d.ts | 1 + 123 files changed, 175 insertions(+), 186 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index b4d5efd0e..2bbe301f0 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -297,6 +297,12 @@ module.exports = { '@typescript-eslint/no-explicit-any': 'off', 'jsdoc/require-jsdoc': 'off', + + // Those rules set stricter rules for TS files + // to enforce better practices when converting from JS + 'import/no-default-export': 'warn', + 'react/prefer-stateless-function': 'warn', + 'react/function-component-definition': ['error', { namedComponents: 'arrow-function' }], }, }, { diff --git a/app/javascript/mastodon/actions/markers.js b/app/javascript/mastodon/actions/markers.js index ca246dce7..b23ecccc3 100644 --- a/app/javascript/mastodon/actions/markers.js +++ b/app/javascript/mastodon/actions/markers.js @@ -1,6 +1,6 @@ import api from '../api'; import { debounce } from 'lodash'; -import compareId from '../compare_id'; +import { compareId } from '../compare_id'; import { List as ImmutableList } from 'immutable'; export const MARKERS_FETCH_REQUEST = 'MARKERS_FETCH_REQUEST'; diff --git a/app/javascript/mastodon/actions/notifications.js b/app/javascript/mastodon/actions/notifications.js index 93588d3c0..0c58f8d15 100644 --- a/app/javascript/mastodon/actions/notifications.js +++ b/app/javascript/mastodon/actions/notifications.js @@ -13,7 +13,7 @@ import { defineMessages } from 'react-intl'; import { List as ImmutableList } from 'immutable'; import { unescapeHTML } from '../utils/html'; import { usePendingItems as preferPendingItems } from 'mastodon/initial_state'; -import compareId from 'mastodon/compare_id'; +import { compareId } from 'mastodon/compare_id'; import { requestNotificationPermission } from '../utils/notifications'; export const NOTIFICATIONS_UPDATE = 'NOTIFICATIONS_UPDATE'; diff --git a/app/javascript/mastodon/actions/timelines.js b/app/javascript/mastodon/actions/timelines.js index 4f772a55f..e9e3a8e24 100644 --- a/app/javascript/mastodon/actions/timelines.js +++ b/app/javascript/mastodon/actions/timelines.js @@ -2,7 +2,7 @@ import { importFetchedStatus, importFetchedStatuses } from './importer'; import { submitMarkers } from './markers'; import api, { getLinks } from 'mastodon/api'; import { Map as ImmutableMap, List as ImmutableList } from 'immutable'; -import compareId from 'mastodon/compare_id'; +import { compareId } from 'mastodon/compare_id'; import { usePendingItems as preferPendingItems } from 'mastodon/initial_state'; export const TIMELINE_UPDATE = 'TIMELINE_UPDATE'; diff --git a/app/javascript/mastodon/compare_id.ts b/app/javascript/mastodon/compare_id.ts index ae4ac6f89..3ddfb7635 100644 --- a/app/javascript/mastodon/compare_id.ts +++ b/app/javascript/mastodon/compare_id.ts @@ -1,4 +1,4 @@ -export default function compareId (id1: string, id2: string) { +export function compareId (id1: string, id2: string) { if (id1 === id2) { return 0; } diff --git a/app/javascript/mastodon/components/__tests__/avatar-test.jsx b/app/javascript/mastodon/components/__tests__/avatar-test.jsx index dd3f7b7d2..5a72fc19a 100644 --- a/app/javascript/mastodon/components/__tests__/avatar-test.jsx +++ b/app/javascript/mastodon/components/__tests__/avatar-test.jsx @@ -1,7 +1,7 @@ import React from 'react'; import renderer from 'react-test-renderer'; import { fromJS } from 'immutable'; -import Avatar from '../avatar'; +import { Avatar } from '../avatar'; describe('', () => { const account = fromJS({ diff --git a/app/javascript/mastodon/components/__tests__/avatar_overlay-test.jsx b/app/javascript/mastodon/components/__tests__/avatar_overlay-test.jsx index 44addea83..ea75dab57 100644 --- a/app/javascript/mastodon/components/__tests__/avatar_overlay-test.jsx +++ b/app/javascript/mastodon/components/__tests__/avatar_overlay-test.jsx @@ -1,7 +1,7 @@ import React from 'react'; import renderer from 'react-test-renderer'; import { fromJS } from 'immutable'; -import AvatarOverlay from '../avatar_overlay'; +import { AvatarOverlay } from '../avatar_overlay'; describe(' { const account = fromJS({ diff --git a/app/javascript/mastodon/components/account.jsx b/app/javascript/mastodon/components/account.jsx index 6a0682e9c..b0bbea7ce 100644 --- a/app/javascript/mastodon/components/account.jsx +++ b/app/javascript/mastodon/components/account.jsx @@ -1,19 +1,19 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import Avatar from './avatar'; +import { Avatar } from './avatar'; import DisplayName from './display_name'; -import IconButton from './icon_button'; +import { IconButton } from './icon_button'; import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { me } from '../initial_state'; -import RelativeTimestamp from './relative_timestamp'; +import { RelativeTimestamp } from './relative_timestamp'; import Skeleton from 'mastodon/components/skeleton'; import { Link } from 'react-router-dom'; import { counterRenderer } from 'mastodon/components/common_counter'; import ShortNumber from 'mastodon/components/short_number'; import classNames from 'classnames'; -import VerifiedBadge from 'mastodon/components/verified_badge'; +import { VerifiedBadge } from 'mastodon/components/verified_badge'; const messages = defineMessages({ follow: { id: 'account.follow', defaultMessage: 'Follow' }, diff --git a/app/javascript/mastodon/components/animated_number.tsx b/app/javascript/mastodon/components/animated_number.tsx index 1673ff41b..20ffa1a4d 100644 --- a/app/javascript/mastodon/components/animated_number.tsx +++ b/app/javascript/mastodon/components/animated_number.tsx @@ -54,5 +54,3 @@ export const AnimatedNumber: React.FC = ({ ); }; - -export default AnimatedNumber; diff --git a/app/javascript/mastodon/components/attachment_list.jsx b/app/javascript/mastodon/components/attachment_list.jsx index 0e23889de..3354025c4 100644 --- a/app/javascript/mastodon/components/attachment_list.jsx +++ b/app/javascript/mastodon/components/attachment_list.jsx @@ -4,7 +4,7 @@ import PropTypes from 'prop-types'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { FormattedMessage } from 'react-intl'; import classNames from 'classnames'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; const filename = url => url.split('/').pop().split('#')[0].split('?')[0]; diff --git a/app/javascript/mastodon/components/avatar.tsx b/app/javascript/mastodon/components/avatar.tsx index e64a8af74..8be94d3f5 100644 --- a/app/javascript/mastodon/components/avatar.tsx +++ b/app/javascript/mastodon/components/avatar.tsx @@ -45,5 +45,3 @@ export const Avatar: React.FC = ({
); }; - -export default Avatar; diff --git a/app/javascript/mastodon/components/avatar_composite.jsx b/app/javascript/mastodon/components/avatar_composite.jsx index 220bf5b4f..e1fae95dc 100644 --- a/app/javascript/mastodon/components/avatar_composite.jsx +++ b/app/javascript/mastodon/components/avatar_composite.jsx @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { autoPlayGif } from '../initial_state'; -import Avatar from './avatar'; +import { Avatar } from './avatar'; export default class AvatarComposite extends React.PureComponent { diff --git a/app/javascript/mastodon/components/avatar_overlay.tsx b/app/javascript/mastodon/components/avatar_overlay.tsx index 5c65a928c..e8dc88896 100644 --- a/app/javascript/mastodon/components/avatar_overlay.tsx +++ b/app/javascript/mastodon/components/avatar_overlay.tsx @@ -47,5 +47,3 @@ export const AvatarOverlay: React.FC = ({
); }; - -export default AvatarOverlay; diff --git a/app/javascript/mastodon/components/blurhash.tsx b/app/javascript/mastodon/components/blurhash.tsx index 6fec6e1ef..181e2183d 100644 --- a/app/javascript/mastodon/components/blurhash.tsx +++ b/app/javascript/mastodon/components/blurhash.tsx @@ -9,13 +9,13 @@ type Props = { children?: never; [key: string]: any; } -function Blurhash({ +const Blurhash: React.FC = ({ hash, width = 32, height = width, dummy = false, ...canvasProps -}: Props) { +}) => { const canvasRef = useRef(null); useEffect(() => { @@ -40,6 +40,8 @@ function Blurhash({ return ( ); -} +}; + +const MemoizedBlurhash = React.memo(Blurhash); -export default React.memo(Blurhash); +export { MemoizedBlurhash as Blurhash }; diff --git a/app/javascript/mastodon/components/check.tsx b/app/javascript/mastodon/components/check.tsx index 3a4a11320..57b810a0e 100644 --- a/app/javascript/mastodon/components/check.tsx +++ b/app/javascript/mastodon/components/check.tsx @@ -5,5 +5,3 @@ export const Check: React.FC = () => ( ); - -export default Check; diff --git a/app/javascript/mastodon/components/column_back_button.jsx b/app/javascript/mastodon/components/column_back_button.jsx index faa800b2a..19e2cb363 100644 --- a/app/javascript/mastodon/components/column_back_button.jsx +++ b/app/javascript/mastodon/components/column_back_button.jsx @@ -1,7 +1,7 @@ import React from 'react'; import { FormattedMessage } from 'react-intl'; import PropTypes from 'prop-types'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import { createPortal } from 'react-dom'; export default class ColumnBackButton extends React.PureComponent { diff --git a/app/javascript/mastodon/components/column_back_button_slim.jsx b/app/javascript/mastodon/components/column_back_button_slim.jsx index 46ac23736..f2c8642ea 100644 --- a/app/javascript/mastodon/components/column_back_button_slim.jsx +++ b/app/javascript/mastodon/components/column_back_button_slim.jsx @@ -1,7 +1,7 @@ import React from 'react'; import { FormattedMessage } from 'react-intl'; import ColumnBackButton from './column_back_button'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; export default class ColumnBackButtonSlim extends ColumnBackButton { diff --git a/app/javascript/mastodon/components/column_header.jsx b/app/javascript/mastodon/components/column_header.jsx index afc526f27..794ea9738 100644 --- a/app/javascript/mastodon/components/column_header.jsx +++ b/app/javascript/mastodon/components/column_header.jsx @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import { createPortal } from 'react-dom'; import classNames from 'classnames'; import { FormattedMessage, injectIntl, defineMessages } from 'react-intl'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; const messages = defineMessages({ show: { id: 'column_header.show_settings', defaultMessage: 'Show settings' }, diff --git a/app/javascript/mastodon/components/dismissable_banner.jsx b/app/javascript/mastodon/components/dismissable_banner.jsx index 242021e76..c433d9532 100644 --- a/app/javascript/mastodon/components/dismissable_banner.jsx +++ b/app/javascript/mastodon/components/dismissable_banner.jsx @@ -1,5 +1,5 @@ import React from 'react'; -import IconButton from './icon_button'; +import { IconButton } from './icon_button'; import PropTypes from 'prop-types'; import { injectIntl, defineMessages } from 'react-intl'; import { bannerSettings } from 'mastodon/settings'; diff --git a/app/javascript/mastodon/components/domain.tsx b/app/javascript/mastodon/components/domain.tsx index 6cb8f7b8f..af0fec35a 100644 --- a/app/javascript/mastodon/components/domain.tsx +++ b/app/javascript/mastodon/components/domain.tsx @@ -1,5 +1,5 @@ import React, { useCallback } from 'react'; -import IconButton from './icon_button'; +import { IconButton } from './icon_button'; import { InjectedIntl, defineMessages, injectIntl } from 'react-intl'; const messages = defineMessages({ diff --git a/app/javascript/mastodon/components/dropdown_menu.jsx b/app/javascript/mastodon/components/dropdown_menu.jsx index eaaa72fd8..0ed3e904f 100644 --- a/app/javascript/mastodon/components/dropdown_menu.jsx +++ b/app/javascript/mastodon/components/dropdown_menu.jsx @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import IconButton from './icon_button'; +import { IconButton } from './icon_button'; import Overlay from 'react-overlays/Overlay'; import { supportsPassiveEvents } from 'detect-passive-events'; import classNames from 'classnames'; diff --git a/app/javascript/mastodon/components/edited_timestamp/index.jsx b/app/javascript/mastodon/components/edited_timestamp/index.jsx index 8a5417a7d..745d8a4b6 100644 --- a/app/javascript/mastodon/components/edited_timestamp/index.jsx +++ b/app/javascript/mastodon/components/edited_timestamp/index.jsx @@ -1,11 +1,11 @@ import React from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage, injectIntl } from 'react-intl'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import DropdownMenu from './containers/dropdown_menu_container'; import { connect } from 'react-redux'; import { openModal } from 'mastodon/actions/modal'; -import RelativeTimestamp from 'mastodon/components/relative_timestamp'; +import { RelativeTimestamp } from 'mastodon/components/relative_timestamp'; import InlineAccount from 'mastodon/components/inline_account'; const mapDispatchToProps = (dispatch, { statusId }) => ({ diff --git a/app/javascript/mastodon/components/gifv.tsx b/app/javascript/mastodon/components/gifv.tsx index 8968170c5..5d9f235e1 100644 --- a/app/javascript/mastodon/components/gifv.tsx +++ b/app/javascript/mastodon/components/gifv.tsx @@ -64,5 +64,3 @@ export const GIFV: React.FC = ({ ); }; - -export default GIFV; diff --git a/app/javascript/mastodon/components/icon.tsx b/app/javascript/mastodon/components/icon.tsx index d85fff6ef..f74437b55 100644 --- a/app/javascript/mastodon/components/icon.tsx +++ b/app/javascript/mastodon/components/icon.tsx @@ -10,5 +10,3 @@ type Props = { } export const Icon: React.FC = ({ id, className, fixedWidth, ...other }) => ; - -export default Icon; diff --git a/app/javascript/mastodon/components/icon_button.tsx b/app/javascript/mastodon/components/icon_button.tsx index ec11ab701..f9db287bb 100644 --- a/app/javascript/mastodon/components/icon_button.tsx +++ b/app/javascript/mastodon/components/icon_button.tsx @@ -30,7 +30,7 @@ type States = { activate: boolean, deactivate: boolean, } -export default class IconButton extends React.PureComponent { +export class IconButton extends React.PureComponent { static defaultProps = { size: 18, diff --git a/app/javascript/mastodon/components/icon_with_badge.tsx b/app/javascript/mastodon/components/icon_with_badge.tsx index 487bf326a..a4af86ca9 100644 --- a/app/javascript/mastodon/components/icon_with_badge.tsx +++ b/app/javascript/mastodon/components/icon_with_badge.tsx @@ -9,12 +9,10 @@ type Props = { issueBadge: boolean; className: string; } -const IconWithBadge: React.FC = ({ id, count, issueBadge, className }) => ( +export const IconWithBadge: React.FC = ({ id, count, issueBadge, className }) => ( {count > 0 && {formatNumber(count)}} {issueBadge && } ); - -export default IconWithBadge; diff --git a/app/javascript/mastodon/components/image.tsx b/app/javascript/mastodon/components/image.tsx index 9b4d60225..b332d4115 100644 --- a/app/javascript/mastodon/components/image.tsx +++ b/app/javascript/mastodon/components/image.tsx @@ -1,5 +1,5 @@ import React, { useCallback, useState } from 'react'; -import Blurhash from './blurhash'; +import { Blurhash } from './blurhash'; import classNames from 'classnames'; type Props = { @@ -23,5 +23,3 @@ export const Image: React.FC = ({ src, srcSet, blurhash, className }) => ); }; - -export default Image; diff --git a/app/javascript/mastodon/components/inline_account.jsx b/app/javascript/mastodon/components/inline_account.jsx index 31dc63f93..ca11f8b1b 100644 --- a/app/javascript/mastodon/components/inline_account.jsx +++ b/app/javascript/mastodon/components/inline_account.jsx @@ -2,7 +2,7 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { connect } from 'react-redux'; import { makeGetAccount } from 'mastodon/selectors'; -import Avatar from 'mastodon/components/avatar'; +import { Avatar } from 'mastodon/components/avatar'; const makeMapStateToProps = () => { const getAccount = makeGetAccount(); diff --git a/app/javascript/mastodon/components/load_gap.jsx b/app/javascript/mastodon/components/load_gap.jsx index 2c91d37be..2637bdbbc 100644 --- a/app/javascript/mastodon/components/load_gap.jsx +++ b/app/javascript/mastodon/components/load_gap.jsx @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { injectIntl, defineMessages } from 'react-intl'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; const messages = defineMessages({ load_more: { id: 'status.load_more', defaultMessage: 'Load more' }, diff --git a/app/javascript/mastodon/components/media_gallery.jsx b/app/javascript/mastodon/components/media_gallery.jsx index 54470f940..54b414de2 100644 --- a/app/javascript/mastodon/components/media_gallery.jsx +++ b/app/javascript/mastodon/components/media_gallery.jsx @@ -2,12 +2,12 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import { is } from 'immutable'; -import IconButton from './icon_button'; +import { IconButton } from './icon_button'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import classNames from 'classnames'; import { autoPlayGif, cropImages, displayMedia, useBlurhash } from '../initial_state'; import { debounce } from 'lodash'; -import Blurhash from 'mastodon/components/blurhash'; +import { Blurhash } from 'mastodon/components/blurhash'; const messages = defineMessages({ toggle_visible: { id: 'media_gallery.toggle_visible', defaultMessage: '{number, plural, one {Hide image} other {Hide images}}' }, diff --git a/app/javascript/mastodon/components/not_signed_in_indicator.tsx b/app/javascript/mastodon/components/not_signed_in_indicator.tsx index 0df90ddbf..3bfee6ae9 100644 --- a/app/javascript/mastodon/components/not_signed_in_indicator.tsx +++ b/app/javascript/mastodon/components/not_signed_in_indicator.tsx @@ -8,5 +8,3 @@ export const NotSignedInIndicator: React.FC = () => ( ); - -export default NotSignedInIndicator; diff --git a/app/javascript/mastodon/components/picture_in_picture_placeholder.jsx b/app/javascript/mastodon/components/picture_in_picture_placeholder.jsx index a51c97401..4763a28d1 100644 --- a/app/javascript/mastodon/components/picture_in_picture_placeholder.jsx +++ b/app/javascript/mastodon/components/picture_in_picture_placeholder.jsx @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import { removePictureInPicture } from 'mastodon/actions/picture_in_picture'; import { connect } from 'react-redux'; import { FormattedMessage } from 'react-intl'; diff --git a/app/javascript/mastodon/components/poll.jsx b/app/javascript/mastodon/components/poll.jsx index b9b96a700..0ccdf472e 100644 --- a/app/javascript/mastodon/components/poll.jsx +++ b/app/javascript/mastodon/components/poll.jsx @@ -8,8 +8,8 @@ import Motion from 'mastodon/features/ui/util/optional_motion'; import spring from 'react-motion/lib/spring'; import escapeTextContentForBrowser from 'escape-html'; import emojify from 'mastodon/features/emoji/emoji'; -import RelativeTimestamp from './relative_timestamp'; -import Icon from 'mastodon/components/icon'; +import { RelativeTimestamp } from './relative_timestamp'; +import { Icon } from 'mastodon/components/icon'; const messages = defineMessages({ closed: { diff --git a/app/javascript/mastodon/components/radio_button.tsx b/app/javascript/mastodon/components/radio_button.tsx index 9ba098f78..194b67afe 100644 --- a/app/javascript/mastodon/components/radio_button.tsx +++ b/app/javascript/mastodon/components/radio_button.tsx @@ -26,5 +26,3 @@ export const RadioButton: React.FC = ({ name, value, checked, onChange, l ); }; - -export default RadioButton; diff --git a/app/javascript/mastodon/components/relative_timestamp.tsx b/app/javascript/mastodon/components/relative_timestamp.tsx index 89cad0665..4f1a76e54 100644 --- a/app/javascript/mastodon/components/relative_timestamp.tsx +++ b/app/javascript/mastodon/components/relative_timestamp.tsx @@ -200,4 +200,6 @@ class RelativeTimestamp extends React.Component { } -export default injectIntl(RelativeTimestamp); +const RelativeTimestampWithIntl = injectIntl(RelativeTimestamp); + +export { RelativeTimestampWithIntl as RelativeTimestamp }; diff --git a/app/javascript/mastodon/components/server_banner.jsx b/app/javascript/mastodon/components/server_banner.jsx index e5f5aa8ee..991907a3f 100644 --- a/app/javascript/mastodon/components/server_banner.jsx +++ b/app/javascript/mastodon/components/server_banner.jsx @@ -7,7 +7,7 @@ import ShortNumber from 'mastodon/components/short_number'; import Skeleton from 'mastodon/components/skeleton'; import Account from 'mastodon/containers/account_container'; import { domain } from 'mastodon/initial_state'; -import Image from 'mastodon/components/image'; +import { Image } from 'mastodon/components/image'; import { Link } from 'react-router-dom'; const messages = defineMessages({ diff --git a/app/javascript/mastodon/components/status.jsx b/app/javascript/mastodon/components/status.jsx index b5242e769..3ca840b72 100644 --- a/app/javascript/mastodon/components/status.jsx +++ b/app/javascript/mastodon/components/status.jsx @@ -1,9 +1,9 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import Avatar from './avatar'; -import AvatarOverlay from './avatar_overlay'; -import RelativeTimestamp from './relative_timestamp'; +import { Avatar } from './avatar'; +import { AvatarOverlay } from './avatar_overlay'; +import { RelativeTimestamp } from './relative_timestamp'; import DisplayName from './display_name'; import StatusContent from './status_content'; import StatusActionBar from './status_action_bar'; @@ -14,7 +14,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component'; import { MediaGallery, Video, Audio } from '../features/ui/util/async-components'; import { HotKeys } from 'react-hotkeys'; import classNames from 'classnames'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import { displayMedia } from '../initial_state'; import PictureInPicturePlaceholder from 'mastodon/components/picture_in_picture_placeholder'; diff --git a/app/javascript/mastodon/components/status_action_bar.jsx b/app/javascript/mastodon/components/status_action_bar.jsx index 7b4031b68..aee9cc19e 100644 --- a/app/javascript/mastodon/components/status_action_bar.jsx +++ b/app/javascript/mastodon/components/status_action_bar.jsx @@ -2,7 +2,7 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; -import IconButton from './icon_button'; +import { IconButton } from './icon_button'; import DropdownMenuContainer from '../containers/dropdown_menu_container'; import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/components/status_content.jsx b/app/javascript/mastodon/components/status_content.jsx index dd589dac6..cece3ffc2 100644 --- a/app/javascript/mastodon/components/status_content.jsx +++ b/app/javascript/mastodon/components/status_content.jsx @@ -6,7 +6,7 @@ import { Link } from 'react-router-dom'; import { connect } from 'react-redux'; import classnames from 'classnames'; import PollContainer from 'mastodon/containers/poll_container'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import { autoPlayGif, languages as preloadedLanguages } from 'mastodon/initial_state'; const MAX_HEIGHT = 706; // 22px * 32 (+ 2px padding at the top) diff --git a/app/javascript/mastodon/components/verified_badge.tsx b/app/javascript/mastodon/components/verified_badge.tsx index 78686b521..da3cab9fe 100644 --- a/app/javascript/mastodon/components/verified_badge.tsx +++ b/app/javascript/mastodon/components/verified_badge.tsx @@ -10,5 +10,3 @@ export const VerifiedBadge: React.FC = ({ link }) => ( ); - -export default VerifiedBadge; diff --git a/app/javascript/mastodon/features/about/index.jsx b/app/javascript/mastodon/features/about/index.jsx index bb35f3203..11aff67c6 100644 --- a/app/javascript/mastodon/features/about/index.jsx +++ b/app/javascript/mastodon/features/about/index.jsx @@ -9,9 +9,9 @@ import { Helmet } from 'react-helmet'; import { fetchServer, fetchExtendedDescription, fetchDomainBlocks } from 'mastodon/actions/server'; import Account from 'mastodon/containers/account_container'; import Skeleton from 'mastodon/components/skeleton'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import classNames from 'classnames'; -import Image from 'mastodon/components/image'; +import { Image } from 'mastodon/components/image'; const messages = defineMessages({ title: { id: 'column.about', defaultMessage: 'About' }, diff --git a/app/javascript/mastodon/features/account/components/follow_request_note.jsx b/app/javascript/mastodon/features/account/components/follow_request_note.jsx index 300ae4266..7972515af 100644 --- a/app/javascript/mastodon/features/account/components/follow_request_note.jsx +++ b/app/javascript/mastodon/features/account/components/follow_request_note.jsx @@ -2,7 +2,7 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; export default class FollowRequestNote extends ImmutablePureComponent { diff --git a/app/javascript/mastodon/features/account/components/header.jsx b/app/javascript/mastodon/features/account/components/header.jsx index ff8dc5fa9..bb0982b5e 100644 --- a/app/javascript/mastodon/features/account/components/header.jsx +++ b/app/javascript/mastodon/features/account/components/header.jsx @@ -6,9 +6,9 @@ import Button from 'mastodon/components/button'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { autoPlayGif, me, domain } from 'mastodon/initial_state'; import classNames from 'classnames'; -import Icon from 'mastodon/components/icon'; -import IconButton from 'mastodon/components/icon_button'; -import Avatar from 'mastodon/components/avatar'; +import { Icon } from 'mastodon/components/icon'; +import { IconButton } from 'mastodon/components/icon_button'; +import { Avatar } from 'mastodon/components/avatar'; import { counterRenderer } from 'mastodon/components/common_counter'; import ShortNumber from 'mastodon/components/short_number'; import { NavLink } from 'react-router-dom'; diff --git a/app/javascript/mastodon/features/account_gallery/components/media_item.jsx b/app/javascript/mastodon/features/account_gallery/components/media_item.jsx index 00526016d..9e9b9e6e1 100644 --- a/app/javascript/mastodon/features/account_gallery/components/media_item.jsx +++ b/app/javascript/mastodon/features/account_gallery/components/media_item.jsx @@ -1,6 +1,6 @@ -import Blurhash from 'mastodon/components/blurhash'; +import { Blurhash } from 'mastodon/components/blurhash'; import classNames from 'classnames'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import { autoPlayGif, displayMedia, useBlurhash } from 'mastodon/initial_state'; import PropTypes from 'prop-types'; import React from 'react'; diff --git a/app/javascript/mastodon/features/account_timeline/components/moved_note.jsx b/app/javascript/mastodon/features/account_timeline/components/moved_note.jsx index daff47a9d..273583c0a 100644 --- a/app/javascript/mastodon/features/account_timeline/components/moved_note.jsx +++ b/app/javascript/mastodon/features/account_timeline/components/moved_note.jsx @@ -2,7 +2,7 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import AvatarOverlay from '../../../components/avatar_overlay'; +import { AvatarOverlay } from '../../../components/avatar_overlay'; import DisplayName from '../../../components/display_name'; import { Link } from 'react-router-dom'; diff --git a/app/javascript/mastodon/features/audio/index.jsx b/app/javascript/mastodon/features/audio/index.jsx index e8fe2c4d9..56e913ae3 100644 --- a/app/javascript/mastodon/features/audio/index.jsx +++ b/app/javascript/mastodon/features/audio/index.jsx @@ -2,12 +2,12 @@ import React from 'react'; import PropTypes from 'prop-types'; import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; import { formatTime, getPointerPosition, fileNameFromURL } from 'mastodon/features/video'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import classNames from 'classnames'; import { throttle, debounce } from 'lodash'; import Visualizer from './visualizer'; import { displayMedia, useBlurhash } from '../../initial_state'; -import Blurhash from '../../components/blurhash'; +import { Blurhash } from '../../components/blurhash'; import { is } from 'immutable'; const messages = defineMessages({ diff --git a/app/javascript/mastodon/features/compose/components/autosuggest_account.jsx b/app/javascript/mastodon/features/compose/components/autosuggest_account.jsx index 1451be0e6..2c92016e8 100644 --- a/app/javascript/mastodon/features/compose/components/autosuggest_account.jsx +++ b/app/javascript/mastodon/features/compose/components/autosuggest_account.jsx @@ -1,5 +1,5 @@ import React from 'react'; -import Avatar from '../../../components/avatar'; +import { Avatar } from '../../../components/avatar'; import DisplayName from '../../../components/display_name'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/features/compose/components/compose_form.jsx b/app/javascript/mastodon/features/compose/components/compose_form.jsx index ffcef83c4..3f42cb885 100644 --- a/app/javascript/mastodon/features/compose/components/compose_form.jsx +++ b/app/javascript/mastodon/features/compose/components/compose_form.jsx @@ -19,7 +19,7 @@ import LanguageDropdown from '../containers/language_dropdown_container'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { length } from 'stringz'; import { countableText } from '../util/counter'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import classNames from 'classnames'; const allowedAroundShortCode = '><\u0085\u0020\u00a0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\u0009\u000a\u000b\u000c\u000d'; diff --git a/app/javascript/mastodon/features/compose/components/navigation_bar.jsx b/app/javascript/mastodon/features/compose/components/navigation_bar.jsx index be979af50..b5a7b6bda 100644 --- a/app/javascript/mastodon/features/compose/components/navigation_bar.jsx +++ b/app/javascript/mastodon/features/compose/components/navigation_bar.jsx @@ -2,9 +2,9 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ActionBar from './action_bar'; -import Avatar from '../../../components/avatar'; +import { Avatar } from '../../../components/avatar'; import { Link } from 'react-router-dom'; -import IconButton from '../../../components/icon_button'; +import { IconButton } from '../../../components/icon_button'; import { FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/features/compose/components/poll_button.jsx b/app/javascript/mastodon/features/compose/components/poll_button.jsx index 6ad689ccc..5d90564bd 100644 --- a/app/javascript/mastodon/features/compose/components/poll_button.jsx +++ b/app/javascript/mastodon/features/compose/components/poll_button.jsx @@ -1,5 +1,5 @@ import React from 'react'; -import IconButton from '../../../components/icon_button'; +import { IconButton } from '../../../components/icon_button'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl } from 'react-intl'; diff --git a/app/javascript/mastodon/features/compose/components/poll_form.jsx b/app/javascript/mastodon/features/compose/components/poll_form.jsx index c0acd7eeb..33afa3ad4 100644 --- a/app/javascript/mastodon/features/compose/components/poll_form.jsx +++ b/app/javascript/mastodon/features/compose/components/poll_form.jsx @@ -3,8 +3,8 @@ import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import IconButton from 'mastodon/components/icon_button'; -import Icon from 'mastodon/components/icon'; +import { IconButton } from 'mastodon/components/icon_button'; +import { Icon } from 'mastodon/components/icon'; import AutosuggestInput from 'mastodon/components/autosuggest_input'; import classNames from 'classnames'; diff --git a/app/javascript/mastodon/features/compose/components/privacy_dropdown.jsx b/app/javascript/mastodon/features/compose/components/privacy_dropdown.jsx index e65c9cb72..ecb7accad 100644 --- a/app/javascript/mastodon/features/compose/components/privacy_dropdown.jsx +++ b/app/javascript/mastodon/features/compose/components/privacy_dropdown.jsx @@ -1,11 +1,11 @@ import React from 'react'; import PropTypes from 'prop-types'; import { injectIntl, defineMessages } from 'react-intl'; -import IconButton from '../../../components/icon_button'; +import { IconButton } from '../../../components/icon_button'; import Overlay from 'react-overlays/Overlay'; import { supportsPassiveEvents } from 'detect-passive-events'; import classNames from 'classnames'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; const messages = defineMessages({ public_short: { id: 'privacy.public.short', defaultMessage: 'Public' }, diff --git a/app/javascript/mastodon/features/compose/components/reply_indicator.jsx b/app/javascript/mastodon/features/compose/components/reply_indicator.jsx index 81de4ea76..68cd7b080 100644 --- a/app/javascript/mastodon/features/compose/components/reply_indicator.jsx +++ b/app/javascript/mastodon/features/compose/components/reply_indicator.jsx @@ -1,8 +1,8 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import Avatar from '../../../components/avatar'; -import IconButton from '../../../components/icon_button'; +import { Avatar } from '../../../components/avatar'; +import { IconButton } from '../../../components/icon_button'; import DisplayName from '../../../components/display_name'; import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/features/compose/components/search.jsx b/app/javascript/mastodon/features/compose/components/search.jsx index 7fff587d6..d20908b9d 100644 --- a/app/javascript/mastodon/features/compose/components/search.jsx +++ b/app/javascript/mastodon/features/compose/components/search.jsx @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { searchEnabled } from 'mastodon/initial_state'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import classNames from 'classnames'; import { HASHTAG_REGEX } from 'mastodon/utils/hashtags'; diff --git a/app/javascript/mastodon/features/compose/components/search_results.jsx b/app/javascript/mastodon/features/compose/components/search_results.jsx index 8fafd88b0..9a44e2eaf 100644 --- a/app/javascript/mastodon/features/compose/components/search_results.jsx +++ b/app/javascript/mastodon/features/compose/components/search_results.jsx @@ -6,7 +6,7 @@ import AccountContainer from '../../../containers/account_container'; import StatusContainer from '../../../containers/status_container'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { ImmutableHashtag as Hashtag } from '../../../components/hashtag'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import { searchEnabled } from '../../../initial_state'; import LoadMore from 'mastodon/components/load_more'; diff --git a/app/javascript/mastodon/features/compose/components/upload.jsx b/app/javascript/mastodon/features/compose/components/upload.jsx index e3651c229..d667f5ef7 100644 --- a/app/javascript/mastodon/features/compose/components/upload.jsx +++ b/app/javascript/mastodon/features/compose/components/upload.jsx @@ -5,7 +5,7 @@ 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 Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; export default class Upload extends ImmutablePureComponent { diff --git a/app/javascript/mastodon/features/compose/components/upload_button.jsx b/app/javascript/mastodon/features/compose/components/upload_button.jsx index f2e6ff85c..3870997c3 100644 --- a/app/javascript/mastodon/features/compose/components/upload_button.jsx +++ b/app/javascript/mastodon/features/compose/components/upload_button.jsx @@ -1,5 +1,5 @@ import React from 'react'; -import IconButton from '../../../components/icon_button'; +import { IconButton } from '../../../components/icon_button'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl } from 'react-intl'; import { connect } from 'react-redux'; diff --git a/app/javascript/mastodon/features/compose/components/upload_progress.jsx b/app/javascript/mastodon/features/compose/components/upload_progress.jsx index cabf520fd..c5740d9bf 100644 --- a/app/javascript/mastodon/features/compose/components/upload_progress.jsx +++ b/app/javascript/mastodon/features/compose/components/upload_progress.jsx @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import Motion from '../../ui/util/optional_motion'; import spring from 'react-motion/lib/spring'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import { FormattedMessage } from 'react-intl'; export default class UploadProgress extends React.PureComponent { diff --git a/app/javascript/mastodon/features/compose/index.jsx b/app/javascript/mastodon/features/compose/index.jsx index 6cba1e9ad..df60d4347 100644 --- a/app/javascript/mastodon/features/compose/index.jsx +++ b/app/javascript/mastodon/features/compose/index.jsx @@ -14,7 +14,7 @@ import SearchResultsContainer from './containers/search_results_container'; import { openModal } from 'mastodon/actions/modal'; import elephantUIPlane from '../../../images/elephant_ui_plane.svg'; import { mascot } from '../../initial_state'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import { logOut } from 'mastodon/utils/log_out'; import Column from 'mastodon/components/column'; import { Helmet } from 'react-helmet'; diff --git a/app/javascript/mastodon/features/direct_timeline/components/conversation.jsx b/app/javascript/mastodon/features/direct_timeline/components/conversation.jsx index 11f2790bf..452de1161 100644 --- a/app/javascript/mastodon/features/direct_timeline/components/conversation.jsx +++ b/app/javascript/mastodon/features/direct_timeline/components/conversation.jsx @@ -8,8 +8,8 @@ import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import DropdownMenuContainer from 'mastodon/containers/dropdown_menu_container'; import AvatarComposite from 'mastodon/components/avatar_composite'; import { Link } from 'react-router-dom'; -import IconButton from 'mastodon/components/icon_button'; -import RelativeTimestamp from 'mastodon/components/relative_timestamp'; +import { IconButton } from 'mastodon/components/icon_button'; +import { RelativeTimestamp } from 'mastodon/components/relative_timestamp'; import { HotKeys } from 'react-hotkeys'; import { autoPlayGif } from 'mastodon/initial_state'; import classNames from 'classnames'; diff --git a/app/javascript/mastodon/features/directory/components/account_card.jsx b/app/javascript/mastodon/features/directory/components/account_card.jsx index 1cee3a4e4..495142715 100644 --- a/app/javascript/mastodon/features/directory/components/account_card.jsx +++ b/app/javascript/mastodon/features/directory/components/account_card.jsx @@ -4,7 +4,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { makeGetAccount } from 'mastodon/selectors'; -import Avatar from 'mastodon/components/avatar'; +import { Avatar } from 'mastodon/components/avatar'; import DisplayName from 'mastodon/components/display_name'; import { Link } from 'react-router-dom'; import Button from 'mastodon/components/button'; diff --git a/app/javascript/mastodon/features/directory/index.jsx b/app/javascript/mastodon/features/directory/index.jsx index afaf39b77..d98a0665a 100644 --- a/app/javascript/mastodon/features/directory/index.jsx +++ b/app/javascript/mastodon/features/directory/index.jsx @@ -9,7 +9,7 @@ import { addColumn, removeColumn, moveColumn, changeColumnParams } from 'mastodo import { fetchDirectory, expandDirectory } from 'mastodon/actions/directory'; import { List as ImmutableList } from 'immutable'; import AccountCard from './components/account_card'; -import RadioButton from 'mastodon/components/radio_button'; +import { RadioButton } from 'mastodon/components/radio_button'; import LoadMore from 'mastodon/components/load_more'; import ScrollContainer from 'mastodon/containers/scroll_container'; import LoadingIndicator from 'mastodon/components/loading_indicator'; diff --git a/app/javascript/mastodon/features/explore/components/story.jsx b/app/javascript/mastodon/features/explore/components/story.jsx index 563128029..c7320c886 100644 --- a/app/javascript/mastodon/features/explore/components/story.jsx +++ b/app/javascript/mastodon/features/explore/components/story.jsx @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import Blurhash from 'mastodon/components/blurhash'; +import { Blurhash } from 'mastodon/components/blurhash'; import { accountsCountRenderer } from 'mastodon/components/hashtag'; import ShortNumber from 'mastodon/components/short_number'; import Skeleton from 'mastodon/components/skeleton'; diff --git a/app/javascript/mastodon/features/favourites/index.jsx b/app/javascript/mastodon/features/favourites/index.jsx index b1e81debd..4a8c1deb6 100644 --- a/app/javascript/mastodon/features/favourites/index.jsx +++ b/app/javascript/mastodon/features/favourites/index.jsx @@ -5,7 +5,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { connect } from 'react-redux'; import ColumnHeader from 'mastodon/components/column_header'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import { fetchFavourites } from 'mastodon/actions/interactions'; import LoadingIndicator from 'mastodon/components/loading_indicator'; import ScrollableList from 'mastodon/components/scrollable_list'; diff --git a/app/javascript/mastodon/features/filters/select_filter.jsx b/app/javascript/mastodon/features/filters/select_filter.jsx index 5778eec8e..618f875db 100644 --- a/app/javascript/mastodon/features/filters/select_filter.jsx +++ b/app/javascript/mastodon/features/filters/select_filter.jsx @@ -4,7 +4,7 @@ import { connect } from 'react-redux'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { toServerSideType } from 'mastodon/utils/filters'; import { loupeIcon, deleteIcon } from 'mastodon/utils/icons'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import fuzzysort from 'fuzzysort'; const messages = defineMessages({ diff --git a/app/javascript/mastodon/features/follow_requests/components/account_authorize.jsx b/app/javascript/mastodon/features/follow_requests/components/account_authorize.jsx index 0bd45592c..b370b33ec 100644 --- a/app/javascript/mastodon/features/follow_requests/components/account_authorize.jsx +++ b/app/javascript/mastodon/features/follow_requests/components/account_authorize.jsx @@ -2,9 +2,9 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { Link } from 'react-router-dom'; -import Avatar from '../../../components/avatar'; +import { Avatar } from '../../../components/avatar'; import DisplayName from '../../../components/display_name'; -import IconButton from '../../../components/icon_button'; +import { IconButton } from '../../../components/icon_button'; import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/features/getting_started/components/announcements.jsx b/app/javascript/mastodon/features/getting_started/components/announcements.jsx index 5f993d2c5..ab29e3dc8 100644 --- a/app/javascript/mastodon/features/getting_started/components/announcements.jsx +++ b/app/javascript/mastodon/features/getting_started/components/announcements.jsx @@ -3,15 +3,15 @@ import ImmutablePureComponent from 'react-immutable-pure-component'; import ReactSwipeableViews from 'react-swipeable-views'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import IconButton from 'mastodon/components/icon_button'; -import Icon from 'mastodon/components/icon'; +import { IconButton } from 'mastodon/components/icon_button'; +import { Icon } from 'mastodon/components/icon'; import { defineMessages, injectIntl, FormattedMessage, FormattedDate } from 'react-intl'; import { autoPlayGif, reduceMotion, disableSwiping, mascot } from 'mastodon/initial_state'; import elephantUIPlane from 'mastodon/../images/elephant_ui_plane.svg'; import unicodeMapping from 'mastodon/features/emoji/emoji_unicode_mapping_light'; import classNames from 'classnames'; import EmojiPickerDropdown from 'mastodon/features/compose/containers/emoji_picker_dropdown_container'; -import AnimatedNumber from 'mastodon/components/animated_number'; +import { AnimatedNumber } from 'mastodon/components/animated_number'; import TransitionMotion from 'react-motion/lib/TransitionMotion'; import spring from 'react-motion/lib/spring'; import { assetHost } from 'mastodon/utils/config'; diff --git a/app/javascript/mastodon/features/hashtag_timeline/index.jsx b/app/javascript/mastodon/features/hashtag_timeline/index.jsx index a244dbdb2..116a5921c 100644 --- a/app/javascript/mastodon/features/hashtag_timeline/index.jsx +++ b/app/javascript/mastodon/features/hashtag_timeline/index.jsx @@ -12,7 +12,7 @@ import { injectIntl, FormattedMessage, defineMessages } from 'react-intl'; import { connectHashtagStream } from 'mastodon/actions/streaming'; import { isEqual } from 'lodash'; import { fetchHashtag, followHashtag, unfollowHashtag } from 'mastodon/actions/tags'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import classNames from 'classnames'; import { Helmet } from 'react-helmet'; diff --git a/app/javascript/mastodon/features/home_timeline/index.jsx b/app/javascript/mastodon/features/home_timeline/index.jsx index 9aa4c6d82..26166b254 100644 --- a/app/javascript/mastodon/features/home_timeline/index.jsx +++ b/app/javascript/mastodon/features/home_timeline/index.jsx @@ -12,8 +12,8 @@ import { Link } from 'react-router-dom'; import { fetchAnnouncements, toggleShowAnnouncements } from 'mastodon/actions/announcements'; import AnnouncementsContainer from 'mastodon/features/getting_started/containers/announcements_container'; import classNames from 'classnames'; -import IconWithBadge from 'mastodon/components/icon_with_badge'; -import NotSignedInIndicator from 'mastodon/components/not_signed_in_indicator'; +import { IconWithBadge } from 'mastodon/components/icon_with_badge'; +import { NotSignedInIndicator } from 'mastodon/components/not_signed_in_indicator'; import { Helmet } from 'react-helmet'; const messages = defineMessages({ diff --git a/app/javascript/mastodon/features/interaction_modal/index.jsx b/app/javascript/mastodon/features/interaction_modal/index.jsx index 5742f1104..f3db2c78d 100644 --- a/app/javascript/mastodon/features/interaction_modal/index.jsx +++ b/app/javascript/mastodon/features/interaction_modal/index.jsx @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; import { registrationsOpen } from 'mastodon/initial_state'; import { connect } from 'react-redux'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import classNames from 'classnames'; import { openModal, closeModal } from 'mastodon/actions/modal'; diff --git a/app/javascript/mastodon/features/list_adder/components/account.jsx b/app/javascript/mastodon/features/list_adder/components/account.jsx index 786af3bb1..410f1537a 100644 --- a/app/javascript/mastodon/features/list_adder/components/account.jsx +++ b/app/javascript/mastodon/features/list_adder/components/account.jsx @@ -3,7 +3,7 @@ import { connect } from 'react-redux'; import { makeGetAccount } from '../../../selectors'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import Avatar from '../../../components/avatar'; +import { Avatar } from '../../../components/avatar'; import DisplayName from '../../../components/display_name'; import { injectIntl } from 'react-intl'; diff --git a/app/javascript/mastodon/features/list_adder/components/list.jsx b/app/javascript/mastodon/features/list_adder/components/list.jsx index 34ccf8451..954a4a5cf 100644 --- a/app/javascript/mastodon/features/list_adder/components/list.jsx +++ b/app/javascript/mastodon/features/list_adder/components/list.jsx @@ -3,10 +3,10 @@ import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import IconButton from '../../../components/icon_button'; +import { IconButton } from '../../../components/icon_button'; import { defineMessages, injectIntl } from 'react-intl'; import { removeFromListAdder, addToListAdder } from '../../../actions/lists'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; const messages = defineMessages({ remove: { id: 'lists.account.remove', defaultMessage: 'Remove from list' }, diff --git a/app/javascript/mastodon/features/list_editor/components/account.jsx b/app/javascript/mastodon/features/list_editor/components/account.jsx index 86209bb3c..b46d0504a 100644 --- a/app/javascript/mastodon/features/list_editor/components/account.jsx +++ b/app/javascript/mastodon/features/list_editor/components/account.jsx @@ -4,9 +4,9 @@ import { connect } from 'react-redux'; import { makeGetAccount } from '../../../selectors'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import Avatar from '../../../components/avatar'; +import { Avatar } from '../../../components/avatar'; import DisplayName from '../../../components/display_name'; -import IconButton from '../../../components/icon_button'; +import { IconButton } from '../../../components/icon_button'; import { defineMessages, injectIntl } from 'react-intl'; import { removeFromListEditor, addToListEditor } from '../../../actions/lists'; diff --git a/app/javascript/mastodon/features/list_editor/components/edit_list_form.jsx b/app/javascript/mastodon/features/list_editor/components/edit_list_form.jsx index 9c1c244cb..65bfe7f94 100644 --- a/app/javascript/mastodon/features/list_editor/components/edit_list_form.jsx +++ b/app/javascript/mastodon/features/list_editor/components/edit_list_form.jsx @@ -2,7 +2,7 @@ import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import { changeListEditorTitle, submitListEditor } from '../../../actions/lists'; -import IconButton from '../../../components/icon_button'; +import { IconButton } from '../../../components/icon_button'; import { defineMessages, injectIntl } from 'react-intl'; const messages = defineMessages({ diff --git a/app/javascript/mastodon/features/list_editor/components/search.jsx b/app/javascript/mastodon/features/list_editor/components/search.jsx index f70e272f7..59e4c7d93 100644 --- a/app/javascript/mastodon/features/list_editor/components/search.jsx +++ b/app/javascript/mastodon/features/list_editor/components/search.jsx @@ -4,7 +4,7 @@ import { connect } from 'react-redux'; import { defineMessages, injectIntl } from 'react-intl'; import { fetchListSuggestions, clearListSuggestions, changeListSuggestions } from '../../../actions/lists'; import classNames from 'classnames'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; const messages = defineMessages({ search: { id: 'lists.search', defaultMessage: 'Search among people you follow' }, diff --git a/app/javascript/mastodon/features/list_timeline/index.jsx b/app/javascript/mastodon/features/list_timeline/index.jsx index 8297c2748..c93305341 100644 --- a/app/javascript/mastodon/features/list_timeline/index.jsx +++ b/app/javascript/mastodon/features/list_timeline/index.jsx @@ -11,9 +11,9 @@ import { connectListStream } from 'mastodon/actions/streaming'; import { expandListTimeline } from 'mastodon/actions/timelines'; import Column from 'mastodon/components/column'; import ColumnHeader from 'mastodon/components/column_header'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import LoadingIndicator from 'mastodon/components/loading_indicator'; -import RadioButton from 'mastodon/components/radio_button'; +import { RadioButton } from 'mastodon/components/radio_button'; import StatusListContainer from 'mastodon/features/ui/containers/status_list_container'; import BundleColumnError from 'mastodon/features/ui/components/bundle_column_error'; diff --git a/app/javascript/mastodon/features/notifications/components/clear_column_button.jsx b/app/javascript/mastodon/features/notifications/components/clear_column_button.jsx index 9a076ce5e..e043f5ee1 100644 --- a/app/javascript/mastodon/features/notifications/components/clear_column_button.jsx +++ b/app/javascript/mastodon/features/notifications/components/clear_column_button.jsx @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; export default class ClearColumnButton extends React.PureComponent { diff --git a/app/javascript/mastodon/features/notifications/components/filter_bar.jsx b/app/javascript/mastodon/features/notifications/components/filter_bar.jsx index 88e95cf48..f16c84f97 100644 --- a/app/javascript/mastodon/features/notifications/components/filter_bar.jsx +++ b/app/javascript/mastodon/features/notifications/components/filter_bar.jsx @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; const tooltips = defineMessages({ mentions: { id: 'notifications.filter.mentions', defaultMessage: 'Mentions' }, diff --git a/app/javascript/mastodon/features/notifications/components/follow_request.jsx b/app/javascript/mastodon/features/notifications/components/follow_request.jsx index 01bf67065..0d930f0b1 100644 --- a/app/javascript/mastodon/features/notifications/components/follow_request.jsx +++ b/app/javascript/mastodon/features/notifications/components/follow_request.jsx @@ -1,10 +1,10 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import Avatar from 'mastodon/components/avatar'; +import { Avatar } from 'mastodon/components/avatar'; import DisplayName from 'mastodon/components/display_name'; import { Link } from 'react-router-dom'; -import IconButton from 'mastodon/components/icon_button'; +import { IconButton } from 'mastodon/components/icon_button'; import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/features/notifications/components/notification.jsx b/app/javascript/mastodon/features/notifications/components/notification.jsx index f3104cee0..0f1aef8db 100644 --- a/app/javascript/mastodon/features/notifications/components/notification.jsx +++ b/app/javascript/mastodon/features/notifications/components/notification.jsx @@ -9,7 +9,7 @@ import StatusContainer from 'mastodon/containers/status_container'; import AccountContainer from 'mastodon/containers/account_container'; import Report from './report'; import FollowRequestContainer from '../containers/follow_request_container'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import { Link } from 'react-router-dom'; import classNames from 'classnames'; diff --git a/app/javascript/mastodon/features/notifications/components/notifications_permission_banner.jsx b/app/javascript/mastodon/features/notifications/components/notifications_permission_banner.jsx index c54137e60..a1b4248e7 100644 --- a/app/javascript/mastodon/features/notifications/components/notifications_permission_banner.jsx +++ b/app/javascript/mastodon/features/notifications/components/notifications_permission_banner.jsx @@ -1,7 +1,7 @@ import React from 'react'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import Button from 'mastodon/components/button'; -import IconButton from 'mastodon/components/icon_button'; +import { IconButton } from 'mastodon/components/icon_button'; import { requestBrowserPermission } from 'mastodon/actions/notifications'; import { changeSetting } from 'mastodon/actions/settings'; import { connect } from 'react-redux'; diff --git a/app/javascript/mastodon/features/notifications/components/report.jsx b/app/javascript/mastodon/features/notifications/components/report.jsx index a9decdc8e..1c0e1a775 100644 --- a/app/javascript/mastodon/features/notifications/components/report.jsx +++ b/app/javascript/mastodon/features/notifications/components/report.jsx @@ -3,8 +3,8 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import AvatarOverlay from 'mastodon/components/avatar_overlay'; -import RelativeTimestamp from 'mastodon/components/relative_timestamp'; +import { AvatarOverlay } from 'mastodon/components/avatar_overlay'; +import { RelativeTimestamp } from 'mastodon/components/relative_timestamp'; const messages = defineMessages({ openReport: { id: 'report_notification.open', defaultMessage: 'Open report' }, diff --git a/app/javascript/mastodon/features/notifications/index.jsx b/app/javascript/mastodon/features/notifications/index.jsx index bb8852abf..8a31c5db6 100644 --- a/app/javascript/mastodon/features/notifications/index.jsx +++ b/app/javascript/mastodon/features/notifications/index.jsx @@ -23,10 +23,10 @@ import { List as ImmutableList } from 'immutable'; import { debounce } from 'lodash'; import ScrollableList from '../../components/scrollable_list'; import LoadGap from '../../components/load_gap'; -import Icon from 'mastodon/components/icon'; -import compareId from 'mastodon/compare_id'; +import { Icon } from 'mastodon/components/icon'; +import { compareId } from 'mastodon/compare_id'; import NotificationsPermissionBanner from './components/notifications_permission_banner'; -import NotSignedInIndicator from 'mastodon/components/not_signed_in_indicator'; +import { NotSignedInIndicator } from 'mastodon/components/not_signed_in_indicator'; import { Helmet } from 'react-helmet'; const messages = defineMessages({ diff --git a/app/javascript/mastodon/features/onboarding/components/progress_indicator.jsx b/app/javascript/mastodon/features/onboarding/components/progress_indicator.jsx index 97134c0c9..7d75e50ed 100644 --- a/app/javascript/mastodon/features/onboarding/components/progress_indicator.jsx +++ b/app/javascript/mastodon/features/onboarding/components/progress_indicator.jsx @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import Check from 'mastodon/components/check'; +import { Check } from 'mastodon/components/check'; import classNames from 'classnames'; const ProgressIndicator = ({ steps, completed }) => ( @@ -22,4 +22,4 @@ ProgressIndicator.propTypes = { completed: PropTypes.number, }; -export default ProgressIndicator; \ No newline at end of file +export default ProgressIndicator; diff --git a/app/javascript/mastodon/features/onboarding/components/step.jsx b/app/javascript/mastodon/features/onboarding/components/step.jsx index 6f376e5d5..38e4b564a 100644 --- a/app/javascript/mastodon/features/onboarding/components/step.jsx +++ b/app/javascript/mastodon/features/onboarding/components/step.jsx @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; -import Icon from 'mastodon/components/icon'; -import Check from 'mastodon/components/check'; +import { Icon } from 'mastodon/components/icon'; +import { Check } from 'mastodon/components/check'; const Step = ({ label, description, icon, completed, onClick, href }) => { const content = ( @@ -47,4 +47,4 @@ Step.propTypes = { onClick: PropTypes.func, }; -export default Step; \ No newline at end of file +export default Step; diff --git a/app/javascript/mastodon/features/onboarding/share.jsx b/app/javascript/mastodon/features/onboarding/share.jsx index 9555a3a43..5f7cfb8a6 100644 --- a/app/javascript/mastodon/features/onboarding/share.jsx +++ b/app/javascript/mastodon/features/onboarding/share.jsx @@ -7,7 +7,7 @@ import { connect } from 'react-redux'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { defineMessages, injectIntl, FormattedMessage, FormattedHTMLMessage } from 'react-intl'; import classNames from 'classnames'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import ArrowSmallRight from './components/arrow_small_right'; import { Link } from 'react-router-dom'; import SwipeableViews from 'react-swipeable-views'; @@ -190,4 +190,4 @@ class Share extends React.PureComponent { } -export default connect(mapStateToProps)(injectIntl(Share)); \ No newline at end of file +export default connect(mapStateToProps)(injectIntl(Share)); diff --git a/app/javascript/mastodon/features/picture_in_picture/components/footer.jsx b/app/javascript/mastodon/features/picture_in_picture/components/footer.jsx index 66124f331..5c60284d6 100644 --- a/app/javascript/mastodon/features/picture_in_picture/components/footer.jsx +++ b/app/javascript/mastodon/features/picture_in_picture/components/footer.jsx @@ -3,7 +3,7 @@ import { connect } from 'react-redux'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import IconButton from 'mastodon/components/icon_button'; +import { IconButton } from 'mastodon/components/icon_button'; import classNames from 'classnames'; import { me, boostModal } from 'mastodon/initial_state'; import { defineMessages, injectIntl } from 'react-intl'; diff --git a/app/javascript/mastodon/features/picture_in_picture/components/header.jsx b/app/javascript/mastodon/features/picture_in_picture/components/header.jsx index 100f9db7a..c6d2a103d 100644 --- a/app/javascript/mastodon/features/picture_in_picture/components/header.jsx +++ b/app/javascript/mastodon/features/picture_in_picture/components/header.jsx @@ -3,9 +3,9 @@ import { connect } from 'react-redux'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import IconButton from 'mastodon/components/icon_button'; +import { IconButton } from 'mastodon/components/icon_button'; import { Link } from 'react-router-dom'; -import Avatar from 'mastodon/components/avatar'; +import { Avatar } from 'mastodon/components/avatar'; import DisplayName from 'mastodon/components/display_name'; import { defineMessages, injectIntl } from 'react-intl'; diff --git a/app/javascript/mastodon/features/reblogs/index.jsx b/app/javascript/mastodon/features/reblogs/index.jsx index 35edb0d6a..fb503f40f 100644 --- a/app/javascript/mastodon/features/reblogs/index.jsx +++ b/app/javascript/mastodon/features/reblogs/index.jsx @@ -9,7 +9,7 @@ import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import AccountContainer from '../../containers/account_container'; import Column from '../ui/components/column'; import ScrollableList from '../../components/scrollable_list'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import ColumnHeader from '../../components/column_header'; import { Helmet } from 'react-helmet'; diff --git a/app/javascript/mastodon/features/report/components/option.jsx b/app/javascript/mastodon/features/report/components/option.jsx index 342204e22..34df4d73b 100644 --- a/app/javascript/mastodon/features/report/components/option.jsx +++ b/app/javascript/mastodon/features/report/components/option.jsx @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; -import Check from 'mastodon/components/check'; +import { Check } from 'mastodon/components/check'; export default class Option extends React.PureComponent { diff --git a/app/javascript/mastodon/features/report/components/status_check_box.jsx b/app/javascript/mastodon/features/report/components/status_check_box.jsx index 28d572e89..003cdc8e3 100644 --- a/app/javascript/mastodon/features/report/components/status_check_box.jsx +++ b/app/javascript/mastodon/features/report/components/status_check_box.jsx @@ -2,13 +2,13 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import StatusContent from 'mastodon/components/status_content'; -import Avatar from 'mastodon/components/avatar'; +import { Avatar } from 'mastodon/components/avatar'; import DisplayName from 'mastodon/components/display_name'; -import RelativeTimestamp from 'mastodon/components/relative_timestamp'; +import { RelativeTimestamp } from 'mastodon/components/relative_timestamp'; import Option from './option'; import MediaAttachments from 'mastodon/components/media_attachments'; import { injectIntl, defineMessages } from 'react-intl'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; const messages = defineMessages({ public_short: { id: 'privacy.public.short', defaultMessage: 'Public' }, diff --git a/app/javascript/mastodon/features/status/components/action_bar.jsx b/app/javascript/mastodon/features/status/components/action_bar.jsx index 0c74c4cc4..e5b08ff28 100644 --- a/app/javascript/mastodon/features/status/components/action_bar.jsx +++ b/app/javascript/mastodon/features/status/components/action_bar.jsx @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; -import IconButton from '../../../components/icon_button'; +import { IconButton } from '../../../components/icon_button'; import ImmutablePropTypes from 'react-immutable-proptypes'; import DropdownMenuContainer from '../../../containers/dropdown_menu_container'; import { defineMessages, injectIntl } from 'react-intl'; diff --git a/app/javascript/mastodon/features/status/components/card.jsx b/app/javascript/mastodon/features/status/components/card.jsx index 88b38c65a..1d5edfc17 100644 --- a/app/javascript/mastodon/features/status/components/card.jsx +++ b/app/javascript/mastodon/features/status/components/card.jsx @@ -5,9 +5,9 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import { FormattedMessage } from 'react-intl'; import punycode from 'punycode'; import classnames from 'classnames'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import { useBlurhash } from 'mastodon/initial_state'; -import Blurhash from 'mastodon/components/blurhash'; +import { Blurhash } from 'mastodon/components/blurhash'; const IDNA_PREFIX = 'xn--'; diff --git a/app/javascript/mastodon/features/status/components/detailed_status.jsx b/app/javascript/mastodon/features/status/components/detailed_status.jsx index e4e572026..72c902124 100644 --- a/app/javascript/mastodon/features/status/components/detailed_status.jsx +++ b/app/javascript/mastodon/features/status/components/detailed_status.jsx @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import Avatar from '../../../components/avatar'; +import { Avatar } from '../../../components/avatar'; import DisplayName from '../../../components/display_name'; import StatusContent from '../../../components/status_content'; import MediaGallery from '../../../components/media_gallery'; @@ -13,8 +13,8 @@ import Video from '../../video'; import Audio from '../../audio'; import scheduleIdleTask from '../../ui/util/schedule_idle_task'; import classNames from 'classnames'; -import Icon from 'mastodon/components/icon'; -import AnimatedNumber from 'mastodon/components/animated_number'; +import { Icon } from 'mastodon/components/icon'; +import { AnimatedNumber } from 'mastodon/components/animated_number'; import PictureInPicturePlaceholder from 'mastodon/components/picture_in_picture_placeholder'; import EditedTimestamp from 'mastodon/components/edited_timestamp'; diff --git a/app/javascript/mastodon/features/status/index.jsx b/app/javascript/mastodon/features/status/index.jsx index 7f1896aed..0c0b55748 100644 --- a/app/javascript/mastodon/features/status/index.jsx +++ b/app/javascript/mastodon/features/status/index.jsx @@ -58,7 +58,7 @@ import { HotKeys } from 'react-hotkeys'; import { boostModal, deleteModal } from '../../initial_state'; import { attachFullscreenListener, detachFullscreenListener, isFullscreen } from '../ui/util/fullscreen'; import { textForScreenReader, defaultMediaVisibility } from '../../components/status'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import { Helmet } from 'react-helmet'; import BundleColumnError from 'mastodon/features/ui/components/bundle_column_error'; diff --git a/app/javascript/mastodon/features/subscribed_languages_modal/index.jsx b/app/javascript/mastodon/features/subscribed_languages_modal/index.jsx index 04fe31b5c..a9dd1e072 100644 --- a/app/javascript/mastodon/features/subscribed_languages_modal/index.jsx +++ b/app/javascript/mastodon/features/subscribed_languages_modal/index.jsx @@ -8,7 +8,7 @@ import { is, List as ImmutableList, Set as ImmutableSet } from 'immutable'; import { languages as preloadedLanguages } from 'mastodon/initial_state'; import Option from 'mastodon/features/report/components/option'; import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; -import IconButton from 'mastodon/components/icon_button'; +import { IconButton } from 'mastodon/components/icon_button'; import Button from 'mastodon/components/button'; import { followAccount } from 'mastodon/actions/accounts'; diff --git a/app/javascript/mastodon/features/ui/components/actions_modal.jsx b/app/javascript/mastodon/features/ui/components/actions_modal.jsx index 35090e242..9d11da608 100644 --- a/app/javascript/mastodon/features/ui/components/actions_modal.jsx +++ b/app/javascript/mastodon/features/ui/components/actions_modal.jsx @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import IconButton from '../../../components/icon_button'; +import { IconButton } from '../../../components/icon_button'; import classNames from 'classnames'; export default class ActionsModal extends ImmutablePureComponent { diff --git a/app/javascript/mastodon/features/ui/components/boost_modal.jsx b/app/javascript/mastodon/features/ui/components/boost_modal.jsx index fe55c963a..1f28927d6 100644 --- a/app/javascript/mastodon/features/ui/components/boost_modal.jsx +++ b/app/javascript/mastodon/features/ui/components/boost_modal.jsx @@ -5,11 +5,11 @@ import PropTypes from 'prop-types'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import Button from '../../../components/button'; import StatusContent from '../../../components/status_content'; -import Avatar from '../../../components/avatar'; -import RelativeTimestamp from '../../../components/relative_timestamp'; +import { Avatar } from '../../../components/avatar'; +import { RelativeTimestamp } from '../../../components/relative_timestamp'; import DisplayName from '../../../components/display_name'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import AttachmentList from 'mastodon/components/attachment_list'; import PrivacyDropdown from 'mastodon/features/compose/components/privacy_dropdown'; import classNames from 'classnames'; diff --git a/app/javascript/mastodon/features/ui/components/bundle_modal_error.jsx b/app/javascript/mastodon/features/ui/components/bundle_modal_error.jsx index d79d0ca4a..6ddf2ae7a 100644 --- a/app/javascript/mastodon/features/ui/components/bundle_modal_error.jsx +++ b/app/javascript/mastodon/features/ui/components/bundle_modal_error.jsx @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl } from 'react-intl'; -import IconButton from '../../../components/icon_button'; +import { IconButton } from '../../../components/icon_button'; const messages = defineMessages({ error: { id: 'bundle_modal_error.message', defaultMessage: 'Something went wrong while loading this component.' }, diff --git a/app/javascript/mastodon/features/ui/components/column_header.jsx b/app/javascript/mastodon/features/ui/components/column_header.jsx index 4ceef5957..a2d3a3871 100644 --- a/app/javascript/mastodon/features/ui/components/column_header.jsx +++ b/app/javascript/mastodon/features/ui/components/column_header.jsx @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; export default class ColumnHeader extends React.PureComponent { diff --git a/app/javascript/mastodon/features/ui/components/column_link.jsx b/app/javascript/mastodon/features/ui/components/column_link.jsx index 8eebbf526..4e9164afb 100644 --- a/app/javascript/mastodon/features/ui/components/column_link.jsx +++ b/app/javascript/mastodon/features/ui/components/column_link.jsx @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { NavLink } from 'react-router-dom'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import classNames from 'classnames'; const ColumnLink = ({ icon, text, to, href, method, badge, transparent, ...other }) => { diff --git a/app/javascript/mastodon/features/ui/components/compare_history_modal.jsx b/app/javascript/mastodon/features/ui/components/compare_history_modal.jsx index 1802c167c..8e4c4d136 100644 --- a/app/javascript/mastodon/features/ui/components/compare_history_modal.jsx +++ b/app/javascript/mastodon/features/ui/components/compare_history_modal.jsx @@ -7,8 +7,8 @@ import { closeModal } from 'mastodon/actions/modal'; import emojify from 'mastodon/features/emoji/emoji'; import escapeTextContentForBrowser from 'escape-html'; import InlineAccount from 'mastodon/components/inline_account'; -import IconButton from 'mastodon/components/icon_button'; -import RelativeTimestamp from 'mastodon/components/relative_timestamp'; +import { IconButton } from 'mastodon/components/icon_button'; +import { RelativeTimestamp } from 'mastodon/components/relative_timestamp'; import MediaAttachments from 'mastodon/components/media_attachments'; const mapStateToProps = (state, { statusId }) => ({ diff --git a/app/javascript/mastodon/features/ui/components/embed_modal.jsx b/app/javascript/mastodon/features/ui/components/embed_modal.jsx index baf6be411..3e0bcc93c 100644 --- a/app/javascript/mastodon/features/ui/components/embed_modal.jsx +++ b/app/javascript/mastodon/features/ui/components/embed_modal.jsx @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; import api from 'mastodon/api'; -import IconButton from 'mastodon/components/icon_button'; +import { IconButton } from 'mastodon/components/icon_button'; const messages = defineMessages({ close: { id: 'lightbox.close', defaultMessage: 'Close' }, diff --git a/app/javascript/mastodon/features/ui/components/filter_modal.jsx b/app/javascript/mastodon/features/ui/components/filter_modal.jsx index 8d77fb3df..473fe4b36 100644 --- a/app/javascript/mastodon/features/ui/components/filter_modal.jsx +++ b/app/javascript/mastodon/features/ui/components/filter_modal.jsx @@ -5,7 +5,7 @@ import { fetchFilters, createFilter, createFilterStatus } from 'mastodon/actions import PropTypes from 'prop-types'; import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import IconButton from 'mastodon/components/icon_button'; +import { IconButton } from 'mastodon/components/icon_button'; import SelectFilter from 'mastodon/features/filters/select_filter'; import AddedToFilter from 'mastodon/features/filters/added_to_filter'; diff --git a/app/javascript/mastodon/features/ui/components/focal_point_modal.jsx b/app/javascript/mastodon/features/ui/components/focal_point_modal.jsx index 2a1e4c8bb..eda550b04 100644 --- a/app/javascript/mastodon/features/ui/components/focal_point_modal.jsx +++ b/app/javascript/mastodon/features/ui/components/focal_point_modal.jsx @@ -7,7 +7,7 @@ import classNames from 'classnames'; import { changeUploadCompose, uploadThumbnail, onChangeMediaDescription, onChangeMediaFocus } from '../../../actions/compose'; import { getPointerPosition } from '../../video'; import { FormattedMessage, defineMessages, injectIntl } from 'react-intl'; -import IconButton from 'mastodon/components/icon_button'; +import { IconButton } from 'mastodon/components/icon_button'; import Button from 'mastodon/components/button'; import Video from 'mastodon/features/video'; import Audio from 'mastodon/features/audio'; @@ -16,7 +16,7 @@ import UploadProgress from 'mastodon/features/compose/components/upload_progress import CharacterCounter from 'mastodon/features/compose/components/character_counter'; import { length } from 'stringz'; import { Tesseract as fetchTesseract } from 'mastodon/features/ui/util/async-components'; -import GIFV from 'mastodon/components/gifv'; +import { GIFV } from 'mastodon/components/gifv'; import { me } from 'mastodon/initial_state'; // eslint-disable-next-line import/no-extraneous-dependencies import tesseractCorePath from 'tesseract.js-core/tesseract-core.wasm.js'; diff --git a/app/javascript/mastodon/features/ui/components/follow_requests_column_link.jsx b/app/javascript/mastodon/features/ui/components/follow_requests_column_link.jsx index 1cd1b79bc..9c8ebd13c 100644 --- a/app/javascript/mastodon/features/ui/components/follow_requests_column_link.jsx +++ b/app/javascript/mastodon/features/ui/components/follow_requests_column_link.jsx @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import { fetchFollowRequests } from 'mastodon/actions/accounts'; import { connect } from 'react-redux'; import ColumnLink from 'mastodon/features/ui/components/column_link'; -import IconWithBadge from 'mastodon/components/icon_with_badge'; +import { IconWithBadge } from 'mastodon/components/icon_with_badge'; import { List as ImmutableList } from 'immutable'; import { injectIntl, defineMessages } from 'react-intl'; diff --git a/app/javascript/mastodon/features/ui/components/header.jsx b/app/javascript/mastodon/features/ui/components/header.jsx index a4def456b..af18ac331 100644 --- a/app/javascript/mastodon/features/ui/components/header.jsx +++ b/app/javascript/mastodon/features/ui/components/header.jsx @@ -3,7 +3,7 @@ import { WordmarkLogo, SymbolLogo } from 'mastodon/components/logo'; import { Link, withRouter } from 'react-router-dom'; import { FormattedMessage } from 'react-intl'; import { registrationsOpen, me } from 'mastodon/initial_state'; -import Avatar from 'mastodon/components/avatar'; +import { Avatar } from 'mastodon/components/avatar'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { openModal } from 'mastodon/actions/modal'; diff --git a/app/javascript/mastodon/features/ui/components/image_modal.jsx b/app/javascript/mastodon/features/ui/components/image_modal.jsx index ca93d7b4e..31c5ab37a 100644 --- a/app/javascript/mastodon/features/ui/components/image_modal.jsx +++ b/app/javascript/mastodon/features/ui/components/image_modal.jsx @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; import { defineMessages, injectIntl } from 'react-intl'; -import IconButton from 'mastodon/components/icon_button'; +import { IconButton } from 'mastodon/components/icon_button'; import ImageLoader from './image_loader'; const messages = defineMessages({ diff --git a/app/javascript/mastodon/features/ui/components/media_modal.jsx b/app/javascript/mastodon/features/ui/components/media_modal.jsx index ec6ddc0e1..e8293c2e7 100644 --- a/app/javascript/mastodon/features/ui/components/media_modal.jsx +++ b/app/javascript/mastodon/features/ui/components/media_modal.jsx @@ -6,11 +6,11 @@ import Video from 'mastodon/features/video'; import { connect } from 'react-redux'; import classNames from 'classnames'; import { defineMessages, injectIntl } from 'react-intl'; -import IconButton from 'mastodon/components/icon_button'; +import { IconButton } from 'mastodon/components/icon_button'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImageLoader from './image_loader'; -import Icon from 'mastodon/components/icon'; -import GIFV from 'mastodon/components/gifv'; +import { Icon } from 'mastodon/components/icon'; +import { GIFV } from 'mastodon/components/gifv'; import { disableSwiping } from 'mastodon/initial_state'; import Footer from 'mastodon/features/picture_in_picture/components/footer'; import { getAverageFromBlurhash } from 'mastodon/blurhash'; diff --git a/app/javascript/mastodon/features/ui/components/notifications_counter_icon.js b/app/javascript/mastodon/features/ui/components/notifications_counter_icon.js index da553cd9f..7ef251603 100644 --- a/app/javascript/mastodon/features/ui/components/notifications_counter_icon.js +++ b/app/javascript/mastodon/features/ui/components/notifications_counter_icon.js @@ -1,5 +1,5 @@ import { connect } from 'react-redux'; -import IconWithBadge from 'mastodon/components/icon_with_badge'; +import { IconWithBadge } from 'mastodon/components/icon_with_badge'; const mapStateToProps = state => ({ count: state.getIn(['notifications', 'unread']), diff --git a/app/javascript/mastodon/features/ui/components/report_modal.jsx b/app/javascript/mastodon/features/ui/components/report_modal.jsx index 8b505b8bd..f3ada9c07 100644 --- a/app/javascript/mastodon/features/ui/components/report_modal.jsx +++ b/app/javascript/mastodon/features/ui/components/report_modal.jsx @@ -9,7 +9,7 @@ import { makeGetAccount } from 'mastodon/selectors'; import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; import { OrderedSet } from 'immutable'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import IconButton from 'mastodon/components/icon_button'; +import { IconButton } from 'mastodon/components/icon_button'; import Category from 'mastodon/features/report/category'; import Statuses from 'mastodon/features/report/statuses'; import Rules from 'mastodon/features/report/rules'; diff --git a/app/javascript/mastodon/features/ui/components/zoomable_image.jsx b/app/javascript/mastodon/features/ui/components/zoomable_image.jsx index b41d0fe31..49be6d5c3 100644 --- a/app/javascript/mastodon/features/ui/components/zoomable_image.jsx +++ b/app/javascript/mastodon/features/ui/components/zoomable_image.jsx @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import IconButton from 'mastodon/components/icon_button'; +import { IconButton } from 'mastodon/components/icon_button'; import { defineMessages, injectIntl } from 'react-intl'; const messages = defineMessages({ diff --git a/app/javascript/mastodon/features/video/index.jsx b/app/javascript/mastodon/features/video/index.jsx index d76d34546..8b57cf3d1 100644 --- a/app/javascript/mastodon/features/video/index.jsx +++ b/app/javascript/mastodon/features/video/index.jsx @@ -6,8 +6,8 @@ import { throttle } from 'lodash'; import classNames from 'classnames'; import { isFullscreen, requestFullscreen, exitFullscreen } from '../ui/util/fullscreen'; import { displayMedia, useBlurhash } from '../../initial_state'; -import Icon from 'mastodon/components/icon'; -import Blurhash from 'mastodon/components/blurhash'; +import { Icon } from 'mastodon/components/icon'; +import { Blurhash } from 'mastodon/components/blurhash'; const messages = defineMessages({ play: { id: 'video.play', defaultMessage: 'Play' }, diff --git a/app/javascript/mastodon/reducers/compose.js b/app/javascript/mastodon/reducers/compose.js index 65f439e03..3e750c4cf 100644 --- a/app/javascript/mastodon/reducers/compose.js +++ b/app/javascript/mastodon/reducers/compose.js @@ -52,7 +52,7 @@ import { TIMELINE_DELETE } from '../actions/timelines'; import { STORE_HYDRATE } from '../actions/store'; import { REDRAFT } from '../actions/statuses'; import { Map as ImmutableMap, List as ImmutableList, OrderedSet as ImmutableOrderedSet, fromJS } from 'immutable'; -import uuid from '../uuid'; +import { uuid } from '../uuid'; import { me } from '../initial_state'; import { unescapeHTML } from '../utils/html'; diff --git a/app/javascript/mastodon/reducers/contexts.js b/app/javascript/mastodon/reducers/contexts.js index 7aa95b5d5..8772e175e 100644 --- a/app/javascript/mastodon/reducers/contexts.js +++ b/app/javascript/mastodon/reducers/contexts.js @@ -5,7 +5,7 @@ import { import { CONTEXT_FETCH_SUCCESS } from '../actions/statuses'; import { TIMELINE_DELETE, TIMELINE_UPDATE } from '../actions/timelines'; import { Map as ImmutableMap, List as ImmutableList } from 'immutable'; -import compareId from '../compare_id'; +import { compareId } from '../compare_id'; const initialState = ImmutableMap({ inReplyTos: ImmutableMap(), diff --git a/app/javascript/mastodon/reducers/conversations.js b/app/javascript/mastodon/reducers/conversations.js index feccf18f0..942c6941b 100644 --- a/app/javascript/mastodon/reducers/conversations.js +++ b/app/javascript/mastodon/reducers/conversations.js @@ -11,7 +11,7 @@ import { } from '../actions/conversations'; import { ACCOUNT_BLOCK_SUCCESS, ACCOUNT_MUTE_SUCCESS } from 'mastodon/actions/accounts'; import { DOMAIN_BLOCK_SUCCESS } from 'mastodon/actions/domain_blocks'; -import compareId from '../compare_id'; +import { compareId } from '../compare_id'; const initialState = ImmutableMap({ items: ImmutableList(), diff --git a/app/javascript/mastodon/reducers/index.js b/app/javascript/mastodon/reducers/index.js index 69771ad1b..4d705f041 100644 --- a/app/javascript/mastodon/reducers/index.js +++ b/app/javascript/mastodon/reducers/index.js @@ -33,7 +33,7 @@ import conversations from './conversations'; import suggestions from './suggestions'; import polls from './polls'; import trends from './trends'; -import missed_updates from './missed_updates'; +import { missedUpdatesReducer } from './missed_updates'; import announcements from './announcements'; import markers from './markers'; import picture_in_picture from './picture_in_picture'; @@ -79,7 +79,7 @@ const reducers = { suggestions, polls, trends, - missed_updates, + missed_updates: missedUpdatesReducer, markers, picture_in_picture, history, diff --git a/app/javascript/mastodon/reducers/missed_updates.ts b/app/javascript/mastodon/reducers/missed_updates.ts index 043fe93fa..628fed2a9 100644 --- a/app/javascript/mastodon/reducers/missed_updates.ts +++ b/app/javascript/mastodon/reducers/missed_updates.ts @@ -12,7 +12,7 @@ const initialState = Record({ unread: 0, })(); -export default function missed_updates( +export function missedUpdatesReducer( state = initialState, action: Action, ) { diff --git a/app/javascript/mastodon/reducers/notifications.js b/app/javascript/mastodon/reducers/notifications.js index 0530a52b4..77e64284b 100644 --- a/app/javascript/mastodon/reducers/notifications.js +++ b/app/javascript/mastodon/reducers/notifications.js @@ -29,7 +29,7 @@ import { import { DOMAIN_BLOCK_SUCCESS } from 'mastodon/actions/domain_blocks'; import { TIMELINE_DELETE, TIMELINE_DISCONNECT } from '../actions/timelines'; import { fromJS, Map as ImmutableMap, List as ImmutableList } from 'immutable'; -import compareId from '../compare_id'; +import { compareId } from '../compare_id'; const initialState = ImmutableMap({ pendingItems: ImmutableList(), diff --git a/app/javascript/mastodon/reducers/settings.js b/app/javascript/mastodon/reducers/settings.js index f48d58bdc..c8fdf1bc8 100644 --- a/app/javascript/mastodon/reducers/settings.js +++ b/app/javascript/mastodon/reducers/settings.js @@ -6,7 +6,7 @@ import { EMOJI_USE } from '../actions/emojis'; import { LANGUAGE_USE } from '../actions/languages'; import { LIST_DELETE_SUCCESS, LIST_FETCH_FAIL } from '../actions/lists'; import { Map as ImmutableMap, fromJS } from 'immutable'; -import uuid from '../uuid'; +import { uuid } from '../uuid'; const initialState = ImmutableMap({ saved: true, diff --git a/app/javascript/mastodon/reducers/timelines.js b/app/javascript/mastodon/reducers/timelines.js index 973e3cf18..41892ae46 100644 --- a/app/javascript/mastodon/reducers/timelines.js +++ b/app/javascript/mastodon/reducers/timelines.js @@ -17,7 +17,7 @@ import { ACCOUNT_UNFOLLOW_SUCCESS, } from '../actions/accounts'; import { Map as ImmutableMap, List as ImmutableList, OrderedSet as ImmutableOrderedSet, fromJS } from 'immutable'; -import compareId from '../compare_id'; +import { compareId } from '../compare_id'; const initialState = ImmutableMap(); diff --git a/app/javascript/mastodon/uuid.ts b/app/javascript/mastodon/uuid.ts index 01b57ee99..cabbc0f4e 100644 --- a/app/javascript/mastodon/uuid.ts +++ b/app/javascript/mastodon/uuid.ts @@ -1,4 +1,4 @@ -export default function uuid(a?: string): string { +export function uuid(a?: string): string { return a ? ( (a as any as number) ^ diff --git a/app/javascript/types/image.d.ts b/app/javascript/types/image.d.ts index 8bd6ab028..fae2ed701 100644 --- a/app/javascript/types/image.d.ts +++ b/app/javascript/types/image.d.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/no-default-export */ declare module '*.avif' { const path: string; export default path; From 6579e3af7d6eb2774eae3d16bb1c9b7772fb58ec Mon Sep 17 00:00:00 2001 From: fusagiko / takayamaki <24884114+takayamaki@users.noreply.github.com> Date: Tue, 9 May 2023 19:09:32 +0900 Subject: [PATCH 14/44] Add more detailed type annotation for Account (#24815) --- app/javascript/types/resources.ts | 52 ++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/app/javascript/types/resources.ts b/app/javascript/types/resources.ts index 28fad2719..090650415 100644 --- a/app/javascript/types/resources.ts +++ b/app/javascript/types/resources.ts @@ -1,10 +1,54 @@ import type { Record } from 'immutable'; -type AccountValues = { - id: number; +type CustomEmoji = Record<{ + shortcode: string; + static_url: string; + url: string; +}>; + +type AccountField = Record<{ + name: string; + value: string; + verified_at: string | null; +}>; + +type AccountApiResponseValues = { + acct: string; avatar: string; avatar_static: string; - [key: string]: any; + bot: boolean; + created_at: string; + discoverable: boolean; + display_name: string; + emojis: CustomEmoji[]; + fields: AccountField[]; + followers_count: number; + following_count: number; + group: boolean; + header: string; + header_static: string; + id: string; + last_status_at: string; + locked: boolean; + note: string; + statuses_count: number; + url: string; + username: string; +}; + +type NormalizedAccountField = Record<{ + name_emojified: string; + value_emojified: string; + value_plain: string; +}>; + +type NormalizedAccountValues = { + display_name_html: string; + fields: NormalizedAccountField[]; + note_emojified: string; + note_plain: string; }; -export type Account = Record; +export type Account = Record< + AccountApiResponseValues & NormalizedAccountValues +>; From aec486b4ec327ca07b0cf8297f1b1dad3ebe0820 Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Tue, 9 May 2023 14:43:07 +0200 Subject: [PATCH 15/44] Upgrade `uuid` to 9.0.0 (#24917) --- .github/dependabot.yml | 4 ---- package.json | 4 ++-- yarn.lock | 16 ++++++++-------- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index ef16f1d48..af7efbe6c 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -17,10 +17,6 @@ updates: - dependency-name: '@rails/ujs' versions: - '>= 7' - # TODO: This was ignored in https://github.com/mastodon/mastodon/pull/19120 - - dependency-name: 'uuid' - versions: - - '>= 9' # TODO: This requires code changes for migration - dependency-name: 'tesseract.js' versions: diff --git a/package.json b/package.json index 76deabc26..b56b79d9f 100644 --- a/package.json +++ b/package.json @@ -126,7 +126,7 @@ "tesseract.js": "^2.1.5", "tiny-queue": "^0.2.1", "twitter-text": "3.1.0", - "uuid": "^8.3.1", + "uuid": "^9.0.0", "webpack": "^4.46.0", "webpack-assets-manifest": "^4.0.6", "webpack-bundle-analyzer": "^4.8.0", @@ -176,7 +176,7 @@ "@types/react-toggle": "^4.0.3", "@types/redux-immutable": "^4.0.3", "@types/requestidlecallback": "^0.3.5", - "@types/uuid": "^8.3.4", + "@types/uuid": "^9.0.0", "@types/webpack": "^4.41.33", "@types/yargs": "^17.0.24", "@typescript-eslint/eslint-plugin": "^5.59.2", diff --git a/yarn.lock b/yarn.lock index 3114f26a3..be8ef990f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2425,10 +2425,10 @@ dependencies: source-map "^0.6.1" -"@types/uuid@^8.3.4": - version "8.3.4" - resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-8.3.4.tgz#bd86a43617df0594787d38b735f55c805becf1bc" - integrity sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw== +"@types/uuid@^9.0.0": + version "9.0.1" + resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-9.0.1.tgz#98586dc36aee8dacc98cc396dbca8d0429647aa6" + integrity sha512-rFT3ak0/2trgvp4yYZo5iKFEPsET7vKydKF+VRCxlQ9bpheehyAJH89dAkaLEq/j/RZXJIqcgsmPJKUP1Z28HA== "@types/warning@^3.0.0": version "3.0.0" @@ -11654,10 +11654,10 @@ uuid@^3.3.2, uuid@^3.4.0: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== -uuid@^8.3.1: - version "8.3.2" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" - integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== +uuid@^9.0.0: + version "9.0.0" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.0.tgz#592f550650024a38ceb0c562f2f6aa435761efb5" + integrity sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg== v8-compile-cache@^2.1.1, v8-compile-cache@^2.3.0: version "2.3.0" From ffb3fef7dba2f7ca2d927bc8432731962d2ee4f9 Mon Sep 17 00:00:00 2001 From: Daniel M Brasil Date: Tue, 9 May 2023 09:45:47 -0300 Subject: [PATCH 16/44] Fix uncaught `ActiveRecord::StatementInvalid` in Mastodon::IpBlocksCLI (#24861) --- lib/mastodon/ip_blocks_cli.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/mastodon/ip_blocks_cli.rb b/lib/mastodon/ip_blocks_cli.rb index 3b9959585..8a8685fe5 100644 --- a/lib/mastodon/ip_blocks_cli.rb +++ b/lib/mastodon/ip_blocks_cli.rb @@ -36,6 +36,12 @@ module Mastodon failed = 0 addresses.each do |address| + unless valid_ip_address?(address) + say("#{address} is invalid", :red) + failed += 1 + next + end + ip_block = IpBlock.find_by(ip: address) if ip_block.present? && !options[:force] @@ -79,6 +85,12 @@ module Mastodon skipped = 0 addresses.each do |address| + unless valid_ip_address?(address) + say("#{address} is invalid", :yellow) + skipped += 1 + next + end + ip_blocks = if options[:force] IpBlock.where('ip >>= ?', address) else @@ -126,5 +138,12 @@ module Mastodon :red end end + + def valid_ip_address?(ip_address) + IPAddr.new(ip_address) + true + rescue IPAddr::InvalidAddressError + false + end end end From 536dd046d44c1fb5738ee7044b359b63fb4359c7 Mon Sep 17 00:00:00 2001 From: Daniel M Brasil Date: Tue, 9 May 2023 09:46:00 -0300 Subject: [PATCH 17/44] Add ability to block sign-ups from IP using the CLI (#24870) --- lib/mastodon/ip_blocks_cli.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mastodon/ip_blocks_cli.rb b/lib/mastodon/ip_blocks_cli.rb index 8a8685fe5..82a08753b 100644 --- a/lib/mastodon/ip_blocks_cli.rb +++ b/lib/mastodon/ip_blocks_cli.rb @@ -11,7 +11,7 @@ module Mastodon true end - option :severity, required: true, enum: %w(no_access sign_up_requires_approval), desc: 'Severity of the block' + option :severity, required: true, enum: %w(no_access sign_up_requires_approval sign_up_block), desc: 'Severity of the block' option :comment, aliases: [:c], desc: 'Optional comment' option :duration, aliases: [:d], type: :numeric, desc: 'Duration of the block in seconds' option :force, type: :boolean, aliases: [:f], desc: 'Overwrite existing blocks' From a3a2414f0ea91c26276728fc7f9d837f81828075 Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Tue, 9 May 2023 14:55:35 +0200 Subject: [PATCH 18/44] Rework polyfills loading (#24907) --- .../base_polyfills.ts} | 22 ++---- .../extra_polyfills.ts} | 0 .../{load_polyfills.js => polyfills/index.ts} | 16 ++--- app/javascript/packs/application.js | 2 +- app/javascript/packs/public.jsx | 6 +- app/javascript/packs/share.jsx | 2 +- package.json | 5 +- tsconfig.json | 1 + yarn.lock | 70 ++----------------- 9 files changed, 25 insertions(+), 99 deletions(-) rename app/javascript/mastodon/{base_polyfills.js => polyfills/base_polyfills.ts} (58%) rename app/javascript/mastodon/{extra_polyfills.js => polyfills/extra_polyfills.ts} (100%) rename app/javascript/mastodon/{load_polyfills.js => polyfills/index.ts} (82%) diff --git a/app/javascript/mastodon/base_polyfills.js b/app/javascript/mastodon/polyfills/base_polyfills.ts similarity index 58% rename from app/javascript/mastodon/base_polyfills.js rename to app/javascript/mastodon/polyfills/base_polyfills.ts index 91bc5d6dc..2e583f580 100644 --- a/app/javascript/mastodon/base_polyfills.js +++ b/app/javascript/mastodon/polyfills/base_polyfills.ts @@ -1,26 +1,16 @@ import 'intl'; import 'intl/locale-data/jsonp/en'; -import 'es6-symbol/implement'; -import assign from 'object-assign'; -import values from 'object.values'; -import { decode as decodeBase64 } from './utils/base64'; -import promiseFinally from 'promise.prototype.finally'; - -if (!Object.assign) { - Object.assign = assign; -} - -if (!Object.values) { - values.shim(); -} - -promiseFinally.shim(); +import 'core-js/features/object/assign'; +import 'core-js/features/object/values'; +import 'core-js/features/symbol'; +import 'core-js/features/promise/finally'; +import { decode as decodeBase64 } from '../utils/base64'; if (!HTMLCanvasElement.prototype.toBlob) { const BASE64_MARKER = ';base64,'; Object.defineProperty(HTMLCanvasElement.prototype, 'toBlob', { - value(callback, type = 'image/png', quality) { + value(callback: BlobCallback, type = 'image/png', quality: any) { const dataURL = this.toDataURL(type, quality); let data; diff --git a/app/javascript/mastodon/extra_polyfills.js b/app/javascript/mastodon/polyfills/extra_polyfills.ts similarity index 100% rename from app/javascript/mastodon/extra_polyfills.js rename to app/javascript/mastodon/polyfills/extra_polyfills.ts diff --git a/app/javascript/mastodon/load_polyfills.js b/app/javascript/mastodon/polyfills/index.ts similarity index 82% rename from app/javascript/mastodon/load_polyfills.js rename to app/javascript/mastodon/polyfills/index.ts index 7909dc4ea..6d2e5426e 100644 --- a/app/javascript/mastodon/load_polyfills.js +++ b/app/javascript/mastodon/polyfills/index.ts @@ -10,14 +10,14 @@ function importExtraPolyfills() { return import(/* webpackChunkName: "extra_polyfills" */ './extra_polyfills'); } -function loadPolyfills() { +export function loadPolyfills() { const needsBasePolyfills = !( - HTMLCanvasElement.prototype.toBlob && - window.Intl && - Object.assign && - Object.values && - window.Symbol && - Promise.prototype.finally + 'toBlob' in HTMLCanvasElement.prototype && + 'Intl' in window && + 'assign' in Object && + 'values' in Object && + 'Symbol' in window && + 'finally' in Promise.prototype ); // Latest version of Firefox and Safari do not have IntersectionObserver. @@ -36,5 +36,3 @@ function loadPolyfills() { needsExtraPolyfills && importExtraPolyfills(), ]); } - -export default loadPolyfills; diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js index 020f2b4a0..ab8708365 100644 --- a/app/javascript/packs/application.js +++ b/app/javascript/packs/application.js @@ -1,5 +1,5 @@ import './public-path'; -import loadPolyfills from '../mastodon/load_polyfills'; +import { loadPolyfills } from '../mastodon/polyfills'; import { start } from '../mastodon/common'; start(); diff --git a/app/javascript/packs/public.jsx b/app/javascript/packs/public.jsx index 21c52fc12..3c6fd3630 100644 --- a/app/javascript/packs/public.jsx +++ b/app/javascript/packs/public.jsx @@ -1,9 +1,9 @@ import './public-path'; -import loadPolyfills from '../mastodon/load_polyfills'; -import { start } from '../mastodon/common'; - import escapeTextContentForBrowser from 'escape-html'; +import { loadPolyfills } from '../mastodon/polyfills'; import ready from '../mastodon/ready'; +import { start } from '../mastodon/common'; + import loadKeyboardExtensions from '../mastodon/load_keyboard_extensions'; import 'cocoon-js-vanilla'; import axios from 'axios'; diff --git a/app/javascript/packs/share.jsx b/app/javascript/packs/share.jsx index 97c3c7b0e..542a2f3ae 100644 --- a/app/javascript/packs/share.jsx +++ b/app/javascript/packs/share.jsx @@ -1,5 +1,5 @@ import './public-path'; -import loadPolyfills from '../mastodon/load_polyfills'; +import { loadPolyfills } from '../mastodon/polyfills'; import { start } from '../mastodon/common'; import ready from '../mastodon/ready'; import ComposeContainer from '../mastodon/containers/compose_container'; diff --git a/package.json b/package.json index b56b79d9f..8ca772722 100644 --- a/package.json +++ b/package.json @@ -52,13 +52,13 @@ "cocoon-js-vanilla": "^1.3.0", "color-blend": "^4.0.0", "compression-webpack-plugin": "^6.1.1", + "core-js": "^3.30.2", "cross-env": "^7.0.3", "css-loader": "^5.2.7", "cssnano": "^6.0.1", "detect-passive-events": "^2.0.3", "dotenv": "^16.0.3", "emoji-mart": "npm:emoji-mart-lazyload@latest", - "es6-symbol": "^3.1.3", "escape-html": "^1.0.3", "express": "^4.18.2", "file-loader": "^6.2.0", @@ -80,14 +80,11 @@ "mini-css-extract-plugin": "^1.6.2", "mkdirp": "^2.1.6", "npmlog": "^7.0.1", - "object-assign": "^4.1.1", - "object.values": "^1.1.6", "path-complete-extname": "^1.0.0", "pg": "^8.5.0", "pg-connection-string": "^2.5.0", "postcss": "^8.4.23", "postcss-loader": "^4.3.0", - "promise.prototype.finally": "^3.1.4", "prop-types": "^15.8.1", "punycode": "^2.3.0", "react": "^16.14.0", diff --git a/tsconfig.json b/tsconfig.json index 09cea2a75..2c2193d55 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "jsx": "react", "target": "esnext", + "module": "CommonJS", "moduleResolution": "node", "allowJs": true, "noEmit": true, diff --git a/yarn.lock b/yarn.lock index be8ef990f..380fc480a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4135,6 +4135,11 @@ core-js@^2.5.0: resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.12.tgz#d9333dfa7b065e347cc5682219d6f690859cc2ec" integrity sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ== +core-js@^3.30.2: + version "3.30.2" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.30.2.tgz#6528abfda65e5ad728143ea23f7a14f0dcf503fc" + integrity sha512-uBJiDmwqsbJCWHAwjrx3cvjbMXP7xD72Dmsn5LOJpiRmE3WbBbN5rCqQ2Qh6Ek6/eOrjlWngEynBWo4VxerQhg== + core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" @@ -4409,14 +4414,6 @@ csstype@^3.0.2: resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.0.6.tgz#865d0b5833d7d8d40f4e5b8a6d76aea3de4725ef" integrity sha512-+ZAmfyWMT7TiIlzdqJgjMb7S4f1beorDbWbsocyK4RaiqA5RTX3K14bnBWmmA9QEM0gRdsjyyrEmcyga8Zsxmw== -d@1, d@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/d/-/d-1.0.1.tgz#8698095372d58dbee346ffd0c7093f99f8f9eb5a" - integrity sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA== - dependencies: - es5-ext "^0.10.50" - type "^1.0.1" - damerau-levenshtein@^1.0.8: version "1.0.8" resolved "https://registry.yarnpkg.com/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz#b43d286ccbd36bc5b2f7ed41caf2d0aba1f8a6e7" @@ -4967,32 +4964,6 @@ es-to-primitive@^1.2.1: is-date-object "^1.0.1" is-symbol "^1.0.2" -es5-ext@^0.10.35, es5-ext@^0.10.50: - version "0.10.53" - resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.53.tgz#93c5a3acfdbef275220ad72644ad02ee18368de1" - integrity sha512-Xs2Stw6NiNHWypzRTY1MtaG/uJlwCk8kH81920ma8mvN8Xq1gsfhZvpkImLQArw8AHnv8MT2I45J3c0R8slE+Q== - dependencies: - es6-iterator "~2.0.3" - es6-symbol "~3.1.3" - next-tick "~1.0.0" - -es6-iterator@~2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.3.tgz#a7de889141a05a94b0854403b2d0a0fbfa98f3b7" - integrity sha1-p96IkUGgWpSwhUQDstCg+/qY87c= - dependencies: - d "1" - es5-ext "^0.10.35" - es6-symbol "^3.1.1" - -es6-symbol@^3.1.1, es6-symbol@^3.1.3, es6-symbol@~3.1.3: - version "3.1.3" - resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.3.tgz#bad5d3c1bcdac28269f4cb331e431c78ac705d18" - integrity sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA== - dependencies: - d "^1.0.1" - ext "^1.1.2" - escalade@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" @@ -5425,13 +5396,6 @@ express@^4.17.1, express@^4.18.2: utils-merge "1.0.1" vary "~1.1.2" -ext@^1.1.2: - version "1.4.0" - resolved "https://registry.yarnpkg.com/ext/-/ext-1.4.0.tgz#89ae7a07158f79d35517882904324077e4379244" - integrity sha512-Key5NIsUxdqKg3vIsdw9dSuXpPCQ297y6wBjL30edxwPgt2E44WcWBZey/ZvUc6sERLTxKdyCu4gZFmUbk1Q7A== - dependencies: - type "^2.0.0" - extend-shallow@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" @@ -8234,11 +8198,6 @@ neo-async@^2.5.0, neo-async@^2.6.1, neo-async@^2.6.2: resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== -next-tick@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c" - integrity sha1-yobR/ogoFpsBICCOPchCS524NCw= - nice-try@^1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" @@ -9284,15 +9243,6 @@ promise-inflight@^1.0.1: resolved "https://registry.yarnpkg.com/promise-inflight/-/promise-inflight-1.0.1.tgz#98472870bf228132fcbdd868129bad12c3c029e3" integrity sha1-mEcocL8igTL8vdhoEputEsPAKeM= -promise.prototype.finally@^3.1.4: - version "3.1.4" - resolved "https://registry.yarnpkg.com/promise.prototype.finally/-/promise.prototype.finally-3.1.4.tgz#4e756a154e4db27fae24c6b18703495c31da3927" - integrity sha512-nNc3YbgMfLzqtqvO/q5DP6RR0SiHI9pUPGzyDf1q+usTwCN2kjvAnJkBb7bHe3o+fFSBPpsGMoYtaSi+LTNqng== - dependencies: - call-bind "^1.0.2" - define-properties "^1.1.4" - es-abstract "^1.20.4" - prompts@^2.0.1: version "2.3.2" resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.3.2.tgz#480572d89ecf39566d2bd3fe2c9fccb7c4c0b068" @@ -11426,16 +11376,6 @@ type-is@~1.6.18: media-typer "0.3.0" mime-types "~2.1.24" -type@^1.0.1: - version "1.2.0" - resolved "https://registry.yarnpkg.com/type/-/type-1.2.0.tgz#848dd7698dafa3e54a6c479e759c4bc3f18847a0" - integrity sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg== - -type@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/type/-/type-2.0.0.tgz#5f16ff6ef2eb44f260494dae271033b29c09a9c3" - integrity sha512-KBt58xCHry4Cejnc2ISQAF7QY+ORngsWfxezO68+12hKV6lQY8P/psIkcbjeHWn7MqcgciWJyCCevFMJdIXpow== - "typescript@^4.7 || 5", typescript@^5.0.4: version "5.0.4" resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.4.tgz#b217fd20119bd61a94d4011274e0ab369058da3b" From af7bf59b3e4e9fb401248908146442eaf5f571e5 Mon Sep 17 00:00:00 2001 From: eggplants Date: Tue, 9 May 2023 21:56:02 +0900 Subject: [PATCH 19/44] Fix wrong documentation link (#24924) --- .rubocop.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.rubocop.yml b/.rubocop.yml index 966a2a43d..ceade6e58 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -157,7 +157,7 @@ Metrics/MethodLength: - 'lib/mastodon/*_cli.rb' # Reason: -# https://docs.rubocop.org/rubocop/cops_style.html#stylerescuestandarderror +# https://docs.rubocop.org/rubocop/cops_metrics.html#metricsmodulelength Metrics/ModuleLength: CountAsOne: [array, heredoc] From a5ba98d2df44d15a280ea46d8353698862555620 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 May 2023 15:25:49 +0200 Subject: [PATCH 20/44] Bump @typescript-eslint/parser from 5.59.2 to 5.59.5 (#24921) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 50 ++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 43 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 8ca772722..9e14c1689 100644 --- a/package.json +++ b/package.json @@ -177,7 +177,7 @@ "@types/webpack": "^4.41.33", "@types/yargs": "^17.0.24", "@typescript-eslint/eslint-plugin": "^5.59.2", - "@typescript-eslint/parser": "^5.59.2", + "@typescript-eslint/parser": "^5.59.5", "babel-jest": "^29.5.0", "eslint": "^8.39.0", "eslint-plugin-formatjs": "^4.10.1", diff --git a/yarn.lock b/yarn.lock index 380fc480a..7551e9fa7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2491,14 +2491,14 @@ semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/parser@^5.59.2": - version "5.59.2" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.59.2.tgz#c2c443247901d95865b9f77332d9eee7c55655e8" - integrity sha512-uq0sKyw6ao1iFOZZGk9F8Nro/8+gfB5ezl1cA06SrqbgJAt0SRoFhb9pXaHvkrxUpZaoLxt8KlovHNk8Gp6/HQ== - dependencies: - "@typescript-eslint/scope-manager" "5.59.2" - "@typescript-eslint/types" "5.59.2" - "@typescript-eslint/typescript-estree" "5.59.2" +"@typescript-eslint/parser@^5.59.5": + version "5.59.5" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.59.5.tgz#63064f5eafbdbfb5f9dfbf5c4503cdf949852981" + integrity sha512-NJXQC4MRnF9N9yWqQE2/KLRSOLvrrlZb48NGVfBa+RuPMN6B7ZcK5jZOvhuygv4D64fRKnZI4L4p8+M+rfeQuw== + dependencies: + "@typescript-eslint/scope-manager" "5.59.5" + "@typescript-eslint/types" "5.59.5" + "@typescript-eslint/typescript-estree" "5.59.5" debug "^4.3.4" "@typescript-eslint/scope-manager@5.59.2": @@ -2509,6 +2509,14 @@ "@typescript-eslint/types" "5.59.2" "@typescript-eslint/visitor-keys" "5.59.2" +"@typescript-eslint/scope-manager@5.59.5": + version "5.59.5" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.59.5.tgz#33ffc7e8663f42cfaac873de65ebf65d2bce674d" + integrity sha512-jVecWwnkX6ZgutF+DovbBJirZcAxgxC0EOHYt/niMROf8p4PwxxG32Qdhj/iIQQIuOflLjNkxoXyArkcIP7C3A== + dependencies: + "@typescript-eslint/types" "5.59.5" + "@typescript-eslint/visitor-keys" "5.59.5" + "@typescript-eslint/type-utils@5.59.2": version "5.59.2" resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.59.2.tgz#0729c237503604cd9a7084b5af04c496c9a4cdcf" @@ -2529,6 +2537,11 @@ resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.59.2.tgz#b511d2b9847fe277c5cb002a2318bd329ef4f655" integrity sha512-LbJ/HqoVs2XTGq5shkiKaNTuVv5tTejdHgfdjqRUGdYhjW1crm/M7og2jhVskMt8/4wS3T1+PfFvL1K3wqYj4w== +"@typescript-eslint/types@5.59.5": + version "5.59.5" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.59.5.tgz#e63c5952532306d97c6ea432cee0981f6d2258c7" + integrity sha512-xkfRPHbqSH4Ggx4eHRIO/eGL8XL4Ysb4woL8c87YuAo8Md7AUjyWKa9YMwTL519SyDPrfEgKdewjkxNCVeJW7w== + "@typescript-eslint/typescript-estree@5.59.0": version "5.59.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.0.tgz#8869156ee1dcfc5a95be3ed0e2809969ea28e965" @@ -2555,6 +2568,19 @@ semver "^7.3.7" tsutils "^3.21.0" +"@typescript-eslint/typescript-estree@5.59.5": + version "5.59.5" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.5.tgz#9b252ce55dd765e972a7a2f99233c439c5101e42" + integrity sha512-+XXdLN2CZLZcD/mO7mQtJMvCkzRfmODbeSKuMY/yXbGkzvA9rJyDY5qDYNoiz2kP/dmyAxXquL2BvLQLJFPQIg== + dependencies: + "@typescript-eslint/types" "5.59.5" + "@typescript-eslint/visitor-keys" "5.59.5" + debug "^4.3.4" + globby "^11.1.0" + is-glob "^4.0.3" + semver "^7.3.7" + tsutils "^3.21.0" + "@typescript-eslint/utils@5.59.2": version "5.59.2" resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.59.2.tgz#0c45178124d10cc986115885688db6abc37939f4" @@ -2585,6 +2611,14 @@ "@typescript-eslint/types" "5.59.2" eslint-visitor-keys "^3.3.0" +"@typescript-eslint/visitor-keys@5.59.5": + version "5.59.5" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.5.tgz#ba5b8d6791a13cf9fea6716af1e7626434b29b9b" + integrity sha512-qL+Oz+dbeBRTeyJTIy0eniD3uvqU7x+y1QceBismZ41hd4aBSRh8UAw4pZP0+XzLuPZmx4raNMq/I+59W2lXKA== + dependencies: + "@typescript-eslint/types" "5.59.5" + eslint-visitor-keys "^3.3.0" + "@webassemblyjs/ast@1.9.0": version "1.9.0" resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.9.0.tgz#bd850604b4042459a5a41cd7d338cbed695ed964" From 72dcb2ef5873300d4716697ee09d6c61303b33bf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 May 2023 15:42:21 +0200 Subject: [PATCH 21/44] Bump @typescript-eslint/eslint-plugin from 5.59.2 to 5.59.5 (#24922) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 74 ++++++++++++++-------------------------------------- 2 files changed, 21 insertions(+), 55 deletions(-) diff --git a/package.json b/package.json index 9e14c1689..9129c8b0a 100644 --- a/package.json +++ b/package.json @@ -176,7 +176,7 @@ "@types/uuid": "^9.0.0", "@types/webpack": "^4.41.33", "@types/yargs": "^17.0.24", - "@typescript-eslint/eslint-plugin": "^5.59.2", + "@typescript-eslint/eslint-plugin": "^5.59.5", "@typescript-eslint/parser": "^5.59.5", "babel-jest": "^29.5.0", "eslint": "^8.39.0", diff --git a/yarn.lock b/yarn.lock index 7551e9fa7..72fb0a333 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2475,15 +2475,15 @@ dependencies: "@types/yargs-parser" "*" -"@typescript-eslint/eslint-plugin@^5.59.2": - version "5.59.2" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.2.tgz#684a2ce7182f3b4dac342eef7caa1c2bae476abd" - integrity sha512-yVrXupeHjRxLDcPKL10sGQ/QlVrA8J5IYOEWVqk0lJaSZP7X5DfnP7Ns3cc74/blmbipQ1htFNVGsHX6wsYm0A== +"@typescript-eslint/eslint-plugin@^5.59.5": + version "5.59.5" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.5.tgz#f156827610a3f8cefc56baeaa93cd4a5f32966b4" + integrity sha512-feA9xbVRWJZor+AnLNAr7A8JRWeZqHUf4T9tlP+TN04b05pFVhO5eN7/O93Y/1OUlLMHKbnJisgDURs/qvtqdg== dependencies: "@eslint-community/regexpp" "^4.4.0" - "@typescript-eslint/scope-manager" "5.59.2" - "@typescript-eslint/type-utils" "5.59.2" - "@typescript-eslint/utils" "5.59.2" + "@typescript-eslint/scope-manager" "5.59.5" + "@typescript-eslint/type-utils" "5.59.5" + "@typescript-eslint/utils" "5.59.5" debug "^4.3.4" grapheme-splitter "^1.0.4" ignore "^5.2.0" @@ -2501,14 +2501,6 @@ "@typescript-eslint/typescript-estree" "5.59.5" debug "^4.3.4" -"@typescript-eslint/scope-manager@5.59.2": - version "5.59.2" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.59.2.tgz#f699fe936ee4e2c996d14f0fdd3a7da5ba7b9a4c" - integrity sha512-dB1v7ROySwQWKqQ8rEWcdbTsFjh2G0vn8KUyvTXdPoyzSL6lLGkiXEV5CvpJsEe9xIdKV+8Zqb7wif2issoOFA== - dependencies: - "@typescript-eslint/types" "5.59.2" - "@typescript-eslint/visitor-keys" "5.59.2" - "@typescript-eslint/scope-manager@5.59.5": version "5.59.5" resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.59.5.tgz#33ffc7e8663f42cfaac873de65ebf65d2bce674d" @@ -2517,13 +2509,13 @@ "@typescript-eslint/types" "5.59.5" "@typescript-eslint/visitor-keys" "5.59.5" -"@typescript-eslint/type-utils@5.59.2": - version "5.59.2" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.59.2.tgz#0729c237503604cd9a7084b5af04c496c9a4cdcf" - integrity sha512-b1LS2phBOsEy/T381bxkkywfQXkV1dWda/z0PhnIy3bC5+rQWQDS7fk9CSpcXBccPY27Z6vBEuaPBCKCgYezyQ== +"@typescript-eslint/type-utils@5.59.5": + version "5.59.5" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.59.5.tgz#485b0e2c5b923460bc2ea6b338c595343f06fc9b" + integrity sha512-4eyhS7oGym67/pSxA2mmNq7X164oqDYNnZCUayBwJZIRVvKpBCMBzFnFxjeoDeShjtO6RQBHBuwybuX3POnDqg== dependencies: - "@typescript-eslint/typescript-estree" "5.59.2" - "@typescript-eslint/utils" "5.59.2" + "@typescript-eslint/typescript-estree" "5.59.5" + "@typescript-eslint/utils" "5.59.5" debug "^4.3.4" tsutils "^3.21.0" @@ -2532,11 +2524,6 @@ resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.59.0.tgz#3fcdac7dbf923ec5251545acdd9f1d42d7c4fe32" integrity sha512-yR2h1NotF23xFFYKHZs17QJnB51J/s+ud4PYU4MqdZbzeNxpgUr05+dNeCN/bb6raslHvGdd6BFCkVhpPk/ZeA== -"@typescript-eslint/types@5.59.2": - version "5.59.2" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.59.2.tgz#b511d2b9847fe277c5cb002a2318bd329ef4f655" - integrity sha512-LbJ/HqoVs2XTGq5shkiKaNTuVv5tTejdHgfdjqRUGdYhjW1crm/M7og2jhVskMt8/4wS3T1+PfFvL1K3wqYj4w== - "@typescript-eslint/types@5.59.5": version "5.59.5" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.59.5.tgz#e63c5952532306d97c6ea432cee0981f6d2258c7" @@ -2555,19 +2542,6 @@ semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/typescript-estree@5.59.2": - version "5.59.2" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.2.tgz#6e2fabd3ba01db5d69df44e0b654c0b051fe9936" - integrity sha512-+j4SmbwVmZsQ9jEyBMgpuBD0rKwi9RxRpjX71Brr73RsYnEr3Lt5QZ624Bxphp8HUkSKfqGnPJp1kA5nl0Sh7Q== - dependencies: - "@typescript-eslint/types" "5.59.2" - "@typescript-eslint/visitor-keys" "5.59.2" - debug "^4.3.4" - globby "^11.1.0" - is-glob "^4.0.3" - semver "^7.3.7" - tsutils "^3.21.0" - "@typescript-eslint/typescript-estree@5.59.5": version "5.59.5" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.5.tgz#9b252ce55dd765e972a7a2f99233c439c5101e42" @@ -2581,17 +2555,17 @@ semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/utils@5.59.2": - version "5.59.2" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.59.2.tgz#0c45178124d10cc986115885688db6abc37939f4" - integrity sha512-kSuF6/77TZzyGPhGO4uVp+f0SBoYxCDf+lW3GKhtKru/L8k/Hd7NFQxyWUeY7Z/KGB2C6Fe3yf2vVi4V9TsCSQ== +"@typescript-eslint/utils@5.59.5": + version "5.59.5" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.59.5.tgz#15b3eb619bb223302e60413adb0accd29c32bcae" + integrity sha512-sCEHOiw+RbyTii9c3/qN74hYDPNORb8yWCoPLmB7BIflhplJ65u2PBpdRla12e3SSTJ2erRkPjz7ngLHhUegxA== dependencies: "@eslint-community/eslint-utils" "^4.2.0" "@types/json-schema" "^7.0.9" "@types/semver" "^7.3.12" - "@typescript-eslint/scope-manager" "5.59.2" - "@typescript-eslint/types" "5.59.2" - "@typescript-eslint/typescript-estree" "5.59.2" + "@typescript-eslint/scope-manager" "5.59.5" + "@typescript-eslint/types" "5.59.5" + "@typescript-eslint/typescript-estree" "5.59.5" eslint-scope "^5.1.1" semver "^7.3.7" @@ -2603,14 +2577,6 @@ "@typescript-eslint/types" "5.59.0" eslint-visitor-keys "^3.3.0" -"@typescript-eslint/visitor-keys@5.59.2": - version "5.59.2" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.2.tgz#37a419dc2723a3eacbf722512b86d6caf7d3b750" - integrity sha512-EEpsO8m3RASrKAHI9jpavNv9NlEUebV4qmF1OWxSTtKSFBpC1NCmWazDQHFivRf0O1DV11BA645yrLEVQ0/Lig== - dependencies: - "@typescript-eslint/types" "5.59.2" - eslint-visitor-keys "^3.3.0" - "@typescript-eslint/visitor-keys@5.59.5": version "5.59.5" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.5.tgz#ba5b8d6791a13cf9fea6716af1e7626434b29b9b" From 224d458f7e351e8c88f71b44d338578525961c88 Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Tue, 9 May 2023 15:48:53 +0200 Subject: [PATCH 22/44] Remove unused iOS agent sniffing function (#24931) --- app/javascript/mastodon/is_mobile.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/app/javascript/mastodon/is_mobile.ts b/app/javascript/mastodon/is_mobile.ts index 43819f85d..b2918eb4b 100644 --- a/app/javascript/mastodon/is_mobile.ts +++ b/app/javascript/mastodon/is_mobile.ts @@ -16,10 +16,6 @@ export const layoutFromWindow = (): LayoutType => { } }; -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-expect-error -const iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && window.MSStream != null; - const listenerOptions = supportsPassiveEvents ? { passive: true } : false; let userTouching = false; @@ -33,5 +29,3 @@ const touchListener = () => { window.addEventListener('touchstart', touchListener, listenerOptions); export const isUserTouching = () => userTouching; - -export const isIOS = () => iOS; From e1f466fbbe94a57f1552b28fc819dc90cd3294d3 Mon Sep 17 00:00:00 2001 From: Claire Date: Tue, 9 May 2023 16:42:02 +0200 Subject: [PATCH 23/44] Fix javascript on moderation interface (#24933) --- app/javascript/packs/public.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/javascript/packs/public.jsx b/app/javascript/packs/public.jsx index 3c6fd3630..1ea39e05a 100644 --- a/app/javascript/packs/public.jsx +++ b/app/javascript/packs/public.jsx @@ -12,7 +12,7 @@ import { defineMessages } from 'react-intl'; import * as IntlMessageFormat from 'intl-messageformat'; import { timeAgoString } from '../mastodon/components/relative_timestamp'; import { delegate } from '@rails/ujs'; -import * as emojify from '../mastodon/features/emoji/emoji'; +import emojify from '../mastodon/features/emoji/emoji'; import { getLocale } from '../mastodon/locales'; import React from 'react'; import ReactDOM from 'react-dom'; From 6aeb162927e6f9bbfd597632a10d82d9656c2385 Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Tue, 9 May 2023 16:56:26 +0200 Subject: [PATCH 24/44] Type Redux store and middleware (#24843) --- .../mastodon/containers/compose_container.jsx | 2 +- .../mastodon/containers/mastodon.jsx | 2 +- app/javascript/mastodon/main.jsx | 2 +- .../mastodon/reducers/{index.js => index.ts} | 4 ++- .../mastodon/store/configureStore.js | 16 ------------ app/javascript/mastodon/store/index.ts | 23 ++++++++++++++++ .../errors.js => store/middlewares/errors.ts} | 9 ++++--- .../middlewares/loading_bar.ts} | 12 ++++++--- .../sounds.js => store/middlewares/sounds.ts} | 26 +++++++++++++------ 9 files changed, 61 insertions(+), 35 deletions(-) rename app/javascript/mastodon/reducers/{index.js => index.ts} (97%) delete mode 100644 app/javascript/mastodon/store/configureStore.js create mode 100644 app/javascript/mastodon/store/index.ts rename app/javascript/mastodon/{middleware/errors.js => store/middlewares/errors.ts} (55%) rename app/javascript/mastodon/{middleware/loading_bar.js => store/middlewares/loading_bar.ts} (68%) rename app/javascript/mastodon/{middleware/sounds.js => store/middlewares/sounds.ts} (54%) diff --git a/app/javascript/mastodon/containers/compose_container.jsx b/app/javascript/mastodon/containers/compose_container.jsx index a4c5f3cb4..9213c5614 100644 --- a/app/javascript/mastodon/containers/compose_container.jsx +++ b/app/javascript/mastodon/containers/compose_container.jsx @@ -1,7 +1,7 @@ import React from 'react'; import { Provider } from 'react-redux'; import PropTypes from 'prop-types'; -import { store } from '../store/configureStore'; +import { store } from '../store'; import { hydrateStore } from '../actions/store'; import { IntlProvider, addLocaleData } from 'react-intl'; import { getLocale } from '../locales'; diff --git a/app/javascript/mastodon/containers/mastodon.jsx b/app/javascript/mastodon/containers/mastodon.jsx index 256ea8e2d..9c6c9e592 100644 --- a/app/javascript/mastodon/containers/mastodon.jsx +++ b/app/javascript/mastodon/containers/mastodon.jsx @@ -5,7 +5,7 @@ import { IntlProvider, addLocaleData } from 'react-intl'; import { Provider as ReduxProvider } from 'react-redux'; import { BrowserRouter, Route } from 'react-router-dom'; import { ScrollContext } from 'react-router-scroll-4'; -import { store } from 'mastodon/store/configureStore'; +import { store } from 'mastodon/store'; import UI from 'mastodon/features/ui'; import { fetchCustomEmojis } from 'mastodon/actions/custom_emojis'; import { hydrateStore } from 'mastodon/actions/store'; diff --git a/app/javascript/mastodon/main.jsx b/app/javascript/mastodon/main.jsx index d8654aded..c5960477d 100644 --- a/app/javascript/mastodon/main.jsx +++ b/app/javascript/mastodon/main.jsx @@ -2,7 +2,7 @@ import React from 'react'; import ReactDOM from 'react-dom'; import { setupBrowserNotifications } from 'mastodon/actions/notifications'; import Mastodon from 'mastodon/containers/mastodon'; -import { store } from 'mastodon/store/configureStore'; +import { store } from 'mastodon/store'; import { me } from 'mastodon/initial_state'; import ready from 'mastodon/ready'; import * as perf from 'mastodon/performance'; diff --git a/app/javascript/mastodon/reducers/index.js b/app/javascript/mastodon/reducers/index.ts similarity index 97% rename from app/javascript/mastodon/reducers/index.js rename to app/javascript/mastodon/reducers/index.ts index 4d705f041..518d8cd79 100644 --- a/app/javascript/mastodon/reducers/index.js +++ b/app/javascript/mastodon/reducers/index.ts @@ -87,4 +87,6 @@ const reducers = { followed_tags, }; -export default combineReducers(reducers); +const rootReducer = combineReducers(reducers); + +export { rootReducer }; diff --git a/app/javascript/mastodon/store/configureStore.js b/app/javascript/mastodon/store/configureStore.js deleted file mode 100644 index cb17dd9ce..000000000 --- a/app/javascript/mastodon/store/configureStore.js +++ /dev/null @@ -1,16 +0,0 @@ -import { configureStore } from '@reduxjs/toolkit'; -import thunk from 'redux-thunk'; -import appReducer from '../reducers'; -import loadingBarMiddleware from '../middleware/loading_bar'; -import errorsMiddleware from '../middleware/errors'; -import soundsMiddleware from '../middleware/sounds'; - -export const store = configureStore({ - reducer: appReducer, - middleware: [ - thunk, - loadingBarMiddleware({ promiseTypeSuffixes: ['REQUEST', 'SUCCESS', 'FAIL'] }), - errorsMiddleware(), - soundsMiddleware(), - ], -}); diff --git a/app/javascript/mastodon/store/index.ts b/app/javascript/mastodon/store/index.ts new file mode 100644 index 000000000..822c01aa9 --- /dev/null +++ b/app/javascript/mastodon/store/index.ts @@ -0,0 +1,23 @@ +import { configureStore } from '@reduxjs/toolkit'; +import { rootReducer } from '../reducers'; +import { loadingBarMiddleware } from './middlewares/loading_bar'; +import { errorsMiddleware } from './middlewares/errors'; +import { soundsMiddleware } from './middlewares/sounds'; +import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux'; + +export const store = configureStore({ + reducer: rootReducer, + middleware: getDefaultMiddleware => + getDefaultMiddleware().concat( + loadingBarMiddleware({ promiseTypeSuffixes: ['REQUEST', 'SUCCESS', 'FAIL'] })) + .concat(errorsMiddleware) + .concat(soundsMiddleware()), +}); + +// Infer the `RootState` and `AppDispatch` types from the store itself +export type RootState = ReturnType +// Inferred type: {posts: PostsState, comments: CommentsState, users: UsersState} +export type AppDispatch = typeof store.dispatch + +export const useAppDispatch: () => AppDispatch = useDispatch; +export const useAppSelector: TypedUseSelectorHook = useSelector; diff --git a/app/javascript/mastodon/middleware/errors.js b/app/javascript/mastodon/store/middlewares/errors.ts similarity index 55% rename from app/javascript/mastodon/middleware/errors.js rename to app/javascript/mastodon/store/middlewares/errors.ts index 708df6bb8..b135fa2ee 100644 --- a/app/javascript/mastodon/middleware/errors.js +++ b/app/javascript/mastodon/store/middlewares/errors.ts @@ -1,9 +1,11 @@ -import { showAlertForError } from '../actions/alerts'; +import { Middleware } from 'redux'; +import { showAlertForError } from '../../actions/alerts'; +import { RootState } from '..'; const defaultFailSuffix = 'FAIL'; -export default function errorsMiddleware() { - return ({ dispatch }) => next => action => { +export const errorsMiddleware: Middleware, RootState> = + ({ dispatch }) => next => action => { if (action.type && !action.skipAlert) { const isFail = new RegExp(`${defaultFailSuffix}$`, 'g'); @@ -14,4 +16,3 @@ export default function errorsMiddleware() { return next(action); }; -} diff --git a/app/javascript/mastodon/middleware/loading_bar.js b/app/javascript/mastodon/store/middlewares/loading_bar.ts similarity index 68% rename from app/javascript/mastodon/middleware/loading_bar.js rename to app/javascript/mastodon/store/middlewares/loading_bar.ts index da8cc4c7d..e860b31b6 100644 --- a/app/javascript/mastodon/middleware/loading_bar.js +++ b/app/javascript/mastodon/store/middlewares/loading_bar.ts @@ -1,8 +1,14 @@ import { showLoading, hideLoading } from 'react-redux-loading-bar'; +import { Middleware } from 'redux'; +import { RootState } from '..'; -const defaultTypeSuffixes = ['PENDING', 'FULFILLED', 'REJECTED']; +interface Config { + promiseTypeSuffixes?: string[] +} + +const defaultTypeSuffixes: Config['promiseTypeSuffixes'] = ['PENDING', 'FULFILLED', 'REJECTED']; -export default function loadingBarMiddleware(config = {}) { +export const loadingBarMiddleware = (config: Config = {}): Middleware, RootState> => { const promiseTypeSuffixes = config.promiseTypeSuffixes || defaultTypeSuffixes; return ({ dispatch }) => next => (action) => { @@ -22,4 +28,4 @@ export default function loadingBarMiddleware(config = {}) { return next(action); }; -} +}; diff --git a/app/javascript/mastodon/middleware/sounds.js b/app/javascript/mastodon/store/middlewares/sounds.ts similarity index 54% rename from app/javascript/mastodon/middleware/sounds.js rename to app/javascript/mastodon/store/middlewares/sounds.ts index 7f2388983..c9d51f857 100644 --- a/app/javascript/mastodon/middleware/sounds.js +++ b/app/javascript/mastodon/store/middlewares/sounds.ts @@ -1,4 +1,12 @@ -const createAudio = sources => { +import { Middleware, AnyAction } from 'redux'; +import { RootState } from '..'; + +interface AudioSource { + src: string + type: string +} + +const createAudio = (sources: AudioSource[]) => { const audio = new Audio(); sources.forEach(({ type, src }) => { const source = document.createElement('source'); @@ -9,7 +17,7 @@ const createAudio = sources => { return audio; }; -const play = audio => { +const play = (audio: HTMLAudioElement) => { if (!audio.paused) { audio.pause(); if (typeof audio.fastSeek === 'function') { @@ -22,8 +30,8 @@ const play = audio => { audio.play(); }; -export default function soundsMiddleware() { - const soundCache = { +export const soundsMiddleware = (): Middleware, RootState> => { + const soundCache: {[key: string]: HTMLAudioElement} = { boop: createAudio([ { src: '/sounds/boop.ogg', @@ -36,11 +44,13 @@ export default function soundsMiddleware() { ]), }; - return () => next => action => { - if (action.meta && action.meta.sound && soundCache[action.meta.sound]) { - play(soundCache[action.meta.sound]); + return () => next => (action: AnyAction) => { + const sound = action?.meta?.sound; + + if (sound && soundCache[sound]) { + play(soundCache[sound]); } return next(action); }; -} +}; From 51b83ed19536b06ce3f57b260400ecec2d1dd187 Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Tue, 9 May 2023 13:02:12 -0400 Subject: [PATCH 25/44] Use Prettier for ESLint formatting TypeScript (#23631) --- .eslintrc.js | 29 +-- .prettierignore | 2 - .prettierrc.js | 3 +- app/javascript/mastodon/blurhash.ts | 4 +- app/javascript/mastodon/compare_id.ts | 2 +- .../mastodon/components/animated_number.tsx | 50 +++-- .../mastodon/components/avatar_overlay.tsx | 14 +- .../mastodon/components/blurhash.tsx | 2 +- app/javascript/mastodon/components/check.tsx | 12 +- app/javascript/mastodon/components/gifv.tsx | 26 ++- app/javascript/mastodon/components/icon.tsx | 15 +- .../mastodon/components/icon_button.tsx | 28 +-- .../mastodon/components/icon_with_badge.tsx | 15 +- app/javascript/mastodon/components/image.tsx | 14 +- .../components/not_signed_in_indicator.tsx | 5 +- .../mastodon/components/radio_button.tsx | 8 +- .../components/relative_timestamp.tsx | 189 ++++++++++++------ app/javascript/mastodon/permissions.ts | 6 +- .../mastodon/polyfills/base_polyfills.ts | 2 +- .../mastodon/reducers/missed_updates.ts | 22 +- app/javascript/mastodon/scroll.ts | 37 +++- app/javascript/mastodon/store/index.ts | 14 +- .../mastodon/store/middlewares/errors.ts | 4 +- .../mastodon/store/middlewares/loading_bar.ts | 43 ++-- .../mastodon/store/middlewares/sounds.ts | 13 +- app/javascript/mastodon/utils/filters.ts | 24 +-- app/javascript/mastodon/utils/hashtags.ts | 26 +-- app/javascript/mastodon/utils/numbers.ts | 13 +- app/javascript/mastodon/uuid.ts | 4 +- package.json | 2 + yarn.lock | 24 +++ 31 files changed, 407 insertions(+), 245 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 2bbe301f0..9e965791b 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -9,6 +9,7 @@ module.exports = { 'plugin:import/recommended', 'plugin:promise/recommended', 'plugin:jsdoc/recommended', + 'plugin:prettier/recommended', ], env: { @@ -62,20 +63,9 @@ module.exports = { }, rules: { - 'brace-style': 'warn', - 'comma-dangle': ['error', 'always-multiline'], - 'comma-spacing': [ - 'warn', - { - before: false, - after: true, - }, - ], - 'comma-style': ['warn', 'last'], 'consistent-return': 'error', 'dot-notation': 'error', eqeqeq: ['error', 'always', { 'null': 'ignore' }], - indent: ['warn', 2], 'jsx-quotes': ['error', 'prefer-single'], 'no-case-declarations': 'off', 'no-catch-shadow': 'error', @@ -95,7 +85,6 @@ module.exports = { { property: 'substr', message: 'Use .slice instead of .substr.' }, ], 'no-self-assign': 'off', - 'no-trailing-spaces': 'warn', 'no-unused-expressions': 'error', 'no-unused-vars': 'off', '@typescript-eslint/no-unused-vars': [ @@ -107,29 +96,14 @@ module.exports = { ignoreRestSiblings: true, }, ], - 'object-curly-spacing': ['error', 'always'], - 'padded-blocks': [ - 'error', - { - classes: 'always', - }, - ], - quotes: ['error', 'single'], - semi: 'error', 'valid-typeof': 'error', 'react/jsx-filename-extension': ['error', { extensions: ['.jsx', 'tsx'] }], 'react/jsx-boolean-value': 'error', - 'react/jsx-closing-bracket-location': ['error', 'line-aligned'], - 'react/jsx-curly-spacing': 'error', 'react/display-name': 'off', 'react/jsx-equals-spacing': 'error', - 'react/jsx-first-prop-new-line': ['error', 'multiline-multiprop'], - 'react/jsx-indent': ['error', 2], 'react/jsx-no-bind': 'error', 'react/jsx-no-target-blank': 'off', - 'react/jsx-tag-spacing': 'error', - 'react/jsx-wrap-multilines': 'error', 'react/no-deprecated': 'off', 'react/no-unknown-property': 'off', 'react/self-closing-comp': 'error', @@ -291,6 +265,7 @@ module.exports = { 'plugin:import/typescript', 'plugin:promise/recommended', 'plugin:jsdoc/recommended', + 'plugin:prettier/recommended', ], rules: { diff --git a/.prettierignore b/.prettierignore index 9bdf76911..2ea407533 100644 --- a/.prettierignore +++ b/.prettierignore @@ -70,8 +70,6 @@ app/javascript/styles/mastodon/reset.scss # Ignore Javascript pending https://github.com/mastodon/mastodon/pull/23631 *.js *.jsx -*.ts -*.tsx # Ignore HTML till cleaned and included in CI *.html diff --git a/.prettierrc.js b/.prettierrc.js index 1d70813d5..af39b253f 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -1,3 +1,4 @@ module.exports = { - singleQuote: true + singleQuote: true, + jsxSingleQuote: true } diff --git a/app/javascript/mastodon/blurhash.ts b/app/javascript/mastodon/blurhash.ts index cb1c3b2c8..dadf2b7f2 100644 --- a/app/javascript/mastodon/blurhash.ts +++ b/app/javascript/mastodon/blurhash.ts @@ -98,9 +98,9 @@ export const decode83 = (str: string) => { }; export const intToRGB = (int: number) => ({ - r: Math.max(0, (int >> 16)), + r: Math.max(0, int >> 16), g: Math.max(0, (int >> 8) & 255), - b: Math.max(0, (int & 255)), + b: Math.max(0, int & 255), }); export const getAverageFromBlurhash = (blurhash: string) => { diff --git a/app/javascript/mastodon/compare_id.ts b/app/javascript/mastodon/compare_id.ts index 3ddfb7635..30b057248 100644 --- a/app/javascript/mastodon/compare_id.ts +++ b/app/javascript/mastodon/compare_id.ts @@ -1,4 +1,4 @@ -export function compareId (id1: string, id2: string) { +export function compareId(id1: string, id2: string) { if (id1 === id2) { return 0; } diff --git a/app/javascript/mastodon/components/animated_number.tsx b/app/javascript/mastodon/components/animated_number.tsx index 20ffa1a4d..f6c77d35f 100644 --- a/app/javascript/mastodon/components/animated_number.tsx +++ b/app/javascript/mastodon/components/animated_number.tsx @@ -16,13 +16,10 @@ const obfuscatedCount = (count: number) => { type Props = { value: number; obfuscate?: boolean; -} -export const AnimatedNumber: React.FC = ({ - value, - obfuscate, -})=> { +}; +export const AnimatedNumber: React.FC = ({ value, obfuscate }) => { const [previousValue, setPreviousValue] = useState(value); - const [direction, setDirection] = useState<1|-1>(1); + const [direction, setDirection] = useState<1 | -1>(1); if (previousValue !== value) { setPreviousValue(value); @@ -30,24 +27,45 @@ export const AnimatedNumber: React.FC = ({ } const willEnter = useCallback(() => ({ y: -1 * direction }), [direction]); - const willLeave = useCallback(() => ({ y: spring(1 * direction, { damping: 35, stiffness: 400 }) }), [direction]); + const willLeave = useCallback( + () => ({ y: spring(1 * direction, { damping: 35, stiffness: 400 }) }), + [direction] + ); if (reduceMotion) { - return obfuscate ? <>{obfuscatedCount(value)} : ; + return obfuscate ? ( + <>{obfuscatedCount(value)} + ) : ( + + ); } - const styles = [{ - key: `${value}`, - data: value, - style: { y: spring(0, { damping: 35, stiffness: 400 }) }, - }]; + const styles = [ + { + key: `${value}`, + data: value, + style: { y: spring(0, { damping: 35, stiffness: 400 }) }, + }, + ]; return ( - - {items => ( + + {(items) => ( {items.map(({ key, data, style }) => ( - 0 ? 'absolute' : 'static', transform: `translateY(${style.y * 100}%)` }}>{obfuscate ? obfuscatedCount(data) : } + 0 ? 'absolute' : 'static', + transform: `translateY(${style.y * 100}%)`, + }} + > + {obfuscate ? obfuscatedCount(data) : } + ))} )} diff --git a/app/javascript/mastodon/components/avatar_overlay.tsx b/app/javascript/mastodon/components/avatar_overlay.tsx index e8dc88896..1dbd53323 100644 --- a/app/javascript/mastodon/components/avatar_overlay.tsx +++ b/app/javascript/mastodon/components/avatar_overlay.tsx @@ -18,13 +18,19 @@ export const AvatarOverlay: React.FC = ({ baseSize = 36, overlaySize = 24, }) => { - const { hovering, handleMouseEnter, handleMouseLeave } = useHovering(autoPlayGif); - const accountSrc = hovering ? account?.get('avatar') : account?.get('avatar_static'); - const friendSrc = hovering ? friend?.get('avatar') : friend?.get('avatar_static'); + const { hovering, handleMouseEnter, handleMouseLeave } = + useHovering(autoPlayGif); + const accountSrc = hovering + ? account?.get('avatar') + : account?.get('avatar_static'); + const friendSrc = hovering + ? friend?.get('avatar') + : friend?.get('avatar_static'); return (
diff --git a/app/javascript/mastodon/components/blurhash.tsx b/app/javascript/mastodon/components/blurhash.tsx index 181e2183d..700513676 100644 --- a/app/javascript/mastodon/components/blurhash.tsx +++ b/app/javascript/mastodon/components/blurhash.tsx @@ -8,7 +8,7 @@ type Props = { dummy?: boolean; // Whether dummy mode is enabled. If enabled, nothing is rendered and canvas left untouched children?: never; [key: string]: any; -} +}; const Blurhash: React.FC = ({ hash, width = 32, diff --git a/app/javascript/mastodon/components/check.tsx b/app/javascript/mastodon/components/check.tsx index 57b810a0e..73d65595e 100644 --- a/app/javascript/mastodon/components/check.tsx +++ b/app/javascript/mastodon/components/check.tsx @@ -1,7 +1,15 @@ import React from 'react'; export const Check: React.FC = () => ( - - + + ); diff --git a/app/javascript/mastodon/components/gifv.tsx b/app/javascript/mastodon/components/gifv.tsx index 5d9f235e1..72914ba74 100644 --- a/app/javascript/mastodon/components/gifv.tsx +++ b/app/javascript/mastodon/components/gifv.tsx @@ -8,7 +8,7 @@ type Props = { width: number; height: number; onClick?: () => void; -} +}; export const GIFV: React.FC = ({ src, @@ -17,19 +17,23 @@ export const GIFV: React.FC = ({ width, height, onClick, -})=> { +}) => { const [loading, setLoading] = useState(true); - const handleLoadedData: React.ReactEventHandler = useCallback(() => { - setLoading(false); - }, [setLoading]); + const handleLoadedData: React.ReactEventHandler = + useCallback(() => { + setLoading(false); + }, [setLoading]); - const handleClick: React.MouseEventHandler = useCallback((e) => { - if (onClick) { - e.stopPropagation(); - onClick(); - } - }, [onClick]); + const handleClick: React.MouseEventHandler = useCallback( + (e) => { + if (onClick) { + e.stopPropagation(); + onClick(); + } + }, + [onClick] + ); return (
diff --git a/app/javascript/mastodon/components/icon.tsx b/app/javascript/mastodon/components/icon.tsx index f74437b55..4eb948dc7 100644 --- a/app/javascript/mastodon/components/icon.tsx +++ b/app/javascript/mastodon/components/icon.tsx @@ -7,6 +7,15 @@ type Props = { fixedWidth?: boolean; children?: never; [key: string]: any; -} -export const Icon: React.FC = ({ id, className, fixedWidth, ...other }) => - ; +}; +export const Icon: React.FC = ({ + id, + className, + fixedWidth, + ...other +}) => ( + +); diff --git a/app/javascript/mastodon/components/icon_button.tsx b/app/javascript/mastodon/components/icon_button.tsx index f9db287bb..178641400 100644 --- a/app/javascript/mastodon/components/icon_button.tsx +++ b/app/javascript/mastodon/components/icon_button.tsx @@ -25,13 +25,12 @@ type Props = { obfuscateCount?: boolean; href?: string; ariaHidden: boolean; -} +}; type States = { - activate: boolean, - deactivate: boolean, -} + activate: boolean; + deactivate: boolean; +}; export class IconButton extends React.PureComponent { - static defaultProps = { size: 18, active: false, @@ -47,7 +46,7 @@ export class IconButton extends React.PureComponent { deactivate: false, }; - UNSAFE_componentWillReceiveProps (nextProps: Props) { + UNSAFE_componentWillReceiveProps(nextProps: Props) { if (!nextProps.animate) return; if (this.props.active && !nextProps.active) { @@ -57,7 +56,7 @@ export class IconButton extends React.PureComponent { } } - handleClick: React.MouseEventHandler = (e) => { + handleClick: React.MouseEventHandler = (e) => { e.preventDefault(); if (!this.props.disabled && this.props.onClick != null) { @@ -83,7 +82,7 @@ export class IconButton extends React.PureComponent { } }; - render () { + render() { const style = { fontSize: `${this.props.size}px`, width: `${this.props.size * 1.28571429}px`, @@ -109,10 +108,7 @@ export class IconButton extends React.PureComponent { ariaHidden, } = this.props; - const { - activate, - deactivate, - } = this.state; + const { activate, deactivate } = this.state; const classes = classNames(className, 'icon-button', { active, @@ -130,7 +126,12 @@ export class IconButton extends React.PureComponent { let contents = ( - ); @@ -162,5 +163,4 @@ export class IconButton extends React.PureComponent { ); } - } diff --git a/app/javascript/mastodon/components/icon_with_badge.tsx b/app/javascript/mastodon/components/icon_with_badge.tsx index a4af86ca9..bf86814c0 100644 --- a/app/javascript/mastodon/components/icon_with_badge.tsx +++ b/app/javascript/mastodon/components/icon_with_badge.tsx @@ -1,18 +1,25 @@ import React from 'react'; import { Icon } from './icon'; -const formatNumber = (num: number): number | string => num > 40 ? '40+' : num; +const formatNumber = (num: number): number | string => (num > 40 ? '40+' : num); type Props = { id: string; count: number; issueBadge: boolean; className: string; -} -export const IconWithBadge: React.FC = ({ id, count, issueBadge, className }) => ( +}; +export const IconWithBadge: React.FC = ({ + id, + count, + issueBadge, + className, +}) => ( - {count > 0 && {formatNumber(count)}} + {count > 0 && ( + {formatNumber(count)} + )} {issueBadge && } ); diff --git a/app/javascript/mastodon/components/image.tsx b/app/javascript/mastodon/components/image.tsx index b332d4115..490543424 100644 --- a/app/javascript/mastodon/components/image.tsx +++ b/app/javascript/mastodon/components/image.tsx @@ -7,9 +7,14 @@ type Props = { srcSet?: string; blurhash?: string; className?: string; -} +}; -export const Image: React.FC = ({ src, srcSet, blurhash, className }) => { +export const Image: React.FC = ({ + src, + srcSet, + blurhash, + className, +}) => { const [loaded, setLoaded] = useState(false); const handleLoad = useCallback(() => { @@ -17,7 +22,10 @@ export const Image: React.FC = ({ src, srcSet, blurhash, className }) => }, [setLoaded]); return ( -
+
{blurhash && }
diff --git a/app/javascript/mastodon/components/not_signed_in_indicator.tsx b/app/javascript/mastodon/components/not_signed_in_indicator.tsx index 3bfee6ae9..53945d6a7 100644 --- a/app/javascript/mastodon/components/not_signed_in_indicator.tsx +++ b/app/javascript/mastodon/components/not_signed_in_indicator.tsx @@ -4,7 +4,10 @@ import { FormattedMessage } from 'react-intl'; export const NotSignedInIndicator: React.FC = () => (
- +
); diff --git a/app/javascript/mastodon/components/radio_button.tsx b/app/javascript/mastodon/components/radio_button.tsx index 194b67afe..829f47174 100644 --- a/app/javascript/mastodon/components/radio_button.tsx +++ b/app/javascript/mastodon/components/radio_button.tsx @@ -9,7 +9,13 @@ type Props = { label: React.ReactNode; }; -export const RadioButton: React.FC = ({ name, value, checked, onChange, label }) => { +export const RadioButton: React.FC = ({ + name, + value, + checked, + onChange, + label, +}) => { return (
); - -export default NotSignedInIndicator; diff --git a/app/javascript/flavours/glitch/components/notification_purge_buttons.jsx b/app/javascript/flavours/glitch/components/notification_purge_buttons.jsx index 9d1139a05..532eb4358 100644 --- a/app/javascript/flavours/glitch/components/notification_purge_buttons.jsx +++ b/app/javascript/flavours/glitch/components/notification_purge_buttons.jsx @@ -10,7 +10,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import classNames from 'classnames'; const messages = defineMessages({ diff --git a/app/javascript/flavours/glitch/components/picture_in_picture_placeholder.jsx b/app/javascript/flavours/glitch/components/picture_in_picture_placeholder.jsx index 7e0255674..e8c9611a3 100644 --- a/app/javascript/flavours/glitch/components/picture_in_picture_placeholder.jsx +++ b/app/javascript/flavours/glitch/components/picture_in_picture_placeholder.jsx @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import { removePictureInPicture } from 'flavours/glitch/actions/picture_in_picture'; import { connect } from 'react-redux'; import { FormattedMessage } from 'react-intl'; diff --git a/app/javascript/flavours/glitch/components/poll.jsx b/app/javascript/flavours/glitch/components/poll.jsx index fb37612d9..df2391956 100644 --- a/app/javascript/flavours/glitch/components/poll.jsx +++ b/app/javascript/flavours/glitch/components/poll.jsx @@ -8,8 +8,8 @@ import Motion from 'flavours/glitch/features/ui/util/optional_motion'; import spring from 'react-motion/lib/spring'; import escapeTextContentForBrowser from 'escape-html'; import emojify from 'flavours/glitch/features/emoji/emoji'; -import RelativeTimestamp from './relative_timestamp'; -import Icon from 'flavours/glitch/components/icon'; +import { RelativeTimestamp } from './relative_timestamp'; +import { Icon } from 'flavours/glitch/components/icon'; const messages = defineMessages({ closed: { diff --git a/app/javascript/flavours/glitch/components/radio_button.tsx b/app/javascript/flavours/glitch/components/radio_button.tsx index 9ba098f78..194b67afe 100644 --- a/app/javascript/flavours/glitch/components/radio_button.tsx +++ b/app/javascript/flavours/glitch/components/radio_button.tsx @@ -26,5 +26,3 @@ export const RadioButton: React.FC = ({ name, value, checked, onChange, l ); }; - -export default RadioButton; diff --git a/app/javascript/flavours/glitch/components/relative_timestamp.tsx b/app/javascript/flavours/glitch/components/relative_timestamp.tsx index 89cad0665..4f1a76e54 100644 --- a/app/javascript/flavours/glitch/components/relative_timestamp.tsx +++ b/app/javascript/flavours/glitch/components/relative_timestamp.tsx @@ -200,4 +200,6 @@ class RelativeTimestamp extends React.Component { } -export default injectIntl(RelativeTimestamp); +const RelativeTimestampWithIntl = injectIntl(RelativeTimestamp); + +export { RelativeTimestampWithIntl as RelativeTimestamp }; diff --git a/app/javascript/flavours/glitch/components/server_banner.jsx b/app/javascript/flavours/glitch/components/server_banner.jsx index ba84064a8..8b9c50153 100644 --- a/app/javascript/flavours/glitch/components/server_banner.jsx +++ b/app/javascript/flavours/glitch/components/server_banner.jsx @@ -7,7 +7,7 @@ import ShortNumber from 'flavours/glitch/components/short_number'; import Skeleton from 'flavours/glitch/components/skeleton'; import Account from 'flavours/glitch/containers/account_container'; import { domain } from 'flavours/glitch/initial_state'; -import Image from 'flavours/glitch/components/image'; +import { Image } from 'flavours/glitch/components/image'; import { Link } from 'react-router-dom'; const messages = defineMessages({ diff --git a/app/javascript/flavours/glitch/components/status_action_bar.jsx b/app/javascript/flavours/glitch/components/status_action_bar.jsx index 091d0b24b..5b87cd439 100644 --- a/app/javascript/flavours/glitch/components/status_action_bar.jsx +++ b/app/javascript/flavours/glitch/components/status_action_bar.jsx @@ -1,12 +1,12 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import IconButton from './icon_button'; +import { IconButton } from './icon_button'; import DropdownMenuContainer from 'flavours/glitch/containers/dropdown_menu_container'; import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { me } from 'flavours/glitch/initial_state'; -import RelativeTimestamp from './relative_timestamp'; +import { RelativeTimestamp } from './relative_timestamp'; import { accountAdminLink, statusAdminLink } from 'flavours/glitch/utils/backend_links'; import classNames from 'classnames'; import { PERMISSION_MANAGE_USERS, PERMISSION_MANAGE_FEDERATION } from 'flavours/glitch/permissions'; diff --git a/app/javascript/flavours/glitch/components/status_content.jsx b/app/javascript/flavours/glitch/components/status_content.jsx index e66df588a..3fefef2c9 100644 --- a/app/javascript/flavours/glitch/components/status_content.jsx +++ b/app/javascript/flavours/glitch/components/status_content.jsx @@ -5,7 +5,7 @@ import { FormattedMessage, injectIntl } from 'react-intl'; import Permalink from './permalink'; import { connect } from 'react-redux'; import classnames from 'classnames'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import { autoPlayGif, languages as preloadedLanguages } from 'flavours/glitch/initial_state'; import { decode as decodeIDNA } from 'flavours/glitch/utils/idna'; diff --git a/app/javascript/flavours/glitch/components/status_header.jsx b/app/javascript/flavours/glitch/components/status_header.jsx index 94c403f16..8813d19b9 100644 --- a/app/javascript/flavours/glitch/components/status_header.jsx +++ b/app/javascript/flavours/glitch/components/status_header.jsx @@ -4,7 +4,7 @@ import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; // Mastodon imports. -import Avatar from './avatar'; +import { Avatar } from './avatar'; import AvatarOverlay from './avatar_overlay'; import DisplayName from './display_name'; diff --git a/app/javascript/flavours/glitch/components/status_icons.jsx b/app/javascript/flavours/glitch/components/status_icons.jsx index dd63cbd21..59912d439 100644 --- a/app/javascript/flavours/glitch/components/status_icons.jsx +++ b/app/javascript/flavours/glitch/components/status_icons.jsx @@ -5,9 +5,9 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import { defineMessages, injectIntl } from 'react-intl'; // Mastodon imports. -import IconButton from './icon_button'; +import { IconButton } from './icon_button'; import VisibilityIcon from './status_visibility_icon'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import { languages } from 'flavours/glitch/initial_state'; // Messages for use with internationalization stuff. diff --git a/app/javascript/flavours/glitch/components/status_prepend.jsx b/app/javascript/flavours/glitch/components/status_prepend.jsx index 8c4343b04..127636c51 100644 --- a/app/javascript/flavours/glitch/components/status_prepend.jsx +++ b/app/javascript/flavours/glitch/components/status_prepend.jsx @@ -3,7 +3,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { FormattedMessage } from 'react-intl'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import { me } from 'flavours/glitch/initial_state'; export default class StatusPrepend extends React.PureComponent { diff --git a/app/javascript/flavours/glitch/components/status_visibility_icon.jsx b/app/javascript/flavours/glitch/components/status_visibility_icon.jsx index fcedfbfd6..cee56a239 100644 --- a/app/javascript/flavours/glitch/components/status_visibility_icon.jsx +++ b/app/javascript/flavours/glitch/components/status_visibility_icon.jsx @@ -3,7 +3,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; const messages = defineMessages({ public: { id: 'privacy.public.short', defaultMessage: 'Public' }, diff --git a/app/javascript/flavours/glitch/features/about/index.jsx b/app/javascript/flavours/glitch/features/about/index.jsx index 67d5afbdd..e2556ec34 100644 --- a/app/javascript/flavours/glitch/features/about/index.jsx +++ b/app/javascript/flavours/glitch/features/about/index.jsx @@ -9,9 +9,9 @@ import { Helmet } from 'react-helmet'; import { fetchServer, fetchExtendedDescription, fetchDomainBlocks } from 'flavours/glitch/actions/server'; import Account from 'flavours/glitch/containers/account_container'; import Skeleton from 'flavours/glitch/components/skeleton'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import classNames from 'classnames'; -import Image from 'flavours/glitch/components/image'; +import { Image } from 'flavours/glitch/components/image'; const messages = defineMessages({ title: { id: 'column.about', defaultMessage: 'About' }, diff --git a/app/javascript/flavours/glitch/features/account/components/account_note.jsx b/app/javascript/flavours/glitch/features/account/components/account_note.jsx index 8ab00f6d4..a548db269 100644 --- a/app/javascript/flavours/glitch/features/account/components/account_note.jsx +++ b/app/javascript/flavours/glitch/features/account/components/account_note.jsx @@ -3,7 +3,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import Textarea from 'react-textarea-autosize'; const messages = defineMessages({ diff --git a/app/javascript/flavours/glitch/features/account/components/action_bar.jsx b/app/javascript/flavours/glitch/features/account/components/action_bar.jsx index 7026c9278..60ac06f91 100644 --- a/app/javascript/flavours/glitch/features/account/components/action_bar.jsx +++ b/app/javascript/flavours/glitch/features/account/components/action_bar.jsx @@ -2,7 +2,7 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { NavLink } from 'react-router-dom'; import { FormattedMessage, FormattedNumber } from 'react-intl'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; class ActionBar extends React.PureComponent { diff --git a/app/javascript/flavours/glitch/features/account/components/follow_request_note.jsx b/app/javascript/flavours/glitch/features/account/components/follow_request_note.jsx index 73c1737a6..5c2940b74 100644 --- a/app/javascript/flavours/glitch/features/account/components/follow_request_note.jsx +++ b/app/javascript/flavours/glitch/features/account/components/follow_request_note.jsx @@ -2,7 +2,7 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; export default class FollowRequestNote extends ImmutablePureComponent { diff --git a/app/javascript/flavours/glitch/features/account/components/header.jsx b/app/javascript/flavours/glitch/features/account/components/header.jsx index 9fcdb82e7..a447750c2 100644 --- a/app/javascript/flavours/glitch/features/account/components/header.jsx +++ b/app/javascript/flavours/glitch/features/account/components/header.jsx @@ -6,9 +6,9 @@ import ImmutablePureComponent from 'react-immutable-pure-component'; import { autoPlayGif, me, domain } from 'flavours/glitch/initial_state'; import { preferencesLink, profileLink, accountAdminLink } from 'flavours/glitch/utils/backend_links'; import classNames from 'classnames'; -import Icon from 'flavours/glitch/components/icon'; -import IconButton from 'flavours/glitch/components/icon_button'; -import Avatar from 'flavours/glitch/components/avatar'; +import { Icon } from 'flavours/glitch/components/icon'; +import { IconButton } from 'flavours/glitch/components/icon_button'; +import { Avatar } from 'flavours/glitch/components/avatar'; import Button from 'flavours/glitch/components/button'; import DropdownMenuContainer from 'flavours/glitch/containers/dropdown_menu_container'; import AccountNoteContainer from '../containers/account_note_container'; diff --git a/app/javascript/flavours/glitch/features/account_gallery/components/media_item.jsx b/app/javascript/flavours/glitch/features/account_gallery/components/media_item.jsx index 5fd84996b..0dfbec30c 100644 --- a/app/javascript/flavours/glitch/features/account_gallery/components/media_item.jsx +++ b/app/javascript/flavours/glitch/features/account_gallery/components/media_item.jsx @@ -1,6 +1,6 @@ -import Blurhash from 'flavours/glitch/components/blurhash'; +import { Blurhash } from 'flavours/glitch/components/blurhash'; import classNames from 'classnames'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import { autoPlayGif, displayMedia, useBlurhash } from 'flavours/glitch/initial_state'; import PropTypes from 'prop-types'; import React from 'react'; diff --git a/app/javascript/flavours/glitch/features/account_timeline/components/moved_note.jsx b/app/javascript/flavours/glitch/features/account_timeline/components/moved_note.jsx index 40bdc4034..8f9693f64 100644 --- a/app/javascript/flavours/glitch/features/account_timeline/components/moved_note.jsx +++ b/app/javascript/flavours/glitch/features/account_timeline/components/moved_note.jsx @@ -5,7 +5,7 @@ import { FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; import AvatarOverlay from '../../../components/avatar_overlay'; import DisplayName from '../../../components/display_name'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; export default class MovedNote extends ImmutablePureComponent { diff --git a/app/javascript/flavours/glitch/features/audio/index.jsx b/app/javascript/flavours/glitch/features/audio/index.jsx index c3e4ed5d4..8c13f6797 100644 --- a/app/javascript/flavours/glitch/features/audio/index.jsx +++ b/app/javascript/flavours/glitch/features/audio/index.jsx @@ -2,12 +2,12 @@ import React from 'react'; import PropTypes from 'prop-types'; import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; import { formatTime, getPointerPosition, fileNameFromURL } from 'flavours/glitch/features/video'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import classNames from 'classnames'; import { throttle, debounce } from 'lodash'; import Visualizer from './visualizer'; import { displayMedia, useBlurhash } from 'flavours/glitch/initial_state'; -import Blurhash from 'flavours/glitch/components/blurhash'; +import { Blurhash } from 'flavours/glitch/components/blurhash'; import { is } from 'immutable'; const messages = defineMessages({ diff --git a/app/javascript/flavours/glitch/features/compose/components/autosuggest_account.jsx b/app/javascript/flavours/glitch/features/compose/components/autosuggest_account.jsx index fb9bb5035..8b7969250 100644 --- a/app/javascript/flavours/glitch/features/compose/components/autosuggest_account.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/autosuggest_account.jsx @@ -1,5 +1,5 @@ import React from 'react'; -import Avatar from 'flavours/glitch/components/avatar'; +import { Avatar } from 'flavours/glitch/components/avatar'; import DisplayName from 'flavours/glitch/components/display_name'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/flavours/glitch/features/compose/components/dropdown.jsx b/app/javascript/flavours/glitch/features/compose/components/dropdown.jsx index d32f3572a..e791faa6b 100644 --- a/app/javascript/flavours/glitch/features/compose/components/dropdown.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/dropdown.jsx @@ -5,7 +5,7 @@ import React from 'react'; import Overlay from 'react-overlays/Overlay'; // Components. -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import DropdownMenu from './dropdown_menu'; // The component. diff --git a/app/javascript/flavours/glitch/features/compose/components/dropdown_menu.jsx b/app/javascript/flavours/glitch/features/compose/components/dropdown_menu.jsx index de50f566d..786f59307 100644 --- a/app/javascript/flavours/glitch/features/compose/components/dropdown_menu.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/dropdown_menu.jsx @@ -4,7 +4,7 @@ import React from 'react'; import classNames from 'classnames'; // Components. -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; // Utils. import { withPassive } from 'flavours/glitch/utils/dom_helpers'; diff --git a/app/javascript/flavours/glitch/features/compose/components/header.jsx b/app/javascript/flavours/glitch/features/compose/components/header.jsx index ad58f7ad4..0a94ca5fc 100644 --- a/app/javascript/flavours/glitch/features/compose/components/header.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/header.jsx @@ -7,7 +7,7 @@ import { Link } from 'react-router-dom'; import ImmutablePureComponent from 'react-immutable-pure-component'; // Components. -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; // Utils. import { conditionalRender } from 'flavours/glitch/utils/react_helpers'; diff --git a/app/javascript/flavours/glitch/features/compose/components/navigation_bar.jsx b/app/javascript/flavours/glitch/features/compose/components/navigation_bar.jsx index 1a68f1e12..371ad6d24 100644 --- a/app/javascript/flavours/glitch/features/compose/components/navigation_bar.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/navigation_bar.jsx @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ActionBar from './action_bar'; -import Avatar from 'flavours/glitch/components/avatar'; +import { Avatar } from 'flavours/glitch/components/avatar'; import Permalink from 'flavours/glitch/components/permalink'; import { FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/flavours/glitch/features/compose/components/options.jsx b/app/javascript/flavours/glitch/features/compose/components/options.jsx index cedb906ca..079065f8c 100644 --- a/app/javascript/flavours/glitch/features/compose/components/options.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/options.jsx @@ -7,7 +7,7 @@ import Toggle from 'react-toggle'; import { connect } from 'react-redux'; // Components. -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import TextIconButton from './text_icon_button'; import DropdownContainer from '../containers/dropdown_container'; import PrivacyDropdownContainer from '../containers/privacy_dropdown_container'; diff --git a/app/javascript/flavours/glitch/features/compose/components/poll_form.jsx b/app/javascript/flavours/glitch/features/compose/components/poll_form.jsx index 694ee3a04..8b0f01a9e 100644 --- a/app/javascript/flavours/glitch/features/compose/components/poll_form.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/poll_form.jsx @@ -3,8 +3,8 @@ import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import IconButton from 'flavours/glitch/components/icon_button'; -import Icon from 'flavours/glitch/components/icon'; +import { IconButton } from 'flavours/glitch/components/icon_button'; +import { Icon } from 'flavours/glitch/components/icon'; import AutosuggestInput from 'flavours/glitch/components/autosuggest_input'; import classNames from 'classnames'; import { pollLimits } from 'flavours/glitch/initial_state'; diff --git a/app/javascript/flavours/glitch/features/compose/components/publisher.jsx b/app/javascript/flavours/glitch/features/compose/components/publisher.jsx index a935e82e8..04c3926ab 100644 --- a/app/javascript/flavours/glitch/features/compose/components/publisher.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/publisher.jsx @@ -8,7 +8,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component'; // Components. import Button from 'flavours/glitch/components/button'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; // Utils. import { maxChars } from 'flavours/glitch/initial_state'; diff --git a/app/javascript/flavours/glitch/features/compose/components/reply_indicator.jsx b/app/javascript/flavours/glitch/features/compose/components/reply_indicator.jsx index 179d85ac3..4077a2964 100644 --- a/app/javascript/flavours/glitch/features/compose/components/reply_indicator.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/reply_indicator.jsx @@ -7,7 +7,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component'; // Components. import AccountContainer from 'flavours/glitch/containers/account_container'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import AttachmentList from 'flavours/glitch/components/attachment_list'; // Messages. diff --git a/app/javascript/flavours/glitch/features/compose/components/search.jsx b/app/javascript/flavours/glitch/features/compose/components/search.jsx index cd1bd0808..3d1aaf264 100644 --- a/app/javascript/flavours/glitch/features/compose/components/search.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/search.jsx @@ -9,7 +9,7 @@ import { import Overlay from 'react-overlays/Overlay'; // Components. -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; // Utils. import { focusRoot } from 'flavours/glitch/utils/dom_helpers'; diff --git a/app/javascript/flavours/glitch/features/compose/components/search_results.jsx b/app/javascript/flavours/glitch/features/compose/components/search_results.jsx index 6c1dee454..8533d4b23 100644 --- a/app/javascript/flavours/glitch/features/compose/components/search_results.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/search_results.jsx @@ -6,7 +6,7 @@ import AccountContainer from 'flavours/glitch/containers/account_container'; import StatusContainer from 'flavours/glitch/containers/status_container'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { ImmutableHashtag as Hashtag } from 'flavours/glitch/components/hashtag'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import { searchEnabled } from 'flavours/glitch/initial_state'; import LoadMore from 'flavours/glitch/components/load_more'; diff --git a/app/javascript/flavours/glitch/features/compose/components/textarea_icons.jsx b/app/javascript/flavours/glitch/features/compose/components/textarea_icons.jsx index 73281fc74..33e29797d 100644 --- a/app/javascript/flavours/glitch/features/compose/components/textarea_icons.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/textarea_icons.jsx @@ -6,7 +6,7 @@ import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; // Components. -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; // Messages. const messages = defineMessages({ diff --git a/app/javascript/flavours/glitch/features/compose/components/upload.jsx b/app/javascript/flavours/glitch/features/compose/components/upload.jsx index 2c74d91f3..4a2c5176b 100644 --- a/app/javascript/flavours/glitch/features/compose/components/upload.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/upload.jsx @@ -5,7 +5,7 @@ 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 Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; export default class Upload extends ImmutablePureComponent { diff --git a/app/javascript/flavours/glitch/features/compose/components/upload_progress.jsx b/app/javascript/flavours/glitch/features/compose/components/upload_progress.jsx index 39ac31053..61047762d 100644 --- a/app/javascript/flavours/glitch/features/compose/components/upload_progress.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/upload_progress.jsx @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import Motion from '../../ui/util/optional_motion'; import spring from 'react-motion/lib/spring'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import { FormattedMessage } from 'react-intl'; export default class UploadProgress extends React.PureComponent { diff --git a/app/javascript/flavours/glitch/features/direct_timeline/components/conversation.jsx b/app/javascript/flavours/glitch/features/direct_timeline/components/conversation.jsx index 06984f3ad..485f2d022 100644 --- a/app/javascript/flavours/glitch/features/direct_timeline/components/conversation.jsx +++ b/app/javascript/flavours/glitch/features/direct_timeline/components/conversation.jsx @@ -8,8 +8,8 @@ import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import DropdownMenuContainer from 'flavours/glitch/containers/dropdown_menu_container'; import AvatarComposite from 'flavours/glitch/components/avatar_composite'; import Permalink from 'flavours/glitch/components/permalink'; -import IconButton from 'flavours/glitch/components/icon_button'; -import RelativeTimestamp from 'flavours/glitch/components/relative_timestamp'; +import { IconButton } from 'flavours/glitch/components/icon_button'; +import { RelativeTimestamp } from 'flavours/glitch/components/relative_timestamp'; import { HotKeys } from 'react-hotkeys'; import { autoPlayGif } from 'flavours/glitch/initial_state'; import classNames from 'classnames'; diff --git a/app/javascript/flavours/glitch/features/directory/components/account_card.jsx b/app/javascript/flavours/glitch/features/directory/components/account_card.jsx index 663710b06..79543389c 100644 --- a/app/javascript/flavours/glitch/features/directory/components/account_card.jsx +++ b/app/javascript/flavours/glitch/features/directory/components/account_card.jsx @@ -4,10 +4,10 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { makeGetAccount } from 'flavours/glitch/selectors'; -import Avatar from 'flavours/glitch/components/avatar'; +import { Avatar } from 'flavours/glitch/components/avatar'; import DisplayName from 'flavours/glitch/components/display_name'; import Permalink from 'flavours/glitch/components/permalink'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import Button from 'flavours/glitch/components/button'; import { FormattedMessage, injectIntl, defineMessages } from 'react-intl'; import { autoPlayGif, me, unfollowModal } from 'flavours/glitch/initial_state'; diff --git a/app/javascript/flavours/glitch/features/directory/index.jsx b/app/javascript/flavours/glitch/features/directory/index.jsx index 4278a4e71..22280bbfd 100644 --- a/app/javascript/flavours/glitch/features/directory/index.jsx +++ b/app/javascript/flavours/glitch/features/directory/index.jsx @@ -9,7 +9,7 @@ import { addColumn, removeColumn, moveColumn, changeColumnParams } from 'flavour import { fetchDirectory, expandDirectory } from 'flavours/glitch/actions/directory'; import { List as ImmutableList } from 'immutable'; import AccountCard from './components/account_card'; -import RadioButton from 'flavours/glitch/components/radio_button'; +import { RadioButton } from 'flavours/glitch/components/radio_button'; import LoadMore from 'flavours/glitch/components/load_more'; import ScrollContainer from 'flavours/glitch/containers/scroll_container'; import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; diff --git a/app/javascript/flavours/glitch/features/explore/components/story.jsx b/app/javascript/flavours/glitch/features/explore/components/story.jsx index 8270d3ccb..d70914d41 100644 --- a/app/javascript/flavours/glitch/features/explore/components/story.jsx +++ b/app/javascript/flavours/glitch/features/explore/components/story.jsx @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import Blurhash from 'flavours/glitch/components/blurhash'; +import { Blurhash } from 'flavours/glitch/components/blurhash'; import { accountsCountRenderer } from 'flavours/glitch/components/hashtag'; import ShortNumber from 'flavours/glitch/components/short_number'; import Skeleton from 'flavours/glitch/components/skeleton'; diff --git a/app/javascript/flavours/glitch/features/favourites/index.jsx b/app/javascript/flavours/glitch/features/favourites/index.jsx index 21ce7fcc7..8755811d9 100644 --- a/app/javascript/flavours/glitch/features/favourites/index.jsx +++ b/app/javascript/flavours/glitch/features/favourites/index.jsx @@ -5,7 +5,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { connect } from 'react-redux'; import ColumnHeader from 'flavours/glitch/components/column_header'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import { fetchFavourites } from 'flavours/glitch/actions/interactions'; import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; import ScrollableList from 'flavours/glitch/components/scrollable_list'; diff --git a/app/javascript/flavours/glitch/features/filters/select_filter.jsx b/app/javascript/flavours/glitch/features/filters/select_filter.jsx index a33892f83..e7cdd4e19 100644 --- a/app/javascript/flavours/glitch/features/filters/select_filter.jsx +++ b/app/javascript/flavours/glitch/features/filters/select_filter.jsx @@ -4,7 +4,7 @@ import { connect } from 'react-redux'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { toServerSideType } from 'flavours/glitch/utils/filters'; import { loupeIcon, deleteIcon } from 'flavours/glitch/utils/icons'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import fuzzysort from 'fuzzysort'; const messages = defineMessages({ diff --git a/app/javascript/flavours/glitch/features/follow_recommendations/components/account.jsx b/app/javascript/flavours/glitch/features/follow_recommendations/components/account.jsx index e56af7364..e15bc1422 100644 --- a/app/javascript/flavours/glitch/features/follow_recommendations/components/account.jsx +++ b/app/javascript/flavours/glitch/features/follow_recommendations/components/account.jsx @@ -4,10 +4,10 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { connect } from 'react-redux'; import { makeGetAccount } from 'flavours/glitch/selectors'; -import Avatar from 'flavours/glitch/components/avatar'; +import { Avatar } from 'flavours/glitch/components/avatar'; import DisplayName from 'flavours/glitch/components/display_name'; import Permalink from 'flavours/glitch/components/permalink'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import { injectIntl, defineMessages } from 'react-intl'; import { followAccount, unfollowAccount } from 'flavours/glitch/actions/accounts'; diff --git a/app/javascript/flavours/glitch/features/follow_requests/components/account_authorize.jsx b/app/javascript/flavours/glitch/features/follow_requests/components/account_authorize.jsx index af8a534fa..b2dfc5dbb 100644 --- a/app/javascript/flavours/glitch/features/follow_requests/components/account_authorize.jsx +++ b/app/javascript/flavours/glitch/features/follow_requests/components/account_authorize.jsx @@ -2,9 +2,9 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import Permalink from 'flavours/glitch/components/permalink'; -import Avatar from 'flavours/glitch/components/avatar'; +import { Avatar } from 'flavours/glitch/components/avatar'; import DisplayName from 'flavours/glitch/components/display_name'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/flavours/glitch/features/getting_started/components/announcements.jsx b/app/javascript/flavours/glitch/features/getting_started/components/announcements.jsx index 29288076b..fd76f9773 100644 --- a/app/javascript/flavours/glitch/features/getting_started/components/announcements.jsx +++ b/app/javascript/flavours/glitch/features/getting_started/components/announcements.jsx @@ -3,15 +3,15 @@ import ImmutablePureComponent from 'react-immutable-pure-component'; import ReactSwipeableViews from 'react-swipeable-views'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import IconButton from 'flavours/glitch/components/icon_button'; -import Icon from 'flavours/glitch/components/icon'; +import { IconButton } from 'flavours/glitch/components/icon_button'; +import { Icon } from 'flavours/glitch/components/icon'; import { defineMessages, injectIntl, FormattedMessage, FormattedDate } from 'react-intl'; import { autoPlayGif, reduceMotion, disableSwiping, mascot } from 'flavours/glitch/initial_state'; import elephantUIPlane from 'mastodon/../images/elephant_ui_plane.svg'; import unicodeMapping from 'flavours/glitch/features/emoji/emoji_unicode_mapping_light'; import classNames from 'classnames'; import EmojiPickerDropdown from 'flavours/glitch/features/compose/containers/emoji_picker_dropdown_container'; -import AnimatedNumber from 'flavours/glitch/components/animated_number'; +import { AnimatedNumber } from 'flavours/glitch/components/animated_number'; import TransitionMotion from 'react-motion/lib/TransitionMotion'; import spring from 'react-motion/lib/spring'; import { assetHost } from 'flavours/glitch/utils/config'; diff --git a/app/javascript/flavours/glitch/features/hashtag_timeline/index.jsx b/app/javascript/flavours/glitch/features/hashtag_timeline/index.jsx index fe5afa240..cd3639d96 100644 --- a/app/javascript/flavours/glitch/features/hashtag_timeline/index.jsx +++ b/app/javascript/flavours/glitch/features/hashtag_timeline/index.jsx @@ -12,7 +12,7 @@ import { connectHashtagStream } from 'flavours/glitch/actions/streaming'; import { injectIntl, FormattedMessage, defineMessages } from 'react-intl'; import { isEqual } from 'lodash'; import { fetchHashtag, followHashtag, unfollowHashtag } from 'flavours/glitch/actions/tags'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import classNames from 'classnames'; import { Helmet } from 'react-helmet'; diff --git a/app/javascript/flavours/glitch/features/home_timeline/index.jsx b/app/javascript/flavours/glitch/features/home_timeline/index.jsx index 71619394b..a8dfa1d08 100644 --- a/app/javascript/flavours/glitch/features/home_timeline/index.jsx +++ b/app/javascript/flavours/glitch/features/home_timeline/index.jsx @@ -12,8 +12,8 @@ import { Link } from 'react-router-dom'; import { fetchAnnouncements, toggleShowAnnouncements } from 'flavours/glitch/actions/announcements'; import AnnouncementsContainer from 'flavours/glitch/features/getting_started/containers/announcements_container'; import classNames from 'classnames'; -import IconWithBadge from 'flavours/glitch/components/icon_with_badge'; -import NotSignedInIndicator from 'flavours/glitch/components/not_signed_in_indicator'; +import { IconWithBadge } from 'flavours/glitch/components/icon_with_badge'; +import { NotSignedInIndicator } from 'flavours/glitch/components/not_signed_in_indicator'; import { Helmet } from 'react-helmet'; const messages = defineMessages({ diff --git a/app/javascript/flavours/glitch/features/interaction_modal/index.jsx b/app/javascript/flavours/glitch/features/interaction_modal/index.jsx index 20e4959e6..380edee65 100644 --- a/app/javascript/flavours/glitch/features/interaction_modal/index.jsx +++ b/app/javascript/flavours/glitch/features/interaction_modal/index.jsx @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; import { registrationsOpen } from 'flavours/glitch/initial_state'; import { connect } from 'react-redux'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import classNames from 'classnames'; import { openModal, closeModal } from 'flavours/glitch/actions/modal'; diff --git a/app/javascript/flavours/glitch/features/list_adder/components/account.jsx b/app/javascript/flavours/glitch/features/list_adder/components/account.jsx index 034ed0edc..64522a3a8 100644 --- a/app/javascript/flavours/glitch/features/list_adder/components/account.jsx +++ b/app/javascript/flavours/glitch/features/list_adder/components/account.jsx @@ -3,7 +3,7 @@ import { connect } from 'react-redux'; import { makeGetAccount } from '../../../selectors'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import Avatar from '../../../components/avatar'; +import { Avatar } from '../../../components/avatar'; import DisplayName from '../../../components/display_name'; import { injectIntl } from 'react-intl'; diff --git a/app/javascript/flavours/glitch/features/list_adder/components/list.jsx b/app/javascript/flavours/glitch/features/list_adder/components/list.jsx index 1957bbe42..587a953b0 100644 --- a/app/javascript/flavours/glitch/features/list_adder/components/list.jsx +++ b/app/javascript/flavours/glitch/features/list_adder/components/list.jsx @@ -3,10 +3,10 @@ import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import IconButton from '../../../components/icon_button'; +import { IconButton } from '../../../components/icon_button'; import { defineMessages, injectIntl } from 'react-intl'; import { removeFromListAdder, addToListAdder } from '../../../actions/lists'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; const messages = defineMessages({ remove: { id: 'lists.account.remove', defaultMessage: 'Remove from list' }, diff --git a/app/javascript/flavours/glitch/features/list_editor/components/account.jsx b/app/javascript/flavours/glitch/features/list_editor/components/account.jsx index 71a8b7673..69fbaf504 100644 --- a/app/javascript/flavours/glitch/features/list_editor/components/account.jsx +++ b/app/javascript/flavours/glitch/features/list_editor/components/account.jsx @@ -2,9 +2,9 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import Avatar from 'flavours/glitch/components/avatar'; +import { Avatar } from 'flavours/glitch/components/avatar'; import DisplayName from 'flavours/glitch/components/display_name'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import { defineMessages } from 'react-intl'; const messages = defineMessages({ diff --git a/app/javascript/flavours/glitch/features/list_editor/components/edit_list_form.jsx b/app/javascript/flavours/glitch/features/list_editor/components/edit_list_form.jsx index b4886ef0e..3f4e9ded6 100644 --- a/app/javascript/flavours/glitch/features/list_editor/components/edit_list_form.jsx +++ b/app/javascript/flavours/glitch/features/list_editor/components/edit_list_form.jsx @@ -2,7 +2,7 @@ import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import { changeListEditorTitle, submitListEditor } from 'flavours/glitch/actions/lists'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import { defineMessages, injectIntl } from 'react-intl'; const messages = defineMessages({ diff --git a/app/javascript/flavours/glitch/features/list_editor/components/search.jsx b/app/javascript/flavours/glitch/features/list_editor/components/search.jsx index 3b66bc325..3a51a7b4e 100644 --- a/app/javascript/flavours/glitch/features/list_editor/components/search.jsx +++ b/app/javascript/flavours/glitch/features/list_editor/components/search.jsx @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { defineMessages } from 'react-intl'; import classNames from 'classnames'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; const messages = defineMessages({ search: { id: 'lists.search', defaultMessage: 'Search among people you follow' }, diff --git a/app/javascript/flavours/glitch/features/list_timeline/index.jsx b/app/javascript/flavours/glitch/features/list_timeline/index.jsx index ef1dbaae7..f7abe248d 100644 --- a/app/javascript/flavours/glitch/features/list_timeline/index.jsx +++ b/app/javascript/flavours/glitch/features/list_timeline/index.jsx @@ -11,9 +11,9 @@ import { connectListStream } from 'flavours/glitch/actions/streaming'; import { expandListTimeline } from 'flavours/glitch/actions/timelines'; import Column from 'flavours/glitch/components/column'; import ColumnHeader from 'flavours/glitch/components/column_header'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; -import RadioButton from 'flavours/glitch/components/radio_button'; +import { RadioButton } from 'flavours/glitch/components/radio_button'; import StatusListContainer from 'flavours/glitch/features/ui/containers/status_list_container'; import BundleColumnError from 'flavours/glitch/features/ui/components/bundle_column_error'; diff --git a/app/javascript/flavours/glitch/features/lists/components/new_list_form.jsx b/app/javascript/flavours/glitch/features/lists/components/new_list_form.jsx index be94ff559..aa743dea4 100644 --- a/app/javascript/flavours/glitch/features/lists/components/new_list_form.jsx +++ b/app/javascript/flavours/glitch/features/lists/components/new_list_form.jsx @@ -2,7 +2,7 @@ import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import { changeListEditorTitle, submitListEditor } from 'flavours/glitch/actions/lists'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import { defineMessages, injectIntl } from 'react-intl'; const messages = defineMessages({ diff --git a/app/javascript/flavours/glitch/features/local_settings/navigation/item/index.jsx b/app/javascript/flavours/glitch/features/local_settings/navigation/item/index.jsx index 9ac6d9b73..2de7c952c 100644 --- a/app/javascript/flavours/glitch/features/local_settings/navigation/item/index.jsx +++ b/app/javascript/flavours/glitch/features/local_settings/navigation/item/index.jsx @@ -3,7 +3,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * diff --git a/app/javascript/flavours/glitch/features/notifications/components/admin_report.jsx b/app/javascript/flavours/glitch/features/notifications/components/admin_report.jsx index 436f64b5d..3d5f67a17 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/admin_report.jsx +++ b/app/javascript/flavours/glitch/features/notifications/components/admin_report.jsx @@ -10,7 +10,7 @@ import classNames from 'classnames'; // Our imports. import Permalink from 'flavours/glitch/components/permalink'; import NotificationOverlayContainer from '../containers/overlay_container'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import Report from './report'; export default class AdminReport extends ImmutablePureComponent { diff --git a/app/javascript/flavours/glitch/features/notifications/components/admin_signup.jsx b/app/javascript/flavours/glitch/features/notifications/components/admin_signup.jsx index d982108e9..7c872e182 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/admin_signup.jsx +++ b/app/javascript/flavours/glitch/features/notifications/components/admin_signup.jsx @@ -11,7 +11,7 @@ import classNames from 'classnames'; import Permalink from 'flavours/glitch/components/permalink'; import AccountContainer from 'flavours/glitch/containers/account_container'; import NotificationOverlayContainer from '../containers/overlay_container'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; export default class NotificationFollow extends ImmutablePureComponent { diff --git a/app/javascript/flavours/glitch/features/notifications/components/clear_column_button.jsx b/app/javascript/flavours/glitch/features/notifications/components/clear_column_button.jsx index cd150314b..0602b4cf0 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/clear_column_button.jsx +++ b/app/javascript/flavours/glitch/features/notifications/components/clear_column_button.jsx @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; export default class ClearColumnButton extends React.Component { diff --git a/app/javascript/flavours/glitch/features/notifications/components/filter_bar.jsx b/app/javascript/flavours/glitch/features/notifications/components/filter_bar.jsx index 7f36fb813..cc83fa5cf 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/filter_bar.jsx +++ b/app/javascript/flavours/glitch/features/notifications/components/filter_bar.jsx @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; const tooltips = defineMessages({ mentions: { id: 'notifications.filter.mentions', defaultMessage: 'Mentions' }, diff --git a/app/javascript/flavours/glitch/features/notifications/components/follow.jsx b/app/javascript/flavours/glitch/features/notifications/components/follow.jsx index e9ef70911..88c90f3ce 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/follow.jsx +++ b/app/javascript/flavours/glitch/features/notifications/components/follow.jsx @@ -11,7 +11,7 @@ import classNames from 'classnames'; import Permalink from 'flavours/glitch/components/permalink'; import AccountContainer from 'flavours/glitch/containers/account_container'; import NotificationOverlayContainer from '../containers/overlay_container'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; export default class NotificationFollow extends ImmutablePureComponent { diff --git a/app/javascript/flavours/glitch/features/notifications/components/follow_request.jsx b/app/javascript/flavours/glitch/features/notifications/components/follow_request.jsx index 2b985bc08..d7c229404 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/follow_request.jsx +++ b/app/javascript/flavours/glitch/features/notifications/components/follow_request.jsx @@ -1,15 +1,15 @@ import React, { Fragment } from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import Avatar from 'flavours/glitch/components/avatar'; +import { Avatar } from 'flavours/glitch/components/avatar'; import DisplayName from 'flavours/glitch/components/display_name'; import Permalink from 'flavours/glitch/components/permalink'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; import NotificationOverlayContainer from '../containers/overlay_container'; import { HotKeys } from 'react-hotkeys'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import classNames from 'classnames'; const messages = defineMessages({ diff --git a/app/javascript/flavours/glitch/features/notifications/components/notifications_permission_banner.jsx b/app/javascript/flavours/glitch/features/notifications/components/notifications_permission_banner.jsx index 5a12191a5..8868cc0cb 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/notifications_permission_banner.jsx +++ b/app/javascript/flavours/glitch/features/notifications/components/notifications_permission_banner.jsx @@ -1,7 +1,7 @@ import React from 'react'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import Button from 'flavours/glitch/components/button'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import { requestBrowserPermission } from 'flavours/glitch/actions/notifications'; import { changeSetting } from 'flavours/glitch/actions/settings'; import { connect } from 'react-redux'; diff --git a/app/javascript/flavours/glitch/features/notifications/components/overlay.jsx b/app/javascript/flavours/glitch/features/notifications/components/overlay.jsx index 554a7a668..00e625738 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/overlay.jsx +++ b/app/javascript/flavours/glitch/features/notifications/components/overlay.jsx @@ -9,7 +9,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { defineMessages, injectIntl } from 'react-intl'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; const messages = defineMessages({ markForDeletion: { id: 'notification.markForDeletion', defaultMessage: 'Mark for deletion' }, diff --git a/app/javascript/flavours/glitch/features/notifications/components/report.jsx b/app/javascript/flavours/glitch/features/notifications/components/report.jsx index 5cff01dac..b2e795b2d 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/report.jsx +++ b/app/javascript/flavours/glitch/features/notifications/components/report.jsx @@ -4,7 +4,7 @@ import PropTypes from 'prop-types'; import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; import AvatarOverlay from 'flavours/glitch/components/avatar_overlay'; -import RelativeTimestamp from 'flavours/glitch/components/relative_timestamp'; +import { RelativeTimestamp } from 'flavours/glitch/components/relative_timestamp'; const messages = defineMessages({ openReport: { id: 'report_notification.open', defaultMessage: 'Open report' }, diff --git a/app/javascript/flavours/glitch/features/notifications/index.jsx b/app/javascript/flavours/glitch/features/notifications/index.jsx index b9c9d8203..c1042c136 100644 --- a/app/javascript/flavours/glitch/features/notifications/index.jsx +++ b/app/javascript/flavours/glitch/features/notifications/index.jsx @@ -25,10 +25,10 @@ import { List as ImmutableList } from 'immutable'; import { debounce } from 'lodash'; import ScrollableList from 'flavours/glitch/components/scrollable_list'; import LoadGap from 'flavours/glitch/components/load_gap'; -import Icon from 'flavours/glitch/components/icon'; -import compareId from 'flavours/glitch/compare_id'; +import { Icon } from 'flavours/glitch/components/icon'; +import { compareId } from 'flavours/glitch/compare_id'; import NotificationsPermissionBanner from './components/notifications_permission_banner'; -import NotSignedInIndicator from 'flavours/glitch/components/not_signed_in_indicator'; +import { NotSignedInIndicator } from 'flavours/glitch/components/not_signed_in_indicator'; import { Helmet } from 'react-helmet'; import NotificationPurgeButtonsContainer from 'flavours/glitch/containers/notification_purge_buttons_container'; diff --git a/app/javascript/flavours/glitch/features/picture_in_picture/components/footer.jsx b/app/javascript/flavours/glitch/features/picture_in_picture/components/footer.jsx index 51fe023d3..01a823f17 100644 --- a/app/javascript/flavours/glitch/features/picture_in_picture/components/footer.jsx +++ b/app/javascript/flavours/glitch/features/picture_in_picture/components/footer.jsx @@ -3,7 +3,7 @@ import { connect } from 'react-redux'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import classNames from 'classnames'; import { me, boostModal } from 'flavours/glitch/initial_state'; import { defineMessages, injectIntl } from 'react-intl'; diff --git a/app/javascript/flavours/glitch/features/picture_in_picture/components/header.jsx b/app/javascript/flavours/glitch/features/picture_in_picture/components/header.jsx index b9b90f1d8..b9c72c276 100644 --- a/app/javascript/flavours/glitch/features/picture_in_picture/components/header.jsx +++ b/app/javascript/flavours/glitch/features/picture_in_picture/components/header.jsx @@ -3,9 +3,9 @@ import { connect } from 'react-redux'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import { Link } from 'react-router-dom'; -import Avatar from 'flavours/glitch/components/avatar'; +import { Avatar } from 'flavours/glitch/components/avatar'; import DisplayName from 'flavours/glitch/components/display_name'; import { defineMessages, injectIntl } from 'react-intl'; diff --git a/app/javascript/flavours/glitch/features/reblogs/index.jsx b/app/javascript/flavours/glitch/features/reblogs/index.jsx index 34fe24d3f..fe74f1fbc 100644 --- a/app/javascript/flavours/glitch/features/reblogs/index.jsx +++ b/app/javascript/flavours/glitch/features/reblogs/index.jsx @@ -6,7 +6,7 @@ import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; import { fetchReblogs } from 'flavours/glitch/actions/interactions'; import AccountContainer from 'flavours/glitch/containers/account_container'; import Column from 'flavours/glitch/features/ui/components/column'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import ColumnHeader from 'flavours/glitch/components/column_header'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/flavours/glitch/features/report/components/status_check_box.jsx b/app/javascript/flavours/glitch/features/report/components/status_check_box.jsx index 2231fc0ce..6b74aafee 100644 --- a/app/javascript/flavours/glitch/features/report/components/status_check_box.jsx +++ b/app/javascript/flavours/glitch/features/report/components/status_check_box.jsx @@ -2,9 +2,9 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import StatusContent from 'flavours/glitch/components/status_content'; -import Avatar from 'flavours/glitch/components/avatar'; +import { Avatar } from 'flavours/glitch/components/avatar'; import DisplayName from 'flavours/glitch/components/display_name'; -import RelativeTimestamp from 'flavours/glitch/components/relative_timestamp'; +import { RelativeTimestamp } from 'flavours/glitch/components/relative_timestamp'; import Option from './option'; import MediaAttachments from 'flavours/glitch/components/media_attachments'; import VisibilityIcon from 'flavours/glitch/components/status_visibility_icon'; diff --git a/app/javascript/flavours/glitch/features/status/components/action_bar.jsx b/app/javascript/flavours/glitch/features/status/components/action_bar.jsx index d5ab730d6..b1998a8fc 100644 --- a/app/javascript/flavours/glitch/features/status/components/action_bar.jsx +++ b/app/javascript/flavours/glitch/features/status/components/action_bar.jsx @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import ImmutablePropTypes from 'react-immutable-proptypes'; import DropdownMenuContainer from 'flavours/glitch/containers/dropdown_menu_container'; import { defineMessages, injectIntl } from 'react-intl'; diff --git a/app/javascript/flavours/glitch/features/status/components/card.jsx b/app/javascript/flavours/glitch/features/status/components/card.jsx index af3fe4bf0..9b84da06e 100644 --- a/app/javascript/flavours/glitch/features/status/components/card.jsx +++ b/app/javascript/flavours/glitch/features/status/components/card.jsx @@ -5,9 +5,9 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import { FormattedMessage } from 'react-intl'; import classnames from 'classnames'; import { decode as decodeIDNA } from 'flavours/glitch/utils/idna'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import { useBlurhash } from 'flavours/glitch/initial_state'; -import Blurhash from 'flavours/glitch/components/blurhash'; +import { Blurhash } from 'flavours/glitch/components/blurhash'; const getHostname = url => { const parser = document.createElement('a'); diff --git a/app/javascript/flavours/glitch/features/status/components/detailed_status.jsx b/app/javascript/flavours/glitch/features/status/components/detailed_status.jsx index 3f5b11944..26f40c3e0 100644 --- a/app/javascript/flavours/glitch/features/status/components/detailed_status.jsx +++ b/app/javascript/flavours/glitch/features/status/components/detailed_status.jsx @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import Avatar from 'flavours/glitch/components/avatar'; +import { Avatar } from 'flavours/glitch/components/avatar'; import DisplayName from 'flavours/glitch/components/display_name'; import StatusContent from 'flavours/glitch/components/status_content'; import MediaGallery from 'flavours/glitch/components/media_gallery'; @@ -16,8 +16,8 @@ import VisibilityIcon from 'flavours/glitch/components/status_visibility_icon'; import scheduleIdleTask from '../../ui/util/schedule_idle_task'; import classNames from 'classnames'; import PollContainer from 'flavours/glitch/containers/poll_container'; -import Icon from 'flavours/glitch/components/icon'; -import AnimatedNumber from 'flavours/glitch/components/animated_number'; +import { Icon } from 'flavours/glitch/components/icon'; +import { AnimatedNumber } from 'flavours/glitch/components/animated_number'; import PictureInPicturePlaceholder from 'flavours/glitch/components/picture_in_picture_placeholder'; import EditedTimestamp from 'flavours/glitch/components/edited_timestamp'; diff --git a/app/javascript/flavours/glitch/features/status/index.jsx b/app/javascript/flavours/glitch/features/status/index.jsx index 54e6691be..46e49177e 100644 --- a/app/javascript/flavours/glitch/features/status/index.jsx +++ b/app/javascript/flavours/glitch/features/status/index.jsx @@ -52,7 +52,7 @@ import { boostModal, favouriteModal, deleteModal } from 'flavours/glitch/initial import { attachFullscreenListener, detachFullscreenListener, isFullscreen } from '../ui/util/fullscreen'; import { autoUnfoldCW } from 'flavours/glitch/utils/content_warning'; import { textForScreenReader, defaultMediaVisibility } from 'flavours/glitch/components/status'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import { Helmet } from 'react-helmet'; import BundleColumnError from 'flavours/glitch/features/ui/components/bundle_column_error'; diff --git a/app/javascript/flavours/glitch/features/subscribed_languages_modal/index.jsx b/app/javascript/flavours/glitch/features/subscribed_languages_modal/index.jsx index 85144a191..5fa0053b2 100644 --- a/app/javascript/flavours/glitch/features/subscribed_languages_modal/index.jsx +++ b/app/javascript/flavours/glitch/features/subscribed_languages_modal/index.jsx @@ -8,7 +8,7 @@ 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 { IconButton } from 'flavours/glitch/components/icon_button'; import Button from 'flavours/glitch/components/button'; import { followAccount } from 'flavours/glitch/actions/accounts'; diff --git a/app/javascript/flavours/glitch/features/ui/components/actions_modal.jsx b/app/javascript/flavours/glitch/features/ui/components/actions_modal.jsx index 9a9b1a3f1..6a98e8b53 100644 --- a/app/javascript/flavours/glitch/features/ui/components/actions_modal.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/actions_modal.jsx @@ -3,11 +3,11 @@ import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; import StatusContent from 'flavours/glitch/components/status_content'; -import Avatar from 'flavours/glitch/components/avatar'; -import RelativeTimestamp from 'flavours/glitch/components/relative_timestamp'; +import { Avatar } from 'flavours/glitch/components/avatar'; +import { RelativeTimestamp } from 'flavours/glitch/components/relative_timestamp'; import DisplayName from 'flavours/glitch/components/display_name'; import classNames from 'classnames'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; export default class ActionsModal extends ImmutablePureComponent { diff --git a/app/javascript/flavours/glitch/features/ui/components/boost_modal.jsx b/app/javascript/flavours/glitch/features/ui/components/boost_modal.jsx index d9523a26e..939e9765e 100644 --- a/app/javascript/flavours/glitch/features/ui/components/boost_modal.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/boost_modal.jsx @@ -5,11 +5,11 @@ import PropTypes from 'prop-types'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import Button from 'flavours/glitch/components/button'; import StatusContent from 'flavours/glitch/components/status_content'; -import Avatar from 'flavours/glitch/components/avatar'; -import RelativeTimestamp from 'flavours/glitch/components/relative_timestamp'; +import { Avatar } from 'flavours/glitch/components/avatar'; +import { RelativeTimestamp } from 'flavours/glitch/components/relative_timestamp'; import DisplayName from 'flavours/glitch/components/display_name'; import AttachmentList from 'flavours/glitch/components/attachment_list'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import ImmutablePureComponent from 'react-immutable-pure-component'; import PrivacyDropdown from 'flavours/glitch/features/compose/components/privacy_dropdown'; import classNames from 'classnames'; diff --git a/app/javascript/flavours/glitch/features/ui/components/bundle_modal_error.jsx b/app/javascript/flavours/glitch/features/ui/components/bundle_modal_error.jsx index b79105450..53a51967a 100644 --- a/app/javascript/flavours/glitch/features/ui/components/bundle_modal_error.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/bundle_modal_error.jsx @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl } from 'react-intl'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; const messages = defineMessages({ error: { id: 'bundle_modal_error.message', defaultMessage: 'Something went wrong while loading this component.' }, diff --git a/app/javascript/flavours/glitch/features/ui/components/column_header.jsx b/app/javascript/flavours/glitch/features/ui/components/column_header.jsx index 151476f8b..2b5d7abe2 100644 --- a/app/javascript/flavours/glitch/features/ui/components/column_header.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/column_header.jsx @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; export default class ColumnHeader extends React.PureComponent { diff --git a/app/javascript/flavours/glitch/features/ui/components/column_link.jsx b/app/javascript/flavours/glitch/features/ui/components/column_link.jsx index 10b46f93d..4b02c9bef 100644 --- a/app/javascript/flavours/glitch/features/ui/components/column_link.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/column_link.jsx @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { NavLink } from 'react-router-dom'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import classNames from 'classnames'; const ColumnLink = ({ icon, text, to, onClick, href, method, badge, transparent, ...other }) => { diff --git a/app/javascript/flavours/glitch/features/ui/components/compare_history_modal.jsx b/app/javascript/flavours/glitch/features/ui/components/compare_history_modal.jsx index cc3a16d17..e0083e3f1 100644 --- a/app/javascript/flavours/glitch/features/ui/components/compare_history_modal.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/compare_history_modal.jsx @@ -7,8 +7,8 @@ import { closeModal } from 'flavours/glitch/actions/modal'; import emojify from 'flavours/glitch/features/emoji/emoji'; import escapeTextContentForBrowser from 'escape-html'; import InlineAccount from 'flavours/glitch/components/inline_account'; -import IconButton from 'flavours/glitch/components/icon_button'; -import RelativeTimestamp from 'flavours/glitch/components/relative_timestamp'; +import { IconButton } from 'flavours/glitch/components/icon_button'; +import { RelativeTimestamp } from 'flavours/glitch/components/relative_timestamp'; import MediaAttachments from 'flavours/glitch/components/media_attachments'; const mapStateToProps = (state, { statusId }) => ({ diff --git a/app/javascript/flavours/glitch/features/ui/components/deprecated_settings_modal.jsx b/app/javascript/flavours/glitch/features/ui/components/deprecated_settings_modal.jsx index 3face1146..d90cb920c 100644 --- a/app/javascript/flavours/glitch/features/ui/components/deprecated_settings_modal.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/deprecated_settings_modal.jsx @@ -4,7 +4,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { preferenceLink } from 'flavours/glitch/utils/backend_links'; import Button from 'flavours/glitch/components/button'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import illustration from 'flavours/glitch/images/logo_warn_glitch.svg'; const messages = defineMessages({ diff --git a/app/javascript/flavours/glitch/features/ui/components/doodle_modal.jsx b/app/javascript/flavours/glitch/features/ui/components/doodle_modal.jsx index 0b66ad09d..7891cfa94 100644 --- a/app/javascript/flavours/glitch/features/ui/components/doodle_modal.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/doodle_modal.jsx @@ -6,7 +6,7 @@ import Atrament from 'atrament'; // the doodling library import { connect } from 'react-redux'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { doodleSet, uploadCompose } from 'flavours/glitch/actions/compose'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import { debounce, mapValues } from 'lodash'; import classNames from 'classnames'; diff --git a/app/javascript/flavours/glitch/features/ui/components/embed_modal.jsx b/app/javascript/flavours/glitch/features/ui/components/embed_modal.jsx index 4f1173fd5..1c83517a1 100644 --- a/app/javascript/flavours/glitch/features/ui/components/embed_modal.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/embed_modal.jsx @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; import api from 'flavours/glitch/api'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; const messages = defineMessages({ close: { id: 'lightbox.close', defaultMessage: 'Close' }, diff --git a/app/javascript/flavours/glitch/features/ui/components/favourite_modal.jsx b/app/javascript/flavours/glitch/features/ui/components/favourite_modal.jsx index fa6f11792..03e93cd27 100644 --- a/app/javascript/flavours/glitch/features/ui/components/favourite_modal.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/favourite_modal.jsx @@ -4,11 +4,11 @@ import PropTypes from 'prop-types'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import Button from 'flavours/glitch/components/button'; import StatusContent from 'flavours/glitch/components/status_content'; -import Avatar from 'flavours/glitch/components/avatar'; -import RelativeTimestamp from 'flavours/glitch/components/relative_timestamp'; +import { Avatar } from 'flavours/glitch/components/avatar'; +import { RelativeTimestamp } from 'flavours/glitch/components/relative_timestamp'; import DisplayName from 'flavours/glitch/components/display_name'; import AttachmentList from 'flavours/glitch/components/attachment_list'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import ImmutablePureComponent from 'react-immutable-pure-component'; import classNames from 'classnames'; import VisibilityIcon from 'flavours/glitch/components/status_visibility_icon'; diff --git a/app/javascript/flavours/glitch/features/ui/components/filter_modal.jsx b/app/javascript/flavours/glitch/features/ui/components/filter_modal.jsx index 440a6ac4b..27d2bada2 100644 --- a/app/javascript/flavours/glitch/features/ui/components/filter_modal.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/filter_modal.jsx @@ -5,7 +5,7 @@ import { fetchFilters, createFilter, createFilterStatus } from 'flavours/glitch/ import PropTypes from 'prop-types'; import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import SelectFilter from 'flavours/glitch/features/filters/select_filter'; import AddedToFilter from 'flavours/glitch/features/filters/added_to_filter'; diff --git a/app/javascript/flavours/glitch/features/ui/components/focal_point_modal.jsx b/app/javascript/flavours/glitch/features/ui/components/focal_point_modal.jsx index 78aee8dfe..2b61bad70 100644 --- a/app/javascript/flavours/glitch/features/ui/components/focal_point_modal.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/focal_point_modal.jsx @@ -7,7 +7,7 @@ import classNames from 'classnames'; import { changeUploadCompose, uploadThumbnail, onChangeMediaDescription, onChangeMediaFocus } from 'flavours/glitch/actions/compose'; import Video, { getPointerPosition } from 'flavours/glitch/features/video'; import { FormattedMessage, defineMessages, injectIntl } from 'react-intl'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import Button from 'flavours/glitch/components/button'; import Audio from 'flavours/glitch/features/audio'; import Textarea from 'react-textarea-autosize'; @@ -15,7 +15,7 @@ import UploadProgress from 'flavours/glitch/features/compose/components/upload_p import CharacterCounter from 'flavours/glitch/features/compose/components/character_counter'; import { length } from 'stringz'; import { Tesseract as fetchTesseract } from 'flavours/glitch/features/ui/util/async-components'; -import GIFV from 'flavours/glitch/components/gifv'; +import { GIFV } from 'flavours/glitch/components/gifv'; import { me } from 'flavours/glitch/initial_state'; // eslint-disable-next-line import/no-extraneous-dependencies import tesseractCorePath from 'tesseract.js-core/tesseract-core.wasm.js'; diff --git a/app/javascript/flavours/glitch/features/ui/components/follow_requests_column_link.jsx b/app/javascript/flavours/glitch/features/ui/components/follow_requests_column_link.jsx index f3e3b78ed..1a5f4418c 100644 --- a/app/javascript/flavours/glitch/features/ui/components/follow_requests_column_link.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/follow_requests_column_link.jsx @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import { fetchFollowRequests } from 'flavours/glitch/actions/accounts'; import { connect } from 'react-redux'; import ColumnLink from 'flavours/glitch/features/ui/components/column_link'; -import IconWithBadge from 'flavours/glitch/components/icon_with_badge'; +import { IconWithBadge } from 'flavours/glitch/components/icon_with_badge'; import { List as ImmutableList } from 'immutable'; import { injectIntl, defineMessages } from 'react-intl'; diff --git a/app/javascript/flavours/glitch/features/ui/components/header.jsx b/app/javascript/flavours/glitch/features/ui/components/header.jsx index 42ed4d901..519f917ca 100644 --- a/app/javascript/flavours/glitch/features/ui/components/header.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/header.jsx @@ -3,7 +3,7 @@ import { WordmarkLogo, SymbolLogo } from 'flavours/glitch/components/logo'; import { Link, withRouter } from 'react-router-dom'; import { FormattedMessage } from 'react-intl'; import { registrationsOpen, me } from 'flavours/glitch/initial_state'; -import Avatar from 'flavours/glitch/components/avatar'; +import { Avatar } from 'flavours/glitch/components/avatar'; import Permalink from 'flavours/glitch/components/permalink'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; diff --git a/app/javascript/flavours/glitch/features/ui/components/image_modal.jsx b/app/javascript/flavours/glitch/features/ui/components/image_modal.jsx index 5198b8809..21d7ae8f3 100644 --- a/app/javascript/flavours/glitch/features/ui/components/image_modal.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/image_modal.jsx @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; import { defineMessages, injectIntl } from 'react-intl'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import ImageLoader from './image_loader'; const messages = defineMessages({ diff --git a/app/javascript/flavours/glitch/features/ui/components/media_modal.jsx b/app/javascript/flavours/glitch/features/ui/components/media_modal.jsx index 6ca96b743..1e51db009 100644 --- a/app/javascript/flavours/glitch/features/ui/components/media_modal.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/media_modal.jsx @@ -6,11 +6,11 @@ import Video from 'flavours/glitch/features/video'; import { connect } from 'react-redux'; import classNames from 'classnames'; import { defineMessages, injectIntl } from 'react-intl'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImageLoader from './image_loader'; -import Icon from 'flavours/glitch/components/icon'; -import GIFV from 'flavours/glitch/components/gifv'; +import { Icon } from 'flavours/glitch/components/icon'; +import { GIFV } from 'flavours/glitch/components/gifv'; import Footer from 'flavours/glitch/features/picture_in_picture/components/footer'; import { getAverageFromBlurhash } from 'flavours/glitch/blurhash'; import { disableSwiping } from 'flavours/glitch/initial_state'; diff --git a/app/javascript/flavours/glitch/features/ui/components/notifications_counter_icon.js b/app/javascript/flavours/glitch/features/ui/components/notifications_counter_icon.js index 6b52ef9b4..db54c1618 100644 --- a/app/javascript/flavours/glitch/features/ui/components/notifications_counter_icon.js +++ b/app/javascript/flavours/glitch/features/ui/components/notifications_counter_icon.js @@ -1,5 +1,5 @@ import { connect } from 'react-redux'; -import IconWithBadge from 'flavours/glitch/components/icon_with_badge'; +import { IconWithBadge } from 'flavours/glitch/components/icon_with_badge'; const mapStateToProps = state => ({ count: state.getIn(['local_settings', 'notifications', 'tab_badge']) ? state.getIn(['notifications', 'unread']) : 0, diff --git a/app/javascript/flavours/glitch/features/ui/components/report_modal.jsx b/app/javascript/flavours/glitch/features/ui/components/report_modal.jsx index 79b495877..b27e69230 100644 --- a/app/javascript/flavours/glitch/features/ui/components/report_modal.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/report_modal.jsx @@ -10,7 +10,7 @@ import { makeGetAccount } from 'flavours/glitch/selectors'; import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; import { OrderedSet } from 'immutable'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import Category from 'flavours/glitch/features/report/category'; import Statuses from 'flavours/glitch/features/report/statuses'; import Rules from 'flavours/glitch/features/report/rules'; diff --git a/app/javascript/flavours/glitch/features/ui/components/zoomable_image.jsx b/app/javascript/flavours/glitch/features/ui/components/zoomable_image.jsx index 47401cfe4..51defec51 100644 --- a/app/javascript/flavours/glitch/features/ui/components/zoomable_image.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/zoomable_image.jsx @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import { defineMessages, injectIntl } from 'react-intl'; const messages = defineMessages({ diff --git a/app/javascript/flavours/glitch/features/video/index.jsx b/app/javascript/flavours/glitch/features/video/index.jsx index 78d36edb7..fb791fa9f 100644 --- a/app/javascript/flavours/glitch/features/video/index.jsx +++ b/app/javascript/flavours/glitch/features/video/index.jsx @@ -6,8 +6,8 @@ import { throttle } from 'lodash'; import classNames from 'classnames'; import { isFullscreen, requestFullscreen, exitFullscreen } from '../ui/util/fullscreen'; import { displayMedia, useBlurhash } from 'flavours/glitch/initial_state'; -import Icon from 'flavours/glitch/components/icon'; -import Blurhash from 'flavours/glitch/components/blurhash'; +import { Icon } from 'flavours/glitch/components/icon'; +import { Blurhash } from 'flavours/glitch/components/blurhash'; const messages = defineMessages({ play: { id: 'video.play', defaultMessage: 'Play' }, diff --git a/app/javascript/flavours/glitch/reducers/compose.js b/app/javascript/flavours/glitch/reducers/compose.js index 6e3bdda63..d95d0c978 100644 --- a/app/javascript/flavours/glitch/reducers/compose.js +++ b/app/javascript/flavours/glitch/reducers/compose.js @@ -54,7 +54,7 @@ import { TIMELINE_DELETE } from 'flavours/glitch/actions/timelines'; import { STORE_HYDRATE } from 'flavours/glitch/actions/store'; import { REDRAFT } from 'flavours/glitch/actions/statuses'; import { Map as ImmutableMap, List as ImmutableList, OrderedSet as ImmutableOrderedSet, fromJS } from 'immutable'; -import uuid from '../uuid'; +import { uuid } from '../uuid'; import { privacyPreference } from 'flavours/glitch/utils/privacy_preference'; import { me, defaultContentType } from 'flavours/glitch/initial_state'; import { overwrite } from 'flavours/glitch/utils/js_helpers'; diff --git a/app/javascript/flavours/glitch/reducers/contexts.js b/app/javascript/flavours/glitch/reducers/contexts.js index aea77ae41..020a84dec 100644 --- a/app/javascript/flavours/glitch/reducers/contexts.js +++ b/app/javascript/flavours/glitch/reducers/contexts.js @@ -5,7 +5,7 @@ import { import { CONTEXT_FETCH_SUCCESS } from 'flavours/glitch/actions/statuses'; import { TIMELINE_DELETE, TIMELINE_UPDATE } from 'flavours/glitch/actions/timelines'; import { Map as ImmutableMap, List as ImmutableList } from 'immutable'; -import compareId from '../compare_id'; +import { compareId } from '../compare_id'; const initialState = ImmutableMap({ inReplyTos: ImmutableMap(), diff --git a/app/javascript/flavours/glitch/reducers/conversations.js b/app/javascript/flavours/glitch/reducers/conversations.js index 48b70cc33..149d21039 100644 --- a/app/javascript/flavours/glitch/reducers/conversations.js +++ b/app/javascript/flavours/glitch/reducers/conversations.js @@ -11,7 +11,7 @@ import { } from '../actions/conversations'; import { ACCOUNT_BLOCK_SUCCESS, ACCOUNT_MUTE_SUCCESS } from 'flavours/glitch/actions/accounts'; import { DOMAIN_BLOCK_SUCCESS } from 'flavours/glitch/actions/domain_blocks'; -import compareId from '../compare_id'; +import { compareId } from '../compare_id'; const initialState = ImmutableMap({ items: ImmutableList(), diff --git a/app/javascript/flavours/glitch/reducers/notifications.js b/app/javascript/flavours/glitch/reducers/notifications.js index d5b1568e9..ccd715a22 100644 --- a/app/javascript/flavours/glitch/reducers/notifications.js +++ b/app/javascript/flavours/glitch/reducers/notifications.js @@ -32,7 +32,7 @@ import { import { DOMAIN_BLOCK_SUCCESS } from 'flavours/glitch/actions/domain_blocks'; import { TIMELINE_DELETE, TIMELINE_DISCONNECT } from 'flavours/glitch/actions/timelines'; import { fromJS, Map as ImmutableMap, List as ImmutableList } from 'immutable'; -import compareId from '../compare_id'; +import { compareId } from '../compare_id'; const initialState = ImmutableMap({ pendingItems: ImmutableList(), diff --git a/app/javascript/flavours/glitch/reducers/settings.js b/app/javascript/flavours/glitch/reducers/settings.js index e69eee966..0e52762f2 100644 --- a/app/javascript/flavours/glitch/reducers/settings.js +++ b/app/javascript/flavours/glitch/reducers/settings.js @@ -6,7 +6,7 @@ import { EMOJI_USE } from 'flavours/glitch/actions/emojis'; import { LANGUAGE_USE } from 'flavours/glitch/actions/languages'; import { LIST_DELETE_SUCCESS, LIST_FETCH_FAIL } from '../actions/lists'; import { Map as ImmutableMap, fromJS } from 'immutable'; -import uuid from '../uuid'; +import { uuid } from '../uuid'; const initialState = ImmutableMap({ saved: true, diff --git a/app/javascript/flavours/glitch/reducers/timelines.js b/app/javascript/flavours/glitch/reducers/timelines.js index 96a6ca961..1c0b1187e 100644 --- a/app/javascript/flavours/glitch/reducers/timelines.js +++ b/app/javascript/flavours/glitch/reducers/timelines.js @@ -17,7 +17,7 @@ import { ACCOUNT_UNFOLLOW_SUCCESS, } from 'flavours/glitch/actions/accounts'; import { Map as ImmutableMap, List as ImmutableList, OrderedSet as ImmutableOrderedSet, fromJS } from 'immutable'; -import compareId from '../compare_id'; +import { compareId } from '../compare_id'; const initialState = ImmutableMap(); diff --git a/app/javascript/flavours/glitch/types/image.d.ts b/app/javascript/flavours/glitch/types/image.d.ts index 8bd6ab028..fae2ed701 100644 --- a/app/javascript/flavours/glitch/types/image.d.ts +++ b/app/javascript/flavours/glitch/types/image.d.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/no-default-export */ declare module '*.avif' { const path: string; export default path; diff --git a/app/javascript/flavours/glitch/uuid.ts b/app/javascript/flavours/glitch/uuid.ts index 655bcf78c..ac5414482 100644 --- a/app/javascript/flavours/glitch/uuid.ts +++ b/app/javascript/flavours/glitch/uuid.ts @@ -1,3 +1,3 @@ -export default function uuid(a?: string): string { +export function uuid(a?: string): string { return a ? ((a as any as number) ^ Math.random() * 16 >> (a as any as number) / 4).toString(16) : ('' + 1e7 + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, uuid); } From 0fff2b67de5d3b330f7805120d2038c3ffb640d2 Mon Sep 17 00:00:00 2001 From: Claire Date: Tue, 9 May 2023 23:03:23 +0200 Subject: [PATCH 38/44] Disable broken onboarding code --- app/javascript/flavours/glitch/features/ui/index.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/javascript/flavours/glitch/features/ui/index.jsx b/app/javascript/flavours/glitch/features/ui/index.jsx index cc7937e5e..a29070bc7 100644 --- a/app/javascript/flavours/glitch/features/ui/index.jsx +++ b/app/javascript/flavours/glitch/features/ui/index.jsx @@ -58,7 +58,7 @@ import { } from './util/async-components'; import { HotKeys } from 'react-hotkeys'; import initialState, { me, owner, singleUserMode, showTrends, trendsAsLanding } from '../../initial_state'; -import { closeOnboarding, INTRODUCTION_VERSION } from 'flavours/glitch/actions/onboarding'; +// TODO: import { closeOnboarding, INTRODUCTION_VERSION } from 'flavours/glitch/actions/onboarding'; import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; import Header from './components/header'; @@ -82,7 +82,7 @@ const mapStateToProps = state => ({ showFaviconBadge: state.getIn(['local_settings', 'notifications', 'favicon_badge']), hicolorPrivacyIcons: state.getIn(['local_settings', 'hicolor_privacy_icons']), moved: state.getIn(['accounts', me, 'moved']) && state.getIn(['accounts', state.getIn(['accounts', me, 'moved'])]), - firstLaunch: state.getIn(['settings', 'introductionVersion'], 0) < INTRODUCTION_VERSION, + firstLaunch: false, // TODO: state.getIn(['settings', 'introductionVersion'], 0) < INTRODUCTION_VERSION, username: state.getIn(['accounts', me, 'username']), }); @@ -405,7 +405,7 @@ class UI extends React.Component { // On first launch, redirect to the follow recommendations page if (signedIn && this.props.firstLaunch) { this.context.router.history.replace('/start'); - this.props.dispatch(closeOnboarding()); + // TODO: this.props.dispatch(closeOnboarding()); } if (signedIn) { From e22a88b512be8cfacc42447d855698dad73bef5f Mon Sep 17 00:00:00 2001 From: fusagiko / takayamaki <24884114+takayamaki@users.noreply.github.com> Date: Tue, 9 May 2023 19:09:32 +0900 Subject: [PATCH 39/44] [Glitch] Add more detailed type annotation for Account Port 6579e3af7d6eb2774eae3d16bb1c9b7772fb58ec to glitch-soc Signed-off-by: Claire --- .../flavours/glitch/types/resources.ts | 52 +++++++++++++++++-- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/app/javascript/flavours/glitch/types/resources.ts b/app/javascript/flavours/glitch/types/resources.ts index 28fad2719..090650415 100644 --- a/app/javascript/flavours/glitch/types/resources.ts +++ b/app/javascript/flavours/glitch/types/resources.ts @@ -1,10 +1,54 @@ import type { Record } from 'immutable'; -type AccountValues = { - id: number; +type CustomEmoji = Record<{ + shortcode: string; + static_url: string; + url: string; +}>; + +type AccountField = Record<{ + name: string; + value: string; + verified_at: string | null; +}>; + +type AccountApiResponseValues = { + acct: string; avatar: string; avatar_static: string; - [key: string]: any; + bot: boolean; + created_at: string; + discoverable: boolean; + display_name: string; + emojis: CustomEmoji[]; + fields: AccountField[]; + followers_count: number; + following_count: number; + group: boolean; + header: string; + header_static: string; + id: string; + last_status_at: string; + locked: boolean; + note: string; + statuses_count: number; + url: string; + username: string; +}; + +type NormalizedAccountField = Record<{ + name_emojified: string; + value_emojified: string; + value_plain: string; +}>; + +type NormalizedAccountValues = { + display_name_html: string; + fields: NormalizedAccountField[]; + note_emojified: string; + note_plain: string; }; -export type Account = Record; +export type Account = Record< + AccountApiResponseValues & NormalizedAccountValues +>; From 526fe33e2f0d7037d1c82f444d768179d22bc7a7 Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Tue, 9 May 2023 14:55:35 +0200 Subject: [PATCH 40/44] [Glitch] Rework polyfills loading Port a3a2414f0ea91c26276728fc7f9d837f81828075 to glitch-soc Signed-off-by: Claire --- app/javascript/flavours/glitch/packs/home.js | 2 +- .../flavours/glitch/packs/public.jsx | 2 +- .../flavours/glitch/packs/settings.js | 2 +- .../flavours/glitch/packs/share.jsx | 2 +- .../base_polyfills.ts} | 22 +++++-------------- .../extra_polyfills.ts} | 0 .../{load_polyfills.js => polyfills/index.ts} | 16 ++++++-------- 7 files changed, 17 insertions(+), 29 deletions(-) rename app/javascript/flavours/glitch/{base_polyfills.js => polyfills/base_polyfills.ts} (58%) rename app/javascript/flavours/glitch/{extra_polyfills.js => polyfills/extra_polyfills.ts} (100%) rename app/javascript/flavours/glitch/{load_polyfills.js => polyfills/index.ts} (82%) diff --git a/app/javascript/flavours/glitch/packs/home.js b/app/javascript/flavours/glitch/packs/home.js index ace9dc3c4..a28625d33 100644 --- a/app/javascript/flavours/glitch/packs/home.js +++ b/app/javascript/flavours/glitch/packs/home.js @@ -1,5 +1,5 @@ import 'packs/public-path'; -import loadPolyfills from 'flavours/glitch/load_polyfills'; +import { loadPolyfills } from 'flavours/glitch/polyfills'; loadPolyfills().then(async () => { const { default: main } = await import('flavours/glitch/main'); diff --git a/app/javascript/flavours/glitch/packs/public.jsx b/app/javascript/flavours/glitch/packs/public.jsx index f77d6d324..34a8f3513 100644 --- a/app/javascript/flavours/glitch/packs/public.jsx +++ b/app/javascript/flavours/glitch/packs/public.jsx @@ -1,5 +1,5 @@ import 'packs/public-path'; -import loadPolyfills from 'flavours/glitch/load_polyfills'; +import { loadPolyfills } from 'flavours/glitch/polyfills'; import ready from 'flavours/glitch/ready'; import loadKeyboardExtensions from 'flavours/glitch/load_keyboard_extensions'; import axios from 'axios'; diff --git a/app/javascript/flavours/glitch/packs/settings.js b/app/javascript/flavours/glitch/packs/settings.js index cca71dae1..891b49337 100644 --- a/app/javascript/flavours/glitch/packs/settings.js +++ b/app/javascript/flavours/glitch/packs/settings.js @@ -1,5 +1,5 @@ import 'packs/public-path'; -import loadPolyfills from 'flavours/glitch/load_polyfills'; +import { loadPolyfills } from 'flavours/glitch/polyfills'; import loadKeyboardExtensions from 'flavours/glitch/load_keyboard_extensions'; import { delegate } from '@rails/ujs'; import 'cocoon-js-vanilla'; diff --git a/app/javascript/flavours/glitch/packs/share.jsx b/app/javascript/flavours/glitch/packs/share.jsx index 26228e448..47a51a5b0 100644 --- a/app/javascript/flavours/glitch/packs/share.jsx +++ b/app/javascript/flavours/glitch/packs/share.jsx @@ -1,5 +1,5 @@ import 'packs/public-path'; -import loadPolyfills from 'flavours/glitch/load_polyfills'; +import { loadPolyfills } from 'flavours/glitch/polyfills'; import ComposeContainer from 'flavours/glitch/containers/compose_container'; import React from 'react'; import ReactDOM from 'react-dom'; diff --git a/app/javascript/flavours/glitch/base_polyfills.js b/app/javascript/flavours/glitch/polyfills/base_polyfills.ts similarity index 58% rename from app/javascript/flavours/glitch/base_polyfills.js rename to app/javascript/flavours/glitch/polyfills/base_polyfills.ts index 91bc5d6dc..2e583f580 100644 --- a/app/javascript/flavours/glitch/base_polyfills.js +++ b/app/javascript/flavours/glitch/polyfills/base_polyfills.ts @@ -1,26 +1,16 @@ import 'intl'; import 'intl/locale-data/jsonp/en'; -import 'es6-symbol/implement'; -import assign from 'object-assign'; -import values from 'object.values'; -import { decode as decodeBase64 } from './utils/base64'; -import promiseFinally from 'promise.prototype.finally'; - -if (!Object.assign) { - Object.assign = assign; -} - -if (!Object.values) { - values.shim(); -} - -promiseFinally.shim(); +import 'core-js/features/object/assign'; +import 'core-js/features/object/values'; +import 'core-js/features/symbol'; +import 'core-js/features/promise/finally'; +import { decode as decodeBase64 } from '../utils/base64'; if (!HTMLCanvasElement.prototype.toBlob) { const BASE64_MARKER = ';base64,'; Object.defineProperty(HTMLCanvasElement.prototype, 'toBlob', { - value(callback, type = 'image/png', quality) { + value(callback: BlobCallback, type = 'image/png', quality: any) { const dataURL = this.toDataURL(type, quality); let data; diff --git a/app/javascript/flavours/glitch/extra_polyfills.js b/app/javascript/flavours/glitch/polyfills/extra_polyfills.ts similarity index 100% rename from app/javascript/flavours/glitch/extra_polyfills.js rename to app/javascript/flavours/glitch/polyfills/extra_polyfills.ts diff --git a/app/javascript/flavours/glitch/load_polyfills.js b/app/javascript/flavours/glitch/polyfills/index.ts similarity index 82% rename from app/javascript/flavours/glitch/load_polyfills.js rename to app/javascript/flavours/glitch/polyfills/index.ts index 7909dc4ea..6d2e5426e 100644 --- a/app/javascript/flavours/glitch/load_polyfills.js +++ b/app/javascript/flavours/glitch/polyfills/index.ts @@ -10,14 +10,14 @@ function importExtraPolyfills() { return import(/* webpackChunkName: "extra_polyfills" */ './extra_polyfills'); } -function loadPolyfills() { +export function loadPolyfills() { const needsBasePolyfills = !( - HTMLCanvasElement.prototype.toBlob && - window.Intl && - Object.assign && - Object.values && - window.Symbol && - Promise.prototype.finally + 'toBlob' in HTMLCanvasElement.prototype && + 'Intl' in window && + 'assign' in Object && + 'values' in Object && + 'Symbol' in window && + 'finally' in Promise.prototype ); // Latest version of Firefox and Safari do not have IntersectionObserver. @@ -36,5 +36,3 @@ function loadPolyfills() { needsExtraPolyfills && importExtraPolyfills(), ]); } - -export default loadPolyfills; From a56c71faba737c0e862319ae4d3b882b0be2aa4f Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Tue, 9 May 2023 15:48:53 +0200 Subject: [PATCH 41/44] [Glitch] Remove unused iOS agent sniffing function Port 224d458f7e351e8c88f71b44d338578525961c88 to glitch-soc Signed-off-by: Claire --- app/javascript/flavours/glitch/is_mobile.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/app/javascript/flavours/glitch/is_mobile.ts b/app/javascript/flavours/glitch/is_mobile.ts index d33246882..a3437d28b 100644 --- a/app/javascript/flavours/glitch/is_mobile.ts +++ b/app/javascript/flavours/glitch/is_mobile.ts @@ -27,10 +27,6 @@ export const layoutFromWindow = (layout_local_setting : string): LayoutType => { } }; -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-expect-error -const iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && window.MSStream != null; - const listenerOptions = supportsPassiveEvents ? { passive: true } : false; let userTouching = false; @@ -44,5 +40,3 @@ const touchListener = () => { window.addEventListener('touchstart', touchListener, listenerOptions); export const isUserTouching = () => userTouching; - -export const isIOS = () => iOS; From 5aa08826cfb61a2d6461db7ad2ca4bb7a31b714a Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Tue, 9 May 2023 16:56:26 +0200 Subject: [PATCH 42/44] [Glitch] Type Redux store and middleware Port 6aeb162927e6f9bbfd597632a10d82d9656c2385 to glitch-soc Signed-off-by: Claire --- .../glitch/containers/compose_container.jsx | 2 +- .../flavours/glitch/containers/mastodon.jsx | 2 +- app/javascript/flavours/glitch/main.jsx | 2 +- .../glitch/reducers/{index.js => index.ts} | 4 ++- .../flavours/glitch/store/configureStore.js | 16 ------------ app/javascript/flavours/glitch/store/index.ts | 23 ++++++++++++++++ .../errors.js => store/middlewares/errors.ts} | 7 ++--- .../middlewares/loading_bar.ts} | 12 ++++++--- .../sounds.js => store/middlewares/sounds.ts} | 26 +++++++++++++------ 9 files changed, 60 insertions(+), 34 deletions(-) rename app/javascript/flavours/glitch/reducers/{index.js => index.ts} (97%) delete mode 100644 app/javascript/flavours/glitch/store/configureStore.js create mode 100644 app/javascript/flavours/glitch/store/index.ts rename app/javascript/flavours/glitch/{middleware/errors.js => store/middlewares/errors.ts} (66%) rename app/javascript/flavours/glitch/{middleware/loading_bar.js => store/middlewares/loading_bar.ts} (68%) rename app/javascript/flavours/glitch/{middleware/sounds.js => store/middlewares/sounds.ts} (54%) diff --git a/app/javascript/flavours/glitch/containers/compose_container.jsx b/app/javascript/flavours/glitch/containers/compose_container.jsx index dada4cfed..9b84ed583 100644 --- a/app/javascript/flavours/glitch/containers/compose_container.jsx +++ b/app/javascript/flavours/glitch/containers/compose_container.jsx @@ -1,7 +1,7 @@ import React from 'react'; import { Provider } from 'react-redux'; import PropTypes from 'prop-types'; -import { store } from 'flavours/glitch/store/configureStore'; +import { store } from 'flavours/glitch/store'; import { hydrateStore } from 'flavours/glitch/actions/store'; import { IntlProvider, addLocaleData } from 'react-intl'; import { getLocale } from 'mastodon/locales'; diff --git a/app/javascript/flavours/glitch/containers/mastodon.jsx b/app/javascript/flavours/glitch/containers/mastodon.jsx index aca7f4dc5..1044fdd16 100644 --- a/app/javascript/flavours/glitch/containers/mastodon.jsx +++ b/app/javascript/flavours/glitch/containers/mastodon.jsx @@ -5,7 +5,7 @@ import { IntlProvider, addLocaleData } from 'react-intl'; import { Provider as ReduxProvider } from 'react-redux'; import { BrowserRouter, Route } from 'react-router-dom'; import { ScrollContext } from 'react-router-scroll-4'; -import { store } from 'flavours/glitch/store/configureStore'; +import { store } from 'flavours/glitch/store'; import UI from 'flavours/glitch/features/ui'; import { fetchCustomEmojis } from 'flavours/glitch/actions/custom_emojis'; import { hydrateStore } from 'flavours/glitch/actions/store'; diff --git a/app/javascript/flavours/glitch/main.jsx b/app/javascript/flavours/glitch/main.jsx index fa8ba47d4..1ac7d579e 100644 --- a/app/javascript/flavours/glitch/main.jsx +++ b/app/javascript/flavours/glitch/main.jsx @@ -2,7 +2,7 @@ import React from 'react'; import ReactDOM from 'react-dom'; import { setupBrowserNotifications } from 'flavours/glitch/actions/notifications'; import Mastodon from 'flavours/glitch/containers/mastodon'; -import { store } from 'flavours/glitch/store/configureStore'; +import { store } from 'flavours/glitch/store'; import { me } from 'flavours/glitch/initial_state'; import ready from 'flavours/glitch/ready'; diff --git a/app/javascript/flavours/glitch/reducers/index.js b/app/javascript/flavours/glitch/reducers/index.ts similarity index 97% rename from app/javascript/flavours/glitch/reducers/index.js rename to app/javascript/flavours/glitch/reducers/index.ts index 5b7bdbf69..da2174fc2 100644 --- a/app/javascript/flavours/glitch/reducers/index.js +++ b/app/javascript/flavours/glitch/reducers/index.ts @@ -91,4 +91,6 @@ const reducers = { followed_tags, }; -export default combineReducers(reducers); +const rootReducer = combineReducers(reducers); + +export { rootReducer }; diff --git a/app/javascript/flavours/glitch/store/configureStore.js b/app/javascript/flavours/glitch/store/configureStore.js deleted file mode 100644 index cb17dd9ce..000000000 --- a/app/javascript/flavours/glitch/store/configureStore.js +++ /dev/null @@ -1,16 +0,0 @@ -import { configureStore } from '@reduxjs/toolkit'; -import thunk from 'redux-thunk'; -import appReducer from '../reducers'; -import loadingBarMiddleware from '../middleware/loading_bar'; -import errorsMiddleware from '../middleware/errors'; -import soundsMiddleware from '../middleware/sounds'; - -export const store = configureStore({ - reducer: appReducer, - middleware: [ - thunk, - loadingBarMiddleware({ promiseTypeSuffixes: ['REQUEST', 'SUCCESS', 'FAIL'] }), - errorsMiddleware(), - soundsMiddleware(), - ], -}); diff --git a/app/javascript/flavours/glitch/store/index.ts b/app/javascript/flavours/glitch/store/index.ts new file mode 100644 index 000000000..822c01aa9 --- /dev/null +++ b/app/javascript/flavours/glitch/store/index.ts @@ -0,0 +1,23 @@ +import { configureStore } from '@reduxjs/toolkit'; +import { rootReducer } from '../reducers'; +import { loadingBarMiddleware } from './middlewares/loading_bar'; +import { errorsMiddleware } from './middlewares/errors'; +import { soundsMiddleware } from './middlewares/sounds'; +import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux'; + +export const store = configureStore({ + reducer: rootReducer, + middleware: getDefaultMiddleware => + getDefaultMiddleware().concat( + loadingBarMiddleware({ promiseTypeSuffixes: ['REQUEST', 'SUCCESS', 'FAIL'] })) + .concat(errorsMiddleware) + .concat(soundsMiddleware()), +}); + +// Infer the `RootState` and `AppDispatch` types from the store itself +export type RootState = ReturnType +// Inferred type: {posts: PostsState, comments: CommentsState, users: UsersState} +export type AppDispatch = typeof store.dispatch + +export const useAppDispatch: () => AppDispatch = useDispatch; +export const useAppSelector: TypedUseSelectorHook = useSelector; diff --git a/app/javascript/flavours/glitch/middleware/errors.js b/app/javascript/flavours/glitch/store/middlewares/errors.ts similarity index 66% rename from app/javascript/flavours/glitch/middleware/errors.js rename to app/javascript/flavours/glitch/store/middlewares/errors.ts index 3639a5951..be9e58652 100644 --- a/app/javascript/flavours/glitch/middleware/errors.js +++ b/app/javascript/flavours/glitch/store/middlewares/errors.ts @@ -1,9 +1,11 @@ +import { Middleware } from 'redux'; import { showAlertForError } from 'flavours/glitch/actions/alerts'; +import { RootState } from '..'; const defaultFailSuffix = 'FAIL'; -export default function errorsMiddleware() { - return ({ dispatch }) => next => action => { +export const errorsMiddleware: Middleware, RootState> = + ({ dispatch }) => next => action => { if (action.type && !action.skipAlert) { const isFail = new RegExp(`${defaultFailSuffix}$`, 'g'); @@ -14,4 +16,3 @@ export default function errorsMiddleware() { return next(action); }; -} diff --git a/app/javascript/flavours/glitch/middleware/loading_bar.js b/app/javascript/flavours/glitch/store/middlewares/loading_bar.ts similarity index 68% rename from app/javascript/flavours/glitch/middleware/loading_bar.js rename to app/javascript/flavours/glitch/store/middlewares/loading_bar.ts index da8cc4c7d..e860b31b6 100644 --- a/app/javascript/flavours/glitch/middleware/loading_bar.js +++ b/app/javascript/flavours/glitch/store/middlewares/loading_bar.ts @@ -1,8 +1,14 @@ import { showLoading, hideLoading } from 'react-redux-loading-bar'; +import { Middleware } from 'redux'; +import { RootState } from '..'; -const defaultTypeSuffixes = ['PENDING', 'FULFILLED', 'REJECTED']; +interface Config { + promiseTypeSuffixes?: string[] +} + +const defaultTypeSuffixes: Config['promiseTypeSuffixes'] = ['PENDING', 'FULFILLED', 'REJECTED']; -export default function loadingBarMiddleware(config = {}) { +export const loadingBarMiddleware = (config: Config = {}): Middleware, RootState> => { const promiseTypeSuffixes = config.promiseTypeSuffixes || defaultTypeSuffixes; return ({ dispatch }) => next => (action) => { @@ -22,4 +28,4 @@ export default function loadingBarMiddleware(config = {}) { return next(action); }; -} +}; diff --git a/app/javascript/flavours/glitch/middleware/sounds.js b/app/javascript/flavours/glitch/store/middlewares/sounds.ts similarity index 54% rename from app/javascript/flavours/glitch/middleware/sounds.js rename to app/javascript/flavours/glitch/store/middlewares/sounds.ts index 7f2388983..c9d51f857 100644 --- a/app/javascript/flavours/glitch/middleware/sounds.js +++ b/app/javascript/flavours/glitch/store/middlewares/sounds.ts @@ -1,4 +1,12 @@ -const createAudio = sources => { +import { Middleware, AnyAction } from 'redux'; +import { RootState } from '..'; + +interface AudioSource { + src: string + type: string +} + +const createAudio = (sources: AudioSource[]) => { const audio = new Audio(); sources.forEach(({ type, src }) => { const source = document.createElement('source'); @@ -9,7 +17,7 @@ const createAudio = sources => { return audio; }; -const play = audio => { +const play = (audio: HTMLAudioElement) => { if (!audio.paused) { audio.pause(); if (typeof audio.fastSeek === 'function') { @@ -22,8 +30,8 @@ const play = audio => { audio.play(); }; -export default function soundsMiddleware() { - const soundCache = { +export const soundsMiddleware = (): Middleware, RootState> => { + const soundCache: {[key: string]: HTMLAudioElement} = { boop: createAudio([ { src: '/sounds/boop.ogg', @@ -36,11 +44,13 @@ export default function soundsMiddleware() { ]), }; - return () => next => action => { - if (action.meta && action.meta.sound && soundCache[action.meta.sound]) { - play(soundCache[action.meta.sound]); + return () => next => (action: AnyAction) => { + const sound = action?.meta?.sound; + + if (sound && soundCache[sound]) { + play(soundCache[sound]); } return next(action); }; -} +}; From 96e99e2170f4e0e5c15079a52b49fdd45ffe7ad4 Mon Sep 17 00:00:00 2001 From: Claire Date: Tue, 9 May 2023 23:41:18 +0200 Subject: [PATCH 43/44] Run prettier on Typescript files Port 51b83ed19536b06ce3f57b260400ecec2d1dd187 to glitch-soc --- app/javascript/flavours/glitch/blurhash.ts | 4 +- app/javascript/flavours/glitch/compare_id.ts | 2 +- .../glitch/components/animated_number.tsx | 50 +++-- .../flavours/glitch/components/avatar.tsx | 15 +- .../flavours/glitch/components/blurhash.tsx | 2 +- .../flavours/glitch/components/gifv.tsx | 26 ++- .../flavours/glitch/components/icon.tsx | 15 +- .../glitch/components/icon_button.tsx | 28 +-- .../glitch/components/icon_with_badge.tsx | 15 +- .../flavours/glitch/components/image.tsx | 14 +- .../components/not_signed_in_indicator.tsx | 5 +- .../glitch/components/radio_button.tsx | 8 +- .../glitch/components/relative_timestamp.tsx | 189 ++++++++++++------ app/javascript/flavours/glitch/is_mobile.ts | 32 +-- app/javascript/flavours/glitch/permissions.ts | 6 +- .../glitch/polyfills/base_polyfills.ts | 2 +- app/javascript/flavours/glitch/scroll.ts | 37 +++- app/javascript/flavours/glitch/store/index.ts | 14 +- .../glitch/store/middlewares/errors.ts | 4 +- .../glitch/store/middlewares/loading_bar.ts | 43 ++-- .../glitch/store/middlewares/sounds.ts | 13 +- .../flavours/glitch/utils/filters.ts | 24 +-- .../flavours/glitch/utils/numbers.ts | 13 +- app/javascript/flavours/glitch/uuid.ts | 7 +- 24 files changed, 373 insertions(+), 195 deletions(-) diff --git a/app/javascript/flavours/glitch/blurhash.ts b/app/javascript/flavours/glitch/blurhash.ts index cb1c3b2c8..dadf2b7f2 100644 --- a/app/javascript/flavours/glitch/blurhash.ts +++ b/app/javascript/flavours/glitch/blurhash.ts @@ -98,9 +98,9 @@ export const decode83 = (str: string) => { }; export const intToRGB = (int: number) => ({ - r: Math.max(0, (int >> 16)), + r: Math.max(0, int >> 16), g: Math.max(0, (int >> 8) & 255), - b: Math.max(0, (int & 255)), + b: Math.max(0, int & 255), }); export const getAverageFromBlurhash = (blurhash: string) => { diff --git a/app/javascript/flavours/glitch/compare_id.ts b/app/javascript/flavours/glitch/compare_id.ts index 3ddfb7635..30b057248 100644 --- a/app/javascript/flavours/glitch/compare_id.ts +++ b/app/javascript/flavours/glitch/compare_id.ts @@ -1,4 +1,4 @@ -export function compareId (id1: string, id2: string) { +export function compareId(id1: string, id2: string) { if (id1 === id2) { return 0; } diff --git a/app/javascript/flavours/glitch/components/animated_number.tsx b/app/javascript/flavours/glitch/components/animated_number.tsx index 20ffa1a4d..f6c77d35f 100644 --- a/app/javascript/flavours/glitch/components/animated_number.tsx +++ b/app/javascript/flavours/glitch/components/animated_number.tsx @@ -16,13 +16,10 @@ const obfuscatedCount = (count: number) => { type Props = { value: number; obfuscate?: boolean; -} -export const AnimatedNumber: React.FC = ({ - value, - obfuscate, -})=> { +}; +export const AnimatedNumber: React.FC = ({ value, obfuscate }) => { const [previousValue, setPreviousValue] = useState(value); - const [direction, setDirection] = useState<1|-1>(1); + const [direction, setDirection] = useState<1 | -1>(1); if (previousValue !== value) { setPreviousValue(value); @@ -30,24 +27,45 @@ export const AnimatedNumber: React.FC = ({ } const willEnter = useCallback(() => ({ y: -1 * direction }), [direction]); - const willLeave = useCallback(() => ({ y: spring(1 * direction, { damping: 35, stiffness: 400 }) }), [direction]); + const willLeave = useCallback( + () => ({ y: spring(1 * direction, { damping: 35, stiffness: 400 }) }), + [direction] + ); if (reduceMotion) { - return obfuscate ? <>{obfuscatedCount(value)} : ; + return obfuscate ? ( + <>{obfuscatedCount(value)} + ) : ( + + ); } - const styles = [{ - key: `${value}`, - data: value, - style: { y: spring(0, { damping: 35, stiffness: 400 }) }, - }]; + const styles = [ + { + key: `${value}`, + data: value, + style: { y: spring(0, { damping: 35, stiffness: 400 }) }, + }, + ]; return ( - - {items => ( + + {(items) => ( {items.map(({ key, data, style }) => ( - 0 ? 'absolute' : 'static', transform: `translateY(${style.y * 100}%)` }}>{obfuscate ? obfuscatedCount(data) : } + 0 ? 'absolute' : 'static', + transform: `translateY(${style.y * 100}%)`, + }} + > + {obfuscate ? obfuscatedCount(data) : } + ))} )} diff --git a/app/javascript/flavours/glitch/components/avatar.tsx b/app/javascript/flavours/glitch/components/avatar.tsx index c2f44706c..1bd7739f5 100644 --- a/app/javascript/flavours/glitch/components/avatar.tsx +++ b/app/javascript/flavours/glitch/components/avatar.tsx @@ -10,7 +10,7 @@ type Props = { size: number; style?: React.CSSProperties; inline?: boolean; -} +}; export const Avatar: React.FC = ({ account, @@ -19,7 +19,8 @@ export const Avatar: React.FC = ({ inline = false, style: styleFromParent, }) => { - const { hovering, handleMouseEnter, handleMouseLeave } = useHovering(autoPlayGif); + const { hovering, handleMouseEnter, handleMouseLeave } = + useHovering(autoPlayGif); const style = { ...styleFromParent, @@ -29,12 +30,18 @@ export const Avatar: React.FC = ({ }; if (account) { - style.backgroundImage = `url(${account.get(hovering ? 'avatar' : 'avatar_static')})`; + style.backgroundImage = `url(${account.get( + hovering ? 'avatar' : 'avatar_static' + )})`; } return (
= ({ hash, width = 32, diff --git a/app/javascript/flavours/glitch/components/gifv.tsx b/app/javascript/flavours/glitch/components/gifv.tsx index 5d9f235e1..72914ba74 100644 --- a/app/javascript/flavours/glitch/components/gifv.tsx +++ b/app/javascript/flavours/glitch/components/gifv.tsx @@ -8,7 +8,7 @@ type Props = { width: number; height: number; onClick?: () => void; -} +}; export const GIFV: React.FC = ({ src, @@ -17,19 +17,23 @@ export const GIFV: React.FC = ({ width, height, onClick, -})=> { +}) => { const [loading, setLoading] = useState(true); - const handleLoadedData: React.ReactEventHandler = useCallback(() => { - setLoading(false); - }, [setLoading]); + const handleLoadedData: React.ReactEventHandler = + useCallback(() => { + setLoading(false); + }, [setLoading]); - const handleClick: React.MouseEventHandler = useCallback((e) => { - if (onClick) { - e.stopPropagation(); - onClick(); - } - }, [onClick]); + const handleClick: React.MouseEventHandler = useCallback( + (e) => { + if (onClick) { + e.stopPropagation(); + onClick(); + } + }, + [onClick] + ); return (
diff --git a/app/javascript/flavours/glitch/components/icon.tsx b/app/javascript/flavours/glitch/components/icon.tsx index f74437b55..4eb948dc7 100644 --- a/app/javascript/flavours/glitch/components/icon.tsx +++ b/app/javascript/flavours/glitch/components/icon.tsx @@ -7,6 +7,15 @@ type Props = { fixedWidth?: boolean; children?: never; [key: string]: any; -} -export const Icon: React.FC = ({ id, className, fixedWidth, ...other }) => - ; +}; +export const Icon: React.FC = ({ + id, + className, + fixedWidth, + ...other +}) => ( + +); diff --git a/app/javascript/flavours/glitch/components/icon_button.tsx b/app/javascript/flavours/glitch/components/icon_button.tsx index d3d060971..80b20ae1b 100644 --- a/app/javascript/flavours/glitch/components/icon_button.tsx +++ b/app/javascript/flavours/glitch/components/icon_button.tsx @@ -26,13 +26,12 @@ type Props = { obfuscateCount?: boolean; href?: string; ariaHidden: boolean; -} +}; type States = { - activate: boolean, - deactivate: boolean, -} + activate: boolean; + deactivate: boolean; +}; export class IconButton extends React.PureComponent { - static defaultProps = { size: 18, active: false, @@ -48,7 +47,7 @@ export class IconButton extends React.PureComponent { deactivate: false, }; - UNSAFE_componentWillReceiveProps (nextProps: Props) { + UNSAFE_componentWillReceiveProps(nextProps: Props) { if (!nextProps.animate) return; if (this.props.active && !nextProps.active) { @@ -58,7 +57,7 @@ export class IconButton extends React.PureComponent { } } - handleClick: React.MouseEventHandler = (e) => { + handleClick: React.MouseEventHandler = (e) => { e.preventDefault(); if (!this.props.disabled && this.props.onClick != null) { @@ -84,7 +83,7 @@ export class IconButton extends React.PureComponent { } }; - render () { + render() { // Hack required for some icons which have an overriden size let containerSize = '1.28571429em'; if (this.props.style?.fontSize) { @@ -120,10 +119,7 @@ export class IconButton extends React.PureComponent { ariaHidden, } = this.props; - const { - activate, - deactivate, - } = this.state; + const { activate, deactivate } = this.state; const classes = classNames(className, 'icon-button', { active, @@ -141,7 +137,12 @@ export class IconButton extends React.PureComponent { let contents = ( - ); @@ -174,5 +175,4 @@ export class IconButton extends React.PureComponent { ); } - } diff --git a/app/javascript/flavours/glitch/components/icon_with_badge.tsx b/app/javascript/flavours/glitch/components/icon_with_badge.tsx index a4af86ca9..bf86814c0 100644 --- a/app/javascript/flavours/glitch/components/icon_with_badge.tsx +++ b/app/javascript/flavours/glitch/components/icon_with_badge.tsx @@ -1,18 +1,25 @@ import React from 'react'; import { Icon } from './icon'; -const formatNumber = (num: number): number | string => num > 40 ? '40+' : num; +const formatNumber = (num: number): number | string => (num > 40 ? '40+' : num); type Props = { id: string; count: number; issueBadge: boolean; className: string; -} -export const IconWithBadge: React.FC = ({ id, count, issueBadge, className }) => ( +}; +export const IconWithBadge: React.FC = ({ + id, + count, + issueBadge, + className, +}) => ( - {count > 0 && {formatNumber(count)}} + {count > 0 && ( + {formatNumber(count)} + )} {issueBadge && } ); diff --git a/app/javascript/flavours/glitch/components/image.tsx b/app/javascript/flavours/glitch/components/image.tsx index b332d4115..490543424 100644 --- a/app/javascript/flavours/glitch/components/image.tsx +++ b/app/javascript/flavours/glitch/components/image.tsx @@ -7,9 +7,14 @@ type Props = { srcSet?: string; blurhash?: string; className?: string; -} +}; -export const Image: React.FC = ({ src, srcSet, blurhash, className }) => { +export const Image: React.FC = ({ + src, + srcSet, + blurhash, + className, +}) => { const [loaded, setLoaded] = useState(false); const handleLoad = useCallback(() => { @@ -17,7 +22,10 @@ export const Image: React.FC = ({ src, srcSet, blurhash, className }) => }, [setLoaded]); return ( -
+
{blurhash && }
diff --git a/app/javascript/flavours/glitch/components/not_signed_in_indicator.tsx b/app/javascript/flavours/glitch/components/not_signed_in_indicator.tsx index 3bfee6ae9..53945d6a7 100644 --- a/app/javascript/flavours/glitch/components/not_signed_in_indicator.tsx +++ b/app/javascript/flavours/glitch/components/not_signed_in_indicator.tsx @@ -4,7 +4,10 @@ import { FormattedMessage } from 'react-intl'; export const NotSignedInIndicator: React.FC = () => (
- +
); diff --git a/app/javascript/flavours/glitch/components/radio_button.tsx b/app/javascript/flavours/glitch/components/radio_button.tsx index 194b67afe..829f47174 100644 --- a/app/javascript/flavours/glitch/components/radio_button.tsx +++ b/app/javascript/flavours/glitch/components/radio_button.tsx @@ -9,7 +9,13 @@ type Props = { label: React.ReactNode; }; -export const RadioButton: React.FC = ({ name, value, checked, onChange, label }) => { +export const RadioButton: React.FC = ({ + name, + value, + checked, + onChange, + label, +}) => { return (