From 2ce2f96b165b727dae4b76f2ea46e2a34e4926a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Sat, 5 Oct 2024 23:12:51 +0200 Subject: [PATCH] pl-fe: Migrate from makeGetStatus to useStatus in most cases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- packages/pl-fe/src/actions/admin.ts | 2 +- packages/pl-fe/src/actions/aliases.ts | 2 +- packages/pl-fe/src/actions/auth.ts | 2 +- packages/pl-fe/src/actions/bookmarks.ts | 2 +- packages/pl-fe/src/actions/compose.ts | 2 +- packages/pl-fe/src/actions/conversations.ts | 3 +- packages/pl-fe/src/actions/directory.ts | 2 +- packages/pl-fe/src/actions/emoji-reacts.ts | 3 +- packages/pl-fe/src/actions/events.ts | 2 +- .../pl-fe/src/actions/familiar-followers.ts | 3 +- packages/pl-fe/src/actions/favourites.ts | 3 +- packages/pl-fe/src/actions/groups.ts | 2 +- packages/pl-fe/src/actions/history.ts | 2 +- packages/pl-fe/src/actions/interactions.ts | 2 +- packages/pl-fe/src/actions/lists.ts | 3 +- packages/pl-fe/src/actions/me.ts | 3 +- packages/pl-fe/src/actions/notifications.ts | 2 +- packages/pl-fe/src/actions/pin-statuses.ts | 3 +- packages/pl-fe/src/actions/polls.ts | 2 +- packages/pl-fe/src/actions/preload.ts | 1 + packages/pl-fe/src/actions/search.ts | 2 +- packages/pl-fe/src/actions/status-quotes.ts | 2 +- packages/pl-fe/src/actions/statuses.ts | 3 +- packages/pl-fe/src/actions/suggestions.ts | 2 +- packages/pl-fe/src/actions/timelines.ts | 3 +- .../pl-fe/src/actions/trending-statuses.ts | 2 +- .../src/components/account-hover-card.tsx | 2 +- packages/pl-fe/src/components/account.tsx | 2 +- .../announcements/announcements-panel.tsx | 2 +- .../src/components/announcements/reaction.tsx | 4 +- .../components/autosuggest-account-input.tsx | 9 ++--- .../src/components/autosuggest-input.tsx | 28 +++++++------- .../pl-fe/src/components/avatar-stack.tsx | 2 +- packages/pl-fe/src/components/big-card.tsx | 2 +- .../dropdown-menu/dropdown-menu-item.tsx | 4 +- .../dropdown-menu/dropdown-menu.tsx | 4 +- .../pl-fe/src/components/event-preview.tsx | 4 +- packages/pl-fe/src/components/group-card.tsx | 4 +- .../groups/popover/group-popover.tsx | 4 +- .../pl-fe/src/components/landing-gradient.tsx | 2 +- packages/pl-fe/src/components/link.tsx | 2 +- packages/pl-fe/src/components/list.tsx | 2 +- .../pl-fe/src/components/location-search.tsx | 9 ++--- packages/pl-fe/src/components/mention.tsx | 2 +- packages/pl-fe/src/components/modal-root.tsx | 2 +- packages/pl-fe/src/components/navlinks.tsx | 2 +- .../src/components/pending-items-row.tsx | 2 +- .../src/components/polls/poll-option.tsx | 10 ++--- .../components/quoted-status-indicator.tsx | 2 +- packages/pl-fe/src/components/radio.tsx | 2 +- .../src/components/scroll-top-button.tsx | 2 +- .../pl-fe/src/components/sidebar-menu.tsx | 12 +++--- .../src/components/site-error-boundary.tsx | 8 ++-- .../src/components/status-action-button.tsx | 2 +- .../pl-fe/src/components/status-content.tsx | 2 +- .../src/components/status-hover-card.tsx | 2 +- .../pl-fe/src/components/status-mention.tsx | 2 +- .../src/components/status-reactions-bar.tsx | 2 +- .../src/components/status-reply-mentions.tsx | 2 +- packages/pl-fe/src/components/status.tsx | 4 +- .../src/components/statuses/status-info.tsx | 2 +- .../pl-fe/src/components/thumb-navigation.tsx | 6 +-- .../pl-fe/src/components/trending-link.tsx | 2 +- .../src/components/ui/accordion/accordion.tsx | 2 +- .../pl-fe/src/components/ui/card/card.tsx | 2 +- .../src/components/ui/carousel/carousel.tsx | 4 +- .../src/components/ui/checkbox/checkbox.tsx | 2 +- .../src/components/ui/counter/counter.tsx | 2 +- .../src/components/ui/divider/divider.tsx | 4 +- .../components/ui/form-group/form-group.tsx | 4 +- .../components/ui/icon-button/icon-button.tsx | 2 +- .../inline-multiselect/inline-multiselect.tsx | 4 +- .../pl-fe/src/components/ui/input/input.tsx | 4 +- .../pl-fe/src/components/ui/layout/layout.tsx | 2 +- .../pl-fe/src/components/ui/menu/menu.tsx | 4 +- .../pl-fe/src/components/ui/modal/modal.tsx | 8 ++-- .../src/components/ui/popover/popover.tsx | 4 +- .../ui/progress-bar/progress-bar.tsx | 4 +- .../ui/radio-button/radio-button.tsx | 2 +- .../pl-fe/src/components/ui/select/select.tsx | 2 +- .../pl-fe/src/components/ui/slider/slider.tsx | 6 +-- .../pl-fe/src/components/ui/tabs/tabs.tsx | 4 +- .../src/components/ui/tag-input/tag-input.tsx | 2 +- .../pl-fe/src/components/ui/tag-input/tag.tsx | 2 +- .../src/components/ui/textarea/textarea.tsx | 2 +- .../pl-fe/src/components/ui/toast/toast.tsx | 8 ++-- .../pl-fe/src/components/ui/toggle/toggle.tsx | 2 +- .../pl-fe/src/components/ui/widget/widget.tsx | 2 +- .../src/components/verification-badge.tsx | 4 +- packages/pl-fe/src/features/about/index.tsx | 2 +- .../components/moved-note.tsx | 2 +- .../features/account/components/header.tsx | 8 ++-- .../src/features/admin/announcements.tsx | 2 +- .../src/features/admin/components/report.tsx | 2 +- packages/pl-fe/src/features/admin/domains.tsx | 2 +- packages/pl-fe/src/features/admin/relays.tsx | 2 +- packages/pl-fe/src/features/admin/rules.tsx | 2 +- .../features/aliases/components/search.tsx | 2 +- packages/pl-fe/src/features/audio/index.tsx | 4 +- .../auth-login/components/consumers-list.tsx | 2 +- .../src/features/auth-token-list/index.tsx | 2 +- packages/pl-fe/src/features/backups/index.tsx | 2 +- .../chats/components/chat-composer.tsx | 4 +- .../chats/components/chat-list-item.tsx | 4 +- .../features/chats/components/chat-list.tsx | 4 +- .../chats/components/chat-page/chat-page.tsx | 6 +-- .../chat-page/components/chat-page-main.tsx | 4 +- .../chats/components/chat-pending-upload.tsx | 2 +- .../chats/components/chat-search/results.tsx | 4 +- .../chats/components/chat-textarea.tsx | 16 ++++---- .../features/chats/components/chat-upload.tsx | 4 +- .../chat-widget/chat-pane-header.tsx | 2 +- .../components/chat-widget/chat-settings.tsx | 6 +-- .../components/chat-widget/chat-window.tsx | 2 +- .../headers/chat-search-header.tsx | 2 +- .../src/features/chats/components/ui/pane.tsx | 2 +- packages/pl-fe/src/features/circle/index.tsx | 2 +- .../compose/components/compose-form.tsx | 2 +- .../compose/components/language-dropdown.tsx | 2 +- .../components/reply-group-indicator.tsx | 4 +- .../compose/components/reply-indicator.tsx | 2 +- .../compose/components/reply-mentions.tsx | 11 +++--- .../containers/quoted-status-container.tsx | 11 +++--- .../containers/reply-indicator-container.tsx | 12 +++--- .../editor/plugins/autosuggest-plugin.tsx | 20 +++++----- .../plugins/floating-link-editor-plugin.tsx | 2 +- .../floating-text-format-toolbar-plugin.tsx | 4 +- .../directory/components/account-card.tsx | 4 +- .../edit-profile/components/avatar-picker.tsx | 2 +- .../edit-profile/components/header-picker.tsx | 2 +- .../src/features/embedded-status/index.tsx | 31 +++++----------- .../event/components/event-header.tsx | 6 +-- .../src/features/event/event-discussion.tsx | 29 ++++----------- .../src/features/event/event-information.tsx | 37 +++++-------------- .../events/components/event-carousel.tsx | 14 +++---- .../feed-suggestions/feed-suggestions.tsx | 4 +- packages/pl-fe/src/features/filters/index.tsx | 2 +- .../group/components/group-header.tsx | 8 ++-- .../src/features/hashtag-timeline/index.tsx | 2 +- .../src/features/home-timeline/index.tsx | 2 +- .../landing-timeline/components/logo-text.tsx | 2 +- .../pl-fe/src/features/migration/index.tsx | 2 +- .../notifications/components/notification.tsx | 4 +- .../src/features/notifications/index.tsx | 6 +-- .../steps/avatar-selection-step.tsx | 2 +- .../onboarding/steps/completed-step.tsx | 2 +- .../steps/cover-photo-selection-step.tsx | 4 +- .../onboarding/steps/fediverse-step.tsx | 6 +-- .../steps/suggested-accounts-step.tsx | 2 +- .../components/icon-picker-menu.tsx | 4 +- .../pl-fe-config/components/site-preview.tsx | 2 +- .../components/placeholder-avatar.tsx | 4 +- .../components/placeholder-card.tsx | 2 +- .../components/placeholder-chat-message.tsx | 4 +- .../components/placeholder-display-name.tsx | 2 +- .../components/placeholder-event-header.tsx | 2 +- .../components/placeholder-event-preview.tsx | 4 +- .../components/placeholder-group-card.tsx | 4 +- .../components/placeholder-group-search.tsx | 2 +- .../components/placeholder-hashtag.tsx | 2 +- .../components/placeholder-media-gallery.tsx | 2 +- .../components/placeholder-notification.tsx | 2 +- .../placeholder-sidebar-suggestions.tsx | 2 +- .../components/placeholder-sidebar-trends.tsx | 2 +- .../components/placeholder-status-content.tsx | 2 +- .../src/features/public-timeline/index.tsx | 2 +- .../components/pinned-hosts-picker.tsx | 2 +- .../search/components/search-results.tsx | 21 +++++------ .../status/components/detailed-status.tsx | 2 +- .../status/components/thread-status.tsx | 2 +- .../src/features/status/components/thread.tsx | 6 +-- .../containers/quoted-status-container.tsx | 11 ++---- packages/pl-fe/src/features/status/index.tsx | 2 +- .../src/features/test-timeline/index.tsx | 2 +- .../ui/components/background-shapes.tsx | 2 +- .../ui/components/column-forbidden.tsx | 2 +- .../ui/components/floating-action-button.tsx | 4 +- .../ui/components/modals/boost-modal.tsx | 11 +++--- .../modals/compare-history-modal.tsx | 2 +- .../modals/compose-event-modal/index.tsx | 4 +- .../compose-event-modal/upload-button.tsx | 2 +- .../components/modals/dropdown-menu-modal.tsx | 2 +- .../modals/edit-bookmark-folder-modal.tsx | 2 +- .../ui/components/modals/event-map-modal.tsx | 15 ++++---- .../modals/familiar-followers-modal.tsx | 3 +- .../ui/components/modals/hotkeys-modal.tsx | 2 +- .../steps/confirmation-step.tsx | 6 +-- .../ui/components/modals/media-modal.tsx | 9 ++--- .../ui/components/modals/mentions-modal.tsx | 12 +++--- .../modals/reply-mentions-modal.tsx | 9 ++--- .../report-modal/steps/confirmation-step.tsx | 2 +- .../modals/report-modal/steps/reason-step.tsx | 2 +- .../modals/select-bookmark-folder-modal.tsx | 16 ++++---- .../ui/components/modals/video-modal.tsx | 11 ++---- .../ui/components/profile-dropdown.tsx | 4 +- packages/pl-fe/src/features/ui/index.tsx | 6 +-- packages/pl-fe/src/features/video/index.tsx | 2 +- packages/pl-fe/src/init/pl-fe-head.tsx | 2 +- packages/pl-fe/src/layouts/chats-layout.tsx | 2 +- packages/pl-fe/src/layouts/event-layout.tsx | 10 ++--- packages/pl-fe/src/layouts/home-layout.tsx | 2 +- packages/pl-fe/src/layouts/landing-layout.tsx | 2 +- .../src/pl-hooks/hooks/accounts/useAccount.ts | 4 +- .../src/pl-hooks/hooks/markers/useMarkers.ts | 1 + .../hooks/markers/useUpdateMarkerMutation.ts | 1 + .../hooks/notifications/useNotification.ts | 3 +- .../notifications/useNotificationList.ts | 4 +- .../src/pl-hooks/hooks/statuses/useStatus.ts | 24 ++++++++---- packages/pl-fe/src/queries/chats.ts | 3 +- packages/pl-fe/src/queries/suggestions.ts | 3 +- packages/pl-fe/src/reducers/compose.ts | 13 +++---- packages/pl-fe/src/reducers/search.ts | 12 +++--- packages/pl-fe/src/reducers/suggestions.ts | 8 ++-- .../pl-fe/src/reducers/trending-statuses.ts | 6 +-- packages/pl-fe/src/reducers/trends.ts | 6 +-- 215 files changed, 460 insertions(+), 513 deletions(-) diff --git a/packages/pl-fe/src/actions/admin.ts b/packages/pl-fe/src/actions/admin.ts index d3f13137a..47795cea0 100644 --- a/packages/pl-fe/src/actions/admin.ts +++ b/packages/pl-fe/src/actions/admin.ts @@ -1,7 +1,7 @@ -import { importEntities } from 'pl-fe/pl-hooks/importer'; import { fetchRelationships } from 'pl-fe/actions/accounts'; import { getClient } from 'pl-fe/api'; +import { importEntities } from 'pl-fe/pl-hooks/importer'; import { filterBadges, getTagDiff } from 'pl-fe/utils/badges'; import { deleteFromTimelines } from './timelines'; diff --git a/packages/pl-fe/src/actions/aliases.ts b/packages/pl-fe/src/actions/aliases.ts index 1d31a4aa1..aad1dc396 100644 --- a/packages/pl-fe/src/actions/aliases.ts +++ b/packages/pl-fe/src/actions/aliases.ts @@ -1,7 +1,7 @@ -import { importEntities } from 'pl-fe/pl-hooks/importer'; import { defineMessages } from 'react-intl'; import { getClient } from 'pl-fe/api'; +import { importEntities } from 'pl-fe/pl-hooks/importer'; import toast from 'pl-fe/toast'; import { isLoggedIn } from 'pl-fe/utils/auth'; diff --git a/packages/pl-fe/src/actions/auth.ts b/packages/pl-fe/src/actions/auth.ts index 711518a33..efb65ec74 100644 --- a/packages/pl-fe/src/actions/auth.ts +++ b/packages/pl-fe/src/actions/auth.ts @@ -7,7 +7,6 @@ * @see module:pl-fe/actions/security */ import { credentialAccountSchema, PlApiClient, type CreateAccountParams, type Token } from 'pl-api'; -import { importEntities } from 'pl-fe/pl-hooks/importer'; import { defineMessages } from 'react-intl'; import { createAccount } from 'pl-fe/actions/accounts'; @@ -18,6 +17,7 @@ import { startOnboarding } from 'pl-fe/actions/onboarding'; import { type PlfeResponse, getClient } from 'pl-fe/api'; import * as BuildConfig from 'pl-fe/build-config'; import { custom } from 'pl-fe/custom'; +import { importEntities } from 'pl-fe/pl-hooks/importer'; import { queryClient } from 'pl-fe/queries/client'; import { selectAccount } from 'pl-fe/selectors'; import { unsetSentryAccount } from 'pl-fe/sentry'; diff --git a/packages/pl-fe/src/actions/bookmarks.ts b/packages/pl-fe/src/actions/bookmarks.ts index 9967c73ea..13cc43d06 100644 --- a/packages/pl-fe/src/actions/bookmarks.ts +++ b/packages/pl-fe/src/actions/bookmarks.ts @@ -1,6 +1,6 @@ +import { getClient } from 'pl-fe/api'; import { importEntities } from 'pl-fe/pl-hooks/importer'; -import { getClient } from 'pl-fe/api'; import type { PaginatedResponse, Status } from 'pl-api'; import type { AppDispatch, RootState } from 'pl-fe/store'; diff --git a/packages/pl-fe/src/actions/compose.ts b/packages/pl-fe/src/actions/compose.ts index f54de5f54..64d6d643f 100644 --- a/packages/pl-fe/src/actions/compose.ts +++ b/packages/pl-fe/src/actions/compose.ts @@ -1,11 +1,11 @@ import throttle from 'lodash/throttle'; -import { importEntities } from 'pl-fe/pl-hooks/importer'; import { defineMessages, IntlShape } from 'react-intl'; import { getClient } from 'pl-fe/api'; import { isNativeEmoji } from 'pl-fe/features/emoji'; import emojiSearch from 'pl-fe/features/emoji/search'; import { Language } from 'pl-fe/features/preferences'; +import { importEntities } from 'pl-fe/pl-hooks/importer'; import { selectAccount, selectOwnAccount, makeGetAccount } from 'pl-fe/selectors'; import { tagHistory } from 'pl-fe/settings'; import { useModalsStore } from 'pl-fe/stores'; diff --git a/packages/pl-fe/src/actions/conversations.ts b/packages/pl-fe/src/actions/conversations.ts index e32c19810..adac3b19f 100644 --- a/packages/pl-fe/src/actions/conversations.ts +++ b/packages/pl-fe/src/actions/conversations.ts @@ -1,6 +1,5 @@ -import { importEntities } from 'pl-fe/pl-hooks/importer'; - import { getClient } from 'pl-fe/api'; +import { importEntities } from 'pl-fe/pl-hooks/importer'; import { isLoggedIn } from 'pl-fe/utils/auth'; import type { Account, Conversation, PaginatedResponse, Status } from 'pl-api'; diff --git a/packages/pl-fe/src/actions/directory.ts b/packages/pl-fe/src/actions/directory.ts index effb747eb..7e9fc983e 100644 --- a/packages/pl-fe/src/actions/directory.ts +++ b/packages/pl-fe/src/actions/directory.ts @@ -1,6 +1,6 @@ +import { getClient } from 'pl-fe/api'; import { importEntities } from 'pl-fe/pl-hooks/importer'; -import { getClient } from 'pl-fe/api'; import { fetchRelationships } from './accounts'; diff --git a/packages/pl-fe/src/actions/emoji-reacts.ts b/packages/pl-fe/src/actions/emoji-reacts.ts index 90a44e8b1..54bc4899d 100644 --- a/packages/pl-fe/src/actions/emoji-reacts.ts +++ b/packages/pl-fe/src/actions/emoji-reacts.ts @@ -1,6 +1,5 @@ -import { importEntities } from 'pl-fe/pl-hooks/importer'; - import { getClient } from 'pl-fe/api'; +import { importEntities } from 'pl-fe/pl-hooks/importer'; import { isLoggedIn } from 'pl-fe/utils/auth'; import type { Status } from 'pl-api'; diff --git a/packages/pl-fe/src/actions/events.ts b/packages/pl-fe/src/actions/events.ts index b4aa9ecb4..515646a71 100644 --- a/packages/pl-fe/src/actions/events.ts +++ b/packages/pl-fe/src/actions/events.ts @@ -1,8 +1,8 @@ -import { importEntities } from 'pl-fe/pl-hooks/importer'; import { defineMessages } from 'react-intl'; import { STATUS_FETCH_SOURCE_FAIL, STATUS_FETCH_SOURCE_REQUEST, STATUS_FETCH_SOURCE_SUCCESS } from 'pl-fe/actions/statuses'; import { getClient } from 'pl-fe/api'; +import { importEntities } from 'pl-fe/pl-hooks/importer'; import { useModalsStore } from 'pl-fe/stores'; import toast from 'pl-fe/toast'; diff --git a/packages/pl-fe/src/actions/familiar-followers.ts b/packages/pl-fe/src/actions/familiar-followers.ts index f4e185820..404a99259 100644 --- a/packages/pl-fe/src/actions/familiar-followers.ts +++ b/packages/pl-fe/src/actions/familiar-followers.ts @@ -1,6 +1,5 @@ -import { importEntities } from 'pl-fe/pl-hooks/importer'; - import { getClient } from 'pl-fe/api'; +import { importEntities } from 'pl-fe/pl-hooks/importer'; import { AppDispatch, RootState } from 'pl-fe/store'; import { fetchRelationships } from './accounts'; diff --git a/packages/pl-fe/src/actions/favourites.ts b/packages/pl-fe/src/actions/favourites.ts index c4c3b747b..2ba10fcd5 100644 --- a/packages/pl-fe/src/actions/favourites.ts +++ b/packages/pl-fe/src/actions/favourites.ts @@ -1,6 +1,5 @@ -import { importEntities } from 'pl-fe/pl-hooks/importer'; - import { getClient } from 'pl-fe/api'; +import { importEntities } from 'pl-fe/pl-hooks/importer'; import { isLoggedIn } from 'pl-fe/utils/auth'; import type { PaginatedResponse, Status } from 'pl-api'; diff --git a/packages/pl-fe/src/actions/groups.ts b/packages/pl-fe/src/actions/groups.ts index 3844a606d..e5aef02e7 100644 --- a/packages/pl-fe/src/actions/groups.ts +++ b/packages/pl-fe/src/actions/groups.ts @@ -1,6 +1,6 @@ +import { getClient } from 'pl-fe/api'; import { importEntities } from 'pl-fe/pl-hooks/importer'; -import { getClient } from 'pl-fe/api'; import type { Account, PaginatedResponse } from 'pl-api'; import type { AppDispatch, RootState } from 'pl-fe/store'; diff --git a/packages/pl-fe/src/actions/history.ts b/packages/pl-fe/src/actions/history.ts index 59f48fdb0..ae46fa8bd 100644 --- a/packages/pl-fe/src/actions/history.ts +++ b/packages/pl-fe/src/actions/history.ts @@ -1,6 +1,6 @@ +import { getClient } from 'pl-fe/api'; import { importEntities } from 'pl-fe/pl-hooks/importer'; -import { getClient } from 'pl-fe/api'; import type { StatusEdit } from 'pl-api'; import type { AppDispatch, RootState } from 'pl-fe/store'; diff --git a/packages/pl-fe/src/actions/interactions.ts b/packages/pl-fe/src/actions/interactions.ts index 65b5d58bc..81a36c9c8 100644 --- a/packages/pl-fe/src/actions/interactions.ts +++ b/packages/pl-fe/src/actions/interactions.ts @@ -1,7 +1,7 @@ -import { importEntities } from 'pl-fe/pl-hooks/importer'; import { defineMessages } from 'react-intl'; import { getClient } from 'pl-fe/api'; +import { importEntities } from 'pl-fe/pl-hooks/importer'; import { useModalsStore } from 'pl-fe/stores'; import toast, { type IToastOptions } from 'pl-fe/toast'; import { isLoggedIn } from 'pl-fe/utils/auth'; diff --git a/packages/pl-fe/src/actions/lists.ts b/packages/pl-fe/src/actions/lists.ts index c30f83a58..502a363a9 100644 --- a/packages/pl-fe/src/actions/lists.ts +++ b/packages/pl-fe/src/actions/lists.ts @@ -1,6 +1,5 @@ -import { importEntities } from 'pl-fe/pl-hooks/importer'; - import { getClient } from 'pl-fe/api'; +import { importEntities } from 'pl-fe/pl-hooks/importer'; import { selectAccount } from 'pl-fe/selectors'; import toast from 'pl-fe/toast'; import { isLoggedIn } from 'pl-fe/utils/auth'; diff --git a/packages/pl-fe/src/actions/me.ts b/packages/pl-fe/src/actions/me.ts index 38958f894..0febc7f61 100644 --- a/packages/pl-fe/src/actions/me.ts +++ b/packages/pl-fe/src/actions/me.ts @@ -1,6 +1,5 @@ -import { importEntities } from 'pl-fe/pl-hooks/importer'; - import { getClient } from 'pl-fe/api'; +import { importEntities } from 'pl-fe/pl-hooks/importer'; import { selectAccount } from 'pl-fe/selectors'; import { setSentryAccount } from 'pl-fe/sentry'; import KVStore from 'pl-fe/storage/kv-store'; diff --git a/packages/pl-fe/src/actions/notifications.ts b/packages/pl-fe/src/actions/notifications.ts index 6687ff683..f96dfc1bb 100644 --- a/packages/pl-fe/src/actions/notifications.ts +++ b/packages/pl-fe/src/actions/notifications.ts @@ -1,11 +1,11 @@ import IntlMessageFormat from 'intl-messageformat'; import 'intl-pluralrules'; -import { importEntities } from 'pl-fe/pl-hooks/importer'; import { defineMessages } from 'react-intl'; import { FILTER_TYPES, type FilterType } from 'pl-fe/features/notifications'; import { getNotificationStatus } from 'pl-fe/features/notifications/components/notification'; import { normalizeNotification } from 'pl-fe/normalizers'; +import { importEntities } from 'pl-fe/pl-hooks/importer'; import { queryClient } from 'pl-fe/queries/client'; import { getFilters, regexFromFilters } from 'pl-fe/selectors'; import { unescapeHTML } from 'pl-fe/utils/html'; diff --git a/packages/pl-fe/src/actions/pin-statuses.ts b/packages/pl-fe/src/actions/pin-statuses.ts index e67474afe..f4968f194 100644 --- a/packages/pl-fe/src/actions/pin-statuses.ts +++ b/packages/pl-fe/src/actions/pin-statuses.ts @@ -1,6 +1,5 @@ -import { importEntities } from 'pl-fe/pl-hooks/importer'; - import { getClient } from 'pl-fe/api'; +import { importEntities } from 'pl-fe/pl-hooks/importer'; import { isLoggedIn } from 'pl-fe/utils/auth'; import type { Status } from 'pl-api'; diff --git a/packages/pl-fe/src/actions/polls.ts b/packages/pl-fe/src/actions/polls.ts index 82af7b4c5..132d5fcd9 100644 --- a/packages/pl-fe/src/actions/polls.ts +++ b/packages/pl-fe/src/actions/polls.ts @@ -1,6 +1,6 @@ +import { getClient } from 'pl-fe/api'; import { importEntities } from 'pl-fe/pl-hooks/importer'; -import { getClient } from 'pl-fe/api'; import type { Poll } from 'pl-api'; import type { AppDispatch, RootState } from 'pl-fe/store'; diff --git a/packages/pl-fe/src/actions/preload.ts b/packages/pl-fe/src/actions/preload.ts index a523f6c9c..7925046ea 100644 --- a/packages/pl-fe/src/actions/preload.ts +++ b/packages/pl-fe/src/actions/preload.ts @@ -1,4 +1,5 @@ import mapValues from 'lodash/mapValues'; + import { importEntities } from 'pl-fe/pl-hooks/importer'; import { verifyCredentials } from './auth'; diff --git a/packages/pl-fe/src/actions/search.ts b/packages/pl-fe/src/actions/search.ts index b04f18940..058b9e196 100644 --- a/packages/pl-fe/src/actions/search.ts +++ b/packages/pl-fe/src/actions/search.ts @@ -1,6 +1,6 @@ +import { getClient } from 'pl-fe/api'; import { importEntities } from 'pl-fe/pl-hooks/importer'; -import { getClient } from 'pl-fe/api'; import { fetchRelationships } from './accounts'; diff --git a/packages/pl-fe/src/actions/status-quotes.ts b/packages/pl-fe/src/actions/status-quotes.ts index 8bdd19f5c..8aa0cad43 100644 --- a/packages/pl-fe/src/actions/status-quotes.ts +++ b/packages/pl-fe/src/actions/status-quotes.ts @@ -1,6 +1,6 @@ +import { getClient } from 'pl-fe/api'; import { importEntities } from 'pl-fe/pl-hooks/importer'; -import { getClient } from 'pl-fe/api'; import type { Status as BaseStatus, PaginatedResponse } from 'pl-api'; import type { AppDispatch, RootState } from 'pl-fe/store'; diff --git a/packages/pl-fe/src/actions/statuses.ts b/packages/pl-fe/src/actions/statuses.ts index db782b070..cd0934ece 100644 --- a/packages/pl-fe/src/actions/statuses.ts +++ b/packages/pl-fe/src/actions/statuses.ts @@ -1,6 +1,5 @@ -import { importEntities } from 'pl-fe/pl-hooks/importer'; - import { getClient } from 'pl-fe/api'; +import { importEntities } from 'pl-fe/pl-hooks/importer'; import { useModalsStore } from 'pl-fe/stores'; import { isLoggedIn } from 'pl-fe/utils/auth'; import { shouldHaveCard } from 'pl-fe/utils/status'; diff --git a/packages/pl-fe/src/actions/suggestions.ts b/packages/pl-fe/src/actions/suggestions.ts index cee2f3908..10d052e6f 100644 --- a/packages/pl-fe/src/actions/suggestions.ts +++ b/packages/pl-fe/src/actions/suggestions.ts @@ -1,6 +1,6 @@ +import { getClient } from 'pl-fe/api'; import { importEntities } from 'pl-fe/pl-hooks/importer'; -import { getClient } from 'pl-fe/api'; import { fetchRelationships } from './accounts'; import { insertSuggestionsIntoTimeline } from './timelines'; diff --git a/packages/pl-fe/src/actions/timelines.ts b/packages/pl-fe/src/actions/timelines.ts index 41bcbc347..2181aac50 100644 --- a/packages/pl-fe/src/actions/timelines.ts +++ b/packages/pl-fe/src/actions/timelines.ts @@ -1,8 +1,9 @@ import { Map as ImmutableMap } from 'immutable'; -import { importEntities } from 'pl-fe/pl-hooks/importer'; + import { getLocale, getSettings } from 'pl-fe/actions/settings'; import { getClient } from 'pl-fe/api'; +import { importEntities } from 'pl-fe/pl-hooks/importer'; import { shouldFilter } from 'pl-fe/utils/timelines'; import type { PaginatedResponse, Status as BaseStatus, PublicTimelineParams, HomeTimelineParams, ListTimelineParams, HashtagTimelineParams, GetAccountStatusesParams, GroupTimelineParams } from 'pl-api'; diff --git a/packages/pl-fe/src/actions/trending-statuses.ts b/packages/pl-fe/src/actions/trending-statuses.ts index c6d8db428..0cd76b090 100644 --- a/packages/pl-fe/src/actions/trending-statuses.ts +++ b/packages/pl-fe/src/actions/trending-statuses.ts @@ -1,6 +1,6 @@ +import { getClient } from 'pl-fe/api'; import { importEntities } from 'pl-fe/pl-hooks/importer'; -import { getClient } from 'pl-fe/api'; import type { AppDispatch, RootState } from 'pl-fe/store'; diff --git a/packages/pl-fe/src/components/account-hover-card.tsx b/packages/pl-fe/src/components/account-hover-card.tsx index 1d38923c4..135326bce 100644 --- a/packages/pl-fe/src/components/account-hover-card.tsx +++ b/packages/pl-fe/src/components/account-hover-card.tsx @@ -118,7 +118,7 @@ const AccountHoverCard: React.FC = ({ visible = true }) => { onMouseEnter={handleMouseEnter} onMouseLeave={handleMouseLeave} > - + = ({ account, disabled }) => { return ( diff --git a/packages/pl-fe/src/components/autosuggest-account-input.tsx b/packages/pl-fe/src/components/autosuggest-account-input.tsx index 90ef70f9e..02131d60b 100644 --- a/packages/pl-fe/src/components/autosuggest-account-input.tsx +++ b/packages/pl-fe/src/components/autosuggest-account-input.tsx @@ -1,4 +1,3 @@ -import { OrderedSet as ImmutableOrderedSet } from 'immutable'; import throttle from 'lodash/throttle'; import React, { useState, useRef, useCallback, useEffect } from 'react'; @@ -30,7 +29,7 @@ const AutosuggestAccountInput: React.FC = ({ ...rest }) => { const dispatch = useAppDispatch(); - const [accountIds, setAccountIds] = useState(ImmutableOrderedSet()); + const [accountIds, setAccountIds] = useState(Array()); const controller = useRef(new AbortController()); const refreshCancelToken = () => { @@ -39,14 +38,14 @@ const AutosuggestAccountInput: React.FC = ({ }; const clearResults = () => { - setAccountIds(ImmutableOrderedSet()); + setAccountIds([]); }; const handleAccountSearch = useCallback(throttle((q) => { dispatch(accountSearch(q, controller.current.signal)) .then((accounts: { id: string }[]) => { const accountIds = accounts.map(account => account.id); - setAccountIds(ImmutableOrderedSet(accountIds)); + setAccountIds(accountIds); }) .catch(noOp); }, 900, { leading: true, trailing: true }), []); @@ -79,7 +78,7 @@ const AutosuggestAccountInput: React.FC = ({ , 'onChange' | 'onKeyUp' | 'onKeyDown'> { value: string; - suggestions: ImmutableList; + suggestions: Array; disabled?: boolean; placeholder?: string; onSuggestionSelected: (tokenStart: number, lastToken: string | null, suggestion: AutoSuggestion) => void; @@ -79,7 +79,7 @@ class AutosuggestInput extends ImmutablePureComponent { const { suggestions, menu, disabled } = this.props; const { selectedSuggestion, suggestionsHidden } = this.state; const firstIndex = this.getFirstIndex(); - const lastIndex = suggestions.size + (menu || []).length - 1; + const lastIndex = suggestions.length + (menu || []).length - 1; if (disabled) { e.preventDefault(); @@ -94,7 +94,7 @@ class AutosuggestInput extends ImmutablePureComponent { switch (e.key) { case 'Escape': - if (suggestions.size === 0 || suggestionsHidden) { + if (suggestions.length === 0 || suggestionsHidden) { document.querySelector('.ui')?.parentElement?.focus(); } else { e.preventDefault(); @@ -103,14 +103,14 @@ class AutosuggestInput extends ImmutablePureComponent { break; case 'ArrowDown': - if (!suggestionsHidden && (suggestions.size > 0 || menu)) { + if (!suggestionsHidden && (suggestions.length > 0 || menu)) { e.preventDefault(); this.setState({ selectedSuggestion: Math.min(selectedSuggestion + 1, lastIndex) }); } break; case 'ArrowUp': - if (!suggestionsHidden && (suggestions.size > 0 || menu)) { + if (!suggestionsHidden && (suggestions.length > 0 || menu)) { e.preventDefault(); this.setState({ selectedSuggestion: Math.max(selectedSuggestion - 1, firstIndex) }); } @@ -119,15 +119,15 @@ class AutosuggestInput extends ImmutablePureComponent { case 'Enter': case 'Tab': // Select suggestion - if (!suggestionsHidden && selectedSuggestion > -1 && (suggestions.size > 0 || menu)) { + if (!suggestionsHidden && selectedSuggestion > -1 && (suggestions.length > 0 || menu)) { e.preventDefault(); e.stopPropagation(); this.setState({ selectedSuggestion: firstIndex }); - if (selectedSuggestion < suggestions.size) { - this.props.onSuggestionSelected(this.state.tokenStart, this.state.lastToken, suggestions.get(selectedSuggestion)); + if (selectedSuggestion < suggestions.length) { + this.props.onSuggestionSelected(this.state.tokenStart, this.state.lastToken, suggestions[selectedSuggestion]); } else if (menu) { - const item = menu[selectedSuggestion - suggestions.size]; + const item = menu[selectedSuggestion - suggestions.length]; this.handleMenuItemAction(item, e); } } @@ -154,7 +154,7 @@ class AutosuggestInput extends ImmutablePureComponent { onSuggestionClick: React.EventHandler = (e) => { const index = Number(e.currentTarget?.getAttribute('data-index')); - const suggestion = this.props.suggestions.get(index); + const suggestion = this.props.suggestions[index]; this.props.onSuggestionSelected(this.state.tokenStart, this.state.lastToken, suggestion); this.input?.focus(); e.preventDefault(); @@ -162,7 +162,7 @@ class AutosuggestInput extends ImmutablePureComponent { componentDidUpdate(prevProps: IAutosuggestInput, prevState: any) { const { suggestions } = this.props; - if (suggestions !== prevProps.suggestions && suggestions.size > 0 && prevState.suggestionsHidden && prevState.focused) { + if (suggestions !== prevProps.suggestions && suggestions.length > 0 && prevState.suggestionsHidden && prevState.focused) { this.setState({ suggestionsHidden: false }); } } @@ -230,7 +230,9 @@ class AutosuggestInput extends ImmutablePureComponent { return menu.map((item, i) => ( { const { value, suggestions, disabled, placeholder, onKeyUp, autoFocus, className, id, maxLength, menu, theme } = this.props; const { suggestionsHidden } = this.state; - const visible = !suggestionsHidden && (!suggestions.isEmpty() || (menu && value)); + const visible = !suggestionsHidden && (suggestions.length !== 0 || (menu && value)); return [
diff --git a/packages/pl-fe/src/components/avatar-stack.tsx b/packages/pl-fe/src/components/avatar-stack.tsx index 4ee47cf64..7776fe6ff 100644 --- a/packages/pl-fe/src/components/avatar-stack.tsx +++ b/packages/pl-fe/src/components/avatar-stack.tsx @@ -27,7 +27,7 @@ const AvatarStack: React.FC = ({ accountIds, limit = 3 }) => { style={{ zIndex: limit - i }} > = ({ title, subtitle, children }) => ( -
+
{title} {subtitle && {subtitle}} diff --git a/packages/pl-fe/src/components/dropdown-menu/dropdown-menu-item.tsx b/packages/pl-fe/src/components/dropdown-menu/dropdown-menu-item.tsx index 430a56c0e..b203c2348 100644 --- a/packages/pl-fe/src/components/dropdown-menu/dropdown-menu-item.tsx +++ b/packages/pl-fe/src/components/dropdown-menu/dropdown-menu-item.tsx @@ -99,7 +99,7 @@ const DropdownMenuItem = ({ index, item, onClick, autoFocus, onSetTab }: IDropdo } return ( -
  • +
  • { } const getClassName = () => { - const className = clsx('black:bg-black no-reduce-motion:transition-all dark:ring-primary-700 z-[1001] bg-white py-1 shadow-lg ease-in-out focus:outline-none dark:bg-gray-900 dark:ring-2', { + const className = clsx('z-[1001] bg-white py-1 shadow-lg ease-in-out focus:outline-none black:bg-black no-reduce-motion:transition-all dark:bg-gray-900 dark:ring-2 dark:ring-primary-700', { 'rounded-md min-w-56 max-w-sm duration-100': true, 'no-reduce-motion:scale-0': !(isDisplayed && isOpen), 'scale-100': isDisplayed && isOpen, @@ -368,7 +368,7 @@ const DropdownMenu = (props: IDropdownMenu) => {
  • diff --git a/packages/pl-fe/src/components/event-preview.tsx b/packages/pl-fe/src/components/event-preview.tsx index a224dc2ce..575facdcc 100644 --- a/packages/pl-fe/src/components/event-preview.tsx +++ b/packages/pl-fe/src/components/event-preview.tsx @@ -51,11 +51,11 @@ const EventPreview: React.FC = ({ status, className, hideAction, )); return ( -
    +
    {floatingAction && action}
    -
    +
    {banner && {intl.formatMessage(messages.eventBanner)}}
    diff --git a/packages/pl-fe/src/components/group-card.tsx b/packages/pl-fe/src/components/group-card.tsx index 644609695..11c1d2b21 100644 --- a/packages/pl-fe/src/components/group-card.tsx +++ b/packages/pl-fe/src/components/group-card.tsx @@ -16,11 +16,11 @@ interface IGroupCard { const GroupCard: React.FC = ({ group }) => ( {/* Group Cover Image */} - + { content={ {/* Group Cover Image */} - + {group.header && ( ( -
    +
    ); export { LandingGradient as default }; diff --git a/packages/pl-fe/src/components/link.tsx b/packages/pl-fe/src/components/link.tsx index 7516ce49f..413061279 100644 --- a/packages/pl-fe/src/components/link.tsx +++ b/packages/pl-fe/src/components/link.tsx @@ -4,7 +4,7 @@ import { Link as Comp, LinkProps } from 'react-router-dom'; const Link = (props: LinkProps) => ( ); diff --git a/packages/pl-fe/src/components/list.tsx b/packages/pl-fe/src/components/list.tsx index 28aedb49e..0e91bc00f 100644 --- a/packages/pl-fe/src/components/list.tsx +++ b/packages/pl-fe/src/components/list.tsx @@ -55,7 +55,7 @@ const ListItem: React.FC = ({ className, label, hint, children, to, h return null; }), [children, domId]); - const classNames = clsx('from-gradient-start/20 to-gradient-end/20 dark:from-gradient-start/10 dark:to-gradient-end/10 flex items-center justify-between overflow-hidden bg-gradient-to-r first:rounded-t-lg last:rounded-b-lg', + const classNames = clsx('flex items-center justify-between overflow-hidden bg-gradient-to-r from-gradient-start/20 to-gradient-end/20 first:rounded-t-lg last:rounded-b-lg dark:from-gradient-start/10 dark:to-gradient-end/10', className, { 'px-4 py-2': size === 'md', diff --git a/packages/pl-fe/src/components/location-search.tsx b/packages/pl-fe/src/components/location-search.tsx index 7585ed249..368841db5 100644 --- a/packages/pl-fe/src/components/location-search.tsx +++ b/packages/pl-fe/src/components/location-search.tsx @@ -1,5 +1,4 @@ import clsx from 'clsx'; -import { OrderedSet as ImmutableOrderedSet } from 'immutable'; import throttle from 'lodash/throttle'; import React, { useCallback, useEffect, useRef, useState } from 'react'; import { defineMessages, useIntl } from 'react-intl'; @@ -24,7 +23,7 @@ interface ILocationSearch { const LocationSearch: React.FC = ({ onSelected }) => { const intl = useIntl(); const dispatch = useAppDispatch(); - const [locationIds, setLocationIds] = useState(ImmutableOrderedSet()); + const [locationIds, setLocationIds] = useState(Array()); const controller = useRef(new AbortController()); const [value, setValue] = useState(''); @@ -63,14 +62,14 @@ const LocationSearch: React.FC = ({ onSelected }) => { }; const clearResults = () => { - setLocationIds(ImmutableOrderedSet()); + setLocationIds([]); }; const handleLocationSearch = useCallback(throttle(q => { dispatch(locationSearch(q, controller.current.signal)) .then((locations: { origin_id: string }[]) => { const locationIds = locations.map(location => location.origin_id); - setLocationIds(ImmutableOrderedSet(locationIds)); + setLocationIds(locationIds); }) .catch(noOp); }, 900, { leading: true, trailing: true }), []); @@ -88,7 +87,7 @@ const LocationSearch: React.FC = ({ onSelected }) => { placeholder={intl.formatMessage(messages.placeholder)} value={value} onChange={handleChange} - suggestions={locationIds.toList()} + suggestions={locationIds} onSuggestionsFetchRequested={noOp} onSuggestionsClearRequested={noOp} onSuggestionSelected={handleSelected} diff --git a/packages/pl-fe/src/components/mention.tsx b/packages/pl-fe/src/components/mention.tsx index 5dbbca63b..582d98990 100644 --- a/packages/pl-fe/src/components/mention.tsx +++ b/packages/pl-fe/src/components/mention.tsx @@ -23,7 +23,7 @@ const Mention: React.FC = ({ mention: { acct, username }, disabled }) diff --git a/packages/pl-fe/src/components/modal-root.tsx b/packages/pl-fe/src/components/modal-root.tsx index 2b1801e54..dd658e786 100644 --- a/packages/pl-fe/src/components/modal-root.tsx +++ b/packages/pl-fe/src/components/modal-root.tsx @@ -233,7 +233,7 @@ const ModalRoot: React.FC = ({ children, onCancel, onClose, type })