diff --git a/.eslintrc.js b/.eslintrc.js index badcb1dcb9..e8e841ecd0 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -98,10 +98,17 @@ module.exports = { 'react/jsx-filename-extension': ['error', { extensions: ['.jsx', 'tsx'] }], 'react/jsx-boolean-value': 'error', 'react/display-name': 'off', + 'react/jsx-fragments': ['error', 'syntax'], 'react/jsx-equals-spacing': 'error', 'react/jsx-no-bind': 'error', + 'react/jsx-no-useless-fragment': 'error', 'react/jsx-no-target-blank': 'off', + 'react/jsx-tag-spacing': 'error', + 'react/jsx-uses-react': 'off', // not needed with new JSX transform + 'react/jsx-wrap-multilines': 'error', + 'react/no-deprecated': 'off', 'react/no-unknown-property': 'off', + 'react/react-in-jsx-scope': 'off', // not needed with new JSX transform 'react/self-closing-comp': 'error', // recommended values found in https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/src/index.js @@ -191,6 +198,55 @@ module.exports = { 'import/no-useless-path-segments': 'error', 'import/no-webpack-loader-syntax': 'error', + 'import/order': [ + 'error', + { + alphabetize: { order: 'asc' }, + 'newlines-between': 'always', + groups: [ + 'builtin', + 'external', + 'internal', + 'parent', + ['index', 'sibling'], + 'object', + ], + pathGroups: [ + // React core packages + { + pattern: '{react,react-dom,react-dom/client,prop-types}', + group: 'builtin', + position: 'after', + }, + // I18n + { + pattern: '{react-intl,intl-messageformat}', + group: 'builtin', + position: 'after', + }, + // Common React utilities + { + pattern: '{classnames,react-helmet,react-router-dom}', + group: 'external', + position: 'before', + }, + // Immutable / Redux / data store + { + pattern: '{immutable,react-redux,react-immutable-proptypes,react-immutable-pure-component,reselect}', + group: 'external', + position: 'before', + }, + // Internal packages + { + pattern: '{mastodon/**,flavours/glitch-soc/**}', + group: 'internal', + position: 'after', + }, + ], + pathGroupsExcludedImportTypes: [], + }, + ], + 'promise/always-return': 'off', 'promise/catch-or-return': [ 'error', @@ -279,55 +335,6 @@ module.exports = { rules: { 'import/consistent-type-specifier-style': ['error', 'prefer-top-level'], - 'import/order': [ - 'error', - { - alphabetize: { order: 'asc' }, - 'newlines-between': 'always', - groups: [ - 'builtin', - 'external', - 'internal', - 'parent', - ['index', 'sibling'], - 'object', - ], - pathGroups: [ - // React core packages - { - pattern: '{react,react-dom,prop-types}', - group: 'builtin', - position: 'after', - }, - // I18n - { - pattern: 'react-intl', - group: 'builtin', - position: 'after', - }, - // Common React utilities - { - pattern: '{classnames,react-helmet}', - group: 'external', - position: 'before', - }, - // Immutable / Redux / data store - { - pattern: '{immutable,react-redux,react-immutable-proptypes,react-immutable-pure-component,reselect}', - group: 'external', - position: 'before', - }, - // Internal packages - { - pattern: '{mastodon/**,flavours/glitch-soc/**}', - group: 'internal', - position: 'after', - }, - ], - pathGroupsExcludedImportTypes: [], - }, - ], - '@typescript-eslint/consistent-type-definitions': ['warn', 'interface'], '@typescript-eslint/consistent-type-exports': 'error', '@typescript-eslint/consistent-type-imports': 'error', @@ -339,6 +346,9 @@ module.exports = { 'import/no-default-export': 'warn', 'react/prefer-stateless-function': 'warn', 'react/function-component-definition': ['error', { namedComponents: 'arrow-function' }], + 'react/jsx-uses-react': 'off', // not needed with new JSX transform + 'react/react-in-jsx-scope': 'off', // not needed with new JSX transform + 'react/prop-types': 'off', }, }, { diff --git a/.rubocop.yml b/.rubocop.yml index ceade6e582..4eef9d63e6 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -43,7 +43,7 @@ Layout/LineLength: - !ruby/regexp / \# .*$/ - !ruby/regexp /^\# .*$/ Exclude: - - lib/**/*cli*.rb + - 'lib/mastodon/cli/*.rb' - db/*migrate/**/* - db/seeds/**/* @@ -57,7 +57,7 @@ Lint/UselessAccessModifier: # https://docs.rubocop.org/rubocop/cops_metrics.html#metricsabcsize Metrics/AbcSize: Exclude: - - 'lib/**/*cli*.rb' + - 'lib/mastodon/cli/*.rb' - db/*migrate/**/* # Reason: Some functions cannot be broken up, but others may be refactor candidates @@ -66,7 +66,7 @@ Metrics/BlockLength: CountAsOne: ['array', 'hash', 'heredoc', 'method_call'] Exclude: - 'config/routes.rb' - - 'lib/mastodon/*_cli.rb' + - 'lib/mastodon/cli/*.rb' - 'lib/tasks/*.rake' - 'app/models/concerns/account_associations.rb' - 'app/models/concerns/account_interactions.rb' @@ -95,14 +95,14 @@ Metrics/BlockLength: # https://docs.rubocop.org/rubocop/cops_metrics.html#metricsblocknesting Metrics/BlockNesting: Exclude: - - 'lib/mastodon/*_cli.rb' + - 'lib/mastodon/cli/*.rb' # Reason: Some Excluded files would be candidates for refactoring but not currently addressed # https://docs.rubocop.org/rubocop/cops_metrics.html#metricsclasslength Metrics/ClassLength: CountAsOne: ['array', 'hash', 'heredoc', 'method_call'] Exclude: - - 'lib/mastodon/*_cli.rb' + - 'lib/mastodon/cli/*.rb' - 'app/controllers/admin/accounts_controller.rb' - 'app/controllers/api/base_controller.rb' - 'app/controllers/api/v1/admin/accounts_controller.rb' @@ -146,7 +146,7 @@ Metrics/ClassLength: # https://docs.rubocop.org/rubocop/cops_metrics.html#metricscyclomaticcomplexity Metrics/CyclomaticComplexity: Exclude: - - lib/mastodon/*cli*.rb + - lib/mastodon/cli/*.rb - db/*migrate/**/* # Reason: Currently disabled in .rubocop_todo.yml @@ -154,7 +154,7 @@ Metrics/CyclomaticComplexity: Metrics/MethodLength: CountAsOne: [array, heredoc] Exclude: - - 'lib/mastodon/*_cli.rb' + - 'lib/mastodon/cli/*.rb' # Reason: # https://docs.rubocop.org/rubocop/cops_metrics.html#metricsmodulelength @@ -171,13 +171,12 @@ Rails/FilePath: Rails/HttpStatus: EnforcedStyle: numeric -# Reason: Allowed only in the `tootctl` CLI application code +# Reason: Allowed in `tootctl` CLI code and in boot ENV checker # https://docs.rubocop.org/rubocop-rails/cops_rails.html#railsexit Rails/Exit: Exclude: - - 'lib/mastodon/*_cli.rb' - - 'lib/mastodon/cli_helper.rb' - - 'lib/cli.rb' + - 'config/boot.rb' + - 'lib/mastodon/cli/*.rb' # Reason: Some single letter camel case files shouldn't be split # https://docs.rubocop.org/rubocop-rspec/cops_rspec.html#rspecfilepath diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 77caad4924..24e78c9ab3 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -379,29 +379,6 @@ RSpec/EmptyExampleGroup: RSpec/ExampleLength: Max: 22 -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: method_call, block -RSpec/ExpectChange: - Exclude: - - 'spec/controllers/admin/account_moderation_notes_controller_spec.rb' - - 'spec/controllers/admin/custom_emojis_controller_spec.rb' - - 'spec/controllers/admin/invites_controller_spec.rb' - - 'spec/controllers/admin/report_notes_controller_spec.rb' - - 'spec/controllers/concerns/accountable_concern_spec.rb' - - 'spec/controllers/invites_controller_spec.rb' - - 'spec/controllers/settings/two_factor_authentication/webauthn_credentials_controller_spec.rb' - - 'spec/models/admin/account_action_spec.rb' - - 'spec/services/suspend_account_service_spec.rb' - - 'spec/services/unsuspend_account_service_spec.rb' - - 'spec/workers/scheduler/accounts_statuses_cleanup_scheduler_spec.rb' - -RSpec/ExpectInHook: - Exclude: - - 'spec/controllers/api/v1/media_controller_spec.rb' - - 'spec/controllers/settings/applications_controller_spec.rb' - - 'spec/lib/status_filter_spec.rb' - # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: implicit, each, example @@ -554,26 +531,10 @@ RSpec/MultipleMemoizedHelpers: RSpec/NestedGroups: Max: 6 -# Configuration parameters: AllowedPatterns. -# AllowedPatterns: ^expect_, ^assert_ -RSpec/NoExpectationExample: - Exclude: - - 'spec/controllers/auth/registrations_controller_spec.rb' - - 'spec/services/precompute_feed_service_spec.rb' - RSpec/PendingWithoutReason: Exclude: - 'spec/models/account_spec.rb' -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: Strict, EnforcedStyle, AllowedExplicitMatchers. -# SupportedStyles: inflected, explicit -RSpec/PredicateMatcher: - Exclude: - - 'spec/controllers/api/v1/accounts/notes_controller_spec.rb' - - 'spec/models/user_spec.rb' - - 'spec/services/post_status_service_spec.rb' - RSpec/StubbedMock: Exclude: - 'spec/controllers/api/base_controller_spec.rb' @@ -715,12 +676,6 @@ Rails/DuplicateAssociation: - 'app/serializers/activitypub/collection_serializer.rb' - 'app/serializers/activitypub/note_serializer.rb' -# Configuration parameters: Include. -# Include: app/**/*.rb, config/**/*.rb, lib/**/*.rb -Rails/Exit: - Exclude: - - 'config/boot.rb' - # Configuration parameters: Include. # Include: app/models/**/*.rb Rails/HasAndBelongsToMany: @@ -855,9 +810,9 @@ Rails/SkipsModelValidations: - 'db/post_migrate/20220617202502_migrate_roles.rb' - 'db/post_migrate/20221101190723_backfill_admin_action_logs.rb' - 'db/post_migrate/20221206114142_backfill_admin_action_logs_again.rb' - - 'lib/cli.rb' - - 'lib/mastodon/accounts_cli.rb' - - 'lib/mastodon/maintenance_cli.rb' + - 'lib/mastodon/cli/accounts.rb' + - 'lib/mastodon/cli/main.rb' + - 'lib/mastodon/cli/maintenance.rb' - 'spec/controllers/api/v1/admin/accounts_controller_spec.rb' - 'spec/lib/activitypub/activity/follow_spec.rb' - 'spec/services/follow_service_spec.rb' @@ -939,7 +894,7 @@ Rails/WhereExists: - 'app/validators/vote_validator.rb' - 'app/workers/move_worker.rb' - 'db/migrate/20190529143559_preserve_old_layout_for_existing_users.rb' - - 'lib/mastodon/email_domain_blocks_cli.rb' + - 'lib/mastodon/cli/email_domain_blocks.rb' - 'lib/tasks/tests.rake' - 'spec/controllers/api/v1/accounts/notes_controller_spec.rb' - 'spec/controllers/api/v1/tags_controller_spec.rb' @@ -1001,7 +956,7 @@ Style/FormatStringToken: Exclude: - 'app/models/privacy_policy.rb' - 'config/initializers/devise.rb' - - 'lib/mastodon/maintenance_cli.rb' + - 'lib/mastodon/cli/maintenance.rb' - 'lib/paperclip/color_extractor.rb' # This cop supports unsafe autocorrection (--autocorrect-all). @@ -1446,9 +1401,9 @@ Style/GuardClause: - 'db/post_migrate/20220704024901_migrate_settings_to_user_roles.rb' - 'lib/devise/two_factor_ldap_authenticatable.rb' - 'lib/devise/two_factor_pam_authenticatable.rb' - - 'lib/mastodon/accounts_cli.rb' - - 'lib/mastodon/maintenance_cli.rb' - - 'lib/mastodon/media_cli.rb' + - 'lib/mastodon/cli/accounts.rb' + - 'lib/mastodon/cli/maintenance.rb' + - 'lib/mastodon/cli/media.rb' - 'lib/paperclip/attachment_extensions.rb' - 'lib/tasks/repo.rake' diff --git a/Gemfile.lock b/Gemfile.lock index 21647e1b69..85cc20e633 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -151,7 +151,7 @@ GEM bundler-audit (0.9.1) bundler (>= 1.2.0, < 3) thor (~> 1.0) - capistrano (3.17.2) + capistrano (3.17.3) airbrussh (>= 1.0.0) i18n rake (>= 10.0.0) @@ -269,7 +269,7 @@ GEM faraday-rack (1.0.0) faraday-retry (1.0.3) fast_blank (1.0.1) - fastimage (2.2.6) + fastimage (2.2.7) ffi (1.15.5) ffi-compiler (1.0.1) ffi (>= 1.0.0) diff --git a/app/controllers/api/v1/featured_tags_controller.rb b/app/controllers/api/v1/featured_tags_controller.rb index 5c81877bd9..516046f009 100644 --- a/app/controllers/api/v1/featured_tags_controller.rb +++ b/app/controllers/api/v1/featured_tags_controller.rb @@ -31,8 +31,4 @@ class Api::V1::FeaturedTagsController < Api::BaseController def set_featured_tags @featured_tags = current_account.featured_tags.order(statuses_count: :desc) end - - def featured_tag_params - params.require(:name) - end end diff --git a/app/controllers/media_controller.rb b/app/controllers/media_controller.rb index 41e20add62..ac820e92bc 100644 --- a/app/controllers/media_controller.rb +++ b/app/controllers/media_controller.rb @@ -46,7 +46,7 @@ class MediaController < ApplicationController end def allow_iframing - response.headers['X-Frame-Options'] = 'ALLOWALL' + response.headers.delete('X-Frame-Options') end def set_pack diff --git a/app/controllers/statuses_controller.rb b/app/controllers/statuses_controller.rb index 5758085988..0efafb8456 100644 --- a/app/controllers/statuses_controller.rb +++ b/app/controllers/statuses_controller.rb @@ -46,7 +46,7 @@ class StatusesController < ApplicationController return not_found if @status.hidden? || @status.reblog? expires_in 180, public: true - response.headers['X-Frame-Options'] = 'ALLOWALL' + response.headers.delete('X-Frame-Options') render layout: 'embedded' end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3192c7ab56..014e3a3f96 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -52,7 +52,7 @@ module ApplicationHelper if closed_registrations? || omniauth_only? 'https://joinmastodon.org/#getting-started' else - new_user_registration_path + ENV.fetch('SSO_ACCOUNT_SIGN_UP', new_user_registration_path) end end diff --git a/app/javascript/core/admin.js b/app/javascript/core/admin.js index ac1b2f95fb..97b2f4e309 100644 --- a/app/javascript/core/admin.js +++ b/app/javascript/core/admin.js @@ -2,6 +2,7 @@ import 'packs/public-path'; import { delegate } from '@rails/ujs'; + import ready from '../mastodon/ready'; const setAnnouncementEndsAttributes = (target) => { diff --git a/app/javascript/core/settings.js b/app/javascript/core/settings.js index c6cf6704c3..40537377c0 100644 --- a/app/javascript/core/settings.js +++ b/app/javascript/core/settings.js @@ -1,9 +1,9 @@ // This file will be loaded on settings pages, regardless of theme. import 'packs/public-path'; +import { delegate } from '@rails/ujs'; import escapeTextContentForBrowser from 'escape-html'; -import { delegate } from '@rails/ujs'; import emojify from '../mastodon/features/emoji/emoji'; diff --git a/app/javascript/core/two_factor_authentication.js b/app/javascript/core/two_factor_authentication.js index f076cdf30a..e76700a480 100644 --- a/app/javascript/core/two_factor_authentication.js +++ b/app/javascript/core/two_factor_authentication.js @@ -1,6 +1,8 @@ import 'packs/public-path'; -import axios from 'axios'; + import * as WebAuthnJSON from '@github/webauthn-json'; +import axios from 'axios'; + import ready from '../mastodon/ready'; import 'regenerator-runtime/runtime'; diff --git a/app/javascript/flavours/glitch/actions/accounts.js b/app/javascript/flavours/glitch/actions/accounts.js index 9e5c85a15c..d4f18ff2d7 100644 --- a/app/javascript/flavours/glitch/actions/accounts.js +++ b/app/javascript/flavours/glitch/actions/accounts.js @@ -1,4 +1,5 @@ import api, { getLinks } from '../api'; + import { importFetchedAccount, importFetchedAccounts } from './importer'; export const ACCOUNT_FETCH_REQUEST = 'ACCOUNT_FETCH_REQUEST'; diff --git a/app/javascript/flavours/glitch/actions/announcements.js b/app/javascript/flavours/glitch/actions/announcements.js index 586dcfd337..339c5f3adc 100644 --- a/app/javascript/flavours/glitch/actions/announcements.js +++ b/app/javascript/flavours/glitch/actions/announcements.js @@ -1,4 +1,5 @@ import api from '../api'; + import { normalizeAnnouncement } from './importer/normalizer'; export const ANNOUNCEMENTS_FETCH_REQUEST = 'ANNOUNCEMENTS_FETCH_REQUEST'; diff --git a/app/javascript/flavours/glitch/actions/blocks.js b/app/javascript/flavours/glitch/actions/blocks.js index 192aa3ce40..e293657ad3 100644 --- a/app/javascript/flavours/glitch/actions/blocks.js +++ b/app/javascript/flavours/glitch/actions/blocks.js @@ -1,4 +1,5 @@ import api, { getLinks } from '../api'; + import { fetchRelationships } from './accounts'; import { importFetchedAccounts } from './importer'; import { openModal } from './modal'; @@ -94,6 +95,6 @@ export function initBlockModal(account) { account, }); - dispatch(openModal('BLOCK')); + dispatch(openModal({ modalType: 'BLOCK' })); }; } diff --git a/app/javascript/flavours/glitch/actions/bookmarks.js b/app/javascript/flavours/glitch/actions/bookmarks.js index 3c8eec5468..0b16f61e63 100644 --- a/app/javascript/flavours/glitch/actions/bookmarks.js +++ b/app/javascript/flavours/glitch/actions/bookmarks.js @@ -1,4 +1,5 @@ import api, { getLinks } from '../api'; + import { importFetchedStatuses } from './importer'; export const BOOKMARKED_STATUSES_FETCH_REQUEST = 'BOOKMARKED_STATUSES_FETCH_REQUEST'; diff --git a/app/javascript/flavours/glitch/actions/boosts.js b/app/javascript/flavours/glitch/actions/boosts.js index c0f0f3acc5..1fc2e391e2 100644 --- a/app/javascript/flavours/glitch/actions/boosts.js +++ b/app/javascript/flavours/glitch/actions/boosts.js @@ -14,7 +14,10 @@ export function initBoostModal(props) { privacy, }); - dispatch(openModal('BOOST', props)); + dispatch(openModal({ + modalType: 'BOOST', + modalProps: props, + })); }; } diff --git a/app/javascript/flavours/glitch/actions/compose.js b/app/javascript/flavours/glitch/actions/compose.js index f0d50ccf13..9e0b123704 100644 --- a/app/javascript/flavours/glitch/actions/compose.js +++ b/app/javascript/flavours/glitch/actions/compose.js @@ -1,11 +1,14 @@ +import { defineMessages } from 'react-intl'; + import axios from 'axios'; import { throttle } from 'lodash'; -import { defineMessages } from 'react-intl'; + import api from 'flavours/glitch/api'; import { search as emojiSearch } from 'flavours/glitch/features/emoji/emoji_mart_search_light'; import { tagHistory } from 'flavours/glitch/settings'; import { recoverHashtags } from 'flavours/glitch/utils/hashtag'; import resizeImage from 'flavours/glitch/utils/resize_image'; + import { showAlert, showAlertForError } from './alerts'; import { useEmoji } from './emojis'; import { importFetchedAccounts, importFetchedStatus } from './importer'; @@ -413,7 +416,10 @@ export function initMediaEditModal(id) { id, }); - dispatch(openModal('FOCAL_POINT', { id })); + dispatch(openModal({ + modalType: 'FOCAL_POINT', + modalProps: { id }, + })); }; } diff --git a/app/javascript/flavours/glitch/actions/conversations.js b/app/javascript/flavours/glitch/actions/conversations.js index 4ef654b1f9..8c4c4529fb 100644 --- a/app/javascript/flavours/glitch/actions/conversations.js +++ b/app/javascript/flavours/glitch/actions/conversations.js @@ -1,4 +1,5 @@ import api, { getLinks } from '../api'; + import { importFetchedAccounts, importFetchedStatuses, diff --git a/app/javascript/flavours/glitch/actions/directory.js b/app/javascript/flavours/glitch/actions/directory.js index 4b2b6dd56d..cda63f2b5a 100644 --- a/app/javascript/flavours/glitch/actions/directory.js +++ b/app/javascript/flavours/glitch/actions/directory.js @@ -1,6 +1,7 @@ import api from '../api'; -import { importFetchedAccounts } from './importer'; + import { fetchRelationships } from './accounts'; +import { importFetchedAccounts } from './importer'; export const DIRECTORY_FETCH_REQUEST = 'DIRECTORY_FETCH_REQUEST'; export const DIRECTORY_FETCH_SUCCESS = 'DIRECTORY_FETCH_SUCCESS'; diff --git a/app/javascript/flavours/glitch/actions/favourites.js b/app/javascript/flavours/glitch/actions/favourites.js index 7388e0c580..2d4d4e6206 100644 --- a/app/javascript/flavours/glitch/actions/favourites.js +++ b/app/javascript/flavours/glitch/actions/favourites.js @@ -1,4 +1,5 @@ import api, { getLinks } from '../api'; + import { importFetchedStatuses } from './importer'; export const FAVOURITED_STATUSES_FETCH_REQUEST = 'FAVOURITED_STATUSES_FETCH_REQUEST'; diff --git a/app/javascript/flavours/glitch/actions/filters.js b/app/javascript/flavours/glitch/actions/filters.js index e9c609fc87..a11956ac56 100644 --- a/app/javascript/flavours/glitch/actions/filters.js +++ b/app/javascript/flavours/glitch/actions/filters.js @@ -1,4 +1,5 @@ import api from '../api'; + import { openModal } from './modal'; export const FILTERS_FETCH_REQUEST = 'FILTERS_FETCH_REQUEST'; @@ -14,9 +15,12 @@ export const FILTERS_CREATE_SUCCESS = 'FILTERS_CREATE_SUCCESS'; export const FILTERS_CREATE_FAIL = 'FILTERS_CREATE_FAIL'; export const initAddFilter = (status, { contextType }) => dispatch => - dispatch(openModal('FILTER', { - statusId: status?.get('id'), - contextType: contextType, + dispatch(openModal({ + modalType: 'FILTER', + modalProps: { + statusId: status?.get('id'), + contextType: contextType, + }, })); export const fetchFilters = () => (dispatch, getState) => { diff --git a/app/javascript/flavours/glitch/actions/history.js b/app/javascript/flavours/glitch/actions/history.js index c142aaf617..52401b7dce 100644 --- a/app/javascript/flavours/glitch/actions/history.js +++ b/app/javascript/flavours/glitch/actions/history.js @@ -1,4 +1,5 @@ import api from '../api'; + import { importFetchedAccounts } from './importer'; export const HISTORY_FETCH_REQUEST = 'HISTORY_FETCH_REQUEST'; diff --git a/app/javascript/flavours/glitch/actions/importer/normalizer.js b/app/javascript/flavours/glitch/actions/importer/normalizer.js index 1c9f524e43..f0d47f95e2 100644 --- a/app/javascript/flavours/glitch/actions/importer/normalizer.js +++ b/app/javascript/flavours/glitch/actions/importer/normalizer.js @@ -1,7 +1,8 @@ import escapeTextContentForBrowser from 'escape-html'; + import emojify from 'flavours/glitch/features/emoji/emoji'; -import { unescapeHTML } from 'flavours/glitch/utils/html'; import { autoHideCW } from 'flavours/glitch/utils/content_warning'; +import { unescapeHTML } from 'flavours/glitch/utils/html'; const domParser = new DOMParser(); diff --git a/app/javascript/flavours/glitch/actions/interactions.js b/app/javascript/flavours/glitch/actions/interactions.js index c7b552a656..6b8864a039 100644 --- a/app/javascript/flavours/glitch/actions/interactions.js +++ b/app/javascript/flavours/glitch/actions/interactions.js @@ -1,4 +1,5 @@ import api from '../api'; + import { importFetchedAccounts, importFetchedStatus } from './importer'; export const REBLOG_REQUEST = 'REBLOG_REQUEST'; diff --git a/app/javascript/flavours/glitch/actions/lists.js b/app/javascript/flavours/glitch/actions/lists.js index 5ab9224363..2faa54b955 100644 --- a/app/javascript/flavours/glitch/actions/lists.js +++ b/app/javascript/flavours/glitch/actions/lists.js @@ -1,6 +1,7 @@ import api from '../api'; -import { importFetchedAccounts } from './importer'; + import { showAlertForError } from './alerts'; +import { importFetchedAccounts } from './importer'; export const LIST_FETCH_REQUEST = 'LIST_FETCH_REQUEST'; export const LIST_FETCH_SUCCESS = 'LIST_FETCH_SUCCESS'; diff --git a/app/javascript/flavours/glitch/actions/local_settings.js b/app/javascript/flavours/glitch/actions/local_settings.js index adf7fd2abc..f2878daa50 100644 --- a/app/javascript/flavours/glitch/actions/local_settings.js +++ b/app/javascript/flavours/glitch/actions/local_settings.js @@ -1,4 +1,5 @@ import { expandSpoilers, disableSwiping } from 'flavours/glitch/initial_state'; + import { openModal } from './modal'; export const LOCAL_SETTING_CHANGE = 'LOCAL_SETTING_CHANGE'; @@ -27,9 +28,12 @@ export function checkDeprecatedLocalSettings() { } if (changed_settings.length > 0) { - dispatch(openModal('DEPRECATED_SETTINGS', { - settings: changed_settings, - onConfirm: () => dispatch(clearDeprecatedLocalSettings()), + dispatch(openModal({ + modalType: 'DEPRECATED_SETTINGS', + modalProps: { + settings: changed_settings, + onConfirm: () => dispatch(clearDeprecatedLocalSettings()), + }, })); } }; diff --git a/app/javascript/flavours/glitch/actions/markers.js b/app/javascript/flavours/glitch/actions/markers.js index 8fd9da405e..ccb1b23d6f 100644 --- a/app/javascript/flavours/glitch/actions/markers.js +++ b/app/javascript/flavours/glitch/actions/markers.js @@ -1,8 +1,10 @@ -import api from '../api'; -import { debounce } from 'lodash'; -import { compareId } from '../compare_id'; import { List as ImmutableList } from 'immutable'; +import { debounce } from 'lodash'; + +import api from '../api'; +import { compareId } from '../compare_id'; + export const MARKERS_FETCH_REQUEST = 'MARKERS_FETCH_REQUEST'; export const MARKERS_FETCH_SUCCESS = 'MARKERS_FETCH_SUCCESS'; export const MARKERS_FETCH_FAIL = 'MARKERS_FETCH_FAIL'; diff --git a/app/javascript/flavours/glitch/actions/modal.js b/app/javascript/flavours/glitch/actions/modal.js deleted file mode 100644 index ef2ae0e4c7..0000000000 --- a/app/javascript/flavours/glitch/actions/modal.js +++ /dev/null @@ -1,18 +0,0 @@ -export const MODAL_OPEN = 'MODAL_OPEN'; -export const MODAL_CLOSE = 'MODAL_CLOSE'; - -export function openModal(type, props) { - return { - type: MODAL_OPEN, - modalType: type, - modalProps: props, - }; -} - -export function closeModal(type, options = { ignoreFocus: false }) { - return { - type: MODAL_CLOSE, - modalType: type, - ignoreFocus: options.ignoreFocus, - }; -} diff --git a/app/javascript/flavours/glitch/actions/modal.ts b/app/javascript/flavours/glitch/actions/modal.ts new file mode 100644 index 0000000000..af34f5d6af --- /dev/null +++ b/app/javascript/flavours/glitch/actions/modal.ts @@ -0,0 +1,17 @@ +import { createAction } from '@reduxjs/toolkit'; + +import type { MODAL_COMPONENTS } from '../features/ui/components/modal_root'; + +export type ModalType = keyof typeof MODAL_COMPONENTS; + +interface OpenModalPayload { + modalType: ModalType; + modalProps: unknown; +} +export const openModal = createAction('MODAL_OPEN'); + +interface CloseModalPayload { + modalType: ModalType | undefined; + ignoreFocus: boolean; +} +export const closeModal = createAction('MODAL_CLOSE'); diff --git a/app/javascript/flavours/glitch/actions/mutes.js b/app/javascript/flavours/glitch/actions/mutes.js index aa47d14642..4af927d932 100644 --- a/app/javascript/flavours/glitch/actions/mutes.js +++ b/app/javascript/flavours/glitch/actions/mutes.js @@ -1,7 +1,9 @@ +import { openModal } from 'flavours/glitch/actions/modal'; + import api, { getLinks } from '../api'; + import { fetchRelationships } from './accounts'; import { importFetchedAccounts } from './importer'; -import { openModal } from 'flavours/glitch/actions/modal'; export const MUTES_FETCH_REQUEST = 'MUTES_FETCH_REQUEST'; export const MUTES_FETCH_SUCCESS = 'MUTES_FETCH_SUCCESS'; @@ -96,7 +98,7 @@ export function initMuteModal(account) { account, }); - dispatch(openModal('MUTE')); + dispatch(openModal({ modalType: 'MUTE' })); }; } diff --git a/app/javascript/flavours/glitch/actions/notifications.js b/app/javascript/flavours/glitch/actions/notifications.js index c044ea927f..47d45d0012 100644 --- a/app/javascript/flavours/glitch/actions/notifications.js +++ b/app/javascript/flavours/glitch/actions/notifications.js @@ -1,5 +1,15 @@ -import api, { getLinks } from '../api'; import IntlMessageFormat from 'intl-messageformat'; +import { defineMessages } from 'react-intl'; + +import { List as ImmutableList } from 'immutable'; + +import { compareId } from 'flavours/glitch/compare_id'; +import { usePendingItems as preferPendingItems } from 'flavours/glitch/initial_state'; +import { unescapeHTML } from 'flavours/glitch/utils/html'; +import { requestNotificationPermission } from 'flavours/glitch/utils/notifications'; + +import api, { getLinks } from '../api'; + import { fetchFollowRequests, fetchRelationships } from './accounts'; import { importFetchedAccount, @@ -9,12 +19,9 @@ import { } from './importer'; import { submitMarkers } from './markers'; import { saveSettings } from './settings'; -import { defineMessages } from 'react-intl'; -import { List as ImmutableList } from 'immutable'; -import { unescapeHTML } from 'flavours/glitch/utils/html'; -import { usePendingItems as preferPendingItems } from 'flavours/glitch/initial_state'; -import { compareId } from 'flavours/glitch/compare_id'; -import { requestNotificationPermission } from 'flavours/glitch/utils/notifications'; + + + export const NOTIFICATIONS_UPDATE = 'NOTIFICATIONS_UPDATE'; export const NOTIFICATIONS_UPDATE_NOOP = 'NOTIFICATIONS_UPDATE_NOOP'; diff --git a/app/javascript/flavours/glitch/actions/onboarding.js b/app/javascript/flavours/glitch/actions/onboarding.js index 5038b7eb67..a4a525c427 100644 --- a/app/javascript/flavours/glitch/actions/onboarding.js +++ b/app/javascript/flavours/glitch/actions/onboarding.js @@ -6,7 +6,9 @@ export function showOnboardingOnce() { const alreadySeen = getState().getIn(['settings', 'onboarded']); if (!alreadySeen) { - dispatch(openModal('ONBOARDING')); + dispatch(openModal({ + modalType: 'ONBOARDING', + })); dispatch(changeSetting(['onboarded'], true)); dispatch(saveSettings()); } diff --git a/app/javascript/flavours/glitch/actions/pin_statuses.js b/app/javascript/flavours/glitch/actions/pin_statuses.js index a0d5933b1c..8aca199e97 100644 --- a/app/javascript/flavours/glitch/actions/pin_statuses.js +++ b/app/javascript/flavours/glitch/actions/pin_statuses.js @@ -1,7 +1,9 @@ +import { me } from 'flavours/glitch/initial_state'; + import api from '../api'; + import { importFetchedStatuses } from './importer'; -import { me } from 'flavours/glitch/initial_state'; export const PINNED_STATUSES_FETCH_REQUEST = 'PINNED_STATUSES_FETCH_REQUEST'; export const PINNED_STATUSES_FETCH_SUCCESS = 'PINNED_STATUSES_FETCH_SUCCESS'; diff --git a/app/javascript/flavours/glitch/actions/polls.js b/app/javascript/flavours/glitch/actions/polls.js index 8e8b82df5d..a37410dc90 100644 --- a/app/javascript/flavours/glitch/actions/polls.js +++ b/app/javascript/flavours/glitch/actions/polls.js @@ -1,4 +1,5 @@ import api from '../api'; + import { importFetchedPoll } from './importer'; export const POLL_VOTE_REQUEST = 'POLL_VOTE_REQUEST'; diff --git a/app/javascript/flavours/glitch/actions/push_notifications/index.js b/app/javascript/flavours/glitch/actions/push_notifications/index.js index 9dcc4bd4bb..46b63867f1 100644 --- a/app/javascript/flavours/glitch/actions/push_notifications/index.js +++ b/app/javascript/flavours/glitch/actions/push_notifications/index.js @@ -1,5 +1,5 @@ -import { setAlerts } from './setter'; import { saveSettings } from './registerer'; +import { setAlerts } from './setter'; export function changeAlerts(path, value) { return dispatch => { diff --git a/app/javascript/flavours/glitch/actions/push_notifications/registerer.js b/app/javascript/flavours/glitch/actions/push_notifications/registerer.js index bc5634233f..336bbc6869 100644 --- a/app/javascript/flavours/glitch/actions/push_notifications/registerer.js +++ b/app/javascript/flavours/glitch/actions/push_notifications/registerer.js @@ -1,5 +1,6 @@ import api from '../../api'; import { pushNotificationsSetting } from '../../settings'; + import { setBrowserSupport, setSubscription, clearSubscription } from './setter'; // Taken from https://www.npmjs.com/package/web-push diff --git a/app/javascript/flavours/glitch/actions/reports.js b/app/javascript/flavours/glitch/actions/reports.js index fbe5b3791b..756b8cd05e 100644 --- a/app/javascript/flavours/glitch/actions/reports.js +++ b/app/javascript/flavours/glitch/actions/reports.js @@ -1,4 +1,5 @@ import api from '../api'; + import { openModal } from './modal'; export const REPORT_SUBMIT_REQUEST = 'REPORT_SUBMIT_REQUEST'; @@ -6,9 +7,12 @@ export const REPORT_SUBMIT_SUCCESS = 'REPORT_SUBMIT_SUCCESS'; export const REPORT_SUBMIT_FAIL = 'REPORT_SUBMIT_FAIL'; export const initReport = (account, status) => dispatch => - dispatch(openModal('REPORT', { - accountId: account.get('id'), - statusId: status?.get('id'), + dispatch(openModal({ + modalType: 'REPORT', + modalProps: { + accountId: account.get('id'), + statusId: status?.get('id'), + }, })); export const submitReport = (params, onSuccess, onFail) => (dispatch, getState) => { diff --git a/app/javascript/flavours/glitch/actions/search.js b/app/javascript/flavours/glitch/actions/search.js index 0012808e5b..d5154c6a84 100644 --- a/app/javascript/flavours/glitch/actions/search.js +++ b/app/javascript/flavours/glitch/actions/search.js @@ -1,4 +1,5 @@ import api from '../api'; + import { fetchRelationships } from './accounts'; import { importFetchedAccounts, importFetchedStatuses } from './importer'; diff --git a/app/javascript/flavours/glitch/actions/server.js b/app/javascript/flavours/glitch/actions/server.js index 091af0f0fe..bd784906d4 100644 --- a/app/javascript/flavours/glitch/actions/server.js +++ b/app/javascript/flavours/glitch/actions/server.js @@ -1,4 +1,5 @@ import api from '../api'; + import { importFetchedAccount } from './importer'; export const SERVER_FETCH_REQUEST = 'Server_FETCH_REQUEST'; diff --git a/app/javascript/flavours/glitch/actions/settings.js b/app/javascript/flavours/glitch/actions/settings.js index 60f0abf950..120ae133ed 100644 --- a/app/javascript/flavours/glitch/actions/settings.js +++ b/app/javascript/flavours/glitch/actions/settings.js @@ -1,5 +1,7 @@ -import api from '../api'; import { debounce } from 'lodash'; + +import api from '../api'; + import { showAlertForError } from './alerts'; export const SETTING_CHANGE = 'SETTING_CHANGE'; diff --git a/app/javascript/flavours/glitch/actions/statuses.js b/app/javascript/flavours/glitch/actions/statuses.js index 487cd69884..9bc9bf3876 100644 --- a/app/javascript/flavours/glitch/actions/statuses.js +++ b/app/javascript/flavours/glitch/actions/statuses.js @@ -1,8 +1,8 @@ import api from '../api'; -import { deleteFromTimelines } from './timelines'; -import { importFetchedStatus, importFetchedStatuses } from './importer'; import { ensureComposeIsVisible, setComposeToStatus } from './compose'; +import { importFetchedStatus, importFetchedStatuses } from './importer'; +import { deleteFromTimelines } from './timelines'; export const STATUS_FETCH_REQUEST = 'STATUS_FETCH_REQUEST'; export const STATUS_FETCH_SUCCESS = 'STATUS_FETCH_SUCCESS'; diff --git a/app/javascript/flavours/glitch/actions/store.js b/app/javascript/flavours/glitch/actions/store.js index 137b68e222..e57b37a122 100644 --- a/app/javascript/flavours/glitch/actions/store.js +++ b/app/javascript/flavours/glitch/actions/store.js @@ -1,4 +1,5 @@ import { Iterable, fromJS } from 'immutable'; + import { hydrateCompose } from './compose'; import { importFetchedAccounts } from './importer'; import { saveSettings } from './settings'; diff --git a/app/javascript/flavours/glitch/actions/streaming.js b/app/javascript/flavours/glitch/actions/streaming.js index b4eb60ad4e..e16a7409e6 100644 --- a/app/javascript/flavours/glitch/actions/streaming.js +++ b/app/javascript/flavours/glitch/actions/streaming.js @@ -1,6 +1,18 @@ // @ts-check +import { getLocale } from 'mastodon/locales'; + import { connectStream } from '../stream'; + +import { + fetchAnnouncements, + updateAnnouncements, + updateReaction as updateAnnouncementsReaction, + deleteAnnouncement, +} from './announcements'; +import { updateConversations } from './conversations'; +import { updateNotifications, expandNotifications } from './notifications'; +import { updateStatus } from './statuses'; import { updateTimeline, deleteFromTimelines, @@ -12,16 +24,6 @@ import { fillCommunityTimelineGaps, fillListTimelineGaps, } from './timelines'; -import { updateNotifications, expandNotifications } from './notifications'; -import { updateConversations } from './conversations'; -import { updateStatus } from './statuses'; -import { - fetchAnnouncements, - updateAnnouncements, - updateReaction as updateAnnouncementsReaction, - deleteAnnouncement, -} from './announcements'; -import { getLocale } from 'mastodon/locales'; const { messages } = getLocale(); diff --git a/app/javascript/flavours/glitch/actions/suggestions.js b/app/javascript/flavours/glitch/actions/suggestions.js index 9e8cd1ea40..870a311024 100644 --- a/app/javascript/flavours/glitch/actions/suggestions.js +++ b/app/javascript/flavours/glitch/actions/suggestions.js @@ -1,6 +1,7 @@ import api from '../api'; -import { importFetchedAccounts } from './importer'; + import { fetchRelationships } from './accounts'; +import { importFetchedAccounts } from './importer'; export const SUGGESTIONS_FETCH_REQUEST = 'SUGGESTIONS_FETCH_REQUEST'; export const SUGGESTIONS_FETCH_SUCCESS = 'SUGGESTIONS_FETCH_SUCCESS'; diff --git a/app/javascript/flavours/glitch/actions/timelines.js b/app/javascript/flavours/glitch/actions/timelines.js index 603759760b..7d4d56a784 100644 --- a/app/javascript/flavours/glitch/actions/timelines.js +++ b/app/javascript/flavours/glitch/actions/timelines.js @@ -1,11 +1,13 @@ -import { importFetchedStatus, importFetchedStatuses } from './importer'; -import { submitMarkers } from './markers'; -import api, { getLinks } from 'flavours/glitch/api'; import { Map as ImmutableMap, List as ImmutableList } from 'immutable'; + +import api, { getLinks } from 'flavours/glitch/api'; import { compareId } from 'flavours/glitch/compare_id'; import { usePendingItems as preferPendingItems } from 'flavours/glitch/initial_state'; import { toServerSideType } from 'flavours/glitch/utils/filters'; +import { importFetchedStatus, importFetchedStatuses } from './importer'; +import { submitMarkers } from './markers'; + export const TIMELINE_UPDATE = 'TIMELINE_UPDATE'; export const TIMELINE_DELETE = 'TIMELINE_DELETE'; export const TIMELINE_CLEAR = 'TIMELINE_CLEAR'; diff --git a/app/javascript/flavours/glitch/actions/trends.js b/app/javascript/flavours/glitch/actions/trends.js index edda0b5b5d..d314423884 100644 --- a/app/javascript/flavours/glitch/actions/trends.js +++ b/app/javascript/flavours/glitch/actions/trends.js @@ -1,4 +1,5 @@ import api, { getLinks } from '../api'; + import { importFetchedStatuses } from './importer'; export const TRENDS_TAGS_FETCH_REQUEST = 'TRENDS_TAGS_FETCH_REQUEST'; diff --git a/app/javascript/flavours/glitch/api.js b/app/javascript/flavours/glitch/api.js index 42b64d6cc5..948ffbc95c 100644 --- a/app/javascript/flavours/glitch/api.js +++ b/app/javascript/flavours/glitch/api.js @@ -2,8 +2,8 @@ import axios from 'axios'; import LinkHeader from 'http-link-header'; -import ready from './ready'; +import ready from './ready'; /** * @param {import('axios').AxiosResponse} response * @returns {LinkHeader} diff --git a/app/javascript/flavours/glitch/components/account.jsx b/app/javascript/flavours/glitch/components/account.jsx index 35f83beab1..518464b040 100644 --- a/app/javascript/flavours/glitch/components/account.jsx +++ b/app/javascript/flavours/glitch/components/account.jsx @@ -1,20 +1,24 @@ -import React, { Fragment } from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; + +import { defineMessages, injectIntl } from 'react-intl'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; + +import { Skeleton } from 'flavours/glitch/components/skeleton'; +import { me } from 'flavours/glitch/initial_state'; + import { Avatar } from './avatar'; import { DisplayName } from './display_name'; -import Permalink from './permalink'; import { IconButton } from './icon_button'; -import { defineMessages, injectIntl } from 'react-intl'; -import ImmutablePureComponent from 'react-immutable-pure-component'; -import { me } from 'flavours/glitch/initial_state'; +import Permalink from './permalink'; import { RelativeTimestamp } from './relative_timestamp'; -import { Skeleton } from 'flavours/glitch/components/skeleton'; + const messages = defineMessages({ follow: { id: 'account.follow', defaultMessage: 'Follow' }, unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' }, - requested: { id: 'account.requested', defaultMessage: 'Awaiting approval' }, + requested: { id: 'account.requested', defaultMessage: 'Awaiting approval. Click to cancel follow request' }, unblock: { id: 'account.unblock', defaultMessage: 'Unblock @{name}' }, unmute: { id: 'account.unmute', defaultMessage: 'Unmute @{name}' }, mute_notifications: { id: 'account.mute_notifications', defaultMessage: 'Mute notifications from @{name}' }, @@ -97,10 +101,10 @@ class Account extends ImmutablePureComponent { if (hidden) { return ( - + <> {account.get('display_name')} {account.get('username')} - + ); } @@ -128,10 +132,10 @@ class Account extends ImmutablePureComponent { hidingNotificationsButton = ; } buttons = ( - + <> {hidingNotificationsButton} - + ); } else if (defaultAction === 'mute') { buttons = ; diff --git a/app/javascript/flavours/glitch/components/admin/Counter.jsx b/app/javascript/flavours/glitch/components/admin/Counter.jsx index 9c0b848d0b..9bb792fc9d 100644 --- a/app/javascript/flavours/glitch/components/admin/Counter.jsx +++ b/app/javascript/flavours/glitch/components/admin/Counter.jsx @@ -1,9 +1,13 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import api from 'flavours/glitch/api'; +import { PureComponent } from 'react'; + import { FormattedNumber } from 'react-intl'; -import { Sparklines, SparklinesCurve } from 'react-sparklines'; + import classNames from 'classnames'; + +import { Sparklines, SparklinesCurve } from 'react-sparklines'; + +import api from 'flavours/glitch/api'; import { Skeleton } from 'flavours/glitch/components/skeleton'; const percIncrease = (a, b) => { @@ -24,7 +28,7 @@ const percIncrease = (a, b) => { return percent; }; -export default class Counter extends React.PureComponent { +export default class Counter extends PureComponent { static propTypes = { measure: PropTypes.string.isRequired, @@ -62,25 +66,25 @@ export default class Counter extends React.PureComponent { if (loading) { content = ( - + <> - + ); } else { const measure = data[0]; const percentChange = measure.previous_total && percIncrease(measure.previous_total * 1, measure.total * 1); content = ( - + <> {measure.human_value || } {measure.previous_total && ( 0, negative: percentChange < 0 })}>{percentChange > 0 && '+'})} - + ); } const inner = ( - + <>
{content}
@@ -96,7 +100,7 @@ export default class Counter extends React.PureComponent { )} -
+ ); if (href) { diff --git a/app/javascript/flavours/glitch/components/admin/Dimension.jsx b/app/javascript/flavours/glitch/components/admin/Dimension.jsx index 8b8466ee78..793fe2dd76 100644 --- a/app/javascript/flavours/glitch/components/admin/Dimension.jsx +++ b/app/javascript/flavours/glitch/components/admin/Dimension.jsx @@ -1,11 +1,13 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import api from 'flavours/glitch/api'; -import { FormattedNumber } from 'react-intl'; -import { roundTo10 } from 'flavours/glitch/utils/numbers'; -import { Skeleton } from 'flavours/glitch/components/skeleton'; +import { PureComponent } from 'react'; -export default class Dimension extends React.PureComponent { +import { FormattedNumber } from 'react-intl'; + +import api from 'flavours/glitch/api'; +import { Skeleton } from 'flavours/glitch/components/skeleton'; +import { roundTo10 } from 'flavours/glitch/utils/numbers'; + +export default class Dimension extends PureComponent { static propTypes = { dimension: PropTypes.string.isRequired, diff --git a/app/javascript/flavours/glitch/components/admin/ReportReasonSelector.jsx b/app/javascript/flavours/glitch/components/admin/ReportReasonSelector.jsx index ecefe7a840..d72465e4ad 100644 --- a/app/javascript/flavours/glitch/components/admin/ReportReasonSelector.jsx +++ b/app/javascript/flavours/glitch/components/admin/ReportReasonSelector.jsx @@ -1,16 +1,19 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import api from 'flavours/glitch/api'; +import { PureComponent } from 'react'; + import { injectIntl, defineMessages } from 'react-intl'; + import classNames from 'classnames'; +import api from 'flavours/glitch/api'; + const messages = defineMessages({ other: { id: 'report.categories.other', defaultMessage: 'Other' }, spam: { id: 'report.categories.spam', defaultMessage: 'Spam' }, violation: { id: 'report.categories.violation', defaultMessage: 'Content violates one or more server rules' }, }); -class Category extends React.PureComponent { +class Category extends PureComponent { static propTypes = { id: PropTypes.string.isRequired, @@ -52,7 +55,7 @@ class Category extends React.PureComponent { } -class Rule extends React.PureComponent { +class Rule extends PureComponent { static propTypes = { id: PropTypes.string.isRequired, @@ -84,7 +87,7 @@ class Rule extends React.PureComponent { } -class ReportReasonSelector extends React.PureComponent { +class ReportReasonSelector extends PureComponent { static propTypes = { id: PropTypes.string.isRequired, diff --git a/app/javascript/flavours/glitch/components/admin/Retention.jsx b/app/javascript/flavours/glitch/components/admin/Retention.jsx index e1ba3f6c9d..2cfc30b6fb 100644 --- a/app/javascript/flavours/glitch/components/admin/Retention.jsx +++ b/app/javascript/flavours/glitch/components/admin/Retention.jsx @@ -1,8 +1,11 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import api from 'flavours/glitch/api'; +import { PureComponent } from 'react'; + import { FormattedMessage, FormattedNumber, FormattedDate } from 'react-intl'; + import classNames from 'classnames'; + +import api from 'flavours/glitch/api'; import { roundTo10 } from 'flavours/glitch/utils/numbers'; const dateForCohort = cohort => { @@ -14,7 +17,7 @@ const dateForCohort = cohort => { } }; -export default class Retention extends React.PureComponent { +export default class Retention extends PureComponent { static propTypes = { start_at: PropTypes.string, diff --git a/app/javascript/flavours/glitch/components/admin/Trends.jsx b/app/javascript/flavours/glitch/components/admin/Trends.jsx index 774bf36e6e..975ea6e0f2 100644 --- a/app/javascript/flavours/glitch/components/admin/Trends.jsx +++ b/app/javascript/flavours/glitch/components/admin/Trends.jsx @@ -1,11 +1,14 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import api from 'flavours/glitch/api'; +import { PureComponent } from 'react'; + import { FormattedMessage } from 'react-intl'; + import classNames from 'classnames'; + +import api from 'flavours/glitch/api'; import Hashtag from 'flavours/glitch/components/hashtag'; -export default class Trends extends React.PureComponent { +export default class Trends extends PureComponent { static propTypes = { limit: PropTypes.number.isRequired, diff --git a/app/javascript/flavours/glitch/components/animated_number.tsx b/app/javascript/flavours/glitch/components/animated_number.tsx index b6b073161b..81e0af395b 100644 --- a/app/javascript/flavours/glitch/components/animated_number.tsx +++ b/app/javascript/flavours/glitch/components/animated_number.tsx @@ -1,4 +1,5 @@ -import React, { useCallback, useState } from 'react'; +import { useCallback, useState } from 'react'; +import * as React from 'react'; import { TransitionMotion, spring } from 'react-motion'; diff --git a/app/javascript/flavours/glitch/components/attachment_list.jsx b/app/javascript/flavours/glitch/components/attachment_list.jsx index 92ba98126a..173157b0d5 100644 --- a/app/javascript/flavours/glitch/components/attachment_list.jsx +++ b/app/javascript/flavours/glitch/components/attachment_list.jsx @@ -1,9 +1,12 @@ -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import ImmutablePureComponent from 'react-immutable-pure-component'; + import { FormattedMessage } from 'react-intl'; + import classNames from 'classnames'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; + import { Icon } from 'flavours/glitch/components/icon'; const filename = url => url.split('/').pop().split('#')[0].split('?')[0]; diff --git a/app/javascript/flavours/glitch/components/autosuggest_emoji.jsx b/app/javascript/flavours/glitch/components/autosuggest_emoji.jsx index 83fafbd10d..32a996fd7c 100644 --- a/app/javascript/flavours/glitch/components/autosuggest_emoji.jsx +++ b/app/javascript/flavours/glitch/components/autosuggest_emoji.jsx @@ -1,10 +1,10 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import unicodeMapping from 'flavours/glitch/features/emoji/emoji_unicode_mapping_light'; +import { PureComponent } from 'react'; +import unicodeMapping from 'flavours/glitch/features/emoji/emoji_unicode_mapping_light'; import { assetHost } from 'flavours/glitch/utils/config'; -export default class AutosuggestEmoji extends React.PureComponent { +export default class AutosuggestEmoji extends PureComponent { static propTypes = { emoji: PropTypes.object.isRequired, diff --git a/app/javascript/flavours/glitch/components/autosuggest_hashtag.jsx b/app/javascript/flavours/glitch/components/autosuggest_hashtag.jsx index d787ed07ad..37f7e20f0a 100644 --- a/app/javascript/flavours/glitch/components/autosuggest_hashtag.jsx +++ b/app/javascript/flavours/glitch/components/autosuggest_hashtag.jsx @@ -1,9 +1,11 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import ShortNumber from 'flavours/glitch/components/short_number'; +import { PureComponent } from 'react'; + import { FormattedMessage } from 'react-intl'; -export default class AutosuggestHashtag extends React.PureComponent { +import ShortNumber from 'flavours/glitch/components/short_number'; + +export default class AutosuggestHashtag extends PureComponent { static propTypes = { tag: PropTypes.shape({ diff --git a/app/javascript/flavours/glitch/components/autosuggest_input.jsx b/app/javascript/flavours/glitch/components/autosuggest_input.jsx index 9e74590e60..d3b7c48ab0 100644 --- a/app/javascript/flavours/glitch/components/autosuggest_input.jsx +++ b/app/javascript/flavours/glitch/components/autosuggest_input.jsx @@ -1,11 +1,16 @@ -import React from 'react'; +import PropTypes from 'prop-types'; + +import classNames from 'classnames'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; + import AutosuggestAccountContainer from 'flavours/glitch/features/compose/containers/autosuggest_account_container'; + import AutosuggestEmoji from './autosuggest_emoji'; import AutosuggestHashtag from './autosuggest_hashtag'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import PropTypes from 'prop-types'; -import ImmutablePureComponent from 'react-immutable-pure-component'; -import classNames from 'classnames'; + + const textAtCursorMatchesToken = (str, caretPosition, searchTokens) => { let word; diff --git a/app/javascript/flavours/glitch/components/autosuggest_textarea.jsx b/app/javascript/flavours/glitch/components/autosuggest_textarea.jsx index fc763146eb..86f10651d6 100644 --- a/app/javascript/flavours/glitch/components/autosuggest_textarea.jsx +++ b/app/javascript/flavours/glitch/components/autosuggest_textarea.jsx @@ -1,12 +1,16 @@ -import React from 'react'; +import PropTypes from 'prop-types'; + +import classNames from 'classnames'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; + +import Textarea from 'react-textarea-autosize'; + import AutosuggestAccountContainer from 'flavours/glitch/features/compose/containers/autosuggest_account_container'; + import AutosuggestEmoji from './autosuggest_emoji'; import AutosuggestHashtag from './autosuggest_hashtag'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import PropTypes from 'prop-types'; -import ImmutablePureComponent from 'react-immutable-pure-component'; -import Textarea from 'react-textarea-autosize'; -import classNames from 'classnames'; const textAtCursorMatchesToken = (str, caretPosition) => { let word; diff --git a/app/javascript/flavours/glitch/components/avatar_composite.jsx b/app/javascript/flavours/glitch/components/avatar_composite.jsx index 1c23a8b36e..5503abf4a9 100644 --- a/app/javascript/flavours/glitch/components/avatar_composite.jsx +++ b/app/javascript/flavours/glitch/components/avatar_composite.jsx @@ -1,9 +1,11 @@ -import React from 'react'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + import ImmutablePropTypes from 'react-immutable-proptypes'; + import { autoPlayGif } from 'flavours/glitch/initial_state'; -export default class AvatarComposite extends React.PureComponent { +export default class AvatarComposite extends PureComponent { static propTypes = { accounts: ImmutablePropTypes.list.isRequired, diff --git a/app/javascript/flavours/glitch/components/avatar_overlay.jsx b/app/javascript/flavours/glitch/components/avatar_overlay.jsx index 01dec587a5..d8215a4785 100644 --- a/app/javascript/flavours/glitch/components/avatar_overlay.jsx +++ b/app/javascript/flavours/glitch/components/avatar_overlay.jsx @@ -1,9 +1,11 @@ -import React from 'react'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + import ImmutablePropTypes from 'react-immutable-proptypes'; + import { autoPlayGif } from 'flavours/glitch/initial_state'; -export default class AvatarOverlay extends React.PureComponent { +export default class AvatarOverlay extends PureComponent { static propTypes = { account: ImmutablePropTypes.map.isRequired, diff --git a/app/javascript/flavours/glitch/components/blurhash.tsx b/app/javascript/flavours/glitch/components/blurhash.tsx index 1550d0b7a5..d98e7d35db 100644 --- a/app/javascript/flavours/glitch/components/blurhash.tsx +++ b/app/javascript/flavours/glitch/components/blurhash.tsx @@ -1,4 +1,5 @@ -import React, { useRef, useEffect } from 'react'; +import { useRef, useEffect } from 'react'; +import * as React from 'react'; import { decode } from 'blurhash'; diff --git a/app/javascript/flavours/glitch/components/button.jsx b/app/javascript/flavours/glitch/components/button.jsx index 40b8f5a159..bdeeeac999 100644 --- a/app/javascript/flavours/glitch/components/button.jsx +++ b/app/javascript/flavours/glitch/components/button.jsx @@ -1,8 +1,9 @@ -import React from 'react'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + import classNames from 'classnames'; -export default class Button extends React.PureComponent { +export default class Button extends PureComponent { static propTypes = { text: PropTypes.node, diff --git a/app/javascript/flavours/glitch/components/check.jsx b/app/javascript/flavours/glitch/components/check.jsx index ee2ef1595a..d818480b7b 100644 --- a/app/javascript/flavours/glitch/components/check.jsx +++ b/app/javascript/flavours/glitch/components/check.jsx @@ -1,5 +1,3 @@ -import React from 'react'; - const Check = () => ( diff --git a/app/javascript/flavours/glitch/components/column.jsx b/app/javascript/flavours/glitch/components/column.jsx index fce6a6c408..312a6848b5 100644 --- a/app/javascript/flavours/glitch/components/column.jsx +++ b/app/javascript/flavours/glitch/components/column.jsx @@ -1,11 +1,13 @@ -import React from 'react'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + import { supportsPassiveEvents } from 'detect-passive-events'; + import { scrollTop } from '../scroll'; const listenerOptions = supportsPassiveEvents ? { passive: true } : false; -export default class Column extends React.PureComponent { +export default class Column extends PureComponent { static propTypes = { children: PropTypes.node, diff --git a/app/javascript/flavours/glitch/components/column_back_button.jsx b/app/javascript/flavours/glitch/components/column_back_button.jsx index 003d37671a..0934d4b335 100644 --- a/app/javascript/flavours/glitch/components/column_back_button.jsx +++ b/app/javascript/flavours/glitch/components/column_back_button.jsx @@ -1,10 +1,13 @@ -import React from 'react'; -import { FormattedMessage } from 'react-intl'; import PropTypes from 'prop-types'; -import { Icon } from 'flavours/glitch/components/icon'; +import { PureComponent } from 'react'; import { createPortal } from 'react-dom'; -export default class ColumnBackButton extends React.PureComponent { +import { FormattedMessage } from 'react-intl'; + +import { Icon } from 'flavours/glitch/components/icon'; + + +export default class ColumnBackButton extends PureComponent { static contextTypes = { router: PropTypes.object, diff --git a/app/javascript/flavours/glitch/components/column_back_button_slim.jsx b/app/javascript/flavours/glitch/components/column_back_button_slim.jsx index 6fb800640c..7b3bac45f9 100644 --- a/app/javascript/flavours/glitch/components/column_back_button_slim.jsx +++ b/app/javascript/flavours/glitch/components/column_back_button_slim.jsx @@ -1,9 +1,11 @@ -import React from 'react'; -import { FormattedMessage } from 'react-intl'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + +import { FormattedMessage } from 'react-intl'; + import { Icon } from 'flavours/glitch/components/icon'; -export default class ColumnBackButtonSlim extends React.PureComponent { +export default class ColumnBackButtonSlim extends PureComponent { static contextTypes = { router: PropTypes.object, diff --git a/app/javascript/flavours/glitch/components/column_header.jsx b/app/javascript/flavours/glitch/components/column_header.jsx index c4b6e92474..e8c056c0bf 100644 --- a/app/javascript/flavours/glitch/components/column_header.jsx +++ b/app/javascript/flavours/glitch/components/column_header.jsx @@ -1,8 +1,11 @@ -import React from 'react'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; import { createPortal } from 'react-dom'; -import classNames from 'classnames'; + import { FormattedMessage, injectIntl, defineMessages } from 'react-intl'; + +import classNames from 'classnames'; + import { Icon } from 'flavours/glitch/components/icon'; const messages = defineMessages({ @@ -12,7 +15,7 @@ const messages = defineMessages({ moveRight: { id: 'column_header.moveRight_settings', defaultMessage: 'Move column to the right' }, }); -class ColumnHeader extends React.PureComponent { +class ColumnHeader extends PureComponent { static contextTypes = { router: PropTypes.object, diff --git a/app/javascript/flavours/glitch/components/common_counter.jsx b/app/javascript/flavours/glitch/components/common_counter.jsx index 9964be5166..785907bd25 100644 --- a/app/javascript/flavours/glitch/components/common_counter.jsx +++ b/app/javascript/flavours/glitch/components/common_counter.jsx @@ -1,7 +1,5 @@ // @ts-check -import React from 'react'; import { FormattedMessage } from 'react-intl'; - /** * Returns custom renderer for one of the common counter types * @param {"statuses" | "following" | "followers"} counterType diff --git a/app/javascript/flavours/glitch/components/dismissable_banner.jsx b/app/javascript/flavours/glitch/components/dismissable_banner.jsx index 2aed19b88f..21063c9ed6 100644 --- a/app/javascript/flavours/glitch/components/dismissable_banner.jsx +++ b/app/javascript/flavours/glitch/components/dismissable_banner.jsx @@ -1,14 +1,17 @@ -import React from 'react'; -import { IconButton } from './icon_button'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + import { injectIntl, defineMessages } from 'react-intl'; + import { bannerSettings } from 'flavours/glitch/settings'; +import { IconButton } from './icon_button'; + const messages = defineMessages({ dismiss: { id: 'dismissable_banner.dismiss', defaultMessage: 'Dismiss' }, }); -class DismissableBanner extends React.PureComponent { +class DismissableBanner extends PureComponent { static propTypes = { id: PropTypes.string.isRequired, diff --git a/app/javascript/flavours/glitch/components/domain.tsx b/app/javascript/flavours/glitch/components/domain.tsx index 9e8e04b65c..d61e4074ee 100644 --- a/app/javascript/flavours/glitch/components/domain.tsx +++ b/app/javascript/flavours/glitch/components/domain.tsx @@ -1,4 +1,5 @@ -import React, { useCallback } from 'react'; +import { useCallback } from 'react'; +import * as React from 'react'; import type { InjectedIntl } from 'react-intl'; import { defineMessages, injectIntl } from 'react-intl'; diff --git a/app/javascript/flavours/glitch/components/dropdown_menu.jsx b/app/javascript/flavours/glitch/components/dropdown_menu.jsx index 901c7fe22f..03bf6e685a 100644 --- a/app/javascript/flavours/glitch/components/dropdown_menu.jsx +++ b/app/javascript/flavours/glitch/components/dropdown_menu.jsx @@ -1,16 +1,21 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import { IconButton } from './icon_button'; -import Overlay from 'react-overlays/Overlay'; -import { supportsPassiveEvents } from 'detect-passive-events'; +import { PureComponent, cloneElement, Children } from 'react'; + import classNames from 'classnames'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; + +import { supportsPassiveEvents } from 'detect-passive-events'; +import Overlay from 'react-overlays/Overlay'; + import { CircularProgress } from 'flavours/glitch/components/loading_indicator'; +import { IconButton } from './icon_button'; + const listenerOptions = supportsPassiveEvents ? { passive: true, capture: true } : true; let id = 0; -class DropdownMenu extends React.PureComponent { +class DropdownMenu extends PureComponent { static contextTypes = { router: PropTypes.object, @@ -155,7 +160,7 @@ class DropdownMenu extends React.PureComponent { } -export default class Dropdown extends React.PureComponent { +export default class Dropdown extends PureComponent { static contextTypes = { router: PropTypes.object, @@ -286,7 +291,7 @@ export default class Dropdown extends React.PureComponent { const open = this.state.id === openDropdownId; - const button = children ? React.cloneElement(React.Children.only(children), { + const button = children ? cloneElement(Children.only(children), { onClick: this.handleClick, onMouseDown: this.handleMouseDown, onKeyDown: this.handleButtonKeyDown, @@ -306,7 +311,7 @@ export default class Dropdown extends React.PureComponent { ); return ( - + <> {button} @@ -329,7 +334,7 @@ export default class Dropdown extends React.PureComponent { )} - + ); } diff --git a/app/javascript/flavours/glitch/components/edited_timestamp/containers/dropdown_menu_container.js b/app/javascript/flavours/glitch/components/edited_timestamp/containers/dropdown_menu_container.js index a1519757de..7c9c167137 100644 --- a/app/javascript/flavours/glitch/components/edited_timestamp/containers/dropdown_menu_container.js +++ b/app/javascript/flavours/glitch/components/edited_timestamp/containers/dropdown_menu_container.js @@ -1,4 +1,5 @@ import { connect } from 'react-redux'; + import { openDropdownMenu, closeDropdownMenu } from 'flavours/glitch/actions/dropdown_menu'; import { fetchHistory } from 'flavours/glitch/actions/history'; import DropdownMenu from 'flavours/glitch/components/dropdown_menu'; diff --git a/app/javascript/flavours/glitch/components/edited_timestamp/index.jsx b/app/javascript/flavours/glitch/components/edited_timestamp/index.jsx index 5315b812fc..3dbac58b54 100644 --- a/app/javascript/flavours/glitch/components/edited_timestamp/index.jsx +++ b/app/javascript/flavours/glitch/components/edited_timestamp/index.jsx @@ -1,22 +1,29 @@ -import React from 'react'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + import { FormattedMessage, injectIntl } from 'react-intl'; -import { Icon } from 'flavours/glitch/components/icon'; -import DropdownMenu from './containers/dropdown_menu_container'; + import { connect } from 'react-redux'; + import { openModal } from 'flavours/glitch/actions/modal'; -import { RelativeTimestamp } from 'flavours/glitch/components/relative_timestamp'; +import { Icon } from 'flavours/glitch/components/icon'; import InlineAccount from 'flavours/glitch/components/inline_account'; +import { RelativeTimestamp } from 'flavours/glitch/components/relative_timestamp'; + +import DropdownMenu from './containers/dropdown_menu_container'; const mapDispatchToProps = (dispatch, { statusId }) => ({ onItemClick (index) { - dispatch(openModal('COMPARE_HISTORY', { index, statusId })); + dispatch(openModal({ + modalType: 'COMPARE_HISTORY', + modalProps: { index, statusId }, + })); }, }); -class EditedTimestamp extends React.PureComponent { +class EditedTimestamp extends PureComponent { static propTypes = { statusId: PropTypes.string.isRequired, diff --git a/app/javascript/flavours/glitch/components/error_boundary.jsx b/app/javascript/flavours/glitch/components/error_boundary.jsx index 234a53417f..4a4dadf0a5 100644 --- a/app/javascript/flavours/glitch/components/error_boundary.jsx +++ b/app/javascript/flavours/glitch/components/error_boundary.jsx @@ -1,12 +1,16 @@ -import React from 'react'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + import { FormattedMessage } from 'react-intl'; -import { source_url } from 'flavours/glitch/initial_state'; -import { preferencesLink } from 'flavours/glitch/utils/backend_links'; -import StackTrace from 'stacktrace-js'; + import { Helmet } from 'react-helmet'; -export default class ErrorBoundary extends React.PureComponent { +import StackTrace from 'stacktrace-js'; + +import { source_url } from 'flavours/glitch/initial_state'; +import { preferencesLink } from 'flavours/glitch/utils/backend_links'; + +export default class ErrorBoundary extends PureComponent { static propTypes = { children: PropTypes.node, diff --git a/app/javascript/flavours/glitch/components/gifv.tsx b/app/javascript/flavours/glitch/components/gifv.tsx index c606a29048..c9b9de29b6 100644 --- a/app/javascript/flavours/glitch/components/gifv.tsx +++ b/app/javascript/flavours/glitch/components/gifv.tsx @@ -1,4 +1,5 @@ -import React, { useCallback, useState } from 'react'; +import { useCallback, useState } from 'react'; +import * as React from 'react'; interface Props { src: string; diff --git a/app/javascript/flavours/glitch/components/hashtag.jsx b/app/javascript/flavours/glitch/components/hashtag.jsx index ced250b79a..422ead01db 100644 --- a/app/javascript/flavours/glitch/components/hashtag.jsx +++ b/app/javascript/flavours/glitch/components/hashtag.jsx @@ -1,15 +1,21 @@ // @ts-check -import React from 'react'; -import { Sparklines, SparklinesCurve } from 'react-sparklines'; -import { FormattedMessage } from 'react-intl'; import PropTypes from 'prop-types'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import Permalink from './permalink'; -import ShortNumber from 'flavours/glitch/components/short_number'; -import { Skeleton } from 'flavours/glitch/components/skeleton'; +import { Component } from 'react'; + +import { FormattedMessage } from 'react-intl'; + import classNames from 'classnames'; -class SilentErrorBoundary extends React.Component { +import ImmutablePropTypes from 'react-immutable-proptypes'; + +import { Sparklines, SparklinesCurve } from 'react-sparklines'; + +import ShortNumber from 'flavours/glitch/components/short_number'; +import { Skeleton } from 'flavours/glitch/components/skeleton'; + +import Permalink from './permalink'; + +class SilentErrorBoundary extends Component { static propTypes = { children: PropTypes.node, @@ -70,7 +76,7 @@ const Hashtag = ({ name, href, to, people, uses, history, className, description
- {name ? #{name} : } + {name ? <>#{name} : } {description ? ( diff --git a/app/javascript/flavours/glitch/components/icon.tsx b/app/javascript/flavours/glitch/components/icon.tsx index 6bd15da6ac..765aa89aec 100644 --- a/app/javascript/flavours/glitch/components/icon.tsx +++ b/app/javascript/flavours/glitch/components/icon.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import classNames from 'classnames'; diff --git a/app/javascript/flavours/glitch/components/icon_button.tsx b/app/javascript/flavours/glitch/components/icon_button.tsx index 0b81288241..ecc418773c 100644 --- a/app/javascript/flavours/glitch/components/icon_button.tsx +++ b/app/javascript/flavours/glitch/components/icon_button.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import classNames from 'classnames'; @@ -138,7 +138,7 @@ export class IconButton extends React.PureComponent { } let contents = ( - + <> + ); if (href != null) { diff --git a/app/javascript/flavours/glitch/components/icon_with_badge.tsx b/app/javascript/flavours/glitch/components/icon_with_badge.tsx index e427b7172b..319c0b2389 100644 --- a/app/javascript/flavours/glitch/components/icon_with_badge.tsx +++ b/app/javascript/flavours/glitch/components/icon_with_badge.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import { Icon } from './icon'; diff --git a/app/javascript/flavours/glitch/components/inline_account.jsx b/app/javascript/flavours/glitch/components/inline_account.jsx index eeb58b5533..98e44c05e0 100644 --- a/app/javascript/flavours/glitch/components/inline_account.jsx +++ b/app/javascript/flavours/glitch/components/inline_account.jsx @@ -1,8 +1,10 @@ -import React from 'react'; +import { PureComponent } from 'react'; + import ImmutablePropTypes from 'react-immutable-proptypes'; import { connect } from 'react-redux'; -import { makeGetAccount } from 'flavours/glitch/selectors'; + import { Avatar } from 'flavours/glitch/components/avatar'; +import { makeGetAccount } from 'flavours/glitch/selectors'; const makeMapStateToProps = () => { const getAccount = makeGetAccount(); @@ -14,7 +16,7 @@ const makeMapStateToProps = () => { return mapStateToProps; }; -class InlineAccount extends React.PureComponent { +class InlineAccount extends PureComponent { static propTypes = { account: ImmutablePropTypes.map.isRequired, diff --git a/app/javascript/flavours/glitch/components/intersection_observer_article.jsx b/app/javascript/flavours/glitch/components/intersection_observer_article.jsx index 6c00e557d0..bef40c07fa 100644 --- a/app/javascript/flavours/glitch/components/intersection_observer_article.jsx +++ b/app/javascript/flavours/glitch/components/intersection_observer_article.jsx @@ -1,12 +1,12 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import scheduleIdleTask from '../features/ui/util/schedule_idle_task'; -import getRectFromEntry from '../features/ui/util/get_rect_from_entry'; +import { cloneElement, Component } from 'react'; +import getRectFromEntry from '../features/ui/util/get_rect_from_entry'; +import scheduleIdleTask from '../features/ui/util/schedule_idle_task'; // Diff these props in the "unrendered" state const updateOnPropsForUnrendered = ['id', 'index', 'listLength', 'cachedHeight']; -export default class IntersectionObserverArticle extends React.Component { +export default class IntersectionObserverArticle extends Component { static propTypes = { intersectionObserverWrapper: PropTypes.object.isRequired, @@ -123,7 +123,7 @@ export default class IntersectionObserverArticle extends React.Component { tabIndex={0} style={style} > - {children && React.cloneElement(children, { hidden: !isIntersecting && (isHidden || !!cachedHeight) })} + {children && cloneElement(children, { hidden: !isIntersecting && (isHidden || !!cachedHeight) })} ); } diff --git a/app/javascript/flavours/glitch/components/link.jsx b/app/javascript/flavours/glitch/components/link.jsx index bbec121a86..9babe7320f 100644 --- a/app/javascript/flavours/glitch/components/link.jsx +++ b/app/javascript/flavours/glitch/components/link.jsx @@ -2,13 +2,13 @@ // ~ 😘 kibi! // Package imports. -import classNames from 'classnames'; import PropTypes from 'prop-types'; -import React from 'react'; +import { PureComponent } from 'react'; + +import classNames from 'classnames'; // Utils. import { assignHandlers } from 'flavours/glitch/utils/react_helpers'; - // Handlers. const handlers = { @@ -25,7 +25,7 @@ const handlers = { }; // The component. -export default class Link extends React.PureComponent { +export default class Link extends PureComponent { // Constructor. constructor (props) { diff --git a/app/javascript/flavours/glitch/components/load_gap.jsx b/app/javascript/flavours/glitch/components/load_gap.jsx deleted file mode 100644 index 9c81df6323..0000000000 --- a/app/javascript/flavours/glitch/components/load_gap.jsx +++ /dev/null @@ -1,35 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import { injectIntl, defineMessages } from 'react-intl'; -import { Icon } from 'flavours/glitch/components/icon'; - -const messages = defineMessages({ - load_more: { id: 'status.load_more', defaultMessage: 'Load more' }, -}); - -class LoadGap extends React.PureComponent { - - static propTypes = { - disabled: PropTypes.bool, - maxId: PropTypes.string, - onClick: PropTypes.func.isRequired, - intl: PropTypes.object.isRequired, - }; - - handleClick = () => { - this.props.onClick(this.props.maxId); - }; - - render () { - const { disabled, intl } = this.props; - - return ( - - ); - } - -} - -export default injectIntl(LoadGap); diff --git a/app/javascript/flavours/glitch/components/load_gap.tsx b/app/javascript/flavours/glitch/components/load_gap.tsx new file mode 100644 index 0000000000..52d701d5d5 --- /dev/null +++ b/app/javascript/flavours/glitch/components/load_gap.tsx @@ -0,0 +1,36 @@ +import { useCallback } from 'react'; + +import type { InjectedIntl } from 'react-intl'; +import { injectIntl, defineMessages } from 'react-intl'; + +import { Icon } from 'flavours/glitch/components/icon'; + +const messages = defineMessages({ + load_more: { id: 'status.load_more', defaultMessage: 'Load more' }, +}); + +interface Props { + disabled: boolean; + maxId: string; + onClick: (maxId: string) => void; + intl: InjectedIntl; +} + +const _LoadGap: React.FC = ({ disabled, maxId, onClick, intl }) => { + const handleClick = useCallback(() => { + onClick(maxId); + }, [maxId, onClick]); + + return ( + + ); +}; + +export const LoadGap = injectIntl(_LoadGap); diff --git a/app/javascript/flavours/glitch/components/load_more.jsx b/app/javascript/flavours/glitch/components/load_more.jsx index ab9428e35a..1cdf6836d2 100644 --- a/app/javascript/flavours/glitch/components/load_more.jsx +++ b/app/javascript/flavours/glitch/components/load_more.jsx @@ -1,8 +1,9 @@ -import React from 'react'; -import { FormattedMessage } from 'react-intl'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; -export default class LoadMore extends React.PureComponent { +import { FormattedMessage } from 'react-intl'; + +export default class LoadMore extends PureComponent { static propTypes = { onClick: PropTypes.func, diff --git a/app/javascript/flavours/glitch/components/load_pending.jsx b/app/javascript/flavours/glitch/components/load_pending.jsx index a75259146a..e9c1a97836 100644 --- a/app/javascript/flavours/glitch/components/load_pending.jsx +++ b/app/javascript/flavours/glitch/components/load_pending.jsx @@ -1,8 +1,9 @@ -import React from 'react'; -import { FormattedMessage } from 'react-intl'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; -export default class LoadPending extends React.PureComponent { +import { FormattedMessage } from 'react-intl'; + +export default class LoadPending extends PureComponent { static propTypes = { onClick: PropTypes.func, diff --git a/app/javascript/flavours/glitch/components/loading_indicator.jsx b/app/javascript/flavours/glitch/components/loading_indicator.jsx index 59f721c50f..708b71d0f0 100644 --- a/app/javascript/flavours/glitch/components/loading_indicator.jsx +++ b/app/javascript/flavours/glitch/components/loading_indicator.jsx @@ -1,4 +1,3 @@ -import React from 'react'; import PropTypes from 'prop-types'; export const CircularProgress = ({ size, strokeWidth }) => { diff --git a/app/javascript/flavours/glitch/components/logo.jsx b/app/javascript/flavours/glitch/components/logo.jsx index 60e8f40b23..16ca9f80fd 100644 --- a/app/javascript/flavours/glitch/components/logo.jsx +++ b/app/javascript/flavours/glitch/components/logo.jsx @@ -1,4 +1,3 @@ -import React from 'react'; import logo from 'mastodon/../images/logo.svg'; export const WordmarkLogo = () => ( diff --git a/app/javascript/flavours/glitch/components/media_attachments.jsx b/app/javascript/flavours/glitch/components/media_attachments.jsx index b11d3526f9..2c1c2831eb 100644 --- a/app/javascript/flavours/glitch/components/media_attachments.jsx +++ b/app/javascript/flavours/glitch/components/media_attachments.jsx @@ -1,11 +1,13 @@ -import React from 'react'; import PropTypes from 'prop-types'; + import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import { MediaGallery, Video, Audio } from 'flavours/glitch/features/ui/util/async-components'; -import Bundle from 'flavours/glitch/features/ui/components/bundle'; + import noop from 'lodash/noop'; +import Bundle from 'flavours/glitch/features/ui/components/bundle'; +import { MediaGallery, Video, Audio } from 'flavours/glitch/features/ui/util/async-components'; + export default class MediaAttachments extends ImmutablePureComponent { static propTypes = { diff --git a/app/javascript/flavours/glitch/components/media_gallery.jsx b/app/javascript/flavours/glitch/components/media_gallery.jsx index 33ddb8a29c..19635ba255 100644 --- a/app/javascript/flavours/glitch/components/media_gallery.jsx +++ b/app/javascript/flavours/glitch/components/media_gallery.jsx @@ -1,13 +1,19 @@ -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 { PureComponent } from 'react'; + import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; + import classNames from 'classnames'; -import { autoPlayGif, displayMedia, useBlurhash } from 'flavours/glitch/initial_state'; + +import { is } from 'immutable'; +import ImmutablePropTypes from 'react-immutable-proptypes'; + import { debounce } from 'lodash'; + import { Blurhash } from 'flavours/glitch/components/blurhash'; +import { autoPlayGif, displayMedia, useBlurhash } from 'flavours/glitch/initial_state'; + +import { IconButton } from './icon_button'; const messages = defineMessages({ hidden: { @@ -32,7 +38,7 @@ const messages = defineMessages({ }, }); -class Item extends React.PureComponent { +class Item extends PureComponent { static propTypes = { attachment: ImmutablePropTypes.map.isRequired, @@ -217,7 +223,7 @@ class Item extends React.PureComponent { } -class MediaGallery extends React.PureComponent { +class MediaGallery extends PureComponent { static propTypes = { sensitive: PropTypes.bool, diff --git a/app/javascript/flavours/glitch/components/modal_root.jsx b/app/javascript/flavours/glitch/components/modal_root.jsx index f08542e7fc..a99c51f924 100644 --- a/app/javascript/flavours/glitch/components/modal_root.jsx +++ b/app/javascript/flavours/glitch/components/modal_root.jsx @@ -1,10 +1,11 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import 'wicg-inert'; -import { createBrowserHistory } from 'history'; -import { multiply } from 'color-blend'; +import { PureComponent } from 'react'; -export default class ModalRoot extends React.PureComponent { +import 'wicg-inert'; +import { multiply } from 'color-blend'; +import { createBrowserHistory } from 'history'; + +export default class ModalRoot extends PureComponent { static contextTypes = { router: PropTypes.object, diff --git a/app/javascript/flavours/glitch/components/navigation_portal.jsx b/app/javascript/flavours/glitch/components/navigation_portal.jsx index 9e84941793..e142a3ec60 100644 --- a/app/javascript/flavours/glitch/components/navigation_portal.jsx +++ b/app/javascript/flavours/glitch/components/navigation_portal.jsx @@ -1,21 +1,21 @@ -import React from 'react'; +import { PureComponent } from 'react'; + import { Switch, Route, withRouter } from 'react-router-dom'; -import { showTrends } from 'flavours/glitch/initial_state'; -import Trends from 'flavours/glitch/features/getting_started/containers/trends_container'; + import AccountNavigation from 'flavours/glitch/features/account/navigation'; +import Trends from 'flavours/glitch/features/getting_started/containers/trends_container'; +import { showTrends } from 'flavours/glitch/initial_state'; const DefaultNavigation = () => ( - <> - {showTrends && ( - <> -
- - - )} - + showTrends ? ( + <> +
+ + + ) : null ); -class NavigationPortal extends React.PureComponent { +class NavigationPortal extends PureComponent { render () { return ( 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 ce94c5d873..d0eedc6412 100644 --- a/app/javascript/flavours/glitch/components/not_signed_in_indicator.tsx +++ b/app/javascript/flavours/glitch/components/not_signed_in_indicator.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import { FormattedMessage } from 'react-intl'; diff --git a/app/javascript/flavours/glitch/components/notification_purge_buttons.jsx b/app/javascript/flavours/glitch/components/notification_purge_buttons.jsx index 532eb4358c..dfc7ac5a8a 100644 --- a/app/javascript/flavours/glitch/components/notification_purge_buttons.jsx +++ b/app/javascript/flavours/glitch/components/notification_purge_buttons.jsx @@ -6,13 +6,16 @@ // Package imports // -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 classNames from 'classnames'; +import ImmutablePureComponent from 'react-immutable-pure-component'; + +import { Icon } from 'flavours/glitch/components/icon'; + const messages = defineMessages({ btnAll : { id: 'notification_purge.btn_all', defaultMessage: 'Select\nall' }, btnNone : { id: 'notification_purge.btn_none', defaultMessage: 'Select\nnone' }, diff --git a/app/javascript/flavours/glitch/components/permalink.jsx b/app/javascript/flavours/glitch/components/permalink.jsx index 1c58431836..fa33ce066a 100644 --- a/app/javascript/flavours/glitch/components/permalink.jsx +++ b/app/javascript/flavours/glitch/components/permalink.jsx @@ -1,7 +1,7 @@ -import React from 'react'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; -export default class Permalink extends React.PureComponent { +export default class Permalink extends PureComponent { static contextTypes = { router: PropTypes.object, 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 e8c9611a34..1a290c91de 100644 --- a/app/javascript/flavours/glitch/components/picture_in_picture_placeholder.jsx +++ b/app/javascript/flavours/glitch/components/picture_in_picture_placeholder.jsx @@ -1,11 +1,14 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import { Icon } from 'flavours/glitch/components/icon'; -import { removePictureInPicture } from 'flavours/glitch/actions/picture_in_picture'; -import { connect } from 'react-redux'; +import { PureComponent } from 'react'; + import { FormattedMessage } from 'react-intl'; -class PictureInPicturePlaceholder extends React.PureComponent { +import { connect } from 'react-redux'; + +import { removePictureInPicture } from 'flavours/glitch/actions/picture_in_picture'; +import { Icon } from 'flavours/glitch/components/icon'; + +class PictureInPicturePlaceholder extends PureComponent { static propTypes = { dispatch: PropTypes.func.isRequired, diff --git a/app/javascript/flavours/glitch/components/poll.jsx b/app/javascript/flavours/glitch/components/poll.jsx index df23919563..3ac9a22730 100644 --- a/app/javascript/flavours/glitch/components/poll.jsx +++ b/app/javascript/flavours/glitch/components/poll.jsx @@ -1,15 +1,21 @@ -import React from 'react'; import PropTypes from 'prop-types'; + +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; + +import classNames from 'classnames'; + import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import classNames from 'classnames'; -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 spring from 'react-motion/lib/spring'; + import { Icon } from 'flavours/glitch/components/icon'; +import emojify from 'flavours/glitch/features/emoji/emoji'; +import Motion from 'flavours/glitch/features/ui/util/optional_motion'; + +import { RelativeTimestamp } from './relative_timestamp'; + 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 67acb09f42..fbd7859d80 100644 --- a/app/javascript/flavours/glitch/components/radio_button.tsx +++ b/app/javascript/flavours/glitch/components/radio_button.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import classNames from 'classnames'; diff --git a/app/javascript/flavours/glitch/components/regeneration_indicator.jsx b/app/javascript/flavours/glitch/components/regeneration_indicator.jsx index 68ce09df9b..78844f389d 100644 --- a/app/javascript/flavours/glitch/components/regeneration_indicator.jsx +++ b/app/javascript/flavours/glitch/components/regeneration_indicator.jsx @@ -1,5 +1,5 @@ -import React from 'react'; import { FormattedMessage } from 'react-intl'; + import illustration from 'flavours/glitch/images/elephant_ui_working.svg'; const RegenerationIndicator = () => ( diff --git a/app/javascript/flavours/glitch/components/relative_timestamp.tsx b/app/javascript/flavours/glitch/components/relative_timestamp.tsx index e0e0d4bb53..aaa424dca6 100644 --- a/app/javascript/flavours/glitch/components/relative_timestamp.tsx +++ b/app/javascript/flavours/glitch/components/relative_timestamp.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import { Component } from 'react'; import type { InjectedIntl } from 'react-intl'; import { injectIntl, defineMessages } from 'react-intl'; @@ -199,7 +199,7 @@ interface Props { interface States { now: number; } -class RelativeTimestamp extends React.Component { +class RelativeTimestamp extends Component { state = { now: this.props.intl.now(), }; diff --git a/app/javascript/flavours/glitch/components/scrollable_list.jsx b/app/javascript/flavours/glitch/components/scrollable_list.jsx index 69925321bd..e7f447f58d 100644 --- a/app/javascript/flavours/glitch/components/scrollable_list.jsx +++ b/app/javascript/flavours/glitch/components/scrollable_list.jsx @@ -1,17 +1,23 @@ -import React, { PureComponent } from 'react'; -import ScrollContainer from 'flavours/glitch/containers/scroll_container'; import PropTypes from 'prop-types'; +import { Children, cloneElement, PureComponent } from 'react'; + +import classNames from 'classnames'; + +import { List as ImmutableList } from 'immutable'; +import { connect } from 'react-redux'; + +import { supportsPassiveEvents } from 'detect-passive-events'; +import { throttle } from 'lodash'; + import IntersectionObserverArticleContainer from 'flavours/glitch/containers/intersection_observer_article_container'; +import ScrollContainer from 'flavours/glitch/containers/scroll_container'; +import IntersectionObserverWrapper from 'flavours/glitch/features/ui/util/intersection_observer_wrapper'; + +import { attachFullscreenListener, detachFullscreenListener, isFullscreen } from '../features/ui/util/fullscreen'; + import LoadMore from './load_more'; import LoadPending from './load_pending'; -import IntersectionObserverWrapper from 'flavours/glitch/features/ui/util/intersection_observer_wrapper'; -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'; const MOUSE_IDLE_DELAY = 300; @@ -184,8 +190,8 @@ class ScrollableList extends PureComponent { }; getSnapshotBeforeUpdate (prevProps) { - const someItemInserted = React.Children.count(prevProps.children) > 0 && - React.Children.count(prevProps.children) < React.Children.count(this.props.children) && + const someItemInserted = Children.count(prevProps.children) > 0 && + Children.count(prevProps.children) < Children.count(this.props.children) && this.getFirstChildKey(prevProps) !== this.getFirstChildKey(this.props); const pendingChanged = (prevProps.numPending > 0) !== (this.props.numPending > 0); @@ -293,7 +299,7 @@ class ScrollableList extends PureComponent { render () { const { children, scrollKey, trackScroll, showLoading, isLoading, hasMore, numPending, prepend, alwaysPrepend, append, emptyMessage, onLoadMore } = this.props; const { fullscreen } = this.state; - const childrenCount = React.Children.count(children); + const childrenCount = Children.count(children); const loadMore = (hasMore && onLoadMore) ? : null; const loadPending = (numPending > 0) ? : null; @@ -319,7 +325,7 @@ class ScrollableList extends PureComponent { {loadPending} - {React.Children.map(this.props.children, (child, index) => ( + {Children.map(this.props.children, (child, index) => ( - {React.cloneElement(child, { + {cloneElement(child, { getScrollPosition: this.getScrollPosition, updateScrollBottom: this.updateScrollBottom, cachedMediaWidth: this.state.cachedMediaWidth, diff --git a/app/javascript/flavours/glitch/components/server_banner.jsx b/app/javascript/flavours/glitch/components/server_banner.jsx index 25ec405603..4809df1ddc 100644 --- a/app/javascript/flavours/glitch/components/server_banner.jsx +++ b/app/javascript/flavours/glitch/components/server_banner.jsx @@ -1,14 +1,18 @@ import PropTypes from 'prop-types'; -import React from 'react'; +import { PureComponent } from 'react'; + import { FormattedMessage, defineMessages, injectIntl } from 'react-intl'; + +import { Link } from 'react-router-dom'; + import { connect } from 'react-redux'; + import { fetchServer } from 'flavours/glitch/actions/server'; +import { ServerHeroImage } from 'flavours/glitch/components/server_hero_image'; 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 { ServerHeroImage } from 'flavours/glitch/components/server_hero_image'; -import { Link } from 'react-router-dom'; const messages = defineMessages({ aboutActiveUsers: { id: 'server_banner.about_active_users', defaultMessage: 'People using this server during the last 30 days (Monthly Active Users)' }, @@ -18,7 +22,7 @@ const mapStateToProps = state => ({ server: state.getIn(['server', 'server']), }); -class ServerBanner extends React.PureComponent { +class ServerBanner extends PureComponent { static propTypes = { server: PropTypes.object, diff --git a/app/javascript/flavours/glitch/components/server_hero_image.tsx b/app/javascript/flavours/glitch/components/server_hero_image.tsx index 973d1d1b37..be05059e49 100644 --- a/app/javascript/flavours/glitch/components/server_hero_image.tsx +++ b/app/javascript/flavours/glitch/components/server_hero_image.tsx @@ -1,4 +1,5 @@ -import React, { useCallback, useState } from 'react'; +import { useCallback, useState } from 'react'; +import * as React from 'react'; import classNames from 'classnames'; diff --git a/app/javascript/flavours/glitch/components/setting_text.jsx b/app/javascript/flavours/glitch/components/setting_text.jsx index 3a21a06018..79d4bf8ea3 100644 --- a/app/javascript/flavours/glitch/components/setting_text.jsx +++ b/app/javascript/flavours/glitch/components/setting_text.jsx @@ -1,8 +1,9 @@ -import React from 'react'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + import ImmutablePropTypes from 'react-immutable-proptypes'; -export default class SettingText extends React.PureComponent { +export default class SettingText extends PureComponent { static propTypes = { settings: ImmutablePropTypes.map.isRequired, diff --git a/app/javascript/flavours/glitch/components/short_number.jsx b/app/javascript/flavours/glitch/components/short_number.jsx index 0c40941c0d..0ddd26e783 100644 --- a/app/javascript/flavours/glitch/components/short_number.jsx +++ b/app/javascript/flavours/glitch/components/short_number.jsx @@ -1,7 +1,9 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import { toShortNumber, pluralReady, DECIMAL_UNITS } from '../utils/numbers'; +import { memo } from 'react'; + import { FormattedMessage, FormattedNumber } from 'react-intl'; + +import { toShortNumber, pluralReady, DECIMAL_UNITS } from '../utils/numbers'; // @ts-check /** @@ -109,4 +111,4 @@ ShortNumberCounter.propTypes = { value: PropTypes.arrayOf(PropTypes.number), }; -export default React.memo(ShortNumber); +export default memo(ShortNumber); diff --git a/app/javascript/flavours/glitch/components/skeleton.tsx b/app/javascript/flavours/glitch/components/skeleton.tsx index 8d43e6827d..30ff0d8525 100644 --- a/app/javascript/flavours/glitch/components/skeleton.tsx +++ b/app/javascript/flavours/glitch/components/skeleton.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; interface Props { width?: number | string; diff --git a/app/javascript/flavours/glitch/components/status.jsx b/app/javascript/flavours/glitch/components/status.jsx index 441936a431..cd7b26881e 100644 --- a/app/javascript/flavours/glitch/components/status.jsx +++ b/app/javascript/flavours/glitch/components/status.jsx @@ -1,27 +1,30 @@ -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import StatusPrepend from './status_prepend'; + +import { injectIntl, FormattedMessage } from 'react-intl'; + +import classNames from 'classnames'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; + +import { HotKeys } from 'react-hotkeys'; + +import PictureInPicturePlaceholder from 'flavours/glitch/components/picture_in_picture_placeholder'; +import PollContainer from 'flavours/glitch/containers/poll_container'; +import NotificationOverlayContainer from 'flavours/glitch/features/notifications/containers/overlay_container'; +import { displayMedia } from 'flavours/glitch/initial_state'; +import { autoUnfoldCW } from 'flavours/glitch/utils/content_warning'; + +import Card from '../features/status/components/card'; +import Bundle from '../features/ui/components/bundle'; +import { MediaGallery, Video, Audio } from '../features/ui/util/async-components'; + +import AttachmentList from './attachment_list'; +import StatusActionBar from './status_action_bar'; +import StatusContent from './status_content'; import StatusHeader from './status_header'; import StatusIcons from './status_icons'; -import StatusContent from './status_content'; -import StatusActionBar from './status_action_bar'; -import AttachmentList from './attachment_list'; -import Card from '../features/status/components/card'; -import { injectIntl, FormattedMessage } from 'react-intl'; -import ImmutablePureComponent from 'react-immutable-pure-component'; -import { MediaGallery, Video, Audio } from '../features/ui/util/async-components'; -import { HotKeys } from 'react-hotkeys'; -import NotificationOverlayContainer from 'flavours/glitch/features/notifications/containers/overlay_container'; -import classNames from 'classnames'; -import { autoUnfoldCW } from 'flavours/glitch/utils/content_warning'; -import PollContainer from 'flavours/glitch/containers/poll_container'; -import { displayMedia } from 'flavours/glitch/initial_state'; -import PictureInPicturePlaceholder from 'flavours/glitch/components/picture_in_picture_placeholder'; - -// We use the component (and not the container) since we do not want -// to use the progress bar to show download progress -import Bundle from '../features/ui/components/bundle'; +import StatusPrepend from './status_prepend'; export const textForScreenReader = (intl, status, rebloggedByText = false, expanded = false) => { const displayName = status.getIn(['account', 'display_name']); diff --git a/app/javascript/flavours/glitch/components/status_action_bar.jsx b/app/javascript/flavours/glitch/components/status_action_bar.jsx index 20f6dd800a..65b822be8d 100644 --- a/app/javascript/flavours/glitch/components/status_action_bar.jsx +++ b/app/javascript/flavours/glitch/components/status_action_bar.jsx @@ -1,15 +1,19 @@ -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -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 { accountAdminLink, statusAdminLink } from 'flavours/glitch/utils/backend_links'; + import classNames from 'classnames'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; + +import DropdownMenuContainer from 'flavours/glitch/containers/dropdown_menu_container'; +import { me } from 'flavours/glitch/initial_state'; import { PERMISSION_MANAGE_USERS, PERMISSION_MANAGE_FEDERATION } from 'flavours/glitch/permissions'; +import { accountAdminLink, statusAdminLink } from 'flavours/glitch/utils/backend_links'; + +import { IconButton } from './icon_button'; +import { RelativeTimestamp } from './relative_timestamp'; const messages = defineMessages({ delete: { id: 'status.delete', defaultMessage: 'Delete' }, @@ -99,7 +103,6 @@ class StatusActionBar extends ImmutablePureComponent { handleShareClick = () => { navigator.share({ - text: this.props.status.get('search_index'), url: this.props.status.get('url'), }); }; @@ -218,6 +221,10 @@ class StatusActionBar extends ImmutablePureComponent { menu.push({ text: intl.formatMessage(messages.copy), action: this.handleCopy }); + if (publicStatus && 'share' in navigator) { + menu.push({ text: intl.formatMessage(messages.share), action: this.handleShareClick }); + } + if (publicStatus) { menu.push({ text: intl.formatMessage(messages.embed), action: this.handleEmbed }); } @@ -277,10 +284,6 @@ class StatusActionBar extends ImmutablePureComponent { replyTitle = intl.formatMessage(messages.replyAll); } - const shareButton = ('share' in navigator) && publicStatus && ( - - ); - const reblogPrivate = status.getIn(['account', 'id']) === me && status.get('visibility') === 'private'; let reblogTitle = ''; @@ -310,7 +313,6 @@ class StatusActionBar extends ImmutablePureComponent { /> - {shareButton} {filterButton} diff --git a/app/javascript/flavours/glitch/components/status_content.jsx b/app/javascript/flavours/glitch/components/status_content.jsx index 3fefef2c93..c7fcf37741 100644 --- a/app/javascript/flavours/glitch/components/status_content.jsx +++ b/app/javascript/flavours/glitch/components/status_content.jsx @@ -1,14 +1,19 @@ -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + import { FormattedMessage, injectIntl } from 'react-intl'; -import Permalink from './permalink'; -import { connect } from 'react-redux'; + import classnames from 'classnames'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; +import { connect } from 'react-redux'; + 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'; +import Permalink from './permalink'; + const textMatchesTarget = (text, origin, host) => { return (text === origin || text === host || text.startsWith(origin + '/') || text.startsWith(host + '/') @@ -63,7 +68,7 @@ const isLinkMisleading = (link) => { return !(textMatchesTarget(text, origin, host) || textMatchesTarget(text.toLowerCase(), origin, host)); }; -class TranslateButton extends React.PureComponent { +class TranslateButton extends PureComponent { static propTypes = { translation: ImmutablePropTypes.map, @@ -104,7 +109,7 @@ const mapStateToProps = state => ({ languages: state.getIn(['server', 'translationLanguages', 'items']), }); -class StatusContent extends React.PureComponent { +class StatusContent extends PureComponent { static contextTypes = { identity: PropTypes.object, diff --git a/app/javascript/flavours/glitch/components/status_header.jsx b/app/javascript/flavours/glitch/components/status_header.jsx index 8f54613579..cf7ab5365e 100644 --- a/app/javascript/flavours/glitch/components/status_header.jsx +++ b/app/javascript/flavours/glitch/components/status_header.jsx @@ -1,6 +1,7 @@ // Package imports. -import React from 'react'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + import ImmutablePropTypes from 'react-immutable-proptypes'; // Mastodon imports. @@ -8,7 +9,7 @@ import { Avatar } from './avatar'; import AvatarOverlay from './avatar_overlay'; import { DisplayName } from './display_name'; -export default class StatusHeader extends React.PureComponent { +export default class StatusHeader extends PureComponent { static propTypes = { status: ImmutablePropTypes.map.isRequired, diff --git a/app/javascript/flavours/glitch/components/status_icons.jsx b/app/javascript/flavours/glitch/components/status_icons.jsx index 59912d4391..a30f2c4df7 100644 --- a/app/javascript/flavours/glitch/components/status_icons.jsx +++ b/app/javascript/flavours/glitch/components/status_icons.jsx @@ -1,15 +1,19 @@ // Package imports. -import React from 'react'; import PropTypes from 'prop-types'; -import ImmutablePropTypes from 'react-immutable-proptypes'; +import { PureComponent } from 'react'; + import { defineMessages, injectIntl } from 'react-intl'; +import ImmutablePropTypes from 'react-immutable-proptypes'; + + // Mastodon imports. -import { IconButton } from './icon_button'; -import VisibilityIcon from './status_visibility_icon'; import { Icon } from 'flavours/glitch/components/icon'; import { languages } from 'flavours/glitch/initial_state'; +import { IconButton } from './icon_button'; +import VisibilityIcon from './status_visibility_icon'; + // Messages for use with internationalization stuff. const messages = defineMessages({ collapse: { id: 'status.collapse', defaultMessage: 'Collapse' }, @@ -40,7 +44,7 @@ LanguageIcon.propTypes = { language: PropTypes.string.isRequired, }; -class StatusIcons extends React.PureComponent { +class StatusIcons extends PureComponent { static propTypes = { status: ImmutablePropTypes.map.isRequired, diff --git a/app/javascript/flavours/glitch/components/status_list.jsx b/app/javascript/flavours/glitch/components/status_list.jsx index a225883a82..f28c42582c 100644 --- a/app/javascript/flavours/glitch/components/status_list.jsx +++ b/app/javascript/flavours/glitch/components/status_list.jsx @@ -1,12 +1,15 @@ -import { debounce } from 'lodash'; -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import StatusContainer from 'flavours/glitch/containers/status_container'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import LoadGap from './load_gap'; -import ScrollableList from './scrollable_list'; + +import { debounce } from 'lodash'; + import RegenerationIndicator from 'flavours/glitch/components/regeneration_indicator'; +import StatusContainer from 'flavours/glitch/containers/status_container'; + +import { LoadGap } from './load_gap'; +import ScrollableList from './scrollable_list'; export default class StatusList extends ImmutablePureComponent { diff --git a/app/javascript/flavours/glitch/components/status_prepend.jsx b/app/javascript/flavours/glitch/components/status_prepend.jsx index 127636c51d..9b2bcc8ea1 100644 --- a/app/javascript/flavours/glitch/components/status_prepend.jsx +++ b/app/javascript/flavours/glitch/components/status_prepend.jsx @@ -1,12 +1,15 @@ // Package imports // -import React from 'react'; import PropTypes from 'prop-types'; -import ImmutablePropTypes from 'react-immutable-proptypes'; +import { PureComponent } from 'react'; + import { FormattedMessage } from 'react-intl'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; + import { Icon } from 'flavours/glitch/components/icon'; import { me } from 'flavours/glitch/initial_state'; -export default class StatusPrepend extends React.PureComponent { +export default class StatusPrepend extends PureComponent { static propTypes = { type: PropTypes.string.isRequired, diff --git a/app/javascript/flavours/glitch/components/status_visibility_icon.jsx b/app/javascript/flavours/glitch/components/status_visibility_icon.jsx index cee56a2391..ad84af4def 100644 --- a/app/javascript/flavours/glitch/components/status_visibility_icon.jsx +++ b/app/javascript/flavours/glitch/components/status_visibility_icon.jsx @@ -1,14 +1,16 @@ // Package imports // -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'; const messages = defineMessages({ public: { id: 'privacy.public.short', defaultMessage: 'Public' }, unlisted: { id: 'privacy.unlisted.short', defaultMessage: 'Unlisted' }, - private: { id: 'privacy.private.short', defaultMessage: 'Followers-only' }, + private: { id: 'privacy.private.short', defaultMessage: 'Followers only' }, direct: { id: 'privacy.direct.short', defaultMessage: 'Mentioned people only' }, }); diff --git a/app/javascript/flavours/glitch/components/timeline_hint.tsx b/app/javascript/flavours/glitch/components/timeline_hint.tsx index 712b4c293b..df7787bf67 100644 --- a/app/javascript/flavours/glitch/components/timeline_hint.tsx +++ b/app/javascript/flavours/glitch/components/timeline_hint.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import { FormattedMessage } from 'react-intl'; diff --git a/app/javascript/flavours/glitch/containers/account_container.jsx b/app/javascript/flavours/glitch/containers/account_container.jsx index 5b57d730f0..f204545852 100644 --- a/app/javascript/flavours/glitch/containers/account_container.jsx +++ b/app/javascript/flavours/glitch/containers/account_container.jsx @@ -1,8 +1,7 @@ -import React from 'react'; -import { connect } from 'react-redux'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import { makeGetAccount } from 'flavours/glitch/selectors'; -import Account from 'flavours/glitch/components/account'; + +import { connect } from 'react-redux'; + import { followAccount, unfollowAccount, @@ -13,7 +12,9 @@ import { } from 'flavours/glitch/actions/accounts'; import { openModal } from 'flavours/glitch/actions/modal'; import { initMuteModal } from 'flavours/glitch/actions/mutes'; +import Account from 'flavours/glitch/components/account'; import { unfollowModal } from 'flavours/glitch/initial_state'; +import { makeGetAccount } from 'flavours/glitch/selectors'; const messages = defineMessages({ unfollowConfirm: { id: 'confirmations.unfollow.confirm', defaultMessage: 'Unfollow' }, @@ -34,10 +35,13 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ onFollow (account) { if (account.getIn(['relationship', 'following']) || account.getIn(['relationship', 'requested'])) { if (unfollowModal) { - dispatch(openModal('CONFIRM', { - message: @{account.get('acct')} }} />, - confirm: intl.formatMessage(messages.unfollowConfirm), - onConfirm: () => dispatch(unfollowAccount(account.get('id'))), + dispatch(openModal({ + modalType: 'CONFIRM', + modalProps: { + message: @{account.get('acct')} }} />, + confirm: intl.formatMessage(messages.unfollowConfirm), + onConfirm: () => dispatch(unfollowAccount(account.get('id'))), + }, })); } else { dispatch(unfollowAccount(account.get('id'))); diff --git a/app/javascript/flavours/glitch/containers/admin_component.jsx b/app/javascript/flavours/glitch/containers/admin_component.jsx index 64dabac8ba..d73189d66d 100644 --- a/app/javascript/flavours/glitch/containers/admin_component.jsx +++ b/app/javascript/flavours/glitch/containers/admin_component.jsx @@ -1,12 +1,14 @@ -import React from 'react'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + import { IntlProvider, addLocaleData } from 'react-intl'; + import { getLocale } from 'mastodon/locales'; const { localeData, messages } = getLocale(); addLocaleData(localeData); -export default class AdminComponent extends React.PureComponent { +export default class AdminComponent extends PureComponent { static propTypes = { locale: PropTypes.string.isRequired, diff --git a/app/javascript/flavours/glitch/containers/compose_container.jsx b/app/javascript/flavours/glitch/containers/compose_container.jsx index 9b84ed583d..a1edfb8450 100644 --- a/app/javascript/flavours/glitch/containers/compose_container.jsx +++ b/app/javascript/flavours/glitch/containers/compose_container.jsx @@ -1,13 +1,17 @@ -import React from 'react'; -import { Provider } from 'react-redux'; import PropTypes from 'prop-types'; -import { store } from 'flavours/glitch/store'; -import { hydrateStore } from 'flavours/glitch/actions/store'; +import { PureComponent } from 'react'; + import { IntlProvider, addLocaleData } from 'react-intl'; -import { getLocale } from 'mastodon/locales'; + +import { Provider } from 'react-redux'; + +import { fetchCustomEmojis } from 'flavours/glitch/actions/custom_emojis'; +import { hydrateStore } from 'flavours/glitch/actions/store'; import Compose from 'flavours/glitch/features/standalone/compose'; import initialState from 'flavours/glitch/initial_state'; -import { fetchCustomEmojis } from 'flavours/glitch/actions/custom_emojis'; +import { store } from 'flavours/glitch/store'; + +import { getLocale } from 'mastodon/locales'; const { localeData, messages } = getLocale(); addLocaleData(localeData); @@ -18,7 +22,7 @@ if (initialState) { store.dispatch(fetchCustomEmojis()); -export default class TimelineContainer extends React.PureComponent { +export default class TimelineContainer extends PureComponent { static propTypes = { locale: PropTypes.string.isRequired, diff --git a/app/javascript/flavours/glitch/containers/domain_container.jsx b/app/javascript/flavours/glitch/containers/domain_container.jsx index 419d5d29f5..c719a5775c 100644 --- a/app/javascript/flavours/glitch/containers/domain_container.jsx +++ b/app/javascript/flavours/glitch/containers/domain_container.jsx @@ -1,9 +1,10 @@ -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 { connect } from 'react-redux'; + +import { blockDomain, unblockDomain } from '../actions/domain_blocks'; import { openModal } from '../actions/modal'; +import { Domain } from '../components/domain'; const messages = defineMessages({ blockDomainConfirm: { id: 'confirmations.domain_block.confirm', defaultMessage: 'Block entire domain' }, @@ -17,10 +18,13 @@ const makeMapStateToProps = () => { const mapDispatchToProps = (dispatch, { intl }) => ({ onBlockDomain (domain) { - dispatch(openModal('CONFIRM', { - message: {domain} }} />, - confirm: intl.formatMessage(messages.blockDomainConfirm), - onConfirm: () => dispatch(blockDomain(domain)), + dispatch(openModal({ + modalType: 'CONFIRM', + modalProps: { + message: {domain} }} />, + confirm: intl.formatMessage(messages.blockDomainConfirm), + onConfirm: () => dispatch(blockDomain(domain)), + }, })); }, diff --git a/app/javascript/flavours/glitch/containers/dropdown_menu_container.js b/app/javascript/flavours/glitch/containers/dropdown_menu_container.js index 43ce8ca631..36aa4c4ea0 100644 --- a/app/javascript/flavours/glitch/containers/dropdown_menu_container.js +++ b/app/javascript/flavours/glitch/containers/dropdown_menu_container.js @@ -1,7 +1,9 @@ +import { connect } from 'react-redux'; + import { openDropdownMenu, closeDropdownMenu } from 'flavours/glitch/actions/dropdown_menu'; import { openModal, closeModal } from 'flavours/glitch/actions/modal'; -import { connect } from 'react-redux'; import DropdownMenu from 'flavours/glitch/components/dropdown_menu'; + import { isUserTouching } from '../is_mobile'; const mapStateToProps = state => ({ @@ -11,10 +13,13 @@ const mapStateToProps = state => ({ const mapDispatchToProps = (dispatch, { status, items, scrollKey }) => ({ onOpen(id, onItemClick, keyboard) { - dispatch(isUserTouching() ? openModal('ACTIONS', { - status, - actions: items, - onClick: onItemClick, + dispatch(isUserTouching() ? openModal({ + modalType: 'ACTIONS', + modalProps: { + status, + actions: items, + onClick: onItemClick, + }, }) : openDropdownMenu(id, keyboard, scrollKey)); }, diff --git a/app/javascript/flavours/glitch/containers/intersection_observer_article_container.js b/app/javascript/flavours/glitch/containers/intersection_observer_article_container.js index f2741f2d4f..11aedd5278 100644 --- a/app/javascript/flavours/glitch/containers/intersection_observer_article_container.js +++ b/app/javascript/flavours/glitch/containers/intersection_observer_article_container.js @@ -1,6 +1,7 @@ import { connect } from 'react-redux'; -import IntersectionObserverArticle from 'flavours/glitch/components/intersection_observer_article'; + import { setHeight } from 'flavours/glitch/actions/height_cache'; +import IntersectionObserverArticle from 'flavours/glitch/components/intersection_observer_article'; const makeMapStateToProps = (state, props) => ({ cachedHeight: state.getIn(['height_cache', props.saveHeightKey, props.id]), diff --git a/app/javascript/flavours/glitch/containers/mastodon.jsx b/app/javascript/flavours/glitch/containers/mastodon.jsx index 1044fdd160..8f46c1697c 100644 --- a/app/javascript/flavours/glitch/containers/mastodon.jsx +++ b/app/javascript/flavours/glitch/containers/mastodon.jsx @@ -1,18 +1,23 @@ import PropTypes from 'prop-types'; -import React from 'react'; -import { Helmet } from 'react-helmet'; +import { PureComponent } from 'react'; + import { IntlProvider, addLocaleData } from 'react-intl'; -import { Provider as ReduxProvider } from 'react-redux'; + +import { Helmet } from 'react-helmet'; import { BrowserRouter, Route } from 'react-router-dom'; + +import { Provider as ReduxProvider } from 'react-redux'; + import { ScrollContext } from 'react-router-scroll-4'; -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'; import { checkDeprecatedLocalSettings } from 'flavours/glitch/actions/local_settings'; +import { hydrateStore } from 'flavours/glitch/actions/store'; import { connectUserStream } from 'flavours/glitch/actions/streaming'; import ErrorBoundary from 'flavours/glitch/components/error_boundary'; +import UI from 'flavours/glitch/features/ui'; import initialState, { title as siteTitle } from 'flavours/glitch/initial_state'; +import { store } from 'flavours/glitch/store'; import { getLocale } from 'locales'; const { localeData, messages } = getLocale(); @@ -38,7 +43,7 @@ const createIdentityContext = state => ({ permissions: state.role ? state.role.permissions : 0, }); -export default class Mastodon extends React.PureComponent { +export default class Mastodon extends PureComponent { static propTypes = { locale: PropTypes.string.isRequired, diff --git a/app/javascript/flavours/glitch/containers/media_container.jsx b/app/javascript/flavours/glitch/containers/media_container.jsx index 99e1ed55c3..0d2f193daf 100644 --- a/app/javascript/flavours/glitch/containers/media_container.jsx +++ b/app/javascript/flavours/glitch/containers/media_container.jsx @@ -1,18 +1,22 @@ -import React, { PureComponent, Fragment } from 'react'; -import { createPortal } from 'react-dom'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; +import { createPortal } from 'react-dom'; + import { IntlProvider, addLocaleData } from 'react-intl'; + import { fromJS } from 'immutable'; -import { getLocale } from 'mastodon/locales'; -import { getScrollbarWidth } from 'flavours/glitch/utils/scrollbar'; -import MediaGallery from 'flavours/glitch/components/media_gallery'; -import Poll from 'flavours/glitch/components/poll'; + import { ImmutableHashtag as Hashtag } from 'flavours/glitch/components/hashtag'; +import MediaGallery from 'flavours/glitch/components/media_gallery'; import ModalRoot from 'flavours/glitch/components/modal_root'; +import Poll from 'flavours/glitch/components/poll'; +import Audio from 'flavours/glitch/features/audio'; +import Card from 'flavours/glitch/features/status/components/card'; import MediaModal from 'flavours/glitch/features/ui/components/media_modal'; import Video from 'flavours/glitch/features/video'; -import Card from 'flavours/glitch/features/status/components/card'; -import Audio from 'flavours/glitch/features/audio'; +import { getScrollbarWidth } from 'flavours/glitch/utils/scrollbar'; + +import { getLocale } from 'mastodon/locales'; const { localeData, messages } = getLocale(); addLocaleData(localeData); @@ -73,9 +77,16 @@ export default class MediaContainer extends PureComponent { render () { const { locale, components } = this.props; + let handleOpenVideo; + + // Don't offer to expand the video in a lightbox if we're in a frame + if (window.self === window.top) { + handleOpenVideo = this.handleOpenVideo; + } + return ( - + <> {[].map.call(components, (component, i) => { const componentName = component.getAttribute('data-component'); const Component = MEDIA_COMPONENTS[componentName]; @@ -89,7 +100,7 @@ export default class MediaContainer extends PureComponent { ...(componentName === 'Video' ? { componentIndex: i, - onOpenVideo: this.handleOpenVideo, + onOpenVideo: handleOpenVideo, } : { onOpenMedia: this.handleOpenMedia, }), @@ -115,7 +126,7 @@ export default class MediaContainer extends PureComponent { /> )} - + ); } diff --git a/app/javascript/flavours/glitch/containers/notification_purge_buttons_container.js b/app/javascript/flavours/glitch/containers/notification_purge_buttons_container.js index 2570cf4a56..144d77f135 100644 --- a/app/javascript/flavours/glitch/containers/notification_purge_buttons_container.js +++ b/app/javascript/flavours/glitch/containers/notification_purge_buttons_container.js @@ -1,15 +1,16 @@ // Package imports. -import { connect } from 'react-redux'; import { defineMessages, injectIntl } from 'react-intl'; +import { connect } from 'react-redux'; + // Our imports. -import NotificationPurgeButtons from 'flavours/glitch/components/notification_purge_buttons'; +import { openModal } from 'flavours/glitch/actions/modal'; import { deleteMarkedNotifications, enterNotificationClearingMode, markAllNotifications, } from 'flavours/glitch/actions/notifications'; -import { openModal } from 'flavours/glitch/actions/modal'; +import NotificationPurgeButtons from 'flavours/glitch/components/notification_purge_buttons'; const messages = defineMessages({ clearMessage: { id: 'notifications.marked_clear_confirmation', defaultMessage: 'Are you sure you want to permanently clear all selected notifications?' }, @@ -22,10 +23,13 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ }, onDeleteMarked() { - dispatch(openModal('CONFIRM', { - message: intl.formatMessage(messages.clearMessage), - confirm: intl.formatMessage(messages.clearConfirm), - onConfirm: () => dispatch(deleteMarkedNotifications()), + dispatch(openModal({ + modalType: 'CONFIRM', + modalProps: { + message: intl.formatMessage(messages.clearMessage), + confirm: intl.formatMessage(messages.clearConfirm), + onConfirm: () => dispatch(deleteMarkedNotifications()), + }, })); }, diff --git a/app/javascript/flavours/glitch/containers/poll_container.js b/app/javascript/flavours/glitch/containers/poll_container.js index 345351cc61..e25dd06148 100644 --- a/app/javascript/flavours/glitch/containers/poll_container.js +++ b/app/javascript/flavours/glitch/containers/poll_container.js @@ -1,8 +1,9 @@ import { connect } from 'react-redux'; + import { debounce } from 'lodash'; -import Poll from 'flavours/glitch/components/poll'; import { fetchPoll, vote } from 'flavours/glitch/actions/polls'; +import Poll from 'flavours/glitch/components/poll'; const mapDispatchToProps = (dispatch, { pollId }) => ({ refresh: debounce( diff --git a/app/javascript/flavours/glitch/containers/status_container.js b/app/javascript/flavours/glitch/containers/status_container.js index 27ba4e4260..5af818c8f5 100644 --- a/app/javascript/flavours/glitch/containers/status_container.js +++ b/app/javascript/flavours/glitch/containers/status_container.js @@ -1,11 +1,17 @@ +import { defineMessages, injectIntl } from 'react-intl'; + import { connect } from 'react-redux'; -import Status from 'flavours/glitch/components/status'; -import { makeGetStatus, makeGetPictureInPicture } from 'flavours/glitch/selectors'; + +import { initBlockModal } from 'flavours/glitch/actions/blocks'; +import { initBoostModal } from 'flavours/glitch/actions/boosts'; import { replyCompose, mentionCompose, directCompose, } from 'flavours/glitch/actions/compose'; +import { + initAddFilter, +} from 'flavours/glitch/actions/filters'; import { reblog, favourite, @@ -16,6 +22,11 @@ import { pin, unpin, } from 'flavours/glitch/actions/interactions'; +import { changeLocalSetting } from 'flavours/glitch/actions/local_settings'; +import { openModal } from 'flavours/glitch/actions/modal'; +import { initMuteModal } from 'flavours/glitch/actions/mutes'; +import { deployPictureInPicture } from 'flavours/glitch/actions/picture_in_picture'; +import { initReport } from 'flavours/glitch/actions/reports'; import { muteStatus, unmuteStatus, @@ -26,18 +37,10 @@ import { translateStatus, undoStatusTranslation, } from 'flavours/glitch/actions/statuses'; -import { - initAddFilter, -} from 'flavours/glitch/actions/filters'; -import { initMuteModal } from 'flavours/glitch/actions/mutes'; -import { initBlockModal } from 'flavours/glitch/actions/blocks'; -import { initReport } from 'flavours/glitch/actions/reports'; -import { initBoostModal } from 'flavours/glitch/actions/boosts'; -import { openModal } from 'flavours/glitch/actions/modal'; -import { deployPictureInPicture } from 'flavours/glitch/actions/picture_in_picture'; -import { changeLocalSetting } from 'flavours/glitch/actions/local_settings'; -import { defineMessages, injectIntl } from 'react-intl'; +import Status from 'flavours/glitch/components/status'; import { boostModal, favouriteModal, deleteModal } from 'flavours/glitch/initial_state'; +import { makeGetStatus, makeGetPictureInPicture } from 'flavours/glitch/selectors'; + import { showAlertForError } from '../actions/alerts'; const messages = defineMessages({ @@ -96,11 +99,14 @@ const mapDispatchToProps = (dispatch, { intl, contextType }) => ({ let state = getState(); if (state.getIn(['local_settings', 'confirm_before_clearing_draft']) && state.getIn(['compose', 'text']).trim().length !== 0) { - dispatch(openModal('CONFIRM', { - message: intl.formatMessage(messages.replyMessage), - confirm: intl.formatMessage(messages.replyConfirm), - onDoNotAsk: () => dispatch(changeLocalSetting(['confirm_before_clearing_draft'], false)), - onConfirm: () => dispatch(replyCompose(status, router)), + dispatch(openModal({ + modalType: 'CONFIRM', + modalProps: { + message: intl.formatMessage(messages.replyMessage), + confirm: intl.formatMessage(messages.replyConfirm), + onDoNotAsk: () => dispatch(changeLocalSetting(['confirm_before_clearing_draft'], false)), + onConfirm: () => dispatch(replyCompose(status, router)), + }, })); } else { dispatch(replyCompose(status, router)); @@ -148,7 +154,13 @@ const mapDispatchToProps = (dispatch, { intl, contextType }) => ({ if (e.shiftKey || !favouriteModal) { this.onModalFavourite(status); } else { - dispatch(openModal('FAVOURITE', { status, onFavourite: this.onModalFavourite })); + dispatch(openModal({ + modalType: 'FAVOURITE', + modalProps: { + status, + onFavourite: this.onModalFavourite, + }, + })); } } }, @@ -162,9 +174,12 @@ const mapDispatchToProps = (dispatch, { intl, contextType }) => ({ }, onEmbed (status) { - dispatch(openModal('EMBED', { - url: status.get('url'), - onError: error => dispatch(showAlertForError(error)), + dispatch(openModal({ + modalType: 'EMBED', + modalProps: { + url: status.get('url'), + onError: error => dispatch(showAlertForError(error)), + }, })); }, @@ -172,10 +187,13 @@ const mapDispatchToProps = (dispatch, { intl, contextType }) => ({ if (!deleteModal) { dispatch(deleteStatus(status.get('id'), history, withRedraft)); } else { - dispatch(openModal('CONFIRM', { - message: intl.formatMessage(withRedraft ? messages.redraftMessage : messages.deleteMessage), - confirm: intl.formatMessage(withRedraft ? messages.redraftConfirm : messages.deleteConfirm), - onConfirm: () => dispatch(deleteStatus(status.get('id'), history, withRedraft)), + dispatch(openModal({ + modalType: 'CONFIRM', + modalProps: { + message: intl.formatMessage(withRedraft ? messages.redraftMessage : messages.deleteMessage), + confirm: intl.formatMessage(withRedraft ? messages.redraftConfirm : messages.deleteConfirm), + onConfirm: () => dispatch(deleteStatus(status.get('id'), history, withRedraft)), + }, })); } }, @@ -184,10 +202,13 @@ const mapDispatchToProps = (dispatch, { intl, contextType }) => ({ dispatch((_, getState) => { let state = getState(); if (state.getIn(['compose', 'text']).trim().length !== 0) { - dispatch(openModal('CONFIRM', { - message: intl.formatMessage(messages.editMessage), - confirm: intl.formatMessage(messages.editConfirm), - onConfirm: () => dispatch(editStatus(status.get('id'), history)), + dispatch(openModal({ + modalType: 'CONFIRM', + modalProps: { + message: intl.formatMessage(messages.editMessage), + confirm: intl.formatMessage(messages.editConfirm), + onConfirm: () => dispatch(editStatus(status.get('id'), history)), + }, })); } else { dispatch(editStatus(status.get('id'), history)); @@ -212,11 +233,17 @@ const mapDispatchToProps = (dispatch, { intl, contextType }) => ({ }, onOpenMedia (statusId, media, index, lang) { - dispatch(openModal('MEDIA', { statusId, media, index, lang })); + dispatch(openModal({ + modalType: 'MEDIA', + modalProps: { statusId, media, index, lang }, + })); }, onOpenVideo (statusId, media, lang, options) { - dispatch(openModal('VIDEO', { statusId, media, lang, options })); + dispatch(openModal({ + modalType: 'VIDEO', + modalProps: { statusId, media, lang, options }, + })); }, onBlock (status) { @@ -261,10 +288,13 @@ const mapDispatchToProps = (dispatch, { intl, contextType }) => ({ }, onInteractionModal (type, status) { - dispatch(openModal('INTERACTION', { - type, - accountId: status.getIn(['account', 'id']), - url: status.get('url'), + dispatch(openModal({ + modalType: 'INTERACTION', + modalProps: { + type, + accountId: status.getIn(['account', 'id']), + url: status.get('url'), + }, })); }, diff --git a/app/javascript/flavours/glitch/features/about/index.jsx b/app/javascript/flavours/glitch/features/about/index.jsx index 8b65d95716..42a3077de6 100644 --- a/app/javascript/flavours/glitch/features/about/index.jsx +++ b/app/javascript/flavours/glitch/features/about/index.jsx @@ -1,17 +1,21 @@ -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import { connect } from 'react-redux'; import PropTypes from 'prop-types'; -import Column from 'flavours/glitch/components/column'; -import LinkFooter from 'flavours/glitch/features/ui/components/link_footer'; -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 { PureComponent } from 'react'; + +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; + import classNames from 'classnames'; +import { Helmet } from 'react-helmet'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; +import { connect } from 'react-redux'; + +import { fetchServer, fetchExtendedDescription, fetchDomainBlocks } from 'flavours/glitch/actions/server'; +import Column from 'flavours/glitch/components/column'; +import { Icon } from 'flavours/glitch/components/icon'; import { ServerHeroImage } from 'flavours/glitch/components/server_hero_image'; +import { Skeleton } from 'flavours/glitch/components/skeleton'; +import Account from 'flavours/glitch/containers/account_container'; +import LinkFooter from 'flavours/glitch/features/ui/components/link_footer'; const messages = defineMessages({ title: { id: 'column.about', defaultMessage: 'About' }, @@ -41,7 +45,7 @@ const mapStateToProps = state => ({ domainBlocks: state.getIn(['server', 'domainBlocks']), }); -class Section extends React.PureComponent { +class Section extends PureComponent { static propTypes = { title: PropTypes.string, @@ -80,7 +84,7 @@ class Section extends React.PureComponent { } -class About extends React.PureComponent { +class About extends PureComponent { static propTypes = { server: ImmutablePropTypes.map, 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 a548db2699..041f8de983 100644 --- a/app/javascript/flavours/glitch/features/account/components/account_note.jsx +++ b/app/javascript/flavours/glitch/features/account/components/account_note.jsx @@ -1,11 +1,14 @@ -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; + import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import { Icon } from 'flavours/glitch/components/icon'; + import Textarea from 'react-textarea-autosize'; +import { Icon } from 'flavours/glitch/components/icon'; + const messages = defineMessages({ placeholder: { id: 'account_note.glitch_placeholder', defaultMessage: 'No comment provided' }, }); 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 60ac06f910..46a766925a 100644 --- a/app/javascript/flavours/glitch/features/account/components/action_bar.jsx +++ b/app/javascript/flavours/glitch/features/account/components/action_bar.jsx @@ -1,10 +1,14 @@ -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import { NavLink } from 'react-router-dom'; +import { PureComponent } from 'react'; + import { FormattedMessage, FormattedNumber } from 'react-intl'; + +import { NavLink } from 'react-router-dom'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; + import { Icon } from 'flavours/glitch/components/icon'; -class ActionBar extends React.PureComponent { +class ActionBar extends PureComponent { static propTypes = { account: ImmutablePropTypes.map.isRequired, diff --git a/app/javascript/flavours/glitch/features/account/components/featured_tags.jsx b/app/javascript/flavours/glitch/features/account/components/featured_tags.jsx index 42e0a8d2f7..87e88f2fa8 100644 --- a/app/javascript/flavours/glitch/features/account/components/featured_tags.jsx +++ b/app/javascript/flavours/glitch/features/account/components/featured_tags.jsx @@ -1,8 +1,10 @@ -import React from 'react'; import PropTypes from 'prop-types'; + +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; + import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; + import Hashtag from 'flavours/glitch/components/hashtag'; const messages = defineMessages({ 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 5c2940b749..7368ce9758 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 @@ -1,7 +1,8 @@ -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; import { FormattedMessage } from 'react-intl'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; + 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 a447750c2d..bd9f8fbd36 100644 --- a/app/javascript/flavours/glitch/features/account/components/header.jsx +++ b/app/javascript/flavours/glitch/features/account/components/header.jsx @@ -1,20 +1,24 @@ -import React from 'react'; -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 { 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 { Helmet } from 'react-helmet'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; + import { Avatar } from 'flavours/glitch/components/avatar'; import Button from 'flavours/glitch/components/button'; +import { Icon } from 'flavours/glitch/components/icon'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import DropdownMenuContainer from 'flavours/glitch/containers/dropdown_menu_container'; +import { autoPlayGif, me, domain } from 'flavours/glitch/initial_state'; +import { PERMISSION_MANAGE_USERS, PERMISSION_MANAGE_FEDERATION } from 'flavours/glitch/permissions'; +import { preferencesLink, profileLink, accountAdminLink } from 'flavours/glitch/utils/backend_links'; + import AccountNoteContainer from '../containers/account_note_container'; import FollowRequestNoteContainer from '../containers/follow_request_note_container'; -import { PERMISSION_MANAGE_USERS, PERMISSION_MANAGE_FEDERATION } from 'flavours/glitch/permissions'; -import { Helmet } from 'react-helmet'; const messages = defineMessages({ unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' }, @@ -146,7 +150,6 @@ class Header extends ImmutablePureComponent { const { account } = this.props; navigator.share({ - text: `${titleFromAccount(account)}\n${account.get('note_plain')}`, url: account.get('url'), }).catch((e) => { if (e.name !== 'AbortError') console.error(e); @@ -345,10 +348,10 @@ class Header extends ImmutablePureComponent { {!suspended && (
{!hidden && ( - + <> {actionBtn} {bellBtn} - + )} diff --git a/app/javascript/flavours/glitch/features/account/components/profile_column_header.jsx b/app/javascript/flavours/glitch/features/account/components/profile_column_header.jsx index 62a459fffb..2dc4216bdd 100644 --- a/app/javascript/flavours/glitch/features/account/components/profile_column_header.jsx +++ b/app/javascript/flavours/glitch/features/account/components/profile_column_header.jsx @@ -1,13 +1,15 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import ColumnHeader from '../../../components/column_header'; +import { PureComponent } from 'react'; + import { injectIntl, defineMessages } from 'react-intl'; +import ColumnHeader from '../../../components/column_header'; + const messages = defineMessages({ profile: { id: 'column_header.profile', defaultMessage: 'Profile' }, }); -class ProfileColumnHeader extends React.PureComponent { +class ProfileColumnHeader extends PureComponent { static propTypes = { onClick: PropTypes.func, diff --git a/app/javascript/flavours/glitch/features/account/containers/account_note_container.js b/app/javascript/flavours/glitch/features/account/containers/account_note_container.js index f1d007ecb0..51d229c84b 100644 --- a/app/javascript/flavours/glitch/features/account/containers/account_note_container.js +++ b/app/javascript/flavours/glitch/features/account/containers/account_note_container.js @@ -1,5 +1,7 @@ import { connect } from 'react-redux'; + import { changeAccountNoteComment, submitAccountNote, initEditAccountNote, cancelAccountNote } from 'flavours/glitch/actions/account_notes'; + import AccountNote from '../components/account_note'; const mapStateToProps = (state, { account }) => { diff --git a/app/javascript/flavours/glitch/features/account/containers/featured_tags_container.js b/app/javascript/flavours/glitch/features/account/containers/featured_tags_container.js index 6f0b069419..bafdcba809 100644 --- a/app/javascript/flavours/glitch/features/account/containers/featured_tags_container.js +++ b/app/javascript/flavours/glitch/features/account/containers/featured_tags_container.js @@ -1,7 +1,9 @@ -import { connect } from 'react-redux'; -import FeaturedTags from '../components/featured_tags'; -import { makeGetAccount } from 'flavours/glitch/selectors'; import { List as ImmutableList } from 'immutable'; +import { connect } from 'react-redux'; + +import { makeGetAccount } from 'flavours/glitch/selectors'; + +import FeaturedTags from '../components/featured_tags'; const mapStateToProps = () => { const getAccount = makeGetAccount(); diff --git a/app/javascript/flavours/glitch/features/account/containers/follow_request_note_container.js b/app/javascript/flavours/glitch/features/account/containers/follow_request_note_container.js index c6a3afb7e2..3b2ffbadfe 100644 --- a/app/javascript/flavours/glitch/features/account/containers/follow_request_note_container.js +++ b/app/javascript/flavours/glitch/features/account/containers/follow_request_note_container.js @@ -1,7 +1,9 @@ import { connect } from 'react-redux'; -import FollowRequestNote from '../components/follow_request_note'; + import { authorizeFollowRequest, rejectFollowRequest } from 'flavours/glitch/actions/accounts'; +import FollowRequestNote from '../components/follow_request_note'; + const mapDispatchToProps = (dispatch, { account }) => ({ onAuthorize () { dispatch(authorizeFollowRequest(account.get('id'))); diff --git a/app/javascript/flavours/glitch/features/account/navigation.jsx b/app/javascript/flavours/glitch/features/account/navigation.jsx index b8b8e54deb..4be00c49f2 100644 --- a/app/javascript/flavours/glitch/features/account/navigation.jsx +++ b/app/javascript/flavours/glitch/features/account/navigation.jsx @@ -1,6 +1,8 @@ -import React from 'react'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + import { connect } from 'react-redux'; + import FeaturedTags from 'flavours/glitch/features/account/containers/featured_tags_container'; import { normalizeForLookup } from 'flavours/glitch/reducers/accounts_map'; @@ -19,7 +21,7 @@ const mapStateToProps = (state, { match: { params: { acct } } }) => { }; }; -class AccountNavigation extends React.PureComponent { +class AccountNavigation extends PureComponent { static propTypes = { match: PropTypes.shape({ 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 0dfbec30c0..4453b557d9 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,12 +1,16 @@ -import { Blurhash } from 'flavours/glitch/components/blurhash'; -import classNames from 'classnames'; -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'; + +import classNames from 'classnames'; + import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; +import { Blurhash } from 'flavours/glitch/components/blurhash'; +import { Icon } from 'flavours/glitch/components/icon'; +import { autoPlayGif, displayMedia, useBlurhash } from 'flavours/glitch/initial_state'; + + + export default class MediaItem extends ImmutablePureComponent { static propTypes = { diff --git a/app/javascript/flavours/glitch/features/account_gallery/index.jsx b/app/javascript/flavours/glitch/features/account_gallery/index.jsx index 26c45eff6d..58db9efd7d 100644 --- a/app/javascript/flavours/glitch/features/account_gallery/index.jsx +++ b/app/javascript/flavours/glitch/features/account_gallery/index.jsx @@ -1,22 +1,25 @@ -import React from 'react'; -import { connect } from 'react-redux'; -import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import { lookupAccount, fetchAccount } from 'flavours/glitch/actions/accounts'; -import { expandAccountMediaTimeline } from 'flavours/glitch/actions/timelines'; -import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; -import Column from 'flavours/glitch/features/ui/components/column'; -import ProfileColumnHeader from 'flavours/glitch/features/account/components/profile_column_header'; -import ImmutablePureComponent from 'react-immutable-pure-component'; -import { getAccountGallery } from 'flavours/glitch/selectors'; -import MediaItem from './components/media_item'; -import HeaderContainer from 'flavours/glitch/features/account_timeline/containers/header_container'; -import ScrollContainer from 'flavours/glitch/containers/scroll_container'; -import LoadMore from 'flavours/glitch/components/load_more'; -import { openModal } from 'flavours/glitch/actions/modal'; + import { FormattedMessage } from 'react-intl'; -import { normalizeForLookup } from 'flavours/glitch/reducers/accounts_map'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; +import { connect } from 'react-redux'; + +import { lookupAccount, fetchAccount } from 'flavours/glitch/actions/accounts'; +import { openModal } from 'flavours/glitch/actions/modal'; +import { expandAccountMediaTimeline } from 'flavours/glitch/actions/timelines'; +import LoadMore from 'flavours/glitch/components/load_more'; +import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; +import ScrollContainer from 'flavours/glitch/containers/scroll_container'; +import ProfileColumnHeader from 'flavours/glitch/features/account/components/profile_column_header'; +import HeaderContainer from 'flavours/glitch/features/account_timeline/containers/header_container'; import BundleColumnError from 'flavours/glitch/features/ui/components/bundle_column_error'; +import Column from 'flavours/glitch/features/ui/components/column'; +import { normalizeForLookup } from 'flavours/glitch/reducers/accounts_map'; +import { getAccountGallery } from 'flavours/glitch/selectors'; + +import MediaItem from './components/media_item'; const mapStateToProps = (state, { params: { acct, id } }) => { const accountId = id || state.getIn(['accounts_map', normalizeForLookup(acct)]); @@ -145,14 +148,23 @@ class AccountGallery extends ImmutablePureComponent { const lang = attachment.getIn(['status', 'language']); if (attachment.get('type') === 'video') { - dispatch(openModal('VIDEO', { media: attachment, statusId, lang, options: { autoPlay: true } })); + dispatch(openModal({ + modalType: 'VIDEO', + modalProps: { media: attachment, statusId, lang, options: { autoPlay: true } }, + })); } else if (attachment.get('type') === 'audio') { - dispatch(openModal('AUDIO', { media: attachment, statusId, lang, options: { autoPlay: true } })); + dispatch(openModal({ + modalType: 'AUDIO', + modalProps: { media: attachment, statusId, lang, options: { autoPlay: true } }, + })); } else { const media = attachment.getIn(['status', 'media_attachments']); const index = media.findIndex(x => x.get('id') === attachment.get('id')); - dispatch(openModal('MEDIA', { media, index, statusId, lang })); + dispatch(openModal({ + modalType: 'MEDIA', + modalProps: { media, index, statusId, lang }, + })); } }; diff --git a/app/javascript/flavours/glitch/features/account_timeline/components/header.jsx b/app/javascript/flavours/glitch/features/account_timeline/components/header.jsx index 9b3c273bc2..5480045b70 100644 --- a/app/javascript/flavours/glitch/features/account_timeline/components/header.jsx +++ b/app/javascript/flavours/glitch/features/account_timeline/components/header.jsx @@ -1,12 +1,16 @@ -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import InnerHeader from 'flavours/glitch/features/account/components/header'; -import ActionBar from 'flavours/glitch/features/account/components/action_bar'; -import ImmutablePureComponent from 'react-immutable-pure-component'; -import MemorialNote from './memorial_note'; + import { FormattedMessage } from 'react-intl'; + import { NavLink } from 'react-router-dom'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; + +import ActionBar from 'flavours/glitch/features/account/components/action_bar'; +import InnerHeader from 'flavours/glitch/features/account/components/header'; + +import MemorialNote from './memorial_note'; import MovedNote from './moved_note'; export default class Header extends ImmutablePureComponent { diff --git a/app/javascript/flavours/glitch/features/account_timeline/components/limited_account_hint.jsx b/app/javascript/flavours/glitch/features/account_timeline/components/limited_account_hint.jsx index c622b76072..5ea37a5d31 100644 --- a/app/javascript/flavours/glitch/features/account_timeline/components/limited_account_hint.jsx +++ b/app/javascript/flavours/glitch/features/account_timeline/components/limited_account_hint.jsx @@ -1,8 +1,11 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import { connect } from 'react-redux'; -import { revealAccount } from 'flavours/glitch/actions/accounts'; +import { PureComponent } from 'react'; + import { FormattedMessage } from 'react-intl'; + +import { connect } from 'react-redux'; + +import { revealAccount } from 'flavours/glitch/actions/accounts'; import Button from 'flavours/glitch/components/button'; import { domain } from 'flavours/glitch/initial_state'; @@ -14,7 +17,7 @@ const mapDispatchToProps = (dispatch, { accountId }) => ({ }); -class LimitedAccountHint extends React.PureComponent { +class LimitedAccountHint extends PureComponent { static propTypes = { accountId: PropTypes.string.isRequired, diff --git a/app/javascript/flavours/glitch/features/account_timeline/components/memorial_note.jsx b/app/javascript/flavours/glitch/features/account_timeline/components/memorial_note.jsx index fed95ac2ab..a04808f1ca 100644 --- a/app/javascript/flavours/glitch/features/account_timeline/components/memorial_note.jsx +++ b/app/javascript/flavours/glitch/features/account_timeline/components/memorial_note.jsx @@ -1,4 +1,3 @@ -import React from 'react'; import { FormattedMessage } from 'react-intl'; const MemorialNote = () => ( 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 7d025ed418..7b9f6fa37d 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 @@ -1,11 +1,14 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import ImmutablePropTypes from 'react-immutable-proptypes'; + import { FormattedMessage } from 'react-intl'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; + +import { Icon } from 'flavours/glitch/components/icon'; + import AvatarOverlay from '../../../components/avatar_overlay'; import { DisplayName } from '../../../components/display_name'; -import { Icon } from 'flavours/glitch/components/icon'; export default class MovedNote extends ImmutablePureComponent { diff --git a/app/javascript/flavours/glitch/features/account_timeline/containers/header_container.jsx b/app/javascript/flavours/glitch/features/account_timeline/containers/header_container.jsx index c5432c64f1..6ee5aba5fc 100644 --- a/app/javascript/flavours/glitch/features/account_timeline/containers/header_container.jsx +++ b/app/javascript/flavours/glitch/features/account_timeline/containers/header_container.jsx @@ -1,7 +1,8 @@ -import React from 'react'; +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; + import { connect } from 'react-redux'; -import { makeGetAccount, getAccountHidden } from 'flavours/glitch/selectors'; -import Header from '../components/header'; + +import { initEditAccountNote } from 'flavours/glitch/actions/account_notes'; import { followAccount, unfollowAccount, @@ -10,23 +11,24 @@ import { pinAccount, unpinAccount, } from 'flavours/glitch/actions/accounts'; +import { initBlockModal } from 'flavours/glitch/actions/blocks'; import { mentionCompose, directCompose, } from 'flavours/glitch/actions/compose'; -import { initMuteModal } from 'flavours/glitch/actions/mutes'; -import { initBlockModal } from 'flavours/glitch/actions/blocks'; -import { initReport } from 'flavours/glitch/actions/reports'; -import { openModal } from 'flavours/glitch/actions/modal'; import { blockDomain, unblockDomain } from 'flavours/glitch/actions/domain_blocks'; -import { initEditAccountNote } from 'flavours/glitch/actions/account_notes'; -import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; +import { openModal } from 'flavours/glitch/actions/modal'; +import { initMuteModal } from 'flavours/glitch/actions/mutes'; +import { initReport } from 'flavours/glitch/actions/reports'; import { unfollowModal } from 'flavours/glitch/initial_state'; +import { makeGetAccount, getAccountHidden } from 'flavours/glitch/selectors'; + +import Header from '../components/header'; const messages = defineMessages({ cancelFollowRequestConfirm: { id: 'confirmations.cancel_follow_request.confirm', defaultMessage: 'Withdraw request' }, unfollowConfirm: { id: 'confirmations.unfollow.confirm', defaultMessage: 'Unfollow' }, - blockDomainConfirm: { id: 'confirmations.domain_block.confirm', defaultMessage: 'Hide entire domain' }, + blockDomainConfirm: { id: 'confirmations.domain_block.confirm', defaultMessage: 'Block entire domain' }, }); const makeMapStateToProps = () => { @@ -46,20 +48,26 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ onFollow (account) { if (account.getIn(['relationship', 'following'])) { if (unfollowModal) { - dispatch(openModal('CONFIRM', { - message: @{account.get('acct')} }} />, - confirm: intl.formatMessage(messages.unfollowConfirm), - onConfirm: () => dispatch(unfollowAccount(account.get('id'))), + dispatch(openModal({ + modalType: 'CONFIRM', + modalProps: { + message: @{account.get('acct')} }} />, + confirm: intl.formatMessage(messages.unfollowConfirm), + onConfirm: () => dispatch(unfollowAccount(account.get('id'))), + }, })); } else { dispatch(unfollowAccount(account.get('id'))); } } else if (account.getIn(['relationship', 'requested'])) { if (unfollowModal) { - dispatch(openModal('CONFIRM', { - message: @{account.get('acct')} }} />, - confirm: intl.formatMessage(messages.cancelFollowRequestConfirm), - onConfirm: () => dispatch(unfollowAccount(account.get('id'))), + dispatch(openModal({ + modalType: 'CONFIRM', + modalProps: { + message: @{account.get('acct')} }} />, + confirm: intl.formatMessage(messages.cancelFollowRequestConfirm), + onConfirm: () => dispatch(unfollowAccount(account.get('id'))), + }, })); } else { dispatch(unfollowAccount(account.get('id'))); @@ -70,10 +78,13 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ }, onInteractionModal (account) { - dispatch(openModal('INTERACTION', { - type: 'follow', - accountId: account.get('id'), - url: account.get('url'), + dispatch(openModal({ + modalType: 'INTERACTION', + modalProps: { + type: 'follow', + accountId: account.get('id'), + url: account.get('url'), + }, })); }, @@ -134,10 +145,13 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ }, onBlockDomain (domain) { - dispatch(openModal('CONFIRM', { - message: {domain} }} />, - confirm: intl.formatMessage(messages.blockDomainConfirm), - onConfirm: () => dispatch(blockDomain(domain)), + dispatch(openModal({ + modalType: 'CONFIRM', + modalProps: { + message: {domain} }} />, + confirm: intl.formatMessage(messages.blockDomainConfirm), + onConfirm: () => dispatch(blockDomain(domain)), + }, })); }, @@ -146,21 +160,30 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ }, onAddToList (account) { - dispatch(openModal('LIST_ADDER', { - accountId: account.get('id'), + dispatch(openModal({ + modalType: 'LIST_ADDER', + modalProps: { + accountId: account.get('id'), + }, })); }, onChangeLanguages (account) { - dispatch(openModal('SUBSCRIBED_LANGUAGES', { - accountId: account.get('id'), + dispatch(openModal({ + modalType: 'SUBSCRIBED_LANGUAGES', + modalProps: { + accountId: account.get('id'), + }, })); }, onOpenAvatar (account) { - dispatch(openModal('IMAGE', { - src: account.get('avatar'), - alt: account.get('acct'), + dispatch(openModal({ + modalType: 'IMAGE', + modalProps: { + src: account.get('avatar'), + alt: account.get('acct'), + }, })); }, diff --git a/app/javascript/flavours/glitch/features/account_timeline/index.jsx b/app/javascript/flavours/glitch/features/account_timeline/index.jsx index b90918a01c..1fe63e9957 100644 --- a/app/javascript/flavours/glitch/features/account_timeline/index.jsx +++ b/app/javascript/flavours/glitch/features/account_timeline/index.jsx @@ -1,23 +1,34 @@ -import React from 'react'; -import { connect } from 'react-redux'; -import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import { lookupAccount, fetchAccount } from 'flavours/glitch/actions/accounts'; -import { expandAccountFeaturedTimeline, expandAccountTimeline } from '../../actions/timelines'; -import StatusList from '../../components/status_list'; -import LoadingIndicator from '../../components/loading_indicator'; -import Column from '../ui/components/column'; -import ProfileColumnHeader from 'flavours/glitch/features/account/components/profile_column_header'; -import HeaderContainer from './containers/header_container'; -import { List as ImmutableList } from 'immutable'; -import ImmutablePureComponent from 'react-immutable-pure-component'; + import { FormattedMessage } from 'react-intl'; + +import { List as ImmutableList } from 'immutable'; +import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; +import { connect } from 'react-redux'; + +import { lookupAccount, fetchAccount } from 'flavours/glitch/actions/accounts'; import { TimelineHint } from 'flavours/glitch/components/timeline_hint'; -import LimitedAccountHint from './components/limited_account_hint'; -import { getAccountHidden } from 'flavours/glitch/selectors'; -import { fetchFeaturedTags } from '../../actions/featured_tags'; -import { normalizeForLookup } from 'flavours/glitch/reducers/accounts_map'; +import ProfileColumnHeader from 'flavours/glitch/features/account/components/profile_column_header'; import BundleColumnError from 'flavours/glitch/features/ui/components/bundle_column_error'; +import { normalizeForLookup } from 'flavours/glitch/reducers/accounts_map'; +import { getAccountHidden } from 'flavours/glitch/selectors'; + +import { fetchFeaturedTags } from '../../actions/featured_tags'; +import { expandAccountFeaturedTimeline, expandAccountTimeline } from '../../actions/timelines'; +import LoadingIndicator from '../../components/loading_indicator'; +import StatusList from '../../components/status_list'; +import Column from '../ui/components/column'; + +import LimitedAccountHint from './components/limited_account_hint'; +import HeaderContainer from './containers/header_container'; + + + + + + + const emptyList = ImmutableList(); diff --git a/app/javascript/flavours/glitch/features/audio/index.jsx b/app/javascript/flavours/glitch/features/audio/index.jsx index 25252c01c3..1c41306666 100644 --- a/app/javascript/flavours/glitch/features/audio/index.jsx +++ b/app/javascript/flavours/glitch/features/audio/index.jsx @@ -1,15 +1,23 @@ -import React from 'react'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; -import { formatTime, getPointerPosition, fileNameFromURL } from 'flavours/glitch/features/video'; -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 { is } from 'immutable'; +import { throttle, debounce } from 'lodash'; + +import { Blurhash } from 'flavours/glitch/components/blurhash'; +import { Icon } from 'flavours/glitch/components/icon'; +import { formatTime, getPointerPosition, fileNameFromURL } from 'flavours/glitch/features/video'; +import { displayMedia, useBlurhash } from 'flavours/glitch/initial_state'; + +import Visualizer from './visualizer'; + + + const messages = defineMessages({ play: { id: 'video.play', defaultMessage: 'Play' }, pause: { id: 'video.pause', defaultMessage: 'Pause' }, @@ -22,7 +30,7 @@ const messages = defineMessages({ const TICK_SIZE = 10; const PADDING = 180; -class Audio extends React.PureComponent { +class Audio extends PureComponent { static propTypes = { src: PropTypes.string.isRequired, diff --git a/app/javascript/flavours/glitch/features/blocks/index.jsx b/app/javascript/flavours/glitch/features/blocks/index.jsx index 669425c7f4..202d38d0ed 100644 --- a/app/javascript/flavours/glitch/features/blocks/index.jsx +++ b/app/javascript/flavours/glitch/features/blocks/index.jsx @@ -1,16 +1,20 @@ -import React from 'react'; -import { connect } from 'react-redux'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import { debounce } from 'lodash'; import PropTypes from 'prop-types'; -import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; -import ScrollableList from '../../components/scrollable_list'; -import Column from 'flavours/glitch/features/ui/components/column'; -import ColumnBackButtonSlim from 'flavours/glitch/components/column_back_button_slim'; -import AccountContainer from 'flavours/glitch/containers/account_container'; -import { fetchBlocks, expandBlocks } from 'flavours/glitch/actions/blocks'; + import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; +import { connect } from 'react-redux'; + +import { debounce } from 'lodash'; + +import { fetchBlocks, expandBlocks } from 'flavours/glitch/actions/blocks'; +import ColumnBackButtonSlim from 'flavours/glitch/components/column_back_button_slim'; +import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; +import AccountContainer from 'flavours/glitch/containers/account_container'; +import Column from 'flavours/glitch/features/ui/components/column'; + +import ScrollableList from '../../components/scrollable_list'; const messages = defineMessages({ heading: { id: 'column.blocks', defaultMessage: 'Blocked users' }, diff --git a/app/javascript/flavours/glitch/features/bookmarked_statuses/index.jsx b/app/javascript/flavours/glitch/features/bookmarked_statuses/index.jsx index d9c0746825..fe8b883de5 100644 --- a/app/javascript/flavours/glitch/features/bookmarked_statuses/index.jsx +++ b/app/javascript/flavours/glitch/features/bookmarked_statuses/index.jsx @@ -1,11 +1,15 @@ -import { debounce } from 'lodash'; import PropTypes from 'prop-types'; -import React from 'react'; -import { Helmet } from 'react-helmet'; + import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; + +import { Helmet } from 'react-helmet'; + import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { connect } from 'react-redux'; + +import { debounce } from 'lodash'; + import { fetchBookmarkedStatuses, expandBookmarkedStatuses } from 'flavours/glitch/actions/bookmarks'; import { addColumn, removeColumn, moveColumn } from 'flavours/glitch/actions/columns'; import ColumnHeader from 'flavours/glitch/components/column_header'; diff --git a/app/javascript/flavours/glitch/features/closed_registrations_modal/index.jsx b/app/javascript/flavours/glitch/features/closed_registrations_modal/index.jsx index 1f17ea9cfd..b556da3911 100644 --- a/app/javascript/flavours/glitch/features/closed_registrations_modal/index.jsx +++ b/app/javascript/flavours/glitch/features/closed_registrations_modal/index.jsx @@ -1,9 +1,10 @@ -import React from 'react'; -import { connect } from 'react-redux'; import { FormattedMessage } from 'react-intl'; + import ImmutablePureComponent from 'react-immutable-pure-component'; -import { domain } from 'flavours/glitch/initial_state'; +import { connect } from 'react-redux'; + import { fetchServer } from 'flavours/glitch/actions/server'; +import { domain } from 'flavours/glitch/initial_state'; const mapStateToProps = state => ({ message: state.getIn(['server', 'server', 'registrations', 'message']), diff --git a/app/javascript/flavours/glitch/features/community_timeline/components/column_settings.jsx b/app/javascript/flavours/glitch/features/community_timeline/components/column_settings.jsx index 0ea874e959..1e93125d59 100644 --- a/app/javascript/flavours/glitch/features/community_timeline/components/column_settings.jsx +++ b/app/javascript/flavours/glitch/features/community_timeline/components/column_settings.jsx @@ -1,7 +1,10 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import ImmutablePropTypes from 'react-immutable-proptypes'; +import { PureComponent } from 'react'; + import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; + import SettingText from 'flavours/glitch/components/setting_text'; import SettingToggle from 'flavours/glitch/features/notifications/components/setting_toggle'; @@ -10,7 +13,7 @@ const messages = defineMessages({ settings: { id: 'home.settings', defaultMessage: 'Column settings' }, }); -class ColumnSettings extends React.PureComponent { +class ColumnSettings extends PureComponent { static propTypes = { settings: ImmutablePropTypes.map.isRequired, diff --git a/app/javascript/flavours/glitch/features/community_timeline/containers/column_settings_container.js b/app/javascript/flavours/glitch/features/community_timeline/containers/column_settings_container.js index eac1c4bbac..dbfc4594e1 100644 --- a/app/javascript/flavours/glitch/features/community_timeline/containers/column_settings_container.js +++ b/app/javascript/flavours/glitch/features/community_timeline/containers/column_settings_container.js @@ -1,8 +1,10 @@ import { connect } from 'react-redux'; -import ColumnSettings from '../components/column_settings'; + import { changeColumnParams } from 'flavours/glitch/actions/columns'; import { changeSetting } from 'flavours/glitch/actions/settings'; +import ColumnSettings from '../components/column_settings'; + const mapStateToProps = (state, { columnId }) => { const uuid = columnId; const columns = state.getIn(['settings', 'columns']); diff --git a/app/javascript/flavours/glitch/features/community_timeline/index.jsx b/app/javascript/flavours/glitch/features/community_timeline/index.jsx index 8f3e10fe9b..127e7cf182 100644 --- a/app/javascript/flavours/glitch/features/community_timeline/index.jsx +++ b/app/javascript/flavours/glitch/features/community_timeline/index.jsx @@ -1,17 +1,22 @@ -import React from 'react'; -import { connect } from 'react-redux'; -import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import PropTypes from 'prop-types'; -import StatusListContainer from 'flavours/glitch/features/ui/containers/status_list_container'; +import { PureComponent } from 'react'; + +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; + +import { Helmet } from 'react-helmet'; + +import { connect } from 'react-redux'; + +import { addColumn, removeColumn, moveColumn } from 'flavours/glitch/actions/columns'; +import { connectCommunityStream } from 'flavours/glitch/actions/streaming'; +import { expandCommunityTimeline } from 'flavours/glitch/actions/timelines'; import Column from 'flavours/glitch/components/column'; import ColumnHeader from 'flavours/glitch/components/column_header'; -import { expandCommunityTimeline } from 'flavours/glitch/actions/timelines'; -import { addColumn, removeColumn, moveColumn } from 'flavours/glitch/actions/columns'; -import ColumnSettingsContainer from './containers/column_settings_container'; -import { connectCommunityStream } from 'flavours/glitch/actions/streaming'; -import { Helmet } from 'react-helmet'; -import { domain } from 'flavours/glitch/initial_state'; import DismissableBanner from 'flavours/glitch/components/dismissable_banner'; +import StatusListContainer from 'flavours/glitch/features/ui/containers/status_list_container'; +import { domain } from 'flavours/glitch/initial_state'; + +import ColumnSettingsContainer from './containers/column_settings_container'; const messages = defineMessages({ title: { id: 'column.community', defaultMessage: 'Local timeline' }, @@ -32,7 +37,7 @@ const mapStateToProps = (state, { columnId }) => { }; }; -class CommunityTimeline extends React.PureComponent { +class CommunityTimeline extends PureComponent { static defaultProps = { onlyMedia: false, diff --git a/app/javascript/flavours/glitch/features/compose/components/action_bar.jsx b/app/javascript/flavours/glitch/features/compose/components/action_bar.jsx index af1f02efc9..2a6202f846 100644 --- a/app/javascript/flavours/glitch/features/compose/components/action_bar.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/action_bar.jsx @@ -1,10 +1,14 @@ -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import DropdownMenuContainer from '../../../containers/dropdown_menu_container'; +import { PureComponent } from 'react'; + import { defineMessages, injectIntl } from 'react-intl'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; + import { preferencesLink, profileLink } from 'flavours/glitch/utils/backend_links'; +import DropdownMenuContainer from '../../../containers/dropdown_menu_container'; + const messages = defineMessages({ edit_profile: { id: 'account.edit_profile', defaultMessage: 'Edit profile' }, pins: { id: 'navigation_bar.pins', defaultMessage: 'Pinned posts' }, @@ -14,14 +18,14 @@ const messages = defineMessages({ lists: { id: 'navigation_bar.lists', defaultMessage: 'Lists' }, followed_tags: { id: 'navigation_bar.followed_tags', defaultMessage: 'Followed hashtags' }, blocks: { id: 'navigation_bar.blocks', defaultMessage: 'Blocked users' }, - domain_blocks: { id: 'navigation_bar.domain_blocks', defaultMessage: 'Hidden domains' }, + domain_blocks: { id: 'navigation_bar.domain_blocks', defaultMessage: 'Blocked domains' }, mutes: { id: 'navigation_bar.mutes', defaultMessage: 'Muted users' }, filters: { id: 'navigation_bar.filters', defaultMessage: 'Muted words' }, logout: { id: 'navigation_bar.logout', defaultMessage: 'Logout' }, bookmarks: { id: 'navigation_bar.bookmarks', defaultMessage: 'Bookmarks' }, }); -class ActionBar extends React.PureComponent { +class ActionBar extends PureComponent { static propTypes = { account: ImmutablePropTypes.map.isRequired, 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 db17c6e727..5f00da52c4 100644 --- a/app/javascript/flavours/glitch/features/compose/components/autosuggest_account.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/autosuggest_account.jsx @@ -1,9 +1,9 @@ -import React from 'react'; -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'; +import { Avatar } from 'flavours/glitch/components/avatar'; +import { DisplayName } from 'flavours/glitch/components/display_name'; + export default class AutosuggestAccount extends ImmutablePureComponent { static propTypes = { diff --git a/app/javascript/flavours/glitch/features/compose/components/character_counter.jsx b/app/javascript/flavours/glitch/features/compose/components/character_counter.jsx index 0ecfc9141d..42452b30f6 100644 --- a/app/javascript/flavours/glitch/features/compose/components/character_counter.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/character_counter.jsx @@ -1,8 +1,9 @@ -import React from 'react'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + import { length } from 'stringz'; -export default class CharacterCounter extends React.PureComponent { +export default class CharacterCounter extends PureComponent { static propTypes = { text: PropTypes.string.isRequired, diff --git a/app/javascript/flavours/glitch/features/compose/components/compose_form.jsx b/app/javascript/flavours/glitch/features/compose/components/compose_form.jsx index 77062b8136..53e1bf79ae 100644 --- a/app/javascript/flavours/glitch/features/compose/components/compose_form.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/compose_form.jsx @@ -1,21 +1,26 @@ -import React from 'react'; -import CharacterCounter from './character_counter'; -import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import ReplyIndicatorContainer from '../containers/reply_indicator_container'; -import AutosuggestTextarea from '../../../components/autosuggest_textarea'; -import AutosuggestInput from '../../../components/autosuggest_input'; + import { defineMessages, injectIntl } from 'react-intl'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; + +import { length } from 'stringz'; + +import { maxChars } from 'flavours/glitch/initial_state'; +import { isMobile } from 'flavours/glitch/is_mobile'; + +import AutosuggestInput from '../../../components/autosuggest_input'; +import AutosuggestTextarea from '../../../components/autosuggest_textarea'; import EmojiPickerDropdown from '../containers/emoji_picker_dropdown_container'; +import OptionsContainer from '../containers/options_container'; import PollFormContainer from '../containers/poll_form_container'; +import ReplyIndicatorContainer from '../containers/reply_indicator_container'; import UploadFormContainer from '../containers/upload_form_container'; import WarningContainer from '../containers/warning_container'; -import { isMobile } from 'flavours/glitch/is_mobile'; -import ImmutablePureComponent from 'react-immutable-pure-component'; -import { length } from 'stringz'; import { countableText } from '../util/counter'; -import { maxChars } from 'flavours/glitch/initial_state'; -import OptionsContainer from '../containers/options_container'; + +import CharacterCounter from './character_counter'; import Publisher from './publisher'; import TextareaIcons from './textarea_icons'; diff --git a/app/javascript/flavours/glitch/features/compose/components/dropdown.jsx b/app/javascript/flavours/glitch/features/compose/components/dropdown.jsx index e791faa6bc..a50413ebe6 100644 --- a/app/javascript/flavours/glitch/features/compose/components/dropdown.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/dropdown.jsx @@ -1,15 +1,18 @@ // Package imports. -import classNames from 'classnames'; import PropTypes from 'prop-types'; -import React from 'react'; +import { PureComponent } from 'react'; + +import classNames from 'classnames'; + import Overlay from 'react-overlays/Overlay'; // Components. import { IconButton } from 'flavours/glitch/components/icon_button'; + import DropdownMenu from './dropdown_menu'; // The component. -export default class ComposerOptionsDropdown extends React.PureComponent { +export default class ComposerOptionsDropdown extends PureComponent { static propTypes = { isUserTouching: PropTypes.func, 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 28f316619c..a78e6914cf 100644 --- a/app/javascript/flavours/glitch/features/compose/components/dropdown_menu.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/dropdown_menu.jsx @@ -1,7 +1,9 @@ // Package imports. import PropTypes from 'prop-types'; -import React from 'react'; +import { PureComponent } from 'react'; + import classNames from 'classnames'; + import { supportsPassiveEvents } from 'detect-passive-events'; // Components. @@ -10,7 +12,7 @@ import { Icon } from 'flavours/glitch/components/icon'; const listenerOptions = supportsPassiveEvents ? { passive: true, capture: true } : true; // The component. -export default class ComposerOptionsDropdownContent extends React.PureComponent { +export default class ComposerOptionsDropdownContent extends PureComponent { static propTypes = { items: PropTypes.arrayOf(PropTypes.shape({ @@ -152,14 +154,14 @@ export default class ComposerOptionsDropdownContent extends React.PureComponent if (!contents) { contents = ( - + <> {icon && }
{text} {meta}
-
+ ); } diff --git a/app/javascript/flavours/glitch/features/compose/components/emoji_picker_dropdown.jsx b/app/javascript/flavours/glitch/features/compose/components/emoji_picker_dropdown.jsx index 68ff37b80e..e01be88a2f 100644 --- a/app/javascript/flavours/glitch/features/compose/components/emoji_picker_dropdown.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/emoji_picker_dropdown.jsx @@ -1,15 +1,21 @@ -import React from 'react'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import { EmojiPicker as EmojiPickerAsync } from '../../ui/util/async-components'; -import Overlay from 'react-overlays/Overlay'; + import classNames from 'classnames'; + import ImmutablePropTypes from 'react-immutable-proptypes'; + import { supportsPassiveEvents } from 'detect-passive-events'; -import { buildCustomEmojis, categoriesFromEmojis } from '../../emoji/emoji'; +import Overlay from 'react-overlays/Overlay'; + import { useSystemEmojiFont } from 'flavours/glitch/initial_state'; import { assetHost } from 'flavours/glitch/utils/config'; +import { buildCustomEmojis, categoriesFromEmojis } from '../../emoji/emoji'; +import { EmojiPicker as EmojiPickerAsync } from '../../ui/util/async-components'; + const messages = defineMessages({ emoji: { id: 'emoji_button.label', defaultMessage: 'Insert emoji' }, emoji_search: { id: 'emoji_button.search', defaultMessage: 'Search...' }, @@ -48,7 +54,7 @@ const notFoundFn = () => (
); -class ModifierPickerMenu extends React.PureComponent { +class ModifierPickerMenu extends PureComponent { static propTypes = { active: PropTypes.bool, @@ -109,7 +115,7 @@ class ModifierPickerMenu extends React.PureComponent { } -class ModifierPicker extends React.PureComponent { +class ModifierPicker extends PureComponent { static propTypes = { active: PropTypes.bool, @@ -145,7 +151,7 @@ class ModifierPicker extends React.PureComponent { } -class EmojiPickerMenuImpl extends React.PureComponent { +class EmojiPickerMenuImpl extends PureComponent { static propTypes = { custom_emojis: ImmutablePropTypes.list, @@ -308,7 +314,7 @@ class EmojiPickerMenuImpl extends React.PureComponent { const EmojiPickerMenu = injectIntl(EmojiPickerMenuImpl); -class EmojiPickerDropdown extends React.PureComponent { +class EmojiPickerDropdown extends PureComponent { static propTypes = { custom_emojis: ImmutablePropTypes.list, diff --git a/app/javascript/flavours/glitch/features/compose/components/header.jsx b/app/javascript/flavours/glitch/features/compose/components/header.jsx index 0a94ca5fc7..ac6d4dce85 100644 --- a/app/javascript/flavours/glitch/features/compose/components/header.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/header.jsx @@ -1,19 +1,16 @@ -// Package imports. import PropTypes from 'prop-types'; -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; + import { injectIntl, defineMessages } from 'react-intl'; + import { Link } from 'react-router-dom'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; -// Components. import { Icon } from 'flavours/glitch/components/icon'; - -// Utils. -import { conditionalRender } from 'flavours/glitch/utils/react_helpers'; import { signOutLink } from 'flavours/glitch/utils/backend_links'; +import { conditionalRender } from 'flavours/glitch/utils/react_helpers'; -// Messages. const messages = defineMessages({ community: { defaultMessage: 'Local timeline', diff --git a/app/javascript/flavours/glitch/features/compose/components/language_dropdown.jsx b/app/javascript/flavours/glitch/features/compose/components/language_dropdown.jsx index 2d4ae72d40..a067f686e1 100644 --- a/app/javascript/flavours/glitch/features/compose/components/language_dropdown.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/language_dropdown.jsx @@ -1,13 +1,18 @@ -import React from 'react'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + import { injectIntl, defineMessages } from 'react-intl'; -import TextIconButton from './text_icon_button'; -import Overlay from 'react-overlays/Overlay'; -import { supportsPassiveEvents } from 'detect-passive-events'; + import classNames from 'classnames'; + +import { supportsPassiveEvents } from 'detect-passive-events'; +import fuzzysort from 'fuzzysort'; +import Overlay from 'react-overlays/Overlay'; + import { languages as preloadedLanguages } from 'flavours/glitch/initial_state'; import { loupeIcon, deleteIcon } from 'flavours/glitch/utils/icons'; -import fuzzysort from 'fuzzysort'; + +import TextIconButton from './text_icon_button'; const messages = defineMessages({ changeLanguage: { id: 'compose.language.change', defaultMessage: 'Change language' }, @@ -17,7 +22,7 @@ const messages = defineMessages({ const listenerOptions = supportsPassiveEvents ? { passive: true, capture: true } : true; -class LanguageDropdownMenu extends React.PureComponent { +class LanguageDropdownMenu extends PureComponent { static propTypes = { value: PropTypes.string.isRequired, @@ -238,7 +243,7 @@ class LanguageDropdownMenu extends React.PureComponent { } -class LanguageDropdown extends React.PureComponent { +class LanguageDropdown extends PureComponent { static propTypes = { value: PropTypes.string, 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 371ad6d245..383a9db528 100644 --- a/app/javascript/flavours/glitch/features/compose/components/navigation_bar.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/navigation_bar.jsx @@ -1,13 +1,16 @@ -import React from 'react'; import PropTypes from 'prop-types'; + +import { FormattedMessage } from 'react-intl'; + import ImmutablePropTypes from 'react-immutable-proptypes'; -import ActionBar from './action_bar'; +import ImmutablePureComponent from 'react-immutable-pure-component'; + 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'; import { profileLink } from 'flavours/glitch/utils/backend_links'; +import ActionBar from './action_bar'; + export default class NavigationBar extends ImmutablePureComponent { static propTypes = { diff --git a/app/javascript/flavours/glitch/features/compose/components/options.jsx b/app/javascript/flavours/glitch/features/compose/components/options.jsx index 079065f8c6..98bba41198 100644 --- a/app/javascript/flavours/glitch/features/compose/components/options.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/options.jsx @@ -1,21 +1,28 @@ // Package imports. import PropTypes from 'prop-types'; -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; + import { defineMessages, injectIntl } from 'react-intl'; -import Toggle from 'react-toggle'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; import { connect } from 'react-redux'; +import Toggle from 'react-toggle'; + + // Components. import { IconButton } from 'flavours/glitch/components/icon_button'; -import TextIconButton from './text_icon_button'; +import { pollLimits } from 'flavours/glitch/initial_state'; + import DropdownContainer from '../containers/dropdown_container'; -import PrivacyDropdownContainer from '../containers/privacy_dropdown_container'; import LanguageDropdown from '../containers/language_dropdown_container'; -import ImmutablePureComponent from 'react-immutable-pure-component'; +import PrivacyDropdownContainer from '../containers/privacy_dropdown_container'; + +import TextIconButton from './text_icon_button'; + + // Utils. -import { pollLimits } from 'flavours/glitch/initial_state'; // Messages. const messages = defineMessages({ @@ -101,14 +108,14 @@ class ToggleOptionImpl extends ImmutablePureComponent { const { meta, text, checked } = this.props; return ( - + <>
{text} {meta}
-
+ ); } 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 8b0f01a9ec..2ba9f6db64 100644 --- a/app/javascript/flavours/glitch/features/compose/components/poll_form.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/poll_form.jsx @@ -1,12 +1,16 @@ -import React from 'react'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; + +import classNames from 'classnames'; + 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 AutosuggestInput from 'flavours/glitch/components/autosuggest_input'; -import classNames from 'classnames'; +import { Icon } from 'flavours/glitch/components/icon'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import { pollLimits } from 'flavours/glitch/initial_state'; const messages = defineMessages({ @@ -21,7 +25,7 @@ const messages = defineMessages({ days: { id: 'intervals.full.days', defaultMessage: '{number, plural, one {# day} other {# days}}' }, }); -class OptionIntl extends React.PureComponent { +class OptionIntl extends PureComponent { static propTypes = { title: PropTypes.string.isRequired, diff --git a/app/javascript/flavours/glitch/features/compose/components/privacy_dropdown.jsx b/app/javascript/flavours/glitch/features/compose/components/privacy_dropdown.jsx index 5b1f48bc50..d0f13cc33c 100644 --- a/app/javascript/flavours/glitch/features/compose/components/privacy_dropdown.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/privacy_dropdown.jsx @@ -1,6 +1,8 @@ import PropTypes from 'prop-types'; -import React from 'react'; +import { PureComponent } from 'react'; + import { defineMessages, injectIntl } from 'react-intl'; + import Dropdown from './dropdown'; const messages = defineMessages({ @@ -10,12 +12,12 @@ const messages = defineMessages({ unlisted_long: { id: 'privacy.unlisted.long', defaultMessage: 'Visible for all, but opted-out of discovery features' }, private_short: { id: 'privacy.private.short', defaultMessage: 'Followers only' }, private_long: { id: 'privacy.private.long', defaultMessage: 'Visible for followers only' }, - direct_short: { id: 'privacy.direct.short', defaultMessage: 'Only people I mention' }, + direct_short: { id: 'privacy.direct.short', defaultMessage: 'Mentioned people only' }, direct_long: { id: 'privacy.direct.long', defaultMessage: 'Visible for mentioned users only' }, change_privacy: { id: 'privacy.change', defaultMessage: 'Adjust status privacy' }, }); -class PrivacyDropdown extends React.PureComponent { +class PrivacyDropdown extends PureComponent { static propTypes = { isUserTouching: PropTypes.func, diff --git a/app/javascript/flavours/glitch/features/compose/components/publisher.jsx b/app/javascript/flavours/glitch/features/compose/components/publisher.jsx index 04c3926abf..b509ed3473 100644 --- a/app/javascript/flavours/glitch/features/compose/components/publisher.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/publisher.jsx @@ -1,19 +1,17 @@ -// Package imports. -import classNames from 'classnames'; import PropTypes from 'prop-types'; -import React from 'react'; + import { defineMessages, injectIntl } from 'react-intl'; -import { length } from 'stringz'; + +import classNames from 'classnames'; + import ImmutablePureComponent from 'react-immutable-pure-component'; -// Components. +import { length } from 'stringz'; + import Button from 'flavours/glitch/components/button'; import { Icon } from 'flavours/glitch/components/icon'; - -// Utils. import { maxChars } from 'flavours/glitch/initial_state'; -// Messages. const messages = defineMessages({ publish: { defaultMessage: 'Publish', @@ -26,7 +24,7 @@ const messages = defineMessages({ saveChanges: { id: 'compose_form.save_changes', defaultMessage: 'Save changes' }, public: { id: 'privacy.public.short', defaultMessage: 'Public' }, unlisted: { id: 'privacy.unlisted.short', defaultMessage: 'Unlisted' }, - private: { id: 'privacy.private.short', defaultMessage: 'Followers-only' }, + private: { id: 'privacy.private.short', defaultMessage: 'Followers only' }, direct: { id: 'privacy.direct.short', defaultMessage: 'Mentioned people only' }, }); 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 4077a29644..8a1089bce7 100644 --- a/app/javascript/flavours/glitch/features/compose/components/reply_indicator.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/reply_indicator.jsx @@ -1,15 +1,15 @@ // Package imports. import PropTypes from 'prop-types'; -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; + import { defineMessages, injectIntl } from 'react-intl'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; 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 AttachmentList from 'flavours/glitch/components/attachment_list'; - +import { IconButton } from 'flavours/glitch/components/icon_button'; +import AccountContainer from 'flavours/glitch/containers/account_container'; // Messages. const messages = defineMessages({ cancel: { diff --git a/app/javascript/flavours/glitch/features/compose/components/search.jsx b/app/javascript/flavours/glitch/features/compose/components/search.jsx index 3d1aaf2646..4b655db1c7 100644 --- a/app/javascript/flavours/glitch/features/compose/components/search.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/search.jsx @@ -1,26 +1,24 @@ -// Package imports. -import React from 'react'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + import { injectIntl, FormattedMessage, defineMessages, } from 'react-intl'; + import Overlay from 'react-overlays/Overlay'; -// Components. import { Icon } from 'flavours/glitch/components/icon'; - -// Utils. -import { focusRoot } from 'flavours/glitch/utils/dom_helpers'; import { searchEnabled } from 'flavours/glitch/initial_state'; +import { focusRoot } from 'flavours/glitch/utils/dom_helpers'; const messages = defineMessages({ placeholder: { id: 'search.placeholder', defaultMessage: 'Search' }, placeholderSignedIn: { id: 'search.search_or_paste', defaultMessage: 'Search or paste URL' }, }); -class SearchPopout extends React.PureComponent { +class SearchPopout extends PureComponent { render () { const extraInformation = searchEnabled ? : ; @@ -43,7 +41,7 @@ class SearchPopout extends React.PureComponent { } // The component. -class Search extends React.PureComponent { +class Search extends PureComponent { static contextTypes = { router: PropTypes.object.isRequired, 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 8533d4b234..3c379fe15c 100644 --- a/app/javascript/flavours/glitch/features/compose/components/search_results.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/search_results.jsx @@ -1,14 +1,16 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import ImmutablePropTypes from 'react-immutable-proptypes'; + import { FormattedMessage, defineMessages, injectIntl } from 'react-intl'; -import AccountContainer from 'flavours/glitch/containers/account_container'; -import StatusContainer from 'flavours/glitch/containers/status_container'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; + import { ImmutableHashtag as Hashtag } from 'flavours/glitch/components/hashtag'; import { Icon } from 'flavours/glitch/components/icon'; -import { searchEnabled } from 'flavours/glitch/initial_state'; import LoadMore from 'flavours/glitch/components/load_more'; +import AccountContainer from 'flavours/glitch/containers/account_container'; +import StatusContainer from 'flavours/glitch/containers/status_container'; +import { searchEnabled } from 'flavours/glitch/initial_state'; const messages = defineMessages({ dismissSuggestion: { id: 'suggestions.dismiss', defaultMessage: 'Dismiss suggestion' }, diff --git a/app/javascript/flavours/glitch/features/compose/components/text_icon_button.jsx b/app/javascript/flavours/glitch/features/compose/components/text_icon_button.jsx index a35bd4ff52..1967cef0da 100644 --- a/app/javascript/flavours/glitch/features/compose/components/text_icon_button.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/text_icon_button.jsx @@ -1,5 +1,5 @@ -import React from 'react'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; const iconStyle = { height: null, @@ -7,7 +7,7 @@ const iconStyle = { width: `${18 * 1.28571429}px`, }; -export default class TextIconButton extends React.PureComponent { +export default class TextIconButton extends PureComponent { static propTypes = { label: PropTypes.string.isRequired, 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 33e29797dc..c52eca09e1 100644 --- a/app/javascript/flavours/glitch/features/compose/components/textarea_icons.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/textarea_icons.jsx @@ -1,13 +1,13 @@ // Package imports. import PropTypes from 'prop-types'; -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; + import { defineMessages, injectIntl } from 'react-intl'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; // Components. import { Icon } from 'flavours/glitch/components/icon'; - // Messages. const messages = defineMessages({ localOnly: { diff --git a/app/javascript/flavours/glitch/features/compose/components/upload.jsx b/app/javascript/flavours/glitch/features/compose/components/upload.jsx index 4a2c5176b4..b55657e912 100644 --- a/app/javascript/flavours/glitch/features/compose/components/upload.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/upload.jsx @@ -1,12 +1,16 @@ -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -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 ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; + +import spring from 'react-motion/lib/spring'; + import { Icon } from 'flavours/glitch/components/icon'; +import Motion from '../../ui/util/optional_motion'; + export default class Upload extends ImmutablePureComponent { static contextTypes = { diff --git a/app/javascript/flavours/glitch/features/compose/components/upload_form.jsx b/app/javascript/flavours/glitch/features/compose/components/upload_form.jsx index f2e7fe7a23..a05bdac90f 100644 --- a/app/javascript/flavours/glitch/features/compose/components/upload_form.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/upload_form.jsx @@ -1,9 +1,9 @@ -import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import UploadProgressContainer from '../containers/upload_progress_container'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import UploadContainer from '../containers/upload_container'; + import SensitiveButtonContainer from '../containers/sensitive_button_container'; +import UploadContainer from '../containers/upload_container'; +import UploadProgressContainer from '../containers/upload_progress_container'; export default class UploadForm 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 61047762d1..928446c728 100644 --- a/app/javascript/flavours/glitch/features/compose/components/upload_progress.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/upload_progress.jsx @@ -1,11 +1,15 @@ -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 { PureComponent } from 'react'; + import { FormattedMessage } from 'react-intl'; -export default class UploadProgress extends React.PureComponent { +import spring from 'react-motion/lib/spring'; + +import { Icon } from 'flavours/glitch/components/icon'; + +import Motion from '../../ui/util/optional_motion'; + +export default class UploadProgress extends PureComponent { static propTypes = { active: PropTypes.bool, diff --git a/app/javascript/flavours/glitch/features/compose/components/warning.jsx b/app/javascript/flavours/glitch/features/compose/components/warning.jsx index 803b7f86ab..c5babc30a5 100644 --- a/app/javascript/flavours/glitch/features/compose/components/warning.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/warning.jsx @@ -1,9 +1,11 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import Motion from '../../ui/util/optional_motion'; +import { PureComponent } from 'react'; + import spring from 'react-motion/lib/spring'; -export default class Warning extends React.PureComponent { +import Motion from '../../ui/util/optional_motion'; + +export default class Warning extends PureComponent { static propTypes = { message: PropTypes.node.isRequired, diff --git a/app/javascript/flavours/glitch/features/compose/containers/autosuggest_account_container.js b/app/javascript/flavours/glitch/features/compose/containers/autosuggest_account_container.js index 0e1c328fe9..87362a4af4 100644 --- a/app/javascript/flavours/glitch/features/compose/containers/autosuggest_account_container.js +++ b/app/javascript/flavours/glitch/features/compose/containers/autosuggest_account_container.js @@ -1,7 +1,9 @@ import { connect } from 'react-redux'; -import AutosuggestAccount from '../components/autosuggest_account'; + import { makeGetAccount } from 'flavours/glitch/selectors'; +import AutosuggestAccount from '../components/autosuggest_account'; + const makeMapStateToProps = () => { const getAccount = makeGetAccount(); diff --git a/app/javascript/flavours/glitch/features/compose/containers/compose_form_container.js b/app/javascript/flavours/glitch/features/compose/containers/compose_form_container.js index ddcdb367a5..e9724568cd 100644 --- a/app/javascript/flavours/glitch/features/compose/containers/compose_form_container.js +++ b/app/javascript/flavours/glitch/features/compose/containers/compose_form_container.js @@ -1,6 +1,7 @@ -import { connect } from 'react-redux'; import { defineMessages, injectIntl } from 'react-intl'; -import ComposeForm from '../components/compose_form'; + +import { connect } from 'react-redux'; + import { changeCompose, changeComposeSpoilerText, @@ -13,13 +14,14 @@ import { submitCompose, uploadCompose, } from 'flavours/glitch/actions/compose'; +import { changeLocalSetting } from 'flavours/glitch/actions/local_settings'; import { openModal, } from 'flavours/glitch/actions/modal'; -import { changeLocalSetting } from 'flavours/glitch/actions/local_settings'; - import { privacyPreference } from 'flavours/glitch/utils/privacy_preference'; +import ComposeForm from '../components/compose_form'; + const messages = defineMessages({ missingDescriptionMessage: { id: 'confirmations.missing_media_description.message', @@ -124,18 +126,24 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ }, onMediaDescriptionConfirm(routerHistory, mediaId, overriddenVisibility = null) { - dispatch(openModal('CONFIRM', { - message: intl.formatMessage(messages.missingDescriptionMessage), - confirm: intl.formatMessage(messages.missingDescriptionConfirm), - onConfirm: () => { - if (overriddenVisibility) { - dispatch(changeComposeVisibility(overriddenVisibility)); - } - dispatch(submitCompose(routerHistory)); + dispatch(openModal({ + modalType: 'CONFIRM', + modalProps: { + message: intl.formatMessage(messages.missingDescriptionMessage), + confirm: intl.formatMessage(messages.missingDescriptionConfirm), + onConfirm: () => { + if (overriddenVisibility) { + dispatch(changeComposeVisibility(overriddenVisibility)); + } + dispatch(submitCompose(routerHistory)); + }, + secondary: intl.formatMessage(messages.missingDescriptionEdit), + onSecondary: () => dispatch(openModal({ + modalType: 'FOCAL_POINT', + modalProps: { id: mediaId }, + })), + onDoNotAsk: () => dispatch(changeLocalSetting(['confirm_missing_media_description'], false)), }, - secondary: intl.formatMessage(messages.missingDescriptionEdit), - onSecondary: () => dispatch(openModal('FOCAL_POINT', { id: mediaId })), - onDoNotAsk: () => dispatch(changeLocalSetting(['confirm_missing_media_description'], false)), })); }, diff --git a/app/javascript/flavours/glitch/features/compose/containers/dropdown_container.js b/app/javascript/flavours/glitch/features/compose/containers/dropdown_container.js index 3ac16505fc..1f39edbffc 100644 --- a/app/javascript/flavours/glitch/features/compose/containers/dropdown_container.js +++ b/app/javascript/flavours/glitch/features/compose/containers/dropdown_container.js @@ -1,11 +1,13 @@ import { connect } from 'react-redux'; -import { isUserTouching } from 'flavours/glitch/is_mobile'; + import { openModal, closeModal } from 'flavours/glitch/actions/modal'; +import { isUserTouching } from 'flavours/glitch/is_mobile'; + import Dropdown from '../components/dropdown'; const mapDispatchToProps = dispatch => ({ isUserTouching, - onModalOpen: props => dispatch(openModal('ACTIONS', props)), + onModalOpen: props => dispatch(openModal({ modalType: 'ACTIONS', modalProps: props })), onModalClose: () => dispatch(closeModal()), }); diff --git a/app/javascript/flavours/glitch/features/compose/containers/emoji_picker_dropdown_container.js b/app/javascript/flavours/glitch/features/compose/containers/emoji_picker_dropdown_container.js index d2fe56103a..c06c52c14e 100644 --- a/app/javascript/flavours/glitch/features/compose/containers/emoji_picker_dropdown_container.js +++ b/app/javascript/flavours/glitch/features/compose/containers/emoji_picker_dropdown_container.js @@ -1,9 +1,11 @@ -import { connect } from 'react-redux'; -import EmojiPickerDropdown from '../components/emoji_picker_dropdown'; -import { changeSetting } from 'flavours/glitch/actions/settings'; -import { createSelector } from 'reselect'; import { Map as ImmutableMap } from 'immutable'; +import { connect } from 'react-redux'; +import { createSelector } from 'reselect'; + import { useEmoji } from 'flavours/glitch/actions/emojis'; +import { changeSetting } from 'flavours/glitch/actions/settings'; + +import EmojiPickerDropdown from '../components/emoji_picker_dropdown'; const perLine = 8; const lines = 2; diff --git a/app/javascript/flavours/glitch/features/compose/containers/header_container.js b/app/javascript/flavours/glitch/features/compose/containers/header_container.js index e1ce19fb08..5b78c8b9cd 100644 --- a/app/javascript/flavours/glitch/features/compose/containers/header_container.js +++ b/app/javascript/flavours/glitch/features/compose/containers/header_container.js @@ -1,9 +1,12 @@ -import { openModal } from 'flavours/glitch/actions/modal'; -import { connect } from 'react-redux'; import { defineMessages, injectIntl } from 'react-intl'; -import Header from '../components/header'; + +import { connect } from 'react-redux'; + +import { openModal } from 'flavours/glitch/actions/modal'; import { logOut } from 'flavours/glitch/utils/log_out'; +import Header from '../components/header'; + const messages = defineMessages({ logoutMessage: { id: 'confirmations.logout.message', defaultMessage: 'Are you sure you want to log out?' }, logoutConfirm: { id: 'confirmations.logout.confirm', defaultMessage: 'Log out' }, @@ -21,14 +24,17 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ onSettingsClick (e) { e.preventDefault(); e.stopPropagation(); - dispatch(openModal('SETTINGS', {})); + dispatch(openModal({ modalType: 'SETTINGS', modalProps: {} })); }, onLogout () { - dispatch(openModal('CONFIRM', { - message: intl.formatMessage(messages.logoutMessage), - confirm: intl.formatMessage(messages.logoutConfirm), - closeWhenConfirm: false, - onConfirm: () => logOut(), + dispatch(openModal({ + modalType: 'CONFIRM', + modalProps: { + message: intl.formatMessage(messages.logoutMessage), + confirm: intl.formatMessage(messages.logoutConfirm), + closeWhenConfirm: false, + onConfirm: () => logOut(), + }, })); }, }); diff --git a/app/javascript/flavours/glitch/features/compose/containers/language_dropdown_container.js b/app/javascript/flavours/glitch/features/compose/containers/language_dropdown_container.js index 7f07064c40..8a50da4c44 100644 --- a/app/javascript/flavours/glitch/features/compose/containers/language_dropdown_container.js +++ b/app/javascript/flavours/glitch/features/compose/containers/language_dropdown_container.js @@ -1,9 +1,11 @@ +import { Map as ImmutableMap } from 'immutable'; import { connect } from 'react-redux'; -import LanguageDropdown from '../components/language_dropdown'; +import { createSelector } from 'reselect'; + import { changeComposeLanguage } from 'flavours/glitch/actions/compose'; import { useLanguage } from 'flavours/glitch/actions/languages'; -import { createSelector } from 'reselect'; -import { Map as ImmutableMap } from 'immutable'; + +import LanguageDropdown from '../components/language_dropdown'; const getFrequentlyUsedLanguages = createSelector([ state => state.getIn(['settings', 'frequentlyUsedLanguages'], ImmutableMap()), diff --git a/app/javascript/flavours/glitch/features/compose/containers/navigation_container.js b/app/javascript/flavours/glitch/features/compose/containers/navigation_container.js index 89036adcd3..541365aa99 100644 --- a/app/javascript/flavours/glitch/features/compose/containers/navigation_container.js +++ b/app/javascript/flavours/glitch/features/compose/containers/navigation_container.js @@ -1,9 +1,12 @@ -import { connect } from 'react-redux'; import { defineMessages, injectIntl } from 'react-intl'; -import NavigationBar from '../components/navigation_bar'; -import { logOut } from 'flavours/glitch/utils/log_out'; + +import { connect } from 'react-redux'; + import { openModal } from 'flavours/glitch/actions/modal'; import { me } from 'flavours/glitch/initial_state'; +import { logOut } from 'flavours/glitch/utils/log_out'; + +import NavigationBar from '../components/navigation_bar'; const messages = defineMessages({ logoutMessage: { id: 'confirmations.logout.message', defaultMessage: 'Are you sure you want to log out?' }, @@ -18,11 +21,14 @@ const mapStateToProps = state => { const mapDispatchToProps = (dispatch, { intl }) => ({ onLogout () { - dispatch(openModal('CONFIRM', { - message: intl.formatMessage(messages.logoutMessage), - confirm: intl.formatMessage(messages.logoutConfirm), - closeWhenConfirm: false, - onConfirm: () => logOut(), + dispatch(openModal({ + modalType: 'CONFIRM', + modalProps: { + message: intl.formatMessage(messages.logoutMessage), + confirm: intl.formatMessage(messages.logoutConfirm), + closeWhenConfirm: false, + onConfirm: () => logOut(), + }, })); }, }); diff --git a/app/javascript/flavours/glitch/features/compose/containers/options_container.js b/app/javascript/flavours/glitch/features/compose/containers/options_container.js index 5b7ccc06b8..c44d3ce305 100644 --- a/app/javascript/flavours/glitch/features/compose/containers/options_container.js +++ b/app/javascript/flavours/glitch/features/compose/containers/options_container.js @@ -1,5 +1,5 @@ import { connect } from 'react-redux'; -import Options from '../components/options'; + import { changeComposeAdvancedOption, changeComposeContentType, @@ -8,6 +8,8 @@ import { } from 'flavours/glitch/actions/compose'; import { openModal } from 'flavours/glitch/actions/modal'; +import Options from '../components/options'; + function mapStateToProps (state) { const poll = state.getIn(['compose', 'poll']); const media = state.getIn(['compose', 'media_attachments']); @@ -44,7 +46,10 @@ const mapDispatchToProps = (dispatch) => ({ }, onDoodleOpen() { - dispatch(openModal('DOODLE', { noEsc: true, noClose: true })); + dispatch(openModal({ + modalType: 'DOODLE', + modalProps: { noEsc: true, noClose: true }, + })); }, }); diff --git a/app/javascript/flavours/glitch/features/compose/containers/poll_form_container.js b/app/javascript/flavours/glitch/features/compose/containers/poll_form_container.js index 14038b3e8c..cc8f341a3a 100644 --- a/app/javascript/flavours/glitch/features/compose/containers/poll_form_container.js +++ b/app/javascript/flavours/glitch/features/compose/containers/poll_form_container.js @@ -1,5 +1,5 @@ import { connect } from 'react-redux'; -import PollForm from '../components/poll_form'; + import { addPollOption, removePollOption, @@ -10,6 +10,8 @@ import { selectComposeSuggestion, } from 'flavours/glitch/actions/compose'; +import PollForm from '../components/poll_form'; + const mapStateToProps = state => ({ suggestions: state.getIn(['compose', 'suggestions']), options: state.getIn(['compose', 'poll', 'options']), diff --git a/app/javascript/flavours/glitch/features/compose/containers/privacy_dropdown_container.js b/app/javascript/flavours/glitch/features/compose/containers/privacy_dropdown_container.js index 5591d89c46..dcbd977dae 100644 --- a/app/javascript/flavours/glitch/features/compose/containers/privacy_dropdown_container.js +++ b/app/javascript/flavours/glitch/features/compose/containers/privacy_dropdown_container.js @@ -1,9 +1,11 @@ import { connect } from 'react-redux'; -import PrivacyDropdown from '../components/privacy_dropdown'; + import { changeComposeVisibility } from 'flavours/glitch/actions/compose'; import { openModal, closeModal } from 'flavours/glitch/actions/modal'; import { isUserTouching } from 'flavours/glitch/is_mobile'; +import PrivacyDropdown from '../components/privacy_dropdown'; + const mapStateToProps = state => ({ value: state.getIn(['compose', 'privacy']), }); @@ -15,8 +17,14 @@ const mapDispatchToProps = dispatch => ({ }, isUserTouching, - onModalOpen: props => dispatch(openModal('ACTIONS', props)), - onModalClose: () => dispatch(closeModal()), + onModalOpen: props => dispatch(openModal({ + modalType: 'ACTIONS', + modalProps: props, + })), + onModalClose: () => dispatch(closeModal({ + modalType: undefined, + ignoreFocus: false, + })), }); diff --git a/app/javascript/flavours/glitch/features/compose/containers/reply_indicator_container.js b/app/javascript/flavours/glitch/features/compose/containers/reply_indicator_container.js index dd6899be41..61012bcb1e 100644 --- a/app/javascript/flavours/glitch/features/compose/containers/reply_indicator_container.js +++ b/app/javascript/flavours/glitch/features/compose/containers/reply_indicator_container.js @@ -1,5 +1,7 @@ import { connect } from 'react-redux'; + import { cancelReplyCompose } from 'flavours/glitch/actions/compose'; + import ReplyIndicator from '../components/reply_indicator'; const makeMapStateToProps = () => { diff --git a/app/javascript/flavours/glitch/features/compose/containers/search_container.js b/app/javascript/flavours/glitch/features/compose/containers/search_container.js index 8f4bfcf088..8280d962b3 100644 --- a/app/javascript/flavours/glitch/features/compose/containers/search_container.js +++ b/app/javascript/flavours/glitch/features/compose/containers/search_container.js @@ -1,10 +1,12 @@ import { connect } from 'react-redux'; + import { changeSearch, clearSearch, submitSearch, showSearch, } from 'flavours/glitch/actions/search'; + import Search from '../components/search'; const mapStateToProps = state => ({ diff --git a/app/javascript/flavours/glitch/features/compose/containers/search_results_container.js b/app/javascript/flavours/glitch/features/compose/containers/search_results_container.js index 5c2c1be232..7287a022b4 100644 --- a/app/javascript/flavours/glitch/features/compose/containers/search_results_container.js +++ b/app/javascript/flavours/glitch/features/compose/containers/search_results_container.js @@ -1,7 +1,9 @@ import { connect } from 'react-redux'; -import SearchResults from '../components/search_results'; -import { fetchSuggestions, dismissSuggestion } from 'flavours/glitch/actions/suggestions'; + import { expandSearch } from 'flavours/glitch/actions/search'; +import { fetchSuggestions, dismissSuggestion } from 'flavours/glitch/actions/suggestions'; + +import SearchResults from '../components/search_results'; const mapStateToProps = state => ({ results: state.getIn(['search', 'results']), diff --git a/app/javascript/flavours/glitch/features/compose/containers/sensitive_button_container.jsx b/app/javascript/flavours/glitch/features/compose/containers/sensitive_button_container.jsx index 9c23d3f47a..931f396b35 100644 --- a/app/javascript/flavours/glitch/features/compose/containers/sensitive_button_container.jsx +++ b/app/javascript/flavours/glitch/features/compose/containers/sensitive_button_container.jsx @@ -1,10 +1,14 @@ -import React from 'react'; -import { connect } from 'react-redux'; import PropTypes from 'prop-types'; -import classNames from 'classnames'; -import { changeComposeSensitivity } from 'flavours/glitch/actions/compose'; +import { PureComponent } from 'react'; + import { injectIntl, defineMessages, FormattedMessage } from 'react-intl'; +import classNames from 'classnames'; + +import { connect } from 'react-redux'; + +import { changeComposeSensitivity } from 'flavours/glitch/actions/compose'; + const messages = defineMessages({ marked: { id: 'compose_form.sensitive.marked', @@ -34,7 +38,7 @@ const mapDispatchToProps = dispatch => ({ }); -class SensitiveButton extends React.PureComponent { +class SensitiveButton extends PureComponent { static propTypes = { active: PropTypes.bool, diff --git a/app/javascript/flavours/glitch/features/compose/containers/upload_container.js b/app/javascript/flavours/glitch/features/compose/containers/upload_container.js index 2189c870b1..006506f169 100644 --- a/app/javascript/flavours/glitch/features/compose/containers/upload_container.js +++ b/app/javascript/flavours/glitch/features/compose/containers/upload_container.js @@ -1,7 +1,9 @@ import { connect } from 'react-redux'; -import Upload from '../components/upload'; + import { undoUploadCompose, initMediaEditModal, submitCompose } from 'flavours/glitch/actions/compose'; +import Upload from '../components/upload'; + const mapStateToProps = (state, { id }) => ({ media: state.getIn(['compose', 'media_attachments']).find(item => item.get('id') === id), }); diff --git a/app/javascript/flavours/glitch/features/compose/containers/upload_form_container.js b/app/javascript/flavours/glitch/features/compose/containers/upload_form_container.js index a6798bf512..336525cf53 100644 --- a/app/javascript/flavours/glitch/features/compose/containers/upload_form_container.js +++ b/app/javascript/flavours/glitch/features/compose/containers/upload_form_container.js @@ -1,4 +1,5 @@ import { connect } from 'react-redux'; + import UploadForm from '../components/upload_form'; const mapStateToProps = state => ({ diff --git a/app/javascript/flavours/glitch/features/compose/containers/upload_progress_container.js b/app/javascript/flavours/glitch/features/compose/containers/upload_progress_container.js index b18c76a43f..ffff321c3f 100644 --- a/app/javascript/flavours/glitch/features/compose/containers/upload_progress_container.js +++ b/app/javascript/flavours/glitch/features/compose/containers/upload_progress_container.js @@ -1,4 +1,5 @@ import { connect } from 'react-redux'; + import UploadProgress from '../components/upload_progress'; const mapStateToProps = state => ({ diff --git a/app/javascript/flavours/glitch/features/compose/containers/warning_container.jsx b/app/javascript/flavours/glitch/features/compose/containers/warning_container.jsx index 8abc668fc6..f7c3fc3e19 100644 --- a/app/javascript/flavours/glitch/features/compose/containers/warning_container.jsx +++ b/app/javascript/flavours/glitch/features/compose/containers/warning_container.jsx @@ -1,11 +1,14 @@ -import React from 'react'; -import { connect } from 'react-redux'; -import Warning from '../components/warning'; import PropTypes from 'prop-types'; + import { FormattedMessage } from 'react-intl'; + +import { connect } from 'react-redux'; + import { me } from 'flavours/glitch/initial_state'; import { profileLink, privacyPolicyLink } from 'flavours/glitch/utils/backend_links'; +import Warning from '../components/warning'; + const buildHashtagRE = () => { try { const HASHTAG_SEPARATORS = '_\\u00b7\\u200c'; diff --git a/app/javascript/flavours/glitch/features/compose/index.jsx b/app/javascript/flavours/glitch/features/compose/index.jsx index 611d83ad0e..39ef19ef59 100644 --- a/app/javascript/flavours/glitch/features/compose/index.jsx +++ b/app/javascript/flavours/glitch/features/compose/index.jsx @@ -1,20 +1,27 @@ -import React from 'react'; -import ComposeFormContainer from './containers/compose_form_container'; -import NavigationContainer from './containers/navigation_container'; import PropTypes from 'prop-types'; -import { connect } from 'react-redux'; -import { mountCompose, unmountCompose, cycleElefriendCompose } from 'flavours/glitch/actions/compose'; +import { PureComponent } from 'react'; + import { injectIntl, defineMessages } from 'react-intl'; + import classNames from 'classnames'; -import SearchContainer from './containers/search_container'; -import Motion from '../ui/util/optional_motion'; -import spring from 'react-motion/lib/spring'; -import SearchResultsContainer from './containers/search_results_container'; -import { mascot } from 'flavours/glitch/initial_state'; -import HeaderContainer from './containers/header_container'; -import Column from 'flavours/glitch/components/column'; import { Helmet } from 'react-helmet'; +import { connect } from 'react-redux'; + +import spring from 'react-motion/lib/spring'; + +import { mountCompose, unmountCompose, cycleElefriendCompose } from 'flavours/glitch/actions/compose'; +import Column from 'flavours/glitch/components/column'; +import { mascot } from 'flavours/glitch/initial_state'; + +import Motion from '../ui/util/optional_motion'; + +import ComposeFormContainer from './containers/compose_form_container'; +import HeaderContainer from './containers/header_container'; +import NavigationContainer from './containers/navigation_container'; +import SearchContainer from './containers/search_container'; +import SearchResultsContainer from './containers/search_results_container'; + const messages = defineMessages({ compose: { id: 'navigation_bar.compose', defaultMessage: 'Compose new post' }, }); @@ -38,7 +45,7 @@ const mapDispatchToProps = (dispatch) => ({ }, }); -class Compose extends React.PureComponent { +class Compose extends PureComponent { static propTypes = { multiColumn: PropTypes.bool, diff --git a/app/javascript/flavours/glitch/features/compose/util/url_regex.js b/app/javascript/flavours/glitch/features/compose/util/url_regex.js index 9c2005c53d..887612ae30 100644 --- a/app/javascript/flavours/glitch/features/compose/util/url_regex.js +++ b/app/javascript/flavours/glitch/features/compose/util/url_regex.js @@ -1,8 +1,8 @@ import regexSupplant from 'twitter-text/dist/lib/regexSupplant'; -import validUrlPrecedingChars from 'twitter-text/dist/regexp/validUrlPrecedingChars'; import validDomain from 'twitter-text/dist/regexp/validDomain'; import validPortNumber from 'twitter-text/dist/regexp/validPortNumber'; import validUrlPath from 'twitter-text/dist/regexp/validUrlPath'; +import validUrlPrecedingChars from 'twitter-text/dist/regexp/validUrlPrecedingChars'; import validUrlQueryChars from 'twitter-text/dist/regexp/validUrlQueryChars'; import validUrlQueryEndingChars from 'twitter-text/dist/regexp/validUrlQueryEndingChars'; diff --git a/app/javascript/flavours/glitch/features/direct_timeline/components/column_settings.jsx b/app/javascript/flavours/glitch/features/direct_timeline/components/column_settings.jsx index 79e98ec6fc..9c8e23ce73 100644 --- a/app/javascript/flavours/glitch/features/direct_timeline/components/column_settings.jsx +++ b/app/javascript/flavours/glitch/features/direct_timeline/components/column_settings.jsx @@ -1,8 +1,12 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import ImmutablePropTypes from 'react-immutable-proptypes'; +import { PureComponent } from 'react'; + import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; + import SettingToggle from 'flavours/glitch/features/notifications/components/setting_toggle'; + import SettingText from '../../../components/setting_text'; const messages = defineMessages({ @@ -10,7 +14,7 @@ const messages = defineMessages({ settings: { id: 'home.settings', defaultMessage: 'Column settings' }, }); -class ColumnSettings extends React.PureComponent { +class ColumnSettings extends PureComponent { static propTypes = { settings: ImmutablePropTypes.map.isRequired, 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 18bc6e575e..0a2262f281 100644 --- a/app/javascript/flavours/glitch/features/direct_timeline/components/conversation.jsx +++ b/app/javascript/flavours/glitch/features/direct_timeline/components/conversation.jsx @@ -1,18 +1,22 @@ -import React from 'react'; import PropTypes from 'prop-types'; + +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; + +import classNames from 'classnames'; + import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import StatusContent from 'flavours/glitch/components/status_content'; -import AttachmentList from 'flavours/glitch/components/attachment_list'; -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 { HotKeys } from 'react-hotkeys'; + +import AttachmentList from 'flavours/glitch/components/attachment_list'; +import AvatarComposite from 'flavours/glitch/components/avatar_composite'; +import { IconButton } from 'flavours/glitch/components/icon_button'; +import Permalink from 'flavours/glitch/components/permalink'; +import { RelativeTimestamp } from 'flavours/glitch/components/relative_timestamp'; +import StatusContent from 'flavours/glitch/components/status_content'; +import DropdownMenuContainer from 'flavours/glitch/containers/dropdown_menu_container'; import { autoPlayGif } from 'flavours/glitch/initial_state'; -import classNames from 'classnames'; const messages = defineMessages({ more: { id: 'status.more', defaultMessage: 'More' }, diff --git a/app/javascript/flavours/glitch/features/direct_timeline/components/conversations_list.jsx b/app/javascript/flavours/glitch/features/direct_timeline/components/conversations_list.jsx index 2bfe6fbf12..03e523bfd6 100644 --- a/app/javascript/flavours/glitch/features/direct_timeline/components/conversations_list.jsx +++ b/app/javascript/flavours/glitch/features/direct_timeline/components/conversations_list.jsx @@ -1,11 +1,14 @@ -import React from 'react'; import PropTypes from 'prop-types'; + import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import ConversationContainer from '../containers/conversation_container'; -import ScrollableList from 'flavours/glitch/components/scrollable_list'; + import { debounce } from 'lodash'; +import ScrollableList from 'flavours/glitch/components/scrollable_list'; + +import ConversationContainer from '../containers/conversation_container'; + export default class ConversationsList extends ImmutablePureComponent { static propTypes = { diff --git a/app/javascript/flavours/glitch/features/direct_timeline/containers/column_settings_container.js b/app/javascript/flavours/glitch/features/direct_timeline/containers/column_settings_container.js index 6385d30a43..d7ccaae3ec 100644 --- a/app/javascript/flavours/glitch/features/direct_timeline/containers/column_settings_container.js +++ b/app/javascript/flavours/glitch/features/direct_timeline/containers/column_settings_container.js @@ -1,7 +1,9 @@ import { connect } from 'react-redux'; -import ColumnSettings from '../components/column_settings'; + import { changeSetting } from 'flavours/glitch/actions/settings'; +import ColumnSettings from '../components/column_settings'; + const mapStateToProps = state => ({ settings: state.getIn(['settings', 'direct']), }); diff --git a/app/javascript/flavours/glitch/features/direct_timeline/containers/conversation_container.js b/app/javascript/flavours/glitch/features/direct_timeline/containers/conversation_container.js index f5e5946e3b..207d3ebb65 100644 --- a/app/javascript/flavours/glitch/features/direct_timeline/containers/conversation_container.js +++ b/app/javascript/flavours/glitch/features/direct_timeline/containers/conversation_container.js @@ -1,11 +1,14 @@ +import { defineMessages, injectIntl } from 'react-intl'; + import { connect } from 'react-redux'; -import Conversation from '../components/conversation'; -import { markConversationRead, deleteConversation } from 'flavours/glitch/actions/conversations'; -import { makeGetStatus } from 'flavours/glitch/selectors'; + import { replyCompose } from 'flavours/glitch/actions/compose'; +import { markConversationRead, deleteConversation } from 'flavours/glitch/actions/conversations'; import { openModal } from 'flavours/glitch/actions/modal'; import { muteStatus, unmuteStatus, hideStatus, revealStatus } from 'flavours/glitch/actions/statuses'; -import { defineMessages, injectIntl } from 'react-intl'; +import { makeGetStatus } from 'flavours/glitch/selectors'; + +import Conversation from '../components/conversation'; const messages = defineMessages({ replyConfirm: { id: 'confirmations.reply.confirm', defaultMessage: 'Reply' }, @@ -39,10 +42,13 @@ const mapDispatchToProps = (dispatch, { intl, conversationId }) => ({ let state = getState(); if (state.getIn(['compose', 'text']).trim().length !== 0) { - dispatch(openModal('CONFIRM', { - message: intl.formatMessage(messages.replyMessage), - confirm: intl.formatMessage(messages.replyConfirm), - onConfirm: () => dispatch(replyCompose(status, router)), + dispatch(openModal({ + modalType: 'CONFIRM', + modalProps: { + message: intl.formatMessage(messages.replyMessage), + confirm: intl.formatMessage(messages.replyConfirm), + onConfirm: () => dispatch(replyCompose(status, router)), + }, })); } else { dispatch(replyCompose(status, router)); diff --git a/app/javascript/flavours/glitch/features/direct_timeline/containers/conversations_list_container.js b/app/javascript/flavours/glitch/features/direct_timeline/containers/conversations_list_container.js index e10558f3ab..d0298c7233 100644 --- a/app/javascript/flavours/glitch/features/direct_timeline/containers/conversations_list_container.js +++ b/app/javascript/flavours/glitch/features/direct_timeline/containers/conversations_list_container.js @@ -1,7 +1,9 @@ import { connect } from 'react-redux'; -import ConversationsList from '../components/conversations_list'; + import { expandConversations } from 'flavours/glitch/actions/conversations'; +import ConversationsList from '../components/conversations_list'; + const mapStateToProps = state => ({ conversations: state.getIn(['conversations', 'items']), isLoading: state.getIn(['conversations', 'isLoading'], true), diff --git a/app/javascript/flavours/glitch/features/direct_timeline/index.jsx b/app/javascript/flavours/glitch/features/direct_timeline/index.jsx index 2fe3f25686..315a5ee107 100644 --- a/app/javascript/flavours/glitch/features/direct_timeline/index.jsx +++ b/app/javascript/flavours/glitch/features/direct_timeline/index.jsx @@ -1,8 +1,12 @@ import PropTypes from 'prop-types'; -import React from 'react'; -import { Helmet } from 'react-helmet'; +import { PureComponent } from 'react'; + import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; + +import { Helmet } from 'react-helmet'; + import { connect } from 'react-redux'; + import { addColumn, removeColumn, moveColumn } from 'flavours/glitch/actions/columns'; import { mountConversations, unmountConversations, expandConversations } from 'flavours/glitch/actions/conversations'; import { connectDirectStream } from 'flavours/glitch/actions/streaming'; @@ -10,6 +14,7 @@ import { expandDirectTimeline } from 'flavours/glitch/actions/timelines'; import Column from 'flavours/glitch/components/column'; import ColumnHeader from 'flavours/glitch/components/column_header'; import StatusListContainer from 'flavours/glitch/features/ui/containers/status_list_container'; + import ColumnSettingsContainer from './containers/column_settings_container'; import ConversationsListContainer from './containers/conversations_list_container'; @@ -22,7 +27,7 @@ const mapStateToProps = state => ({ conversationsMode: state.getIn(['settings', 'direct', 'conversations']), }); -class DirectTimeline extends React.PureComponent { +class DirectTimeline extends PureComponent { static propTypes = { dispatch: PropTypes.func.isRequired, 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 da11f881fc..345dbe5a27 100644 --- a/app/javascript/flavours/glitch/features/directory/components/account_card.jsx +++ b/app/javascript/flavours/glitch/features/directory/components/account_card.jsx @@ -1,17 +1,13 @@ -import React from 'react'; -import ImmutablePureComponent from 'react-immutable-pure-component'; -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 { DisplayName } from 'flavours/glitch/components/display_name'; -import Permalink from 'flavours/glitch/components/permalink'; -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'; -import ShortNumber from 'flavours/glitch/components/short_number'; + +import classNames from 'classnames'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; +import { connect } from 'react-redux'; + import { followAccount, unfollowAccount, @@ -19,7 +15,14 @@ import { unmuteAccount, } from 'flavours/glitch/actions/accounts'; import { openModal } from 'flavours/glitch/actions/modal'; -import classNames from 'classnames'; +import { Avatar } from 'flavours/glitch/components/avatar'; +import Button from 'flavours/glitch/components/button'; +import { DisplayName } from 'flavours/glitch/components/display_name'; +import { IconButton } from 'flavours/glitch/components/icon_button'; +import Permalink from 'flavours/glitch/components/permalink'; +import ShortNumber from 'flavours/glitch/components/short_number'; +import { autoPlayGif, me, unfollowModal } from 'flavours/glitch/initial_state'; +import { makeGetAccount } from 'flavours/glitch/selectors'; const messages = defineMessages({ unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' }, @@ -49,27 +52,32 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ if (account.getIn(['relationship', 'following'])) { if (unfollowModal) { dispatch( - openModal('CONFIRM', { - message: ( - @{account.get('acct')} }} - /> - ), - confirm: intl.formatMessage(messages.unfollowConfirm), - onConfirm: () => dispatch(unfollowAccount(account.get('id'))), - }), + openModal({ + modalType: 'CONFIRM', + modalProps: { + message: ( + @{account.get('acct')} }} + /> + ), + confirm: intl.formatMessage(messages.unfollowConfirm), + onConfirm: () => dispatch(unfollowAccount(account.get('id'))), + } }), ); } else { dispatch(unfollowAccount(account.get('id'))); } } else if (account.getIn(['relationship', 'requested'])) { if (unfollowModal) { - dispatch(openModal('CONFIRM', { - message: @{account.get('acct')} }} />, - confirm: intl.formatMessage(messages.cancelFollowRequestConfirm), - onConfirm: () => dispatch(unfollowAccount(account.get('id'))), + dispatch(openModal({ + modalType: 'CONFIRM', + modalProps: { + message: @{account.get('acct')} }} />, + confirm: intl.formatMessage(messages.cancelFollowRequestConfirm), + onConfirm: () => dispatch(unfollowAccount(account.get('id'))), + }, })); } else { dispatch(unfollowAccount(account.get('id'))); diff --git a/app/javascript/flavours/glitch/features/directory/index.jsx b/app/javascript/flavours/glitch/features/directory/index.jsx index 22280bbfdb..4daa5f942c 100644 --- a/app/javascript/flavours/glitch/features/directory/index.jsx +++ b/app/javascript/flavours/glitch/features/directory/index.jsx @@ -1,19 +1,24 @@ -import React from 'react'; -import { connect } from 'react-redux'; -import { defineMessages, injectIntl } from 'react-intl'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + +import { defineMessages, injectIntl } from 'react-intl'; + +import { Helmet } from 'react-helmet'; + +import { List as ImmutableList } from 'immutable'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import Column from 'flavours/glitch/components/column'; -import ColumnHeader from 'flavours/glitch/components/column_header'; +import { connect } from 'react-redux'; + import { addColumn, removeColumn, moveColumn, changeColumnParams } from 'flavours/glitch/actions/columns'; 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 Column from 'flavours/glitch/components/column'; +import ColumnHeader from 'flavours/glitch/components/column_header'; import LoadMore from 'flavours/glitch/components/load_more'; -import ScrollContainer from 'flavours/glitch/containers/scroll_container'; import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; -import { Helmet } from 'react-helmet'; +import { RadioButton } from 'flavours/glitch/components/radio_button'; +import ScrollContainer from 'flavours/glitch/containers/scroll_container'; + +import AccountCard from './components/account_card'; const messages = defineMessages({ title: { id: 'column.directory', defaultMessage: 'Browse profiles' }, @@ -29,7 +34,7 @@ const mapStateToProps = state => ({ domain: state.getIn(['meta', 'domain']), }); -class Directory extends React.PureComponent { +class Directory extends PureComponent { static contextTypes = { router: PropTypes.object, diff --git a/app/javascript/flavours/glitch/features/domain_blocks/index.jsx b/app/javascript/flavours/glitch/features/domain_blocks/index.jsx index b9ef739593..c7be4d9338 100644 --- a/app/javascript/flavours/glitch/features/domain_blocks/index.jsx +++ b/app/javascript/flavours/glitch/features/domain_blocks/index.jsx @@ -1,18 +1,27 @@ -import React from 'react'; -import { connect } from 'react-redux'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import { debounce } from 'lodash'; import PropTypes from 'prop-types'; -import LoadingIndicator from '../../components/loading_indicator'; -import Column from '../ui/components/column'; -import ColumnBackButtonSlim from '../../components/column_back_button_slim'; -import DomainContainer from '../../containers/domain_container'; -import { fetchDomainBlocks, expandDomainBlocks } from '../../actions/domain_blocks'; + import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import ImmutablePureComponent from 'react-immutable-pure-component'; -import ScrollableList from 'flavours/glitch/components/scrollable_list'; + import { Helmet } from 'react-helmet'; +import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; +import { connect } from 'react-redux'; + +import { debounce } from 'lodash'; + +import ScrollableList from 'flavours/glitch/components/scrollable_list'; + +import { fetchDomainBlocks, expandDomainBlocks } from '../../actions/domain_blocks'; +import ColumnBackButtonSlim from '../../components/column_back_button_slim'; +import LoadingIndicator from '../../components/loading_indicator'; +import DomainContainer from '../../containers/domain_container'; +import Column from '../ui/components/column'; + + + + + const messages = defineMessages({ heading: { id: 'column.domain_blocks', defaultMessage: 'Blocked domains' }, unblockDomain: { id: 'account.unblock_domain', defaultMessage: 'Unblock domain {domain}' }, diff --git a/app/javascript/flavours/glitch/features/emoji/emoji.js b/app/javascript/flavours/glitch/features/emoji/emoji.js index b058db522a..465966f87c 100644 --- a/app/javascript/flavours/glitch/features/emoji/emoji.js +++ b/app/javascript/flavours/glitch/features/emoji/emoji.js @@ -1,8 +1,10 @@ -import { autoPlayGif, useSystemEmojiFont } from 'flavours/glitch/initial_state'; -import unicodeMapping from './emoji_unicode_mapping_light'; -import { assetHost } from 'flavours/glitch/utils/config'; import Trie from 'substring-trie'; +import { autoPlayGif, useSystemEmojiFont } from 'flavours/glitch/initial_state'; +import { assetHost } from 'flavours/glitch/utils/config'; + +import unicodeMapping from './emoji_unicode_mapping_light'; + const trie = new Trie(Object.keys(unicodeMapping)); // Convert to file names from emojis. (For different variation selector emojis) diff --git a/app/javascript/flavours/glitch/features/emoji/emoji_compressed.js b/app/javascript/flavours/glitch/features/emoji/emoji_compressed.js index 0ed18b6a44..bd3d8937d8 100644 --- a/app/javascript/flavours/glitch/features/emoji/emoji_compressed.js +++ b/app/javascript/flavours/glitch/features/emoji/emoji_compressed.js @@ -7,13 +7,14 @@ // It's designed to be emitted in an array format to take up less space // over the wire. -const { unicodeToFilename } = require('./unicode_to_filename'); -const { unicodeToUnifiedName } = require('./unicode_to_unified_name'); -const emojiMap = require('./emoji_map.json'); const { emojiIndex } = require('emoji-mart'); +let data = require('emoji-mart/data/all.json'); const { uncompress: emojiMartUncompress } = require('emoji-mart/dist/utils/data'); -let data = require('emoji-mart/data/all.json'); +const emojiMap = require('./emoji_map.json'); +const { unicodeToFilename } = require('./unicode_to_filename'); +const { unicodeToUnifiedName } = require('./unicode_to_unified_name'); + if(data.compressed) { data = emojiMartUncompress(data); diff --git a/app/javascript/flavours/glitch/features/emoji/emoji_mart_data_light.js b/app/javascript/flavours/glitch/features/emoji/emoji_mart_data_light.js index 000aeb0de4..11698937c0 100644 --- a/app/javascript/flavours/glitch/features/emoji/emoji_mart_data_light.js +++ b/app/javascript/flavours/glitch/features/emoji/emoji_mart_data_light.js @@ -1,8 +1,8 @@ // 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. -import { unicodeToUnifiedName } from './unicode_to_unified_name'; import emojiCompressed from './emoji_compressed'; +import { unicodeToUnifiedName } from './unicode_to_unified_name'; const [ shortCodesToEmojiData, skins, categories, short_names ] = emojiCompressed; diff --git a/app/javascript/flavours/glitch/features/emoji/emoji_picker.js b/app/javascript/flavours/glitch/features/emoji/emoji_picker.js index 044d38cb2b..8725d39ecd 100644 --- a/app/javascript/flavours/glitch/features/emoji/emoji_picker.js +++ b/app/javascript/flavours/glitch/features/emoji/emoji_picker.js @@ -1,5 +1,5 @@ -import Picker from 'emoji-mart/dist-es/components/picker/picker'; import Emoji from 'emoji-mart/dist-es/components/emoji/emoji'; +import Picker from 'emoji-mart/dist-es/components/picker/picker'; export { Picker, diff --git a/app/javascript/flavours/glitch/features/emoji/emoji_unicode_mapping_light.js b/app/javascript/flavours/glitch/features/emoji/emoji_unicode_mapping_light.js index 30fbd9e349..3e3834580d 100644 --- a/app/javascript/flavours/glitch/features/emoji/emoji_unicode_mapping_light.js +++ b/app/javascript/flavours/glitch/features/emoji/emoji_unicode_mapping_light.js @@ -3,7 +3,6 @@ // as a "title" attribute in an HTML element (aka tooltip). import emojiCompressed from './emoji_compressed'; - import { unicodeToFilename } from './unicode_to_filename'; const [ diff --git a/app/javascript/flavours/glitch/features/explore/components/story.jsx b/app/javascript/flavours/glitch/features/explore/components/story.jsx index cadc710d4d..05590441f5 100644 --- a/app/javascript/flavours/glitch/features/explore/components/story.jsx +++ b/app/javascript/flavours/glitch/features/explore/components/story.jsx @@ -1,12 +1,15 @@ -import React from 'react'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + +import classNames from 'classnames'; + 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'; -import classNames from 'classnames'; -export default class Story extends React.PureComponent { + +export default class Story extends PureComponent { static propTypes = { url: PropTypes.string, @@ -38,10 +41,10 @@ export default class Story extends React.PureComponent {
{thumbnail ? ( - + <>
-
+ ) : }
diff --git a/app/javascript/flavours/glitch/features/explore/index.jsx b/app/javascript/flavours/glitch/features/explore/index.jsx index a64c8183c4..a6e153addc 100644 --- a/app/javascript/flavours/glitch/features/explore/index.jsx +++ b/app/javascript/flavours/glitch/features/explore/index.jsx @@ -1,18 +1,25 @@ -import React from 'react'; -import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import { connect } from 'react-redux'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; + +import { Helmet } from 'react-helmet'; +import { NavLink, Switch, Route } from 'react-router-dom'; + +import { connect } from 'react-redux'; + import Column from 'flavours/glitch/components/column'; import ColumnHeader from 'flavours/glitch/components/column_header'; -import { NavLink, Switch, Route } from 'react-router-dom'; +import Search from 'flavours/glitch/features/compose/containers/search_container'; +import { showTrends } from 'flavours/glitch/initial_state'; + import Links from './links'; -import Tags from './tags'; +import SearchResults from './results'; import Statuses from './statuses'; import Suggestions from './suggestions'; -import Search from 'flavours/glitch/features/compose/containers/search_container'; -import SearchResults from './results'; -import { showTrends } from 'flavours/glitch/initial_state'; -import { Helmet } from 'react-helmet'; +import Tags from './tags'; + + const messages = defineMessages({ title: { id: 'explore.title', defaultMessage: 'Explore' }, @@ -24,7 +31,7 @@ const mapStateToProps = state => ({ isSearching: state.getIn(['search', 'submitted']) || !showTrends, }); -class Explore extends React.PureComponent { +class Explore extends PureComponent { static contextTypes = { router: PropTypes.object, diff --git a/app/javascript/flavours/glitch/features/explore/links.jsx b/app/javascript/flavours/glitch/features/explore/links.jsx index 425934c4ab..fd80ecb93f 100644 --- a/app/javascript/flavours/glitch/features/explore/links.jsx +++ b/app/javascript/flavours/glitch/features/explore/links.jsx @@ -1,19 +1,23 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import Story from './components/story'; -import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; -import { connect } from 'react-redux'; -import { fetchTrendingLinks } from 'flavours/glitch/actions/trends'; +import { PureComponent } from 'react'; + import { FormattedMessage } from 'react-intl'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; +import { connect } from 'react-redux'; + +import { fetchTrendingLinks } from 'flavours/glitch/actions/trends'; import DismissableBanner from 'flavours/glitch/components/dismissable_banner'; +import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; + +import Story from './components/story'; const mapStateToProps = state => ({ links: state.getIn(['trends', 'links', 'items']), isLoading: state.getIn(['trends', 'links', 'isLoading']), }); -class Links extends React.PureComponent { +class Links extends PureComponent { static propTypes = { links: ImmutablePropTypes.list, diff --git a/app/javascript/flavours/glitch/features/explore/results.jsx b/app/javascript/flavours/glitch/features/explore/results.jsx index 0d6c0e8f1d..601e375a73 100644 --- a/app/javascript/flavours/glitch/features/explore/results.jsx +++ b/app/javascript/flavours/glitch/features/explore/results.jsx @@ -1,16 +1,22 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import ImmutablePropTypes from 'react-immutable-proptypes'; +import { PureComponent } from 'react'; + import { injectIntl, defineMessages, FormattedMessage } from 'react-intl'; -import { connect } from 'react-redux'; -import { expandSearch } from 'flavours/glitch/actions/search'; -import Account from 'flavours/glitch/containers/account_container'; -import Status from 'flavours/glitch/containers/status_container'; -import { ImmutableHashtag as Hashtag } from 'flavours/glitch/components/hashtag'; + +import { Helmet } from 'react-helmet'; + import { List as ImmutableList } from 'immutable'; +import ImmutablePropTypes from 'react-immutable-proptypes'; +import { connect } from 'react-redux'; + +import { expandSearch } from 'flavours/glitch/actions/search'; +import { ImmutableHashtag as Hashtag } from 'flavours/glitch/components/hashtag'; import LoadMore from 'flavours/glitch/components/load_more'; import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; -import { Helmet } from 'react-helmet'; +import Account from 'flavours/glitch/containers/account_container'; +import Status from 'flavours/glitch/containers/status_container'; + + const messages = defineMessages({ title: { id: 'search_results.title', defaultMessage: 'Search for {q}' }, @@ -42,7 +48,7 @@ const renderStatuses = (results, onLoadMore) => appendLoadMore('statuses', resul )), onLoadMore); -class Results extends React.PureComponent { +class Results extends PureComponent { static propTypes = { results: ImmutablePropTypes.map, @@ -102,7 +108,7 @@ class Results extends React.PureComponent { } return ( - + <>
@@ -117,7 +123,7 @@ class Results extends React.PureComponent { {intl.formatMessage(messages.title, { q })} - + ); } diff --git a/app/javascript/flavours/glitch/features/explore/statuses.jsx b/app/javascript/flavours/glitch/features/explore/statuses.jsx index 381c50c5d5..212980c28f 100644 --- a/app/javascript/flavours/glitch/features/explore/statuses.jsx +++ b/app/javascript/flavours/glitch/features/explore/statuses.jsx @@ -1,12 +1,16 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import StatusList from 'flavours/glitch/components/status_list'; +import { PureComponent } from 'react'; + import { FormattedMessage } from 'react-intl'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; import { connect } from 'react-redux'; -import { fetchTrendingStatuses, expandTrendingStatuses } from 'flavours/glitch/actions/trends'; + import { debounce } from 'lodash'; + +import { fetchTrendingStatuses, expandTrendingStatuses } from 'flavours/glitch/actions/trends'; import DismissableBanner from 'flavours/glitch/components/dismissable_banner'; +import StatusList from 'flavours/glitch/components/status_list'; const mapStateToProps = state => ({ statusIds: state.getIn(['status_lists', 'trending', 'items']), @@ -14,7 +18,7 @@ const mapStateToProps = state => ({ hasMore: !!state.getIn(['status_lists', 'trending', 'next']), }); -class Statuses extends React.PureComponent { +class Statuses extends PureComponent { static propTypes = { statusIds: ImmutablePropTypes.list, diff --git a/app/javascript/flavours/glitch/features/explore/suggestions.jsx b/app/javascript/flavours/glitch/features/explore/suggestions.jsx index e1b84098a0..b6e50eedef 100644 --- a/app/javascript/flavours/glitch/features/explore/suggestions.jsx +++ b/app/javascript/flavours/glitch/features/explore/suggestions.jsx @@ -1,18 +1,21 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import AccountCard from 'flavours/glitch/features/directory/components/account_card'; -import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; -import { connect } from 'react-redux'; -import { fetchSuggestions, dismissSuggestion } from 'flavours/glitch/actions/suggestions'; +import { PureComponent } from 'react'; + import { FormattedMessage } from 'react-intl'; +import ImmutablePropTypes from 'react-immutable-proptypes'; +import { connect } from 'react-redux'; + +import { fetchSuggestions, dismissSuggestion } from 'flavours/glitch/actions/suggestions'; +import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; +import AccountCard from 'flavours/glitch/features/directory/components/account_card'; + const mapStateToProps = state => ({ suggestions: state.getIn(['suggestions', 'items']), isLoading: state.getIn(['suggestions', 'isLoading']), }); -class Suggestions extends React.PureComponent { +class Suggestions extends PureComponent { static propTypes = { isLoading: PropTypes.bool, diff --git a/app/javascript/flavours/glitch/features/explore/tags.jsx b/app/javascript/flavours/glitch/features/explore/tags.jsx index e0fdd1d912..c79543dd5f 100644 --- a/app/javascript/flavours/glitch/features/explore/tags.jsx +++ b/app/javascript/flavours/glitch/features/explore/tags.jsx @@ -1,19 +1,24 @@ -import React from 'react'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + +import { FormattedMessage } from 'react-intl'; + import ImmutablePropTypes from 'react-immutable-proptypes'; +import { connect } from 'react-redux'; + +import { fetchTrendingHashtags } from 'flavours/glitch/actions/trends'; +import DismissableBanner from 'flavours/glitch/components/dismissable_banner'; import { ImmutableHashtag as Hashtag } from 'flavours/glitch/components/hashtag'; import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; -import { connect } from 'react-redux'; -import { fetchTrendingHashtags } from 'flavours/glitch/actions/trends'; -import { FormattedMessage } from 'react-intl'; -import DismissableBanner from 'flavours/glitch/components/dismissable_banner'; + + const mapStateToProps = state => ({ hashtags: state.getIn(['trends', 'tags', 'items']), isLoadingHashtags: state.getIn(['trends', 'tags', 'isLoading']), }); -class Tags extends React.PureComponent { +class Tags extends PureComponent { static propTypes = { hashtags: ImmutablePropTypes.list, diff --git a/app/javascript/flavours/glitch/features/favourited_statuses/index.jsx b/app/javascript/flavours/glitch/features/favourited_statuses/index.jsx index 9b63dec23b..08152063c7 100644 --- a/app/javascript/flavours/glitch/features/favourited_statuses/index.jsx +++ b/app/javascript/flavours/glitch/features/favourited_statuses/index.jsx @@ -1,11 +1,15 @@ -import { debounce } from 'lodash'; import PropTypes from 'prop-types'; -import React from 'react'; + +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; + import { Helmet } from 'react-helmet'; + import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { connect } from 'react-redux'; + +import { debounce } from 'lodash'; + import { addColumn, removeColumn, moveColumn } from 'flavours/glitch/actions/columns'; import { fetchFavouritedStatuses, expandFavouritedStatuses } from 'flavours/glitch/actions/favourites'; import ColumnHeader from 'flavours/glitch/components/column_header'; diff --git a/app/javascript/flavours/glitch/features/favourites/index.jsx b/app/javascript/flavours/glitch/features/favourites/index.jsx index 3287c5989d..86ef9ab142 100644 --- a/app/javascript/flavours/glitch/features/favourites/index.jsx +++ b/app/javascript/flavours/glitch/features/favourites/index.jsx @@ -1,17 +1,21 @@ import PropTypes from 'prop-types'; -import React from 'react'; -import ImmutablePureComponent from 'react-immutable-pure-component'; -import ImmutablePropTypes from 'react-immutable-proptypes'; + import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; + +import { Helmet } from 'react-helmet'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; import { connect } from 'react-redux'; + +import { fetchFavourites } from 'flavours/glitch/actions/interactions'; import ColumnHeader from 'flavours/glitch/components/column_header'; 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'; import AccountContainer from 'flavours/glitch/containers/account_container'; import Column from 'flavours/glitch/features/ui/components/column'; -import { Helmet } from 'react-helmet'; + const messages = defineMessages({ heading: { id: 'column.favourited_by', defaultMessage: 'Favourited by' }, diff --git a/app/javascript/flavours/glitch/features/filters/added_to_filter.jsx b/app/javascript/flavours/glitch/features/filters/added_to_filter.jsx index 2f3f98c813..743d379474 100644 --- a/app/javascript/flavours/glitch/features/filters/added_to_filter.jsx +++ b/app/javascript/flavours/glitch/features/filters/added_to_filter.jsx @@ -1,16 +1,19 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import ImmutablePropTypes from 'react-immutable-proptypes'; +import { PureComponent } from 'react'; + import { FormattedMessage } from 'react-intl'; -import { toServerSideType } from 'flavours/glitch/utils/filters'; -import Button from 'flavours/glitch/components/button'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; import { connect } from 'react-redux'; +import Button from 'flavours/glitch/components/button'; +import { toServerSideType } from 'flavours/glitch/utils/filters'; + const mapStateToProps = (state, { filterId }) => ({ filter: state.getIn(['filters', filterId]), }); -class AddedToFilter extends React.PureComponent { +class AddedToFilter extends PureComponent { static propTypes = { onClose: PropTypes.func.isRequired, @@ -30,7 +33,7 @@ class AddedToFilter extends React.PureComponent { let expiredMessage = null; if (filter.get('expires_at') && filter.get('expires_at') < new Date()) { expiredMessage = ( - + <>

-
+ ); } let contextMismatchMessage = null; if (contextType && !filter.get('context').includes(toServerSideType(contextType))) { contextMismatchMessage = ( - + <>

-
+ ); } @@ -67,7 +70,7 @@ class AddedToFilter extends React.PureComponent { ); return ( - + <>

-
+ ); } diff --git a/app/javascript/flavours/glitch/features/filters/select_filter.jsx b/app/javascript/flavours/glitch/features/filters/select_filter.jsx index e7cdd4e197..bae1d9ef95 100644 --- a/app/javascript/flavours/glitch/features/filters/select_filter.jsx +++ b/app/javascript/flavours/glitch/features/filters/select_filter.jsx @@ -1,11 +1,15 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import { connect } from 'react-redux'; +import { PureComponent } from 'react'; + import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; + +import { connect } from 'react-redux'; + +import fuzzysort from 'fuzzysort'; + +import { Icon } from 'flavours/glitch/components/icon'; import { toServerSideType } from 'flavours/glitch/utils/filters'; import { loupeIcon, deleteIcon } from 'flavours/glitch/utils/icons'; -import { Icon } from 'flavours/glitch/components/icon'; -import fuzzysort from 'fuzzysort'; const messages = defineMessages({ search: { id: 'filter_modal.select_filter.search', defaultMessage: 'Search or create' }, @@ -22,7 +26,7 @@ const mapStateToProps = (state, { contextType }) => ({ ]), }); -class SelectFilter extends React.PureComponent { +class SelectFilter extends PureComponent { static propTypes = { onSelectFilter: PropTypes.func.isRequired, @@ -169,7 +173,7 @@ class SelectFilter extends React.PureComponent { const results = this.search(); return ( - + <>

@@ -183,7 +187,7 @@ class SelectFilter extends React.PureComponent { {isSearching && this.renderCreateNew(searchValue) }
- + ); } 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 4eeffc402b..89a270d092 100644 --- a/app/javascript/flavours/glitch/features/follow_recommendations/components/account.jsx +++ b/app/javascript/flavours/glitch/features/follow_recommendations/components/account.jsx @@ -1,15 +1,17 @@ -import React from 'react'; import PropTypes from 'prop-types'; + +import { injectIntl, defineMessages } from 'react-intl'; + 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 { followAccount, unfollowAccount } from 'flavours/glitch/actions/accounts'; 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 { injectIntl, defineMessages } from 'react-intl'; -import { followAccount, unfollowAccount } from 'flavours/glitch/actions/accounts'; +import Permalink from 'flavours/glitch/components/permalink'; +import { makeGetAccount } from 'flavours/glitch/selectors'; const messages = defineMessages({ follow: { id: 'account.follow', defaultMessage: 'Follow' }, diff --git a/app/javascript/flavours/glitch/features/follow_recommendations/index.jsx b/app/javascript/flavours/glitch/features/follow_recommendations/index.jsx index 70f2191f11..194784a7a5 100644 --- a/app/javascript/flavours/glitch/features/follow_recommendations/index.jsx +++ b/app/javascript/flavours/glitch/features/follow_recommendations/index.jsx @@ -1,19 +1,23 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import ImmutablePureComponent from 'react-immutable-pure-component'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import { connect } from 'react-redux'; + import { FormattedMessage } from 'react-intl'; -import { fetchSuggestions } from 'flavours/glitch/actions/suggestions'; -import { changeSetting, saveSettings } from 'flavours/glitch/actions/settings'; -import { requestBrowserPermission } from 'flavours/glitch/actions/notifications'; -import { markAsPartial } from 'flavours/glitch/actions/timelines'; -import Column from 'flavours/glitch/features/ui/components/column'; -import Account from './components/account'; -import imageGreeting from 'mastodon/../images/elephant_ui_greeting.svg'; -import Button from 'flavours/glitch/components/button'; + import { Helmet } from 'react-helmet'; +import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; +import { connect } from 'react-redux'; + +import { requestBrowserPermission } from 'flavours/glitch/actions/notifications'; +import { changeSetting, saveSettings } from 'flavours/glitch/actions/settings'; +import { fetchSuggestions } from 'flavours/glitch/actions/suggestions'; +import { markAsPartial } from 'flavours/glitch/actions/timelines'; +import Button from 'flavours/glitch/components/button'; +import Column from 'flavours/glitch/features/ui/components/column'; +import imageGreeting from 'mastodon/../images/elephant_ui_greeting.svg'; + +import Account from './components/account'; + const mapStateToProps = state => ({ suggestions: state.getIn(['suggestions', 'items']), isLoading: state.getIn(['suggestions', 'isLoading']), @@ -86,7 +90,7 @@ class FollowRecommendations extends ImmutablePureComponent {
{!isLoading && ( - + <>
{suggestions.size > 0 ? suggestions.map(suggestion => ( @@ -101,7 +105,7 @@ class FollowRecommendations extends ImmutablePureComponent {
-
+ )}
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 31e79f042e..1f665c0496 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 @@ -1,12 +1,14 @@ -import React from 'react'; import PropTypes from 'prop-types'; + +import { defineMessages, injectIntl } from 'react-intl'; + import ImmutablePropTypes from 'react-immutable-proptypes'; -import Permalink from 'flavours/glitch/components/permalink'; +import ImmutablePureComponent from 'react-immutable-pure-component'; + import { Avatar } from 'flavours/glitch/components/avatar'; import { DisplayName } from 'flavours/glitch/components/display_name'; import { IconButton } from 'flavours/glitch/components/icon_button'; -import { defineMessages, injectIntl } from 'react-intl'; -import ImmutablePureComponent from 'react-immutable-pure-component'; +import Permalink from 'flavours/glitch/components/permalink'; const messages = defineMessages({ authorize: { id: 'follow_request.authorize', defaultMessage: 'Authorize' }, diff --git a/app/javascript/flavours/glitch/features/follow_requests/containers/account_authorize_container.js b/app/javascript/flavours/glitch/features/follow_requests/containers/account_authorize_container.js index 693e98e8ce..854ebaecb8 100644 --- a/app/javascript/flavours/glitch/features/follow_requests/containers/account_authorize_container.js +++ b/app/javascript/flavours/glitch/features/follow_requests/containers/account_authorize_container.js @@ -1,7 +1,9 @@ import { connect } from 'react-redux'; -import { makeGetAccount } from 'flavours/glitch/selectors'; -import AccountAuthorize from '../components/account_authorize'; + import { authorizeFollowRequest, rejectFollowRequest } from 'flavours/glitch/actions/accounts'; +import { makeGetAccount } from 'flavours/glitch/selectors'; + +import AccountAuthorize from '../components/account_authorize'; const makeMapStateToProps = () => { const getAccount = makeGetAccount(); diff --git a/app/javascript/flavours/glitch/features/follow_requests/index.jsx b/app/javascript/flavours/glitch/features/follow_requests/index.jsx index 7ca707ec95..70a2ac1e42 100644 --- a/app/javascript/flavours/glitch/features/follow_requests/index.jsx +++ b/app/javascript/flavours/glitch/features/follow_requests/index.jsx @@ -1,18 +1,28 @@ -import React from 'react'; -import { connect } from 'react-redux'; import PropTypes from 'prop-types'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import { debounce } from 'lodash'; -import Column from 'flavours/glitch/features/ui/components/column'; -import ColumnBackButtonSlim from 'flavours/glitch/components/column_back_button_slim'; -import AccountAuthorizeContainer from './containers/account_authorize_container'; -import { fetchFollowRequests, expandFollowRequests } from 'flavours/glitch/actions/accounts'; + import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import ImmutablePureComponent from 'react-immutable-pure-component'; -import ScrollableList from 'flavours/glitch/components/scrollable_list'; -import { me } from 'flavours/glitch/initial_state'; + import { Helmet } from 'react-helmet'; +import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; +import { connect } from 'react-redux'; + +import { debounce } from 'lodash'; + +import { fetchFollowRequests, expandFollowRequests } from 'flavours/glitch/actions/accounts'; +import ColumnBackButtonSlim from 'flavours/glitch/components/column_back_button_slim'; +import ScrollableList from 'flavours/glitch/components/scrollable_list'; +import Column from 'flavours/glitch/features/ui/components/column'; +import { me } from 'flavours/glitch/initial_state'; + +import AccountAuthorizeContainer from './containers/account_authorize_container'; + + + + + + const messages = defineMessages({ heading: { id: 'column.follow_requests', defaultMessage: 'Follow requests' }, }); diff --git a/app/javascript/flavours/glitch/features/followed_tags/index.jsx b/app/javascript/flavours/glitch/features/followed_tags/index.jsx index a5abb151f3..9acb77c25f 100644 --- a/app/javascript/flavours/glitch/features/followed_tags/index.jsx +++ b/app/javascript/flavours/glitch/features/followed_tags/index.jsx @@ -1,16 +1,20 @@ -import { debounce } from 'lodash'; import PropTypes from 'prop-types'; -import React from 'react'; -import ImmutablePureComponent from 'react-immutable-pure-component'; -import ImmutablePropTypes from 'react-immutable-proptypes'; + import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; + +import { Helmet } from 'react-helmet'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; import { connect } from 'react-redux'; + +import { debounce } from 'lodash'; + +import { expandFollowedHashtags, fetchFollowedHashtags } from 'flavours/glitch/actions/tags'; import ColumnHeader from 'flavours/glitch/components/column_header'; +import Hashtag from 'flavours/glitch/components/hashtag'; import ScrollableList from 'flavours/glitch/components/scrollable_list'; import Column from 'flavours/glitch/features/ui/components/column'; -import { Helmet } from 'react-helmet'; -import Hashtag from 'flavours/glitch/components/hashtag'; -import { expandFollowedHashtags, fetchFollowedHashtags } from 'flavours/glitch/actions/tags'; const messages = defineMessages({ heading: { id: 'followed_tags', defaultMessage: 'Followed hashtags' }, diff --git a/app/javascript/flavours/glitch/features/followers/index.jsx b/app/javascript/flavours/glitch/features/followers/index.jsx index 39eaed1285..2f586e143b 100644 --- a/app/javascript/flavours/glitch/features/followers/index.jsx +++ b/app/javascript/flavours/glitch/features/followers/index.jsx @@ -1,27 +1,31 @@ -import React from 'react'; -import { connect } from 'react-redux'; import PropTypes from 'prop-types'; + +import { FormattedMessage } from 'react-intl'; + import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; +import { connect } from 'react-redux'; + import { debounce } from 'lodash'; -import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; + import { lookupAccount, fetchAccount, fetchFollowers, expandFollowers, } from 'flavours/glitch/actions/accounts'; -import { FormattedMessage } from 'react-intl'; -import AccountContainer from 'flavours/glitch/containers/account_container'; -import Column from 'flavours/glitch/features/ui/components/column'; -import ProfileColumnHeader from 'flavours/glitch/features/account/components/profile_column_header'; -import HeaderContainer from 'flavours/glitch/features/account_timeline/containers/header_container'; -import ImmutablePureComponent from 'react-immutable-pure-component'; +import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; import ScrollableList from 'flavours/glitch/components/scrollable_list'; import { TimelineHint } from 'flavours/glitch/components/timeline_hint'; -import LimitedAccountHint from '../account_timeline/components/limited_account_hint'; -import { getAccountHidden } from 'flavours/glitch/selectors'; -import { normalizeForLookup } from 'flavours/glitch/reducers/accounts_map'; +import AccountContainer from 'flavours/glitch/containers/account_container'; +import ProfileColumnHeader from 'flavours/glitch/features/account/components/profile_column_header'; +import HeaderContainer from 'flavours/glitch/features/account_timeline/containers/header_container'; import BundleColumnError from 'flavours/glitch/features/ui/components/bundle_column_error'; +import Column from 'flavours/glitch/features/ui/components/column'; +import { normalizeForLookup } from 'flavours/glitch/reducers/accounts_map'; +import { getAccountHidden } from 'flavours/glitch/selectors'; + +import LimitedAccountHint from '../account_timeline/components/limited_account_hint'; const mapStateToProps = (state, { params: { acct, id } }) => { const accountId = id || state.getIn(['accounts_map', normalizeForLookup(acct)]); diff --git a/app/javascript/flavours/glitch/features/following/index.jsx b/app/javascript/flavours/glitch/features/following/index.jsx index 39f87eef9c..45fbbe329e 100644 --- a/app/javascript/flavours/glitch/features/following/index.jsx +++ b/app/javascript/flavours/glitch/features/following/index.jsx @@ -1,27 +1,31 @@ -import React from 'react'; -import { connect } from 'react-redux'; import PropTypes from 'prop-types'; + +import { FormattedMessage } from 'react-intl'; + import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; +import { connect } from 'react-redux'; + import { debounce } from 'lodash'; -import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; + import { lookupAccount, fetchAccount, fetchFollowing, expandFollowing, } from 'flavours/glitch/actions/accounts'; -import { FormattedMessage } from 'react-intl'; -import AccountContainer from 'flavours/glitch/containers/account_container'; -import Column from 'flavours/glitch/features/ui/components/column'; -import ProfileColumnHeader from 'flavours/glitch/features/account/components/profile_column_header'; -import HeaderContainer from 'flavours/glitch/features/account_timeline/containers/header_container'; -import ImmutablePureComponent from 'react-immutable-pure-component'; +import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; import ScrollableList from 'flavours/glitch/components/scrollable_list'; import { TimelineHint } from 'flavours/glitch/components/timeline_hint'; -import LimitedAccountHint from '../account_timeline/components/limited_account_hint'; -import { getAccountHidden } from 'flavours/glitch/selectors'; -import { normalizeForLookup } from 'flavours/glitch/reducers/accounts_map'; +import AccountContainer from 'flavours/glitch/containers/account_container'; +import ProfileColumnHeader from 'flavours/glitch/features/account/components/profile_column_header'; +import HeaderContainer from 'flavours/glitch/features/account_timeline/containers/header_container'; import BundleColumnError from 'flavours/glitch/features/ui/components/bundle_column_error'; +import Column from 'flavours/glitch/features/ui/components/column'; +import { normalizeForLookup } from 'flavours/glitch/reducers/accounts_map'; +import { getAccountHidden } from 'flavours/glitch/selectors'; + +import LimitedAccountHint from '../account_timeline/components/limited_account_hint'; const mapStateToProps = (state, { params: { acct, id } }) => { const accountId = id || state.getIn(['accounts_map', normalizeForLookup(acct)]); 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 fd76f9773d..fd17f8c9d7 100644 --- a/app/javascript/flavours/glitch/features/getting_started/components/announcements.jsx +++ b/app/javascript/flavours/glitch/features/getting_started/components/announcements.jsx @@ -1,20 +1,27 @@ -import React from 'react'; -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 { PureComponent } from 'react'; + 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 ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; + import TransitionMotion from 'react-motion/lib/TransitionMotion'; import spring from 'react-motion/lib/spring'; +import ReactSwipeableViews from 'react-swipeable-views'; + +import { AnimatedNumber } from 'flavours/glitch/components/animated_number'; +import { Icon } from 'flavours/glitch/components/icon'; +import { IconButton } from 'flavours/glitch/components/icon_button'; +import EmojiPickerDropdown from 'flavours/glitch/features/compose/containers/emoji_picker_dropdown_container'; +import unicodeMapping from 'flavours/glitch/features/emoji/emoji_unicode_mapping_light'; +import { autoPlayGif, reduceMotion, disableSwiping, mascot } from 'flavours/glitch/initial_state'; import { assetHost } from 'flavours/glitch/utils/config'; +import elephantUIPlane from 'mastodon/../images/elephant_ui_plane.svg'; + + const messages = defineMessages({ close: { id: 'lightbox.close', defaultMessage: 'Close' }, @@ -148,7 +155,7 @@ class Content extends ImmutablePureComponent { } -class Emoji extends React.PureComponent { +class Emoji extends PureComponent { static propTypes = { emoji: PropTypes.string.isRequired, diff --git a/app/javascript/flavours/glitch/features/getting_started/components/trends.jsx b/app/javascript/flavours/glitch/features/getting_started/components/trends.jsx index d7e222d716..c5bb92b3be 100644 --- a/app/javascript/flavours/glitch/features/getting_started/components/trends.jsx +++ b/app/javascript/flavours/glitch/features/getting_started/components/trends.jsx @@ -1,11 +1,14 @@ -import React from 'react'; -import ImmutablePureComponent from 'react-immutable-pure-component'; import PropTypes from 'prop-types'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import { ImmutableHashtag as Hashtag } from 'flavours/glitch/components/hashtag'; + import { FormattedMessage } from 'react-intl'; + import { Link } from 'react-router-dom'; +import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; + +import { ImmutableHashtag as Hashtag } from 'flavours/glitch/components/hashtag'; + export default class Trends extends ImmutablePureComponent { static defaultProps = { diff --git a/app/javascript/flavours/glitch/features/getting_started/containers/announcements_container.js b/app/javascript/flavours/glitch/features/getting_started/containers/announcements_container.js index d472323f8f..893da21df9 100644 --- a/app/javascript/flavours/glitch/features/getting_started/containers/announcements_container.js +++ b/app/javascript/flavours/glitch/features/getting_started/containers/announcements_container.js @@ -1,8 +1,10 @@ -import { connect } from 'react-redux'; -import { addReaction, removeReaction, dismissAnnouncement } from 'flavours/glitch/actions/announcements'; -import Announcements from '../components/announcements'; -import { createSelector } from 'reselect'; import { Map as ImmutableMap } from 'immutable'; +import { connect } from 'react-redux'; +import { createSelector } from 'reselect'; + +import { addReaction, removeReaction, dismissAnnouncement } from 'flavours/glitch/actions/announcements'; + +import Announcements from '../components/announcements'; const customEmojiMap = createSelector([state => state.get('custom_emojis')], items => items.reduce((map, emoji) => map.set(emoji.get('shortcode'), emoji), ImmutableMap())); diff --git a/app/javascript/flavours/glitch/features/getting_started/containers/trends_container.js b/app/javascript/flavours/glitch/features/getting_started/containers/trends_container.js index d88dbbaf40..cd08b61d40 100644 --- a/app/javascript/flavours/glitch/features/getting_started/containers/trends_container.js +++ b/app/javascript/flavours/glitch/features/getting_started/containers/trends_container.js @@ -1,5 +1,7 @@ import { connect } from 'react-redux'; + import { fetchTrendingHashtags } from 'flavours/glitch/actions/trends'; + import Trends from '../components/trends'; const mapStateToProps = state => ({ diff --git a/app/javascript/flavours/glitch/features/getting_started/index.jsx b/app/javascript/flavours/glitch/features/getting_started/index.jsx index 8356e977ef..0f6f3330e8 100644 --- a/app/javascript/flavours/glitch/features/getting_started/index.jsx +++ b/app/javascript/flavours/glitch/features/getting_started/index.jsx @@ -1,23 +1,29 @@ -import React from 'react'; +import PropTypes from 'prop-types'; + +import { defineMessages, injectIntl } from 'react-intl'; + +import { Helmet } from 'react-helmet'; + +import { List as ImmutableList } from 'immutable'; +import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; +import { connect } from 'react-redux'; +import { createSelector } from 'reselect'; + +import { fetchFollowRequests } from 'flavours/glitch/actions/accounts'; +import { fetchLists } from 'flavours/glitch/actions/lists'; +import { openModal } from 'flavours/glitch/actions/modal'; import Column from 'flavours/glitch/features/ui/components/column'; import ColumnLink from 'flavours/glitch/features/ui/components/column_link'; import ColumnSubheading from 'flavours/glitch/features/ui/components/column_subheading'; -import { defineMessages, injectIntl } from 'react-intl'; -import { connect } from 'react-redux'; -import { openModal } from 'flavours/glitch/actions/modal'; -import PropTypes from 'prop-types'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import ImmutablePureComponent from 'react-immutable-pure-component'; -import { me, showTrends } from 'flavours/glitch/initial_state'; -import { fetchFollowRequests } from 'flavours/glitch/actions/accounts'; -import { List as ImmutableList } from 'immutable'; -import { createSelector } from 'reselect'; -import { fetchLists } from 'flavours/glitch/actions/lists'; -import { preferencesLink } from 'flavours/glitch/utils/backend_links'; -import NavigationBar from '../compose/components/navigation_bar'; import LinkFooter from 'flavours/glitch/features/ui/components/link_footer'; +import { me, showTrends } from 'flavours/glitch/initial_state'; +import { preferencesLink } from 'flavours/glitch/utils/backend_links'; + +import NavigationBar from '../compose/components/navigation_bar'; + import TrendsContainer from './containers/trends_container'; -import { Helmet } from 'react-helmet'; + const messages = defineMessages({ heading: { id: 'getting_started.heading', defaultMessage: 'Getting started' }, @@ -63,7 +69,10 @@ const makeMapStateToProps = () => { const mapDispatchToProps = dispatch => ({ fetchFollowRequests: () => dispatch(fetchFollowRequests()), fetchLists: () => dispatch(fetchLists()), - openSettings: () => dispatch(openModal('SETTINGS', {})), + openSettings: () => dispatch(openModal({ + modalType: 'SETTINGS', + modalProps: {}, + })), }); const badgeDisplay = (number, limit) => { @@ -173,13 +182,13 @@ class GettingStarted extends ImmutablePureComponent { {multiColumn && } {navItems} {signedIn && ( - + <> {listItems} { preferencesLink !== undefined && } - + )}
diff --git a/app/javascript/flavours/glitch/features/getting_started_misc/index.jsx b/app/javascript/flavours/glitch/features/getting_started_misc/index.jsx index ad40edd75e..20dfe80b47 100644 --- a/app/javascript/flavours/glitch/features/getting_started_misc/index.jsx +++ b/app/javascript/flavours/glitch/features/getting_started_misc/index.jsx @@ -1,20 +1,23 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import Column from 'flavours/glitch/features/ui/components/column'; -import ColumnBackButtonSlim from 'flavours/glitch/components/column_back_button_slim'; + import { defineMessages, injectIntl } from 'react-intl'; + import ImmutablePureComponent from 'react-immutable-pure-component'; +import { connect } from 'react-redux'; + +import { openModal } from 'flavours/glitch/actions/modal'; +import ColumnBackButtonSlim from 'flavours/glitch/components/column_back_button_slim'; +import Column from 'flavours/glitch/features/ui/components/column'; import ColumnLink from 'flavours/glitch/features/ui/components/column_link'; import ColumnSubheading from 'flavours/glitch/features/ui/components/column_subheading'; -import { openModal } from 'flavours/glitch/actions/modal'; -import { connect } from 'react-redux'; + const messages = defineMessages({ heading: { id: 'column.heading', defaultMessage: 'Misc' }, subheading: { id: 'column.subheading', defaultMessage: 'Miscellaneous options' }, favourites: { id: 'navigation_bar.favourites', defaultMessage: 'Favourites' }, blocks: { id: 'navigation_bar.blocks', defaultMessage: 'Blocked users' }, - domain_blocks: { id: 'navigation_bar.domain_blocks', defaultMessage: 'Hidden domains' }, + domain_blocks: { id: 'navigation_bar.domain_blocks', defaultMessage: 'Blocked domains' }, mutes: { id: 'navigation_bar.mutes', defaultMessage: 'Muted users' }, show_me_around: { id: 'getting_started.onboarding', defaultMessage: 'Show me around' }, pins: { id: 'navigation_bar.pins', defaultMessage: 'Pinned posts' }, @@ -35,11 +38,15 @@ class GettingStartedMisc extends ImmutablePureComponent { }; openOnboardingModal = () => { - this.props.dispatch(openModal('ONBOARDING')); + this.props.dispatch(openModal({ + modalType: 'ONBOARDING', + })); }; openFeaturedAccountsModal = () => { - this.props.dispatch(openModal('PINNED_ACCOUNTS_EDITOR')); + this.props.dispatch(openModal({ + modalType: 'PINNED_ACCOUNTS_EDITOR', + })); }; render () { diff --git a/app/javascript/flavours/glitch/features/hashtag_timeline/components/column_settings.jsx b/app/javascript/flavours/glitch/features/hashtag_timeline/components/column_settings.jsx index f140f2d013..c60de4c518 100644 --- a/app/javascript/flavours/glitch/features/hashtag_timeline/components/column_settings.jsx +++ b/app/javascript/flavours/glitch/features/hashtag_timeline/components/column_settings.jsx @@ -1,10 +1,14 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import ImmutablePropTypes from 'react-immutable-proptypes'; +import { PureComponent } from 'react'; + import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import Toggle from 'react-toggle'; -import AsyncSelect from 'react-select/async'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; + import { NonceProvider } from 'react-select'; +import AsyncSelect from 'react-select/async'; +import Toggle from 'react-toggle'; + import SettingToggle from '../../notifications/components/setting_toggle'; const messages = defineMessages({ @@ -12,7 +16,7 @@ const messages = defineMessages({ noOptions: { id: 'hashtag.column_settings.select.no_options_message', defaultMessage: 'No suggestions found' }, }); -class ColumnSettings extends React.PureComponent { +class ColumnSettings extends PureComponent { static propTypes = { settings: ImmutablePropTypes.map.isRequired, diff --git a/app/javascript/flavours/glitch/features/hashtag_timeline/containers/column_settings_container.js b/app/javascript/flavours/glitch/features/hashtag_timeline/containers/column_settings_container.js index 004856b048..6e67d1fce4 100644 --- a/app/javascript/flavours/glitch/features/hashtag_timeline/containers/column_settings_container.js +++ b/app/javascript/flavours/glitch/features/hashtag_timeline/containers/column_settings_container.js @@ -1,8 +1,10 @@ import { connect } from 'react-redux'; -import ColumnSettings from '../components/column_settings'; + import { changeColumnParams } from 'flavours/glitch/actions/columns'; import api from 'flavours/glitch/api'; +import ColumnSettings from '../components/column_settings'; + const mapStateToProps = (state, { columnId }) => { const columns = state.getIn(['settings', 'columns']); const index = columns.findIndex(c => c.get('uuid') === columnId); diff --git a/app/javascript/flavours/glitch/features/hashtag_timeline/index.jsx b/app/javascript/flavours/glitch/features/hashtag_timeline/index.jsx index cd3639d968..de67b06ca8 100644 --- a/app/javascript/flavours/glitch/features/hashtag_timeline/index.jsx +++ b/app/javascript/flavours/glitch/features/hashtag_timeline/index.jsx @@ -1,21 +1,28 @@ -import React from 'react'; -import { connect } from 'react-redux'; import PropTypes from 'prop-types'; -import StatusListContainer from 'flavours/glitch/features/ui/containers/status_list_container'; -import Column from 'flavours/glitch/components/column'; -import ColumnHeader from 'flavours/glitch/components/column_header'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import ColumnSettingsContainer from './containers/column_settings_container'; -import { expandHashtagTimeline, clearTimeline } from 'flavours/glitch/actions/timelines'; -import { addColumn, removeColumn, moveColumn } from 'flavours/glitch/actions/columns'; -import { connectHashtagStream } from 'flavours/glitch/actions/streaming'; +import { PureComponent } from 'react'; + 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 classNames from 'classnames'; import { Helmet } from 'react-helmet'; +import ImmutablePropTypes from 'react-immutable-proptypes'; +import { connect } from 'react-redux'; + +import { isEqual } from 'lodash'; + +import { addColumn, removeColumn, moveColumn } from 'flavours/glitch/actions/columns'; +import { connectHashtagStream } from 'flavours/glitch/actions/streaming'; +import { fetchHashtag, followHashtag, unfollowHashtag } from 'flavours/glitch/actions/tags'; +import { expandHashtagTimeline, clearTimeline } 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 StatusListContainer from 'flavours/glitch/features/ui/containers/status_list_container'; + +import ColumnSettingsContainer from './containers/column_settings_container'; + + const messages = defineMessages({ followHashtag: { id: 'hashtag.follow', defaultMessage: 'Follow hashtag' }, unfollowHashtag: { id: 'hashtag.unfollow', defaultMessage: 'Unfollow hashtag' }, @@ -26,7 +33,7 @@ const mapStateToProps = (state, props) => ({ tag: state.getIn(['tags', props.params.id]), }); -class HashtagTimeline extends React.PureComponent { +class HashtagTimeline extends PureComponent { disconnects = []; diff --git a/app/javascript/flavours/glitch/features/home_timeline/components/column_settings.jsx b/app/javascript/flavours/glitch/features/home_timeline/components/column_settings.jsx index 1eeeaa378a..07d0447a89 100644 --- a/app/javascript/flavours/glitch/features/home_timeline/components/column_settings.jsx +++ b/app/javascript/flavours/glitch/features/home_timeline/components/column_settings.jsx @@ -1,16 +1,19 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import ImmutablePropTypes from 'react-immutable-proptypes'; +import { PureComponent } from 'react'; + import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import SettingToggle from 'flavours/glitch/features/notifications/components/setting_toggle'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; + import SettingText from 'flavours/glitch/components/setting_text'; +import SettingToggle from 'flavours/glitch/features/notifications/components/setting_toggle'; const messages = defineMessages({ filter_regex: { id: 'home.column_settings.filter_regex', defaultMessage: 'Filter out by regular expressions' }, settings: { id: 'home.settings', defaultMessage: 'Column settings' }, }); -class ColumnSettings extends React.PureComponent { +class ColumnSettings extends PureComponent { static propTypes = { settings: ImmutablePropTypes.map.isRequired, diff --git a/app/javascript/flavours/glitch/features/home_timeline/containers/column_settings_container.js b/app/javascript/flavours/glitch/features/home_timeline/containers/column_settings_container.js index 16747151b0..215b8c42f0 100644 --- a/app/javascript/flavours/glitch/features/home_timeline/containers/column_settings_container.js +++ b/app/javascript/flavours/glitch/features/home_timeline/containers/column_settings_container.js @@ -1,7 +1,9 @@ import { connect } from 'react-redux'; -import ColumnSettings from '../components/column_settings'; + import { changeSetting, saveSettings } from 'flavours/glitch/actions/settings'; +import ColumnSettings from '../components/column_settings'; + const mapStateToProps = state => ({ settings: state.getIn(['settings', 'home']), }); diff --git a/app/javascript/flavours/glitch/features/home_timeline/index.jsx b/app/javascript/flavours/glitch/features/home_timeline/index.jsx index a8dfa1d08f..791c310557 100644 --- a/app/javascript/flavours/glitch/features/home_timeline/index.jsx +++ b/app/javascript/flavours/glitch/features/home_timeline/index.jsx @@ -1,20 +1,26 @@ -import React from 'react'; -import { connect } from 'react-redux'; -import { expandHomeTimeline } from 'flavours/glitch/actions/timelines'; import PropTypes from 'prop-types'; -import StatusListContainer from 'flavours/glitch/features/ui/containers/status_list_container'; +import { PureComponent } from 'react'; + +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; + +import classNames from 'classnames'; +import { Helmet } from 'react-helmet'; +import { Link } from 'react-router-dom'; + +import { connect } from 'react-redux'; + +import { fetchAnnouncements, toggleShowAnnouncements } from 'flavours/glitch/actions/announcements'; +import { addColumn, removeColumn, moveColumn } from 'flavours/glitch/actions/columns'; +import { expandHomeTimeline } from 'flavours/glitch/actions/timelines'; import Column from 'flavours/glitch/components/column'; import ColumnHeader from 'flavours/glitch/components/column_header'; -import { addColumn, removeColumn, moveColumn } from 'flavours/glitch/actions/columns'; -import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import ColumnSettingsContainer from './containers/column_settings_container'; -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 { Helmet } from 'react-helmet'; +import AnnouncementsContainer from 'flavours/glitch/features/getting_started/containers/announcements_container'; +import StatusListContainer from 'flavours/glitch/features/ui/containers/status_list_container'; + +import ColumnSettingsContainer from './containers/column_settings_container'; + const messages = defineMessages({ title: { id: 'column.home', defaultMessage: 'Home' }, @@ -31,7 +37,7 @@ const mapStateToProps = state => ({ regex: state.getIn(['settings', 'home', 'regex', 'body']), }); -class HomeTimeline extends React.PureComponent { +class HomeTimeline extends PureComponent { static contextTypes = { identity: PropTypes.object, diff --git a/app/javascript/flavours/glitch/features/interaction_modal/index.jsx b/app/javascript/flavours/glitch/features/interaction_modal/index.jsx index 515e47de2a..db28876476 100644 --- a/app/javascript/flavours/glitch/features/interaction_modal/index.jsx +++ b/app/javascript/flavours/glitch/features/interaction_modal/index.jsx @@ -1,24 +1,32 @@ -import React from 'react'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + 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 classNames from 'classnames'; + +import { connect } from 'react-redux'; + import { openModal, closeModal } from 'flavours/glitch/actions/modal'; +import { Icon } from 'flavours/glitch/components/icon'; +import { registrationsOpen } from 'flavours/glitch/initial_state'; const mapStateToProps = (state, { accountId }) => ({ displayNameHtml: state.getIn(['accounts', accountId, 'display_name_html']), + signupUrl: state.getIn(['server', 'server', 'registrations', 'url'], '/auth/sign_up'), }); const mapDispatchToProps = (dispatch) => ({ onSignupClick() { - dispatch(closeModal()); - dispatch(openModal('CLOSED_REGISTRATIONS')); + dispatch(closeModal({ + modalType: undefined, + ignoreFocus: false, + })); + dispatch(openModal({ modalType: 'CLOSED_REGISTRATIONS' })); }, }); -class Copypaste extends React.PureComponent { +class Copypaste extends PureComponent { static propTypes = { value: PropTypes.string, @@ -74,13 +82,14 @@ class Copypaste extends React.PureComponent { } -class InteractionModal extends React.PureComponent { +class InteractionModal extends PureComponent { static propTypes = { displayNameHtml: PropTypes.string, url: PropTypes.string, type: PropTypes.oneOf(['reply', 'reblog', 'favourite', 'follow']), onSignupClick: PropTypes.func.isRequired, + signupUrl: PropTypes.string.isRequired, }; handleSignupClick = () => { @@ -88,7 +97,7 @@ class InteractionModal extends React.PureComponent { }; render () { - const { url, type, displayNameHtml } = this.props; + const { url, type, displayNameHtml, signupUrl } = this.props; const name = ; @@ -121,7 +130,7 @@ class InteractionModal extends React.PureComponent { if (registrationsOpen) { signupButton = ( - + ); diff --git a/app/javascript/flavours/glitch/features/keyboard_shortcuts/index.jsx b/app/javascript/flavours/glitch/features/keyboard_shortcuts/index.jsx index 7160e7efbf..14d483212e 100644 --- a/app/javascript/flavours/glitch/features/keyboard_shortcuts/index.jsx +++ b/app/javascript/flavours/glitch/features/keyboard_shortcuts/index.jsx @@ -1,12 +1,16 @@ -import React from 'react'; -import Column from 'flavours/glitch/components/column'; -import { connect } from 'react-redux'; -import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import PropTypes from 'prop-types'; -import ImmutablePureComponent from 'react-immutable-pure-component'; -import ColumnHeader from 'flavours/glitch/components/column_header'; + +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; + import { Helmet } from 'react-helmet'; +import ImmutablePureComponent from 'react-immutable-pure-component'; +import { connect } from 'react-redux'; + +import Column from 'flavours/glitch/components/column'; +import ColumnHeader from 'flavours/glitch/components/column_header'; + + const messages = defineMessages({ heading: { id: 'keyboard_shortcuts.heading', defaultMessage: 'Keyboard Shortcuts' }, }); 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 0e4b098d92..4dc9c1f893 100644 --- a/app/javascript/flavours/glitch/features/list_adder/components/account.jsx +++ b/app/javascript/flavours/glitch/features/list_adder/components/account.jsx @@ -1,11 +1,13 @@ -import React from 'react'; -import { connect } from 'react-redux'; -import { makeGetAccount } from '../../../selectors'; -import ImmutablePureComponent from 'react-immutable-pure-component'; +import { injectIntl } from 'react-intl'; + import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; +import { connect } from 'react-redux'; + import { Avatar } from '../../../components/avatar'; import { DisplayName } from '../../../components/display_name'; -import { injectIntl } from 'react-intl'; +import { makeGetAccount } from '../../../selectors'; + const makeMapStateToProps = () => { const getAccount = makeGetAccount(); 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 587a953b01..83a5ecb91f 100644 --- a/app/javascript/flavours/glitch/features/list_adder/components/list.jsx +++ b/app/javascript/flavours/glitch/features/list_adder/components/list.jsx @@ -1,13 +1,16 @@ -import React from 'react'; 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 { defineMessages, injectIntl } from 'react-intl'; -import { removeFromListAdder, addToListAdder } from '../../../actions/lists'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; +import { connect } from 'react-redux'; + import { Icon } from 'flavours/glitch/components/icon'; +import { removeFromListAdder, addToListAdder } from '../../../actions/lists'; +import { IconButton } from '../../../components/icon_button'; + const messages = defineMessages({ remove: { id: 'lists.account.remove', defaultMessage: 'Remove from list' }, add: { id: 'lists.account.add', defaultMessage: 'Add to list' }, diff --git a/app/javascript/flavours/glitch/features/list_adder/index.jsx b/app/javascript/flavours/glitch/features/list_adder/index.jsx index 45d5589f96..1ba9972e00 100644 --- a/app/javascript/flavours/glitch/features/list_adder/index.jsx +++ b/app/javascript/flavours/glitch/features/list_adder/index.jsx @@ -1,14 +1,17 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import { connect } from 'react-redux'; -import ImmutablePureComponent from 'react-immutable-pure-component'; + import { injectIntl } from 'react-intl'; -import { setupListAdder, resetListAdder } from '../../actions/lists'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; +import { connect } from 'react-redux'; import { createSelector } from 'reselect'; -import List from './components/list'; -import Account from './components/account'; + +import { setupListAdder, resetListAdder } from '../../actions/lists'; import NewListForm from '../lists/components/new_list_form'; + +import Account from './components/account'; +import List from './components/list'; // hack const getOrderedLists = createSelector([state => state.get('lists')], lists => { 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 b94b7e3f62..01c0444153 100644 --- a/app/javascript/flavours/glitch/features/list_editor/components/account.jsx +++ b/app/javascript/flavours/glitch/features/list_editor/components/account.jsx @@ -1,11 +1,14 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import ImmutablePureComponent from 'react-immutable-pure-component'; + +import { defineMessages } from 'react-intl'; + import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; + import { Avatar } from 'flavours/glitch/components/avatar'; import { DisplayName } from 'flavours/glitch/components/display_name'; import { IconButton } from 'flavours/glitch/components/icon_button'; -import { defineMessages } from 'react-intl'; + const messages = defineMessages({ remove: { id: 'lists.account.remove', defaultMessage: 'Remove from list' }, 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 3f4e9ded60..5c4fff27b5 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 @@ -1,9 +1,12 @@ -import React from 'react'; -import { connect } from 'react-redux'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + +import { defineMessages, injectIntl } from 'react-intl'; + +import { connect } from 'react-redux'; + import { changeListEditorTitle, submitListEditor } from 'flavours/glitch/actions/lists'; import { IconButton } from 'flavours/glitch/components/icon_button'; -import { defineMessages, injectIntl } from 'react-intl'; const messages = defineMessages({ title: { id: 'lists.edit.submit', defaultMessage: 'Change title' }, @@ -19,7 +22,7 @@ const mapDispatchToProps = dispatch => ({ onSubmit: () => dispatch(submitListEditor(false)), }); -class ListForm extends React.PureComponent { +class ListForm extends PureComponent { static propTypes = { value: PropTypes.string.isRequired, 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 3a51a7b4e5..a43b3b969e 100644 --- a/app/javascript/flavours/glitch/features/list_editor/components/search.jsx +++ b/app/javascript/flavours/glitch/features/list_editor/components/search.jsx @@ -1,14 +1,17 @@ -import React from 'react'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + import { defineMessages } from 'react-intl'; + import classNames from 'classnames'; + import { Icon } from 'flavours/glitch/components/icon'; const messages = defineMessages({ search: { id: 'lists.search', defaultMessage: 'Search among people you follow' }, }); -export default class Search extends React.PureComponent { +export default class Search extends PureComponent { static propTypes = { intl: PropTypes.object.isRequired, diff --git a/app/javascript/flavours/glitch/features/list_editor/containers/account_container.js b/app/javascript/flavours/glitch/features/list_editor/containers/account_container.js index 578bbc3e01..329a1dcb91 100644 --- a/app/javascript/flavours/glitch/features/list_editor/containers/account_container.js +++ b/app/javascript/flavours/glitch/features/list_editor/containers/account_container.js @@ -1,7 +1,10 @@ -import { connect } from 'react-redux'; -import { makeGetAccount } from 'flavours/glitch/selectors'; import { injectIntl } from 'react-intl'; + +import { connect } from 'react-redux'; + import { removeFromListEditor, addToListEditor } from 'flavours/glitch/actions/lists'; +import { makeGetAccount } from 'flavours/glitch/selectors'; + import Account from '../components/account'; const makeMapStateToProps = () => { diff --git a/app/javascript/flavours/glitch/features/list_editor/containers/search_container.js b/app/javascript/flavours/glitch/features/list_editor/containers/search_container.js index d11a6f82b3..a7f0009a84 100644 --- a/app/javascript/flavours/glitch/features/list_editor/containers/search_container.js +++ b/app/javascript/flavours/glitch/features/list_editor/containers/search_container.js @@ -1,5 +1,7 @@ -import { connect } from 'react-redux'; import { injectIntl } from 'react-intl'; + +import { connect } from 'react-redux'; + import { fetchListSuggestions, clearListSuggestions, changeListSuggestions } from '../../../actions/lists'; import Search from '../components/search'; diff --git a/app/javascript/flavours/glitch/features/list_editor/index.jsx b/app/javascript/flavours/glitch/features/list_editor/index.jsx index 44951d1c64..134d5ff074 100644 --- a/app/javascript/flavours/glitch/features/list_editor/index.jsx +++ b/app/javascript/flavours/glitch/features/list_editor/index.jsx @@ -1,15 +1,21 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import { connect } from 'react-redux'; -import ImmutablePureComponent from 'react-immutable-pure-component'; + import { injectIntl } from 'react-intl'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; +import { connect } from 'react-redux'; + +import spring from 'react-motion/lib/spring'; + import { setupListEditor, clearListSuggestions, resetListEditor } from 'flavours/glitch/actions/lists'; + +import Motion from '../ui/util/optional_motion'; + +import EditListForm from './components/edit_list_form'; import AccountContainer from './containers/account_container'; import SearchContainer from './containers/search_container'; -import EditListForm from './components/edit_list_form'; -import Motion from '../ui/util/optional_motion'; -import spring from 'react-motion/lib/spring'; + const mapStateToProps = state => ({ accountIds: state.getIn(['listEditor', 'accounts', 'items']), diff --git a/app/javascript/flavours/glitch/features/list_timeline/index.jsx b/app/javascript/flavours/glitch/features/list_timeline/index.jsx index 8803664761..554a3a0e89 100644 --- a/app/javascript/flavours/glitch/features/list_timeline/index.jsx +++ b/app/javascript/flavours/glitch/features/list_timeline/index.jsx @@ -1,9 +1,13 @@ import PropTypes from 'prop-types'; -import React from 'react'; -import { Helmet } from 'react-helmet'; -import ImmutablePropTypes from 'react-immutable-proptypes'; +import { PureComponent } from 'react'; + import { FormattedMessage, defineMessages, injectIntl } from 'react-intl'; + +import { Helmet } from 'react-helmet'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; import { connect } from 'react-redux'; + import { addColumn, removeColumn, moveColumn } from 'flavours/glitch/actions/columns'; import { fetchList, deleteList, updateList } from 'flavours/glitch/actions/lists'; import { openModal } from 'flavours/glitch/actions/modal'; @@ -14,8 +18,8 @@ import ColumnHeader from 'flavours/glitch/components/column_header'; import { Icon } from 'flavours/glitch/components/icon'; import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; 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'; +import StatusListContainer from 'flavours/glitch/features/ui/containers/status_list_container'; const messages = defineMessages({ deleteMessage: { id: 'confirmations.delete_list.message', defaultMessage: 'Are you sure you want to permanently delete this list?' }, @@ -30,7 +34,7 @@ const mapStateToProps = (state, props) => ({ hasUnread: state.getIn(['timelines', `list:${props.params.id}`, 'unread']) > 0, }); -class ListTimeline extends React.PureComponent { +class ListTimeline extends PureComponent { static contextTypes = { router: PropTypes.object, @@ -110,24 +114,30 @@ class ListTimeline extends React.PureComponent { }; handleEditClick = () => { - this.props.dispatch(openModal('LIST_EDITOR', { listId: this.props.params.id })); + this.props.dispatch(openModal({ + modalType: 'LIST_EDITOR', + modalProps: { listId: this.props.params.id }, + })); }; handleDeleteClick = () => { const { dispatch, columnId, intl } = this.props; const { id } = this.props.params; - dispatch(openModal('CONFIRM', { - message: intl.formatMessage(messages.deleteMessage), - confirm: intl.formatMessage(messages.deleteConfirm), - onConfirm: () => { - dispatch(deleteList(id)); + dispatch(openModal({ + modalType: 'CONFIRM', + modalProps: { + message: intl.formatMessage(messages.deleteMessage), + confirm: intl.formatMessage(messages.deleteConfirm), + onConfirm: () => { + dispatch(deleteList(id)); - if (columnId) { - dispatch(removeColumn(columnId)); - } else { - this.context.router.history.push('/lists'); - } + if (columnId) { + dispatch(removeColumn(columnId)); + } else { + this.context.router.history.push('/lists'); + } + }, }, })); }; 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 aa743dea4a..72602f1882 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 @@ -1,9 +1,12 @@ -import React from 'react'; -import { connect } from 'react-redux'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + +import { defineMessages, injectIntl } from 'react-intl'; + +import { connect } from 'react-redux'; + import { changeListEditorTitle, submitListEditor } from 'flavours/glitch/actions/lists'; import { IconButton } from 'flavours/glitch/components/icon_button'; -import { defineMessages, injectIntl } from 'react-intl'; const messages = defineMessages({ label: { id: 'lists.new.title_placeholder', defaultMessage: 'New list title' }, @@ -20,7 +23,7 @@ const mapDispatchToProps = dispatch => ({ onSubmit: () => dispatch(submitListEditor(true)), }); -class NewListForm extends React.PureComponent { +class NewListForm extends PureComponent { static propTypes = { value: PropTypes.string.isRequired, diff --git a/app/javascript/flavours/glitch/features/lists/index.jsx b/app/javascript/flavours/glitch/features/lists/index.jsx index 375ab5faed..3ab82e2948 100644 --- a/app/javascript/flavours/glitch/features/lists/index.jsx +++ b/app/javascript/flavours/glitch/features/lists/index.jsx @@ -1,11 +1,14 @@ import PropTypes from 'prop-types'; -import React from 'react'; + +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; + import { Helmet } from 'react-helmet'; + import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { connect } from 'react-redux'; import { createSelector } from 'reselect'; + import { fetchLists } from 'flavours/glitch/actions/lists'; import ColumnBackButtonSlim from 'flavours/glitch/components/column_back_button_slim'; import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; @@ -13,6 +16,7 @@ import ScrollableList from 'flavours/glitch/components/scrollable_list'; import Column from 'flavours/glitch/features/ui/components/column'; import ColumnLink from 'flavours/glitch/features/ui/components/column_link'; import ColumnSubheading from 'flavours/glitch/features/ui/components/column_subheading'; + import NewListForm from './components/new_list_form'; const messages = defineMessages({ diff --git a/app/javascript/flavours/glitch/features/local_settings/index.jsx b/app/javascript/flavours/glitch/features/local_settings/index.jsx index 4e4605ea9d..f78b8a38e9 100644 --- a/app/javascript/flavours/glitch/features/local_settings/index.jsx +++ b/app/javascript/flavours/glitch/features/local_settings/index.jsx @@ -1,14 +1,16 @@ // Package imports. -import React from 'react'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + import ImmutablePropTypes from 'react-immutable-proptypes'; import { connect } from 'react-redux'; // Our imports -import LocalSettingsPage from './page'; -import LocalSettingsNavigation from './navigation'; -import { closeModal } from 'flavours/glitch/actions/modal'; import { changeLocalSetting } from 'flavours/glitch/actions/local_settings'; +import { closeModal } from 'flavours/glitch/actions/modal'; + +import LocalSettingsNavigation from './navigation'; +import LocalSettingsPage from './page'; const mapStateToProps = state => ({ settings: state.get('local_settings'), @@ -23,7 +25,7 @@ const mapDispatchToProps = dispatch => ({ }, }); -class LocalSettings extends React.PureComponent { +class LocalSettings extends PureComponent { static propTypes = { onChange: PropTypes.func.isRequired, diff --git a/app/javascript/flavours/glitch/features/local_settings/navigation/index.jsx b/app/javascript/flavours/glitch/features/local_settings/navigation/index.jsx index fe08e5d7b0..022d817126 100644 --- a/app/javascript/flavours/glitch/features/local_settings/navigation/index.jsx +++ b/app/javascript/flavours/glitch/features/local_settings/navigation/index.jsx @@ -1,12 +1,14 @@ // Package imports -import React from 'react'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + import { injectIntl, defineMessages } from 'react-intl'; // Our imports -import LocalSettingsNavigationItem from './item'; import { preferencesLink } from 'flavours/glitch/utils/backend_links'; +import LocalSettingsNavigationItem from './item'; + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * const messages = defineMessages({ @@ -19,7 +21,7 @@ const messages = defineMessages({ close: { id: 'settings.close', defaultMessage: 'Close' }, }); -class LocalSettingsNavigation extends React.PureComponent { +class LocalSettingsNavigation extends PureComponent { static propTypes = { index : PropTypes.number, 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 2de7c952c8..d1f3512ed7 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 @@ -1,13 +1,14 @@ // Package imports -import React from 'react'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + import classNames from 'classnames'; import { Icon } from 'flavours/glitch/components/icon'; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -export default class LocalSettingsPage extends React.PureComponent { +export default class LocalSettingsPage extends PureComponent { static propTypes = { active: PropTypes.bool, diff --git a/app/javascript/flavours/glitch/features/local_settings/page/deprecated_item/index.jsx b/app/javascript/flavours/glitch/features/local_settings/page/deprecated_item/index.jsx index 0f0dc3ce37..f266488ca4 100644 --- a/app/javascript/flavours/glitch/features/local_settings/page/deprecated_item/index.jsx +++ b/app/javascript/flavours/glitch/features/local_settings/page/deprecated_item/index.jsx @@ -1,10 +1,10 @@ // Package imports -import React from 'react'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -export default class LocalSettingsPageItem extends React.PureComponent { +export default class LocalSettingsPageItem extends PureComponent { static propTypes = { children: PropTypes.node.isRequired, diff --git a/app/javascript/flavours/glitch/features/local_settings/page/index.jsx b/app/javascript/flavours/glitch/features/local_settings/page/index.jsx index 91582a3183..5badc90791 100644 --- a/app/javascript/flavours/glitch/features/local_settings/page/index.jsx +++ b/app/javascript/flavours/glitch/features/local_settings/page/index.jsx @@ -1,14 +1,18 @@ // Package imports -import React from 'react'; import PropTypes from 'prop-types'; -import ImmutablePropTypes from 'react-immutable-proptypes'; +import { PureComponent } from 'react'; + import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; +import ImmutablePropTypes from 'react-immutable-proptypes'; + + // Our imports import { expandSpoilers } from 'flavours/glitch/initial_state'; import { preferenceLink } from 'flavours/glitch/utils/backend_links'; -import LocalSettingsPageItem from './item'; + import DeprecatedLocalSettingsPageItem from './deprecated_item'; +import LocalSettingsPageItem from './item'; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * @@ -31,11 +35,11 @@ const messages = defineMessages({ pop_in_right: { id: 'settings.pop_in_right', defaultMessage: 'Right' }, public: { id: 'privacy.public.short', defaultMessage: 'Public' }, unlisted: { id: 'privacy.unlisted.short', defaultMessage: 'Unlisted' }, - private: { id: 'privacy.private.short', defaultMessage: 'Followers-only' }, + private: { id: 'privacy.private.short', defaultMessage: 'Followers only' }, direct: { id: 'privacy.direct.short', defaultMessage: 'Mentioned people only' }, }); -class LocalSettingsPage extends React.PureComponent { +class LocalSettingsPage extends PureComponent { static propTypes = { index : PropTypes.number, diff --git a/app/javascript/flavours/glitch/features/local_settings/page/item/index.jsx b/app/javascript/flavours/glitch/features/local_settings/page/item/index.jsx index 99bb65ca03..15dce634d2 100644 --- a/app/javascript/flavours/glitch/features/local_settings/page/item/index.jsx +++ b/app/javascript/flavours/glitch/features/local_settings/page/item/index.jsx @@ -1,11 +1,11 @@ // Package imports -import React from 'react'; import PropTypes from 'prop-types'; -import ImmutablePropTypes from 'react-immutable-proptypes'; +import { PureComponent } from 'react'; +import ImmutablePropTypes from 'react-immutable-proptypes'; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -export default class LocalSettingsPageItem extends React.PureComponent { +export default class LocalSettingsPageItem extends PureComponent { static propTypes = { children: PropTypes.node.isRequired, diff --git a/app/javascript/flavours/glitch/features/mutes/index.jsx b/app/javascript/flavours/glitch/features/mutes/index.jsx index e1a76e2fe3..3cf67b8b98 100644 --- a/app/javascript/flavours/glitch/features/mutes/index.jsx +++ b/app/javascript/flavours/glitch/features/mutes/index.jsx @@ -1,18 +1,25 @@ -import React from 'react'; -import { connect } from 'react-redux'; -import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import PropTypes from 'prop-types'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import { debounce } from 'lodash'; -import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; -import Column from 'flavours/glitch/features/ui/components/column'; -import ColumnBackButtonSlim from 'flavours/glitch/components/column_back_button_slim'; -import AccountContainer from 'flavours/glitch/containers/account_container'; -import { fetchMutes, expandMutes } from 'flavours/glitch/actions/mutes'; -import ImmutablePureComponent from 'react-immutable-pure-component'; -import ScrollableList from 'flavours/glitch/components/scrollable_list'; + +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; + import { Helmet } from 'react-helmet'; +import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; +import { connect } from 'react-redux'; + +import { debounce } from 'lodash'; + +import { fetchMutes, expandMutes } from 'flavours/glitch/actions/mutes'; +import ColumnBackButtonSlim from 'flavours/glitch/components/column_back_button_slim'; +import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; +import ScrollableList from 'flavours/glitch/components/scrollable_list'; +import AccountContainer from 'flavours/glitch/containers/account_container'; +import Column from 'flavours/glitch/features/ui/components/column'; + + + + const messages = defineMessages({ heading: { id: 'column.mutes', defaultMessage: 'Muted users' }, }); 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 3d5f67a178..9f63b3ce79 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/admin_report.jsx +++ b/app/javascript/flavours/glitch/features/notifications/components/admin_report.jsx @@ -1,16 +1,22 @@ // Package imports. -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; + import { FormattedMessage } from 'react-intl'; -import ImmutablePureComponent from 'react-immutable-pure-component'; -import { HotKeys } from 'react-hotkeys'; + import classNames from 'classnames'; +import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; + +import { HotKeys } from 'react-hotkeys'; + + // Our imports. -import Permalink from 'flavours/glitch/components/permalink'; -import NotificationOverlayContainer from '../containers/overlay_container'; import { Icon } from 'flavours/glitch/components/icon'; +import Permalink from 'flavours/glitch/components/permalink'; + +import NotificationOverlayContainer from '../containers/overlay_container'; + 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 7c872e182f..8036f783a7 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/admin_signup.jsx +++ b/app/javascript/flavours/glitch/features/notifications/components/admin_signup.jsx @@ -1,17 +1,22 @@ // Package imports. -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; + import { FormattedMessage } from 'react-intl'; -import ImmutablePureComponent from 'react-immutable-pure-component'; -import { HotKeys } from 'react-hotkeys'; + import classNames from 'classnames'; +import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; + +import { HotKeys } from 'react-hotkeys'; + + // Our imports. +import { Icon } from 'flavours/glitch/components/icon'; 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'; 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 0602b4cf00..0833ac29d7 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,9 +1,11 @@ -import React from 'react'; import PropTypes from 'prop-types'; +import { Component } from 'react'; + import { FormattedMessage } from 'react-intl'; + import { Icon } from 'flavours/glitch/components/icon'; -export default class ClearColumnButton extends React.Component { +export default class ClearColumnButton extends Component { static propTypes = { onClick: PropTypes.func.isRequired, diff --git a/app/javascript/flavours/glitch/features/notifications/components/column_settings.jsx b/app/javascript/flavours/glitch/features/notifications/components/column_settings.jsx index 1c04218bac..937d01b46a 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/column_settings.jsx +++ b/app/javascript/flavours/glitch/features/notifications/components/column_settings.jsx @@ -1,14 +1,18 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import ImmutablePropTypes from 'react-immutable-proptypes'; +import { PureComponent } from 'react'; + import { FormattedMessage } from 'react-intl'; -import ClearColumnButton from './clear_column_button'; -import GrantPermissionButton from './grant_permission_button'; -import SettingToggle from './setting_toggle'; -import PillBarButton from './pill_bar_button'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; + import { PERMISSION_MANAGE_USERS, PERMISSION_MANAGE_REPORTS } from 'flavours/glitch/permissions'; -export default class ColumnSettings extends React.PureComponent { +import ClearColumnButton from './clear_column_button'; +import GrantPermissionButton from './grant_permission_button'; +import PillBarButton from './pill_bar_button'; +import SettingToggle from './setting_toggle'; + +export default class ColumnSettings extends PureComponent { static contextTypes = { identity: PropTypes.object, 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 cc83fa5cfd..99ce167496 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/filter_bar.jsx +++ b/app/javascript/flavours/glitch/features/notifications/components/filter_bar.jsx @@ -1,6 +1,8 @@ -import React from 'react'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; + import { Icon } from 'flavours/glitch/components/icon'; const tooltips = defineMessages({ @@ -12,7 +14,7 @@ const tooltips = defineMessages({ statuses: { id: 'notifications.filter.statuses', defaultMessage: 'Updates from people you follow' }, }); -class FilterBar extends React.PureComponent { +class FilterBar extends PureComponent { static propTypes = { selectFilter: PropTypes.func.isRequired, diff --git a/app/javascript/flavours/glitch/features/notifications/components/follow.jsx b/app/javascript/flavours/glitch/features/notifications/components/follow.jsx index 88c90f3ce6..7e2749d66d 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/follow.jsx +++ b/app/javascript/flavours/glitch/features/notifications/components/follow.jsx @@ -1,17 +1,22 @@ // Package imports. -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; + import { FormattedMessage } from 'react-intl'; -import ImmutablePureComponent from 'react-immutable-pure-component'; -import { HotKeys } from 'react-hotkeys'; + import classNames from 'classnames'; +import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; + +import { HotKeys } from 'react-hotkeys'; + + // Our imports. +import { Icon } from 'flavours/glitch/components/icon'; 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'; 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 c61f656f69..d5ae9dd3f3 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/follow_request.jsx +++ b/app/javascript/flavours/glitch/features/notifications/components/follow_request.jsx @@ -1,16 +1,21 @@ -import React, { Fragment } from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; + +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; + +import classNames from 'classnames'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; + +import { HotKeys } from 'react-hotkeys'; + 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 { 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 classNames from 'classnames'; +import { IconButton } from 'flavours/glitch/components/icon_button'; +import Permalink from 'flavours/glitch/components/permalink'; + +import NotificationOverlayContainer from '../containers/overlay_container'; const messages = defineMessages({ authorize: { id: 'follow_request.authorize', defaultMessage: 'Authorize' }, @@ -74,10 +79,10 @@ class FollowRequest extends ImmutablePureComponent { if (hidden) { return ( - + <> {account.get('display_name')} {account.get('username')} - + ); } diff --git a/app/javascript/flavours/glitch/features/notifications/components/grant_permission_button.jsx b/app/javascript/flavours/glitch/features/notifications/components/grant_permission_button.jsx index 5b2db48fdb..cd46d878bb 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/grant_permission_button.jsx +++ b/app/javascript/flavours/glitch/features/notifications/components/grant_permission_button.jsx @@ -1,8 +1,9 @@ -import React from 'react'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + import { FormattedMessage } from 'react-intl'; -export default class GrantPermissionButton extends React.PureComponent { +export default class GrantPermissionButton extends PureComponent { static propTypes = { onClick: PropTypes.func.isRequired, diff --git a/app/javascript/flavours/glitch/features/notifications/components/notification.jsx b/app/javascript/flavours/glitch/features/notifications/components/notification.jsx index d1aea1b21d..1d476969cb 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/notification.jsx +++ b/app/javascript/flavours/glitch/features/notifications/components/notification.jsx @@ -1,15 +1,17 @@ // Package imports. -import React from 'react'; import PropTypes from 'prop-types'; + import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; // Our imports, import StatusContainer from 'flavours/glitch/containers/status_container'; -import NotificationFollow from './follow'; -import NotificationFollowRequestContainer from '../containers/follow_request_container'; -import NotificationAdminSignup from './admin_signup'; + import NotificationAdminReportContainer from '../containers/admin_report_container'; +import NotificationFollowRequestContainer from '../containers/follow_request_container'; + +import NotificationAdminSignup from './admin_signup'; +import NotificationFollow from './follow'; export default class Notification extends ImmutablePureComponent { 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 8868cc0cb4..b088935285 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,18 +1,23 @@ -import React from 'react'; -import { Icon } from 'flavours/glitch/components/icon'; -import Button from 'flavours/glitch/components/button'; -import { IconButton } from 'flavours/glitch/components/icon_button'; +import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; + +import { connect } from 'react-redux'; + import { requestBrowserPermission } from 'flavours/glitch/actions/notifications'; import { changeSetting } from 'flavours/glitch/actions/settings'; -import { connect } from 'react-redux'; -import PropTypes from 'prop-types'; -import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; +import Button from 'flavours/glitch/components/button'; +import { Icon } from 'flavours/glitch/components/icon'; +import { IconButton } from 'flavours/glitch/components/icon_button'; + + const messages = defineMessages({ close: { id: 'lightbox.close', defaultMessage: 'Close' }, }); -class NotificationsPermissionBanner extends React.PureComponent { +class NotificationsPermissionBanner extends PureComponent { static propTypes = { dispatch: PropTypes.func.isRequired, diff --git a/app/javascript/flavours/glitch/features/notifications/components/overlay.jsx b/app/javascript/flavours/glitch/features/notifications/components/overlay.jsx index 00e6257380..73fb698643 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/overlay.jsx +++ b/app/javascript/flavours/glitch/features/notifications/components/overlay.jsx @@ -4,11 +4,13 @@ // Package imports. -import React from 'react'; -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 ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; + import { Icon } from 'flavours/glitch/components/icon'; const messages = defineMessages({ diff --git a/app/javascript/flavours/glitch/features/notifications/components/pill_bar_button.jsx b/app/javascript/flavours/glitch/features/notifications/components/pill_bar_button.jsx index 2f0b48ef98..633401d6e3 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/pill_bar_button.jsx +++ b/app/javascript/flavours/glitch/features/notifications/components/pill_bar_button.jsx @@ -1,9 +1,11 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import ImmutablePropTypes from 'react-immutable-proptypes'; +import { PureComponent } from 'react'; + import classNames from 'classnames'; -export default class PillBarButton extends React.PureComponent { +import ImmutablePropTypes from 'react-immutable-proptypes'; + +export default class PillBarButton extends PureComponent { static propTypes = { prefix: PropTypes.string, diff --git a/app/javascript/flavours/glitch/features/notifications/components/report.jsx b/app/javascript/flavours/glitch/features/notifications/components/report.jsx index b2e795b2d1..70293e2100 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/report.jsx +++ b/app/javascript/flavours/glitch/features/notifications/components/report.jsx @@ -1,8 +1,10 @@ -import React, { Fragment } from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; + import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; + import AvatarOverlay from 'flavours/glitch/components/avatar_overlay'; import { RelativeTimestamp } from 'flavours/glitch/components/relative_timestamp'; @@ -31,9 +33,9 @@ class Report extends ImmutablePureComponent { if (hidden) { return ( - + <> {report.get('id')} - + ); } diff --git a/app/javascript/flavours/glitch/features/notifications/components/setting_toggle.jsx b/app/javascript/flavours/glitch/features/notifications/components/setting_toggle.jsx index dc7b89b7fd..2f849c5484 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/setting_toggle.jsx +++ b/app/javascript/flavours/glitch/features/notifications/components/setting_toggle.jsx @@ -1,9 +1,11 @@ -import React from 'react'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + import ImmutablePropTypes from 'react-immutable-proptypes'; + import Toggle from 'react-toggle'; -export default class SettingToggle extends React.PureComponent { +export default class SettingToggle extends PureComponent { static propTypes = { prefix: PropTypes.string, diff --git a/app/javascript/flavours/glitch/features/notifications/containers/admin_report_container.js b/app/javascript/flavours/glitch/features/notifications/containers/admin_report_container.js index 4198afce8b..62809b57b2 100644 --- a/app/javascript/flavours/glitch/features/notifications/containers/admin_report_container.js +++ b/app/javascript/flavours/glitch/features/notifications/containers/admin_report_container.js @@ -1,5 +1,7 @@ import { connect } from 'react-redux'; + import { makeGetReport } from 'flavours/glitch/selectors'; + import AdminReport from '../components/admin_report'; const mapStateToProps = (state, { notification }) => { diff --git a/app/javascript/flavours/glitch/features/notifications/containers/column_settings_container.js b/app/javascript/flavours/glitch/features/notifications/containers/column_settings_container.js index 27c2f96fe4..cc3793fccc 100644 --- a/app/javascript/flavours/glitch/features/notifications/containers/column_settings_container.js +++ b/app/javascript/flavours/glitch/features/notifications/containers/column_settings_container.js @@ -1,11 +1,14 @@ -import { connect } from 'react-redux'; import { defineMessages, injectIntl } from 'react-intl'; -import ColumnSettings from '../components/column_settings'; -import { changeSetting } from 'flavours/glitch/actions/settings'; + +import { connect } from 'react-redux'; + +import { showAlert } from 'flavours/glitch/actions/alerts'; +import { openModal } from 'flavours/glitch/actions/modal'; import { setFilter, clearNotifications, requestBrowserPermission } from 'flavours/glitch/actions/notifications'; import { changeAlerts as changePushNotifications } from 'flavours/glitch/actions/push_notifications'; -import { openModal } from 'flavours/glitch/actions/modal'; -import { showAlert } from 'flavours/glitch/actions/alerts'; +import { changeSetting } from 'flavours/glitch/actions/settings'; + +import ColumnSettings from '../components/column_settings'; const messages = defineMessages({ clearMessage: { id: 'notifications.clear_confirmation', defaultMessage: 'Are you sure you want to permanently clear all your notifications?' }, @@ -57,10 +60,13 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ }, onClear () { - dispatch(openModal('CONFIRM', { - message: intl.formatMessage(messages.clearMessage), - confirm: intl.formatMessage(messages.clearConfirm), - onConfirm: () => dispatch(clearNotifications()), + dispatch(openModal({ + modalType: 'CONFIRM', + modalProps: { + message: intl.formatMessage(messages.clearMessage), + confirm: intl.formatMessage(messages.clearConfirm), + onConfirm: () => dispatch(clearNotifications()), + }, })); }, diff --git a/app/javascript/flavours/glitch/features/notifications/containers/filter_bar_container.js b/app/javascript/flavours/glitch/features/notifications/containers/filter_bar_container.js index 4d495c2908..4e0184cef3 100644 --- a/app/javascript/flavours/glitch/features/notifications/containers/filter_bar_container.js +++ b/app/javascript/flavours/glitch/features/notifications/containers/filter_bar_container.js @@ -1,6 +1,7 @@ import { connect } from 'react-redux'; -import FilterBar from '../components/filter_bar'; + import { setFilter } from '../../../actions/notifications'; +import FilterBar from '../components/filter_bar'; const makeMapStateToProps = state => ({ selectedFilter: state.getIn(['settings', 'notifications', 'quickFilter', 'active']), diff --git a/app/javascript/flavours/glitch/features/notifications/containers/follow_request_container.js b/app/javascript/flavours/glitch/features/notifications/containers/follow_request_container.js index 004d1e173b..d66b24991d 100644 --- a/app/javascript/flavours/glitch/features/notifications/containers/follow_request_container.js +++ b/app/javascript/flavours/glitch/features/notifications/containers/follow_request_container.js @@ -1,7 +1,9 @@ import { connect } from 'react-redux'; -import FollowRequest from '../components/follow_request'; + import { authorizeFollowRequest, rejectFollowRequest } from 'flavours/glitch/actions/accounts'; +import FollowRequest from '../components/follow_request'; + const mapDispatchToProps = (dispatch, { account }) => ({ onAuthorize () { dispatch(authorizeFollowRequest(account.get('id'))); diff --git a/app/javascript/flavours/glitch/features/notifications/containers/notification_container.js b/app/javascript/flavours/glitch/features/notifications/containers/notification_container.js index be007f30bb..b39d1169f2 100644 --- a/app/javascript/flavours/glitch/features/notifications/containers/notification_container.js +++ b/app/javascript/flavours/glitch/features/notifications/containers/notification_container.js @@ -2,9 +2,10 @@ import { connect } from 'react-redux'; // Our imports. -import { makeGetNotification } from 'flavours/glitch/selectors'; -import Notification from '../components/notification'; import { mentionCompose } from 'flavours/glitch/actions/compose'; +import { makeGetNotification } from 'flavours/glitch/selectors'; + +import Notification from '../components/notification'; const makeMapStateToProps = () => { const getNotification = makeGetNotification(); diff --git a/app/javascript/flavours/glitch/features/notifications/containers/overlay_container.js b/app/javascript/flavours/glitch/features/notifications/containers/overlay_container.js index ee2d19814a..e4b8902a81 100644 --- a/app/javascript/flavours/glitch/features/notifications/containers/overlay_container.js +++ b/app/javascript/flavours/glitch/features/notifications/containers/overlay_container.js @@ -2,9 +2,10 @@ import { connect } from 'react-redux'; // Our imports. -import NotificationOverlay from '../components/overlay'; import { markNotificationForDelete } from 'flavours/glitch/actions/notifications'; +import NotificationOverlay from '../components/overlay'; + const mapDispatchToProps = dispatch => ({ onMarkForDelete(id, yes) { dispatch(markNotificationForDelete(id, yes)); diff --git a/app/javascript/flavours/glitch/features/notifications/index.jsx b/app/javascript/flavours/glitch/features/notifications/index.jsx index c1042c1367..d84d29f112 100644 --- a/app/javascript/flavours/glitch/features/notifications/index.jsx +++ b/app/javascript/flavours/glitch/features/notifications/index.jsx @@ -1,10 +1,20 @@ -import React from 'react'; -import { connect } from 'react-redux'; -import classNames from 'classnames'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; + +import classNames from 'classnames'; +import { Helmet } from 'react-helmet'; + +import { List as ImmutableList } from 'immutable'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import Column from 'flavours/glitch/components/column'; -import ColumnHeader from 'flavours/glitch/components/column_header'; +import { connect } from 'react-redux'; +import { createSelector } from 'reselect'; + +import { debounce } from 'lodash'; + +import { addColumn, removeColumn, moveColumn } from 'flavours/glitch/actions/columns'; +import { submitMarkers } from 'flavours/glitch/actions/markers'; import { enterNotificationClearingMode, expandNotifications, @@ -14,24 +24,24 @@ import { unmountNotifications, markNotificationsAsRead, } from 'flavours/glitch/actions/notifications'; -import { addColumn, removeColumn, moveColumn } from 'flavours/glitch/actions/columns'; -import { submitMarkers } from 'flavours/glitch/actions/markers'; -import NotificationContainer from './containers/notification_container'; -import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; +import { compareId } from 'flavours/glitch/compare_id'; +import Column from 'flavours/glitch/components/column'; +import ColumnHeader from 'flavours/glitch/components/column_header'; +import { Icon } from 'flavours/glitch/components/icon'; +import { LoadGap } from 'flavours/glitch/components/load_gap'; +import { NotSignedInIndicator } from 'flavours/glitch/components/not_signed_in_indicator'; +import ScrollableList from 'flavours/glitch/components/scrollable_list'; +import NotificationPurgeButtonsContainer from 'flavours/glitch/containers/notification_purge_buttons_container'; + +import NotificationsPermissionBanner from './components/notifications_permission_banner'; import ColumnSettingsContainer from './containers/column_settings_container'; import FilterBarContainer from './containers/filter_bar_container'; -import { createSelector } from 'reselect'; -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 NotificationsPermissionBanner from './components/notifications_permission_banner'; -import { NotSignedInIndicator } from 'flavours/glitch/components/not_signed_in_indicator'; -import { Helmet } from 'react-helmet'; +import NotificationContainer from './containers/notification_container'; + + + + -import NotificationPurgeButtonsContainer from 'flavours/glitch/containers/notification_purge_buttons_container'; const messages = defineMessages({ title: { id: 'column.notifications', defaultMessage: 'Notifications' }, @@ -82,7 +92,7 @@ const mapDispatchToProps = dispatch => ({ dispatch, }); -class Notifications extends React.PureComponent { +class Notifications extends PureComponent { static contextTypes = { identity: PropTypes.object, @@ -323,12 +333,6 @@ class Notifications extends React.PureComponent { ); - const extraButton = ( - <> - {extraButtons} - - ); - return ( 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 01a823f173..7d5c4adb6f 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 @@ -1,17 +1,20 @@ -import React from 'react'; -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 classNames from 'classnames'; -import { me, boostModal } from 'flavours/glitch/initial_state'; + import { defineMessages, injectIntl } from 'react-intl'; + +import classNames from 'classnames'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; +import { connect } from 'react-redux'; + +import { initBoostModal } from 'flavours/glitch/actions/boosts'; import { replyCompose } from 'flavours/glitch/actions/compose'; import { reblog, favourite, unreblog, unfavourite } from 'flavours/glitch/actions/interactions'; -import { makeGetStatus } from 'flavours/glitch/selectors'; import { openModal } from 'flavours/glitch/actions/modal'; -import { initBoostModal } from 'flavours/glitch/actions/boosts'; +import { IconButton } from 'flavours/glitch/components/icon_button'; +import { me, boostModal } from 'flavours/glitch/initial_state'; +import { makeGetStatus } from 'flavours/glitch/selectors'; const messages = defineMessages({ reply: { id: 'status.reply', defaultMessage: 'Reply' }, @@ -73,19 +76,25 @@ class Footer extends ImmutablePureComponent { if (signedIn) { if (askReplyConfirmation) { - dispatch(openModal('CONFIRM', { - message: intl.formatMessage(messages.replyMessage), - confirm: intl.formatMessage(messages.replyConfirm), - onConfirm: this._performReply, + dispatch(openModal({ + modalType: 'CONFIRM', + modalProps: { + message: intl.formatMessage(messages.replyMessage), + confirm: intl.formatMessage(messages.replyConfirm), + onConfirm: this._performReply, + }, })); } else { this._performReply(); } } else { - dispatch(openModal('INTERACTION', { - type: 'reply', - accountId: status.getIn(['account', 'id']), - url: status.get('url'), + dispatch(openModal({ + modalType: 'INTERACTION', + modalProps: { + type: 'reply', + accountId: status.getIn(['account', 'id']), + url: status.get('url'), + }, })); } }; @@ -101,10 +110,13 @@ class Footer extends ImmutablePureComponent { dispatch(favourite(status)); } } else { - dispatch(openModal('INTERACTION', { - type: 'favourite', - accountId: status.getIn(['account', 'id']), - url: status.get('url'), + dispatch(openModal({ + modalType: 'INTERACTION', + modalProps: { + type: 'favourite', + accountId: status.getIn(['account', 'id']), + url: status.get('url'), + }, })); } }; @@ -127,10 +139,13 @@ class Footer extends ImmutablePureComponent { dispatch(initBoostModal({ status, onReblog: this._performReblog })); } } else { - dispatch(openModal('INTERACTION', { - type: 'reblog', - accountId: status.getIn(['account', 'id']), - url: status.get('url'), + dispatch(openModal({ + modalType: 'INTERACTION', + modalProps: { + type: 'reblog', + accountId: status.getIn(['account', 'id']), + url: status.get('url'), + }, })); } }; 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 43a910c505..d58d77d7ab 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 @@ -1,13 +1,18 @@ -import React from 'react'; -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 { defineMessages, injectIntl } from 'react-intl'; + import { Link } from 'react-router-dom'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; +import { connect } from 'react-redux'; + import { Avatar } from 'flavours/glitch/components/avatar'; import { DisplayName } from 'flavours/glitch/components/display_name'; -import { defineMessages, injectIntl } from 'react-intl'; +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/picture_in_picture/index.jsx b/app/javascript/flavours/glitch/features/picture_in_picture/index.jsx index e6fb64ff99..ed229384c4 100644 --- a/app/javascript/flavours/glitch/features/picture_in_picture/index.jsx +++ b/app/javascript/flavours/glitch/features/picture_in_picture/index.jsx @@ -1,19 +1,23 @@ -import React from 'react'; -import { connect } from 'react-redux'; import PropTypes from 'prop-types'; -import Video from 'flavours/glitch/features/video'; -import Audio from 'flavours/glitch/features/audio'; -import { removePictureInPicture } from 'flavours/glitch/actions/picture_in_picture'; -import Header from './components/header'; -import Footer from './components/footer'; +import { Component } from 'react'; + import classNames from 'classnames'; +import { connect } from 'react-redux'; + +import { removePictureInPicture } from 'flavours/glitch/actions/picture_in_picture'; +import Audio from 'flavours/glitch/features/audio'; +import Video from 'flavours/glitch/features/video'; + +import Footer from './components/footer'; +import Header from './components/header'; + const mapStateToProps = state => ({ ...state.get('picture_in_picture'), left: state.getIn(['local_settings', 'media', 'pop_in_position']) === 'left', }); -class PictureInPicture extends React.Component { +class PictureInPicture extends Component { static propTypes = { statusId: PropTypes.string, diff --git a/app/javascript/flavours/glitch/features/pinned_accounts_editor/containers/account_container.js b/app/javascript/flavours/glitch/features/pinned_accounts_editor/containers/account_container.js index 155afcca18..29f89b95a2 100644 --- a/app/javascript/flavours/glitch/features/pinned_accounts_editor/containers/account_container.js +++ b/app/javascript/flavours/glitch/features/pinned_accounts_editor/containers/account_container.js @@ -1,8 +1,10 @@ -import { connect } from 'react-redux'; -import { makeGetAccount } from 'flavours/glitch/selectors'; import { injectIntl } from 'react-intl'; + +import { connect } from 'react-redux'; + import { pinAccount, unpinAccount } from 'flavours/glitch/actions/accounts'; import Account from 'flavours/glitch/features/list_editor/components/account'; +import { makeGetAccount } from 'flavours/glitch/selectors'; const makeMapStateToProps = () => { const getAccount = makeGetAccount(); diff --git a/app/javascript/flavours/glitch/features/pinned_accounts_editor/containers/search_container.js b/app/javascript/flavours/glitch/features/pinned_accounts_editor/containers/search_container.js index 0ada7b0401..010a7527de 100644 --- a/app/javascript/flavours/glitch/features/pinned_accounts_editor/containers/search_container.js +++ b/app/javascript/flavours/glitch/features/pinned_accounts_editor/containers/search_container.js @@ -1,11 +1,15 @@ -import { connect } from 'react-redux'; import { injectIntl } from 'react-intl'; + +import { connect } from 'react-redux'; + +import Search from 'flavours/glitch/features/list_editor/components/search'; + import { fetchPinnedAccountsSuggestions, clearPinnedAccountsSuggestions, changePinnedAccountsSuggestions, } from '../../../actions/accounts'; -import Search from 'flavours/glitch/features/list_editor/components/search'; + const mapStateToProps = state => ({ value: state.getIn(['pinnedAccountsEditor', 'suggestions', 'value']), diff --git a/app/javascript/flavours/glitch/features/pinned_accounts_editor/index.jsx b/app/javascript/flavours/glitch/features/pinned_accounts_editor/index.jsx index 834de652f5..603d7209a7 100644 --- a/app/javascript/flavours/glitch/features/pinned_accounts_editor/index.jsx +++ b/app/javascript/flavours/glitch/features/pinned_accounts_editor/index.jsx @@ -1,14 +1,18 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import { connect } from 'react-redux'; -import ImmutablePureComponent from 'react-immutable-pure-component'; + import { injectIntl, FormattedMessage } from 'react-intl'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; +import { connect } from 'react-redux'; + +import spring from 'react-motion/lib/spring'; + import { fetchPinnedAccounts, clearPinnedAccountsSuggestions, resetPinnedAccountsEditor } from 'flavours/glitch/actions/accounts'; +import Motion from 'flavours/glitch/features/ui/util/optional_motion'; + import AccountContainer from './containers/account_container'; import SearchContainer from './containers/search_container'; -import Motion from 'flavours/glitch/features/ui/util/optional_motion'; -import spring from 'react-motion/lib/spring'; const mapStateToProps = state => ({ accountIds: state.getIn(['pinnedAccountsEditor', 'accounts', 'items']), diff --git a/app/javascript/flavours/glitch/features/pinned_statuses/index.jsx b/app/javascript/flavours/glitch/features/pinned_statuses/index.jsx index 5f6035cb1e..add05bdff0 100644 --- a/app/javascript/flavours/glitch/features/pinned_statuses/index.jsx +++ b/app/javascript/flavours/glitch/features/pinned_statuses/index.jsx @@ -1,14 +1,17 @@ -import React from 'react'; -import { connect } from 'react-redux'; import PropTypes from 'prop-types'; + +import { defineMessages, injectIntl } from 'react-intl'; + +import { Helmet } from 'react-helmet'; + import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; +import { connect } from 'react-redux'; + import { fetchPinnedStatuses } from 'flavours/glitch/actions/pin_statuses'; -import Column from 'flavours/glitch/features/ui/components/column'; import ColumnBackButtonSlim from 'flavours/glitch/components/column_back_button_slim'; import StatusList from 'flavours/glitch/components/status_list'; -import { defineMessages, injectIntl } from 'react-intl'; -import ImmutablePureComponent from 'react-immutable-pure-component'; -import { Helmet } from 'react-helmet'; +import Column from 'flavours/glitch/features/ui/components/column'; const messages = defineMessages({ heading: { id: 'column.pins', defaultMessage: 'Pinned post' }, diff --git a/app/javascript/flavours/glitch/features/privacy_policy/index.jsx b/app/javascript/flavours/glitch/features/privacy_policy/index.jsx index 44cb9b0d0a..2b9fc013d8 100644 --- a/app/javascript/flavours/glitch/features/privacy_policy/index.jsx +++ b/app/javascript/flavours/glitch/features/privacy_policy/index.jsx @@ -1,16 +1,19 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import { Helmet } from 'react-helmet'; +import { PureComponent } from 'react'; + import { FormattedMessage, FormattedDate, injectIntl, defineMessages } from 'react-intl'; -import Column from 'flavours/glitch/components/column'; + +import { Helmet } from 'react-helmet'; + import api from 'flavours/glitch/api'; +import Column from 'flavours/glitch/components/column'; import { Skeleton } from 'flavours/glitch/components/skeleton'; const messages = defineMessages({ title: { id: 'privacy_policy.title', defaultMessage: 'Privacy Policy' }, }); -class PrivacyPolicy extends React.PureComponent { +class PrivacyPolicy extends PureComponent { static propTypes = { intl: PropTypes.object, diff --git a/app/javascript/flavours/glitch/features/public_timeline/components/column_settings.jsx b/app/javascript/flavours/glitch/features/public_timeline/components/column_settings.jsx index a44d5c784d..2d083a90ec 100644 --- a/app/javascript/flavours/glitch/features/public_timeline/components/column_settings.jsx +++ b/app/javascript/flavours/glitch/features/public_timeline/components/column_settings.jsx @@ -1,7 +1,10 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import ImmutablePropTypes from 'react-immutable-proptypes'; +import { PureComponent } from 'react'; + import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; + +import ImmutablePropTypes from 'react-immutable-proptypes'; + import SettingText from 'flavours/glitch/components/setting_text'; import SettingToggle from 'flavours/glitch/features/notifications/components/setting_toggle'; @@ -9,7 +12,7 @@ const messages = defineMessages({ filter_regex: { id: 'home.column_settings.filter_regex', defaultMessage: 'Filter out by regular expressions' }, }); -class ColumnSettings extends React.PureComponent { +class ColumnSettings extends PureComponent { static propTypes = { settings: ImmutablePropTypes.map.isRequired, diff --git a/app/javascript/flavours/glitch/features/public_timeline/containers/column_settings_container.js b/app/javascript/flavours/glitch/features/public_timeline/containers/column_settings_container.js index 97b7566585..b884f15f5f 100644 --- a/app/javascript/flavours/glitch/features/public_timeline/containers/column_settings_container.js +++ b/app/javascript/flavours/glitch/features/public_timeline/containers/column_settings_container.js @@ -1,7 +1,9 @@ import { connect } from 'react-redux'; -import ColumnSettings from '../components/column_settings'; -import { changeSetting } from 'flavours/glitch/actions/settings'; + import { changeColumnParams } from 'flavours/glitch/actions/columns'; +import { changeSetting } from 'flavours/glitch/actions/settings'; + +import ColumnSettings from '../components/column_settings'; const mapStateToProps = (state, { columnId }) => { const uuid = columnId; diff --git a/app/javascript/flavours/glitch/features/public_timeline/index.jsx b/app/javascript/flavours/glitch/features/public_timeline/index.jsx index 737e5723f4..5bbbea0662 100644 --- a/app/javascript/flavours/glitch/features/public_timeline/index.jsx +++ b/app/javascript/flavours/glitch/features/public_timeline/index.jsx @@ -1,16 +1,21 @@ -import React from 'react'; -import { connect } from 'react-redux'; -import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import PropTypes from 'prop-types'; -import StatusListContainer from 'flavours/glitch/features/ui/containers/status_list_container'; +import { PureComponent } from 'react'; + +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; + +import { Helmet } from 'react-helmet'; + +import { connect } from 'react-redux'; + +import { addColumn, removeColumn, moveColumn } from 'flavours/glitch/actions/columns'; +import { connectPublicStream } from 'flavours/glitch/actions/streaming'; +import { expandPublicTimeline } from 'flavours/glitch/actions/timelines'; import Column from 'flavours/glitch/components/column'; import ColumnHeader from 'flavours/glitch/components/column_header'; -import { expandPublicTimeline } from 'flavours/glitch/actions/timelines'; -import { addColumn, removeColumn, moveColumn } from 'flavours/glitch/actions/columns'; -import ColumnSettingsContainer from './containers/column_settings_container'; -import { connectPublicStream } from 'flavours/glitch/actions/streaming'; -import { Helmet } from 'react-helmet'; import DismissableBanner from 'flavours/glitch/components/dismissable_banner'; +import StatusListContainer from 'flavours/glitch/features/ui/containers/status_list_container'; + +import ColumnSettingsContainer from './containers/column_settings_container'; const messages = defineMessages({ title: { id: 'column.public', defaultMessage: 'Federated timeline' }, @@ -35,7 +40,7 @@ const mapStateToProps = (state, { columnId }) => { }; }; -class PublicTimeline extends React.PureComponent { +class PublicTimeline extends PureComponent { static defaultProps = { onlyMedia: false, diff --git a/app/javascript/flavours/glitch/features/reblogs/index.jsx b/app/javascript/flavours/glitch/features/reblogs/index.jsx index 5b03500c2c..87d6de90ec 100644 --- a/app/javascript/flavours/glitch/features/reblogs/index.jsx +++ b/app/javascript/flavours/glitch/features/reblogs/index.jsx @@ -1,17 +1,24 @@ -import React from 'react'; -import { connect } from 'react-redux'; import PropTypes from 'prop-types'; + +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; + +import { Helmet } from 'react-helmet'; + import ImmutablePropTypes from 'react-immutable-proptypes'; -import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; +import ImmutablePureComponent from 'react-immutable-pure-component'; +import { connect } from 'react-redux'; + import { fetchReblogs } from 'flavours/glitch/actions/interactions'; +import ColumnHeader from 'flavours/glitch/components/column_header'; +import { Icon } from 'flavours/glitch/components/icon'; +import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; +import ScrollableList from 'flavours/glitch/components/scrollable_list'; 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 ColumnHeader from 'flavours/glitch/components/column_header'; -import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import ImmutablePureComponent from 'react-immutable-pure-component'; -import ScrollableList from 'flavours/glitch/components/scrollable_list'; -import { Helmet } from 'react-helmet'; + + + + const messages = defineMessages({ heading: { id: 'column.reblogged_by', defaultMessage: 'Boosted by' }, diff --git a/app/javascript/flavours/glitch/features/report/category.jsx b/app/javascript/flavours/glitch/features/report/category.jsx index 43e311f3d0..e734058fac 100644 --- a/app/javascript/flavours/glitch/features/report/category.jsx +++ b/app/javascript/flavours/glitch/features/report/category.jsx @@ -1,11 +1,15 @@ -import React from 'react'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; + +import { List as ImmutableList } from 'immutable'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { connect } from 'react-redux'; -import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; + import Button from 'flavours/glitch/components/button'; + import Option from './components/option'; -import { List as ImmutableList } from 'immutable'; const messages = defineMessages({ dislike: { id: 'report.reasons.dislike', defaultMessage: 'I don\'t like it' }, @@ -24,7 +28,7 @@ const mapStateToProps = state => ({ rules: state.getIn(['server', 'server', 'rules'], ImmutableList()), }); -class Category extends React.PureComponent { +class Category extends PureComponent { static propTypes = { onNextStep: PropTypes.func.isRequired, @@ -72,7 +76,7 @@ class Category extends React.PureComponent { ]; return ( - + <>

@@ -95,7 +99,7 @@ class Category extends React.PureComponent {
-
+ ); } diff --git a/app/javascript/flavours/glitch/features/report/comment.jsx b/app/javascript/flavours/glitch/features/report/comment.jsx index afcb7afa4f..db534a21fb 100644 --- a/app/javascript/flavours/glitch/features/report/comment.jsx +++ b/app/javascript/flavours/glitch/features/report/comment.jsx @@ -1,14 +1,17 @@ -import React from 'react'; import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + import { injectIntl, defineMessages, FormattedMessage } from 'react-intl'; -import Button from 'flavours/glitch/components/button'; + import Toggle from 'react-toggle'; +import Button from 'flavours/glitch/components/button'; + const messages = defineMessages({ placeholder: { id: 'report.placeholder', defaultMessage: 'Type or paste additional comments' }, }); -class Comment extends React.PureComponent { +class Comment extends PureComponent { static propTypes = { onSubmit: PropTypes.func.isRequired, @@ -47,7 +50,7 @@ class Comment extends React.PureComponent { const { comment, isRemote, forward, domain, isSubmitting, intl } = this.props; return ( - + <>