pl-fe: move stuff around

Signed-off-by: mkljczk <git@mkljczk.pl>
This commit is contained in:
mkljczk 2024-12-05 10:18:27 +01:00
parent feb5b7a836
commit 047a371a45
72 changed files with 119 additions and 138 deletions

View file

@ -17,7 +17,7 @@ import { getClient, type PlfeResponse } from '../api';
import { importEntities } from './importer';
import type { MinifiedSuggestion } from 'pl-fe/api/hooks/trends/use-suggested-accounts';
import type { MinifiedSuggestion } from 'pl-fe/queries/trends/use-suggested-accounts';
import type { MinifiedStatus } from 'pl-fe/reducers/statuses';
import type { AppDispatch, RootState } from 'pl-fe/store';
import type { History } from 'pl-fe/types/history';

View file

@ -5,9 +5,9 @@ import { isLoggedIn } from 'pl-fe/utils/auth';
import { getClient } from '../api';
import type { PaginatedResponse } from 'pl-api';
import type { MinifiedSuggestion } from 'pl-fe/api/hooks/trends/use-suggested-accounts';
import type { EntityStore } from 'pl-fe/entity-store/types';
import type { Account } from 'pl-fe/normalizers/account';
import type { MinifiedSuggestion } from 'pl-fe/queries/trends/use-suggested-accounts';
import type { AppDispatch, RootState } from 'pl-fe/store';
const DOMAIN_BLOCK_REQUEST = 'DOMAIN_BLOCK_REQUEST' as const;

View file

@ -3,9 +3,9 @@ import 'intl-pluralrules';
import { defineMessages } from 'react-intl';
import { getClient } from 'pl-fe/api';
import { appendFollowRequest } from 'pl-fe/api/hooks/account-lists/use-follow-requests';
import { getNotificationStatus } from 'pl-fe/features/notifications/components/notification';
import { normalizeNotification } from 'pl-fe/normalizers/notification';
import { appendFollowRequest } from 'pl-fe/queries/account-lists/use-follow-requests';
import { getFilters, regexFromFilters } from 'pl-fe/selectors';
import { useSettingsStore } from 'pl-fe/stores/settings';
import { isLoggedIn } from 'pl-fe/utils/auth';

View file

@ -8,7 +8,8 @@ import { useFeatures } from 'pl-fe/hooks/use-features';
import { useLoggedIn } from 'pl-fe/hooks/use-logged-in';
import { type Account, normalizeAccount } from 'pl-fe/normalizers/account';
import { useAccountScrobble } from './use-account-scrobble';
import { useAccountScrobble } from '../../../queries/accounts/use-account-scrobble';
import { useRelationship } from './use-relationship';
import type { Account as BaseAccount } from 'pl-api';

View file

@ -9,7 +9,8 @@ import { useFeatures } from 'pl-fe/hooks/use-features';
import { useLoggedIn } from 'pl-fe/hooks/use-logged-in';
import { type Account, normalizeAccount } from 'pl-fe/normalizers/account';
import { useAccountScrobble } from './use-account-scrobble';
import { useAccountScrobble } from '../../../queries/accounts/use-account-scrobble';
import { useRelationship } from './use-relationship';
import type { Account as BaseAccount } from 'pl-api';

View file

@ -10,7 +10,7 @@ import * as v from 'valibot';
import { useClient } from 'pl-fe/hooks/use-client';
import { queryClient } from 'pl-fe/queries/client';
import { useAnnouncements as useUserAnnouncements } from '../announcements/use-announcements';
import { useAnnouncements as useUserAnnouncements } from '../../../queries/announcements/use-announcements';
const useAnnouncements = () => {
const client = useClient();

View file

@ -1,5 +0,0 @@
import { useBookmarkFolders } from './use-bookmark-folders';
const useBookmarkFolder = (folderId?: string) => useBookmarkFolders((data) => folderId ? data.find(folder => folder.id === folderId) : undefined);
export { useBookmarkFolder };

View file

@ -1,22 +0,0 @@
import { useQuery } from '@tanstack/react-query';
import { useClient } from 'pl-fe/hooks/use-client';
import { useFeatures } from 'pl-fe/hooks/use-features';
import type { BookmarkFolder } from 'pl-api';
const useBookmarkFolders = <T>(
select?: ((data: Array<BookmarkFolder>) => T),
) => {
const client = useClient();
const features = useFeatures();
return useQuery({
queryKey: ['bookmarkFolders'],
queryFn: () => client.myAccount.getBookmarkFolders(),
enabled: features.bookmarkFolders,
select,
});
};
export { useBookmarkFolders };

View file

@ -1,21 +0,0 @@
import { useMutation } from '@tanstack/react-query';
import { useClient } from 'pl-fe/hooks/use-client';
import { queryClient } from 'pl-fe/queries/client';
interface CreateBookmarkFolderParams {
name: string;
emoji?: string;
}
const useCreateBookmarkFolder = () => {
const client = useClient();
return useMutation({
mutationKey: ['bookmarkFolders', 'create'],
mutationFn: (params: CreateBookmarkFolderParams) => client.myAccount.createBookmarkFolder(params),
onSettled: () => queryClient.invalidateQueries({ queryKey: ['bookmarkFolders'] }),
});
};
export { useCreateBookmarkFolder };

View file

@ -1,16 +0,0 @@
import { useMutation } from '@tanstack/react-query';
import { useClient } from 'pl-fe/hooks/use-client';
import { queryClient } from 'pl-fe/queries/client';
const useDeleteBookmarkFolder = () => {
const client = useClient();
return useMutation({
mutationKey: ['bookmarkFolders', 'delete'],
mutationFn: (folderId: string) => client.myAccount.deleteBookmarkFolder(folderId),
onSettled: () => queryClient.invalidateQueries({ queryKey: ['bookmarkFolders'] }),
});
};
export { useDeleteBookmarkFolder };

View file

@ -1,21 +0,0 @@
import { useMutation } from '@tanstack/react-query';
import { useClient } from 'pl-fe/hooks/use-client';
import { queryClient } from 'pl-fe/queries/client';
interface UpdateBookmarkFolderParams {
name: string;
emoji?: string;
}
const useUpdateBookmarkFolder = (folderId: string) => {
const client = useClient();
return useMutation({
mutationKey: ['bookmarkFolders', 'update', folderId],
mutationFn: (params: UpdateBookmarkFolderParams) => client.myAccount.updateBookmarkFolder(folderId, params),
onSettled: () => queryClient.invalidateQueries({ queryKey: ['bookmarkFolders'] }),
});
};
export { useUpdateBookmarkFolder };

View file

@ -19,7 +19,7 @@ import { useSettingsStore } from 'pl-fe/stores/settings';
import { getUnreadChatsCount, updateChatListItem } from 'pl-fe/utils/chats';
import { play, soundCache } from 'pl-fe/utils/sounds';
import { updateReactions } from '../announcements/use-announcements';
import { updateReactions } from '../../../queries/announcements/use-announcements';
import { useTimelineStream } from './use-timeline-stream';

View file

@ -4,11 +4,11 @@ import { FormattedMessage } from 'react-intl';
import ReactSwipeableViews from 'react-swipeable-views';
import { createSelector } from 'reselect';
import { useAnnouncements } from 'pl-fe/api/hooks/announcements/use-announcements';
import Card from 'pl-fe/components/ui/card';
import HStack from 'pl-fe/components/ui/hstack';
import Widget from 'pl-fe/components/ui/widget';
import { useAppSelector } from 'pl-fe/hooks/use-app-selector';
import { useAnnouncements } from 'pl-fe/queries/announcements/use-announcements';
import Announcement from './announcement';

View file

@ -1,9 +1,9 @@
import clsx from 'clsx';
import React, { useState } from 'react';
import { useAnnouncements } from 'pl-fe/api/hooks/announcements/use-announcements';
import AnimatedNumber from 'pl-fe/components/animated-number';
import unicodeMapping from 'pl-fe/features/emoji/mapping';
import { useAnnouncements } from 'pl-fe/queries/announcements/use-announcements';
import Emoji from './emoji';

View file

@ -1,9 +1,9 @@
import React from 'react';
import { TransitionMotion, spring } from 'react-motion';
import { useAnnouncements } from 'pl-fe/api/hooks/announcements/use-announcements';
import EmojiPickerDropdown from 'pl-fe/features/emoji/containers/emoji-picker-dropdown-container';
import { useSettings } from 'pl-fe/hooks/use-settings';
import { useAnnouncements } from 'pl-fe/queries/announcements/use-announcements';
import Reaction from './reaction';

View file

@ -1,9 +1,9 @@
import React, { useRef, useState } from 'react';
import { FormattedMessage } from 'react-intl';
import { useBirthdayReminders } from 'pl-fe/api/hooks/account-lists/use-birthday-reminders';
import Widget from 'pl-fe/components/ui/widget';
import AccountContainer from 'pl-fe/containers/account-container';
import { useBirthdayReminders } from 'pl-fe/queries/account-lists/use-birthday-reminders';
const timeToMidnight = () => {
const now = new Date();

View file

@ -3,9 +3,9 @@ import clsx from 'clsx';
import React, { useState } from 'react';
import { defineMessages, useIntl } from 'react-intl';
import { useSearchLocation } from 'pl-fe/api/hooks/search/use-search-location';
import AutosuggestInput, { AutoSuggestion } from 'pl-fe/components/autosuggest-input';
import Icon from 'pl-fe/components/icon';
import { useSearchLocation } from 'pl-fe/queries/search/use-search-location';
import type { Location } from 'pl-api';

View file

@ -5,9 +5,7 @@ import { defineMessages, useIntl, FormattedMessage } from 'react-intl';
import { Link, NavLink } from 'react-router-dom';
import { fetchOwnAccounts, logOut, switchAccount } from 'pl-fe/actions/auth';
import { useFollowRequestsCount } from 'pl-fe/api/hooks/account-lists/use-follow-requests';
import { useAccount } from 'pl-fe/api/hooks/accounts/use-account';
import { useInteractionRequestsCount } from 'pl-fe/api/hooks/statuses/use-interaction-requests';
import Account from 'pl-fe/components/account';
import Divider from 'pl-fe/components/ui/divider';
import HStack from 'pl-fe/components/ui/hstack';
@ -20,6 +18,8 @@ import { useAppSelector } from 'pl-fe/hooks/use-app-selector';
import { useFeatures } from 'pl-fe/hooks/use-features';
import { useInstance } from 'pl-fe/hooks/use-instance';
import { useRegistrationStatus } from 'pl-fe/hooks/use-registration-status';
import { useFollowRequestsCount } from 'pl-fe/queries/account-lists/use-follow-requests';
import { useInteractionRequestsCount } from 'pl-fe/queries/statuses/use-interaction-requests';
import { makeGetOtherAccounts } from 'pl-fe/selectors';
import { useSettingsStore } from 'pl-fe/stores/settings';
import { useUiStore } from 'pl-fe/stores/ui';

View file

@ -1,8 +1,6 @@
import React from 'react';
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
import { useFollowRequestsCount } from 'pl-fe/api/hooks/account-lists/use-follow-requests';
import { useInteractionRequestsCount } from 'pl-fe/api/hooks/statuses/use-interaction-requests';
import Icon from 'pl-fe/components/ui/icon';
import Stack from 'pl-fe/components/ui/stack';
import { useStatContext } from 'pl-fe/contexts/stat-context';
@ -15,6 +13,8 @@ import { useLogo } from 'pl-fe/hooks/use-logo';
import { useOwnAccount } from 'pl-fe/hooks/use-own-account';
import { useRegistrationStatus } from 'pl-fe/hooks/use-registration-status';
import { useSettings } from 'pl-fe/hooks/use-settings';
import { useFollowRequestsCount } from 'pl-fe/queries/account-lists/use-follow-requests';
import { useInteractionRequestsCount } from 'pl-fe/queries/statuses/use-interaction-requests';
import Account from './account';
import DropdownMenu, { Menu } from './dropdown-menu';

View file

@ -17,7 +17,6 @@ import { useBlockGroupMember } from 'pl-fe/api/hooks/groups/use-block-group-memb
import { useDeleteGroupStatus } from 'pl-fe/api/hooks/groups/use-delete-group-status';
import { useGroup } from 'pl-fe/api/hooks/groups/use-group';
import { useGroupRelationship } from 'pl-fe/api/hooks/groups/use-group-relationship';
import { useTranslationLanguages } from 'pl-fe/api/hooks/instance/use-translation-languages';
import DropdownMenu from 'pl-fe/components/dropdown-menu';
import StatusActionButton from 'pl-fe/components/status-action-button';
import HStack from 'pl-fe/components/ui/hstack';
@ -31,6 +30,7 @@ import { useInstance } from 'pl-fe/hooks/use-instance';
import { useOwnAccount } from 'pl-fe/hooks/use-own-account';
import { useSettings } from 'pl-fe/hooks/use-settings';
import { useChats } from 'pl-fe/queries/chats';
import { useTranslationLanguages } from 'pl-fe/queries/instance/use-translation-languages';
import { RootState } from 'pl-fe/store';
import { useModalsStore } from 'pl-fe/stores/modals';
import { useStatusMetaStore } from 'pl-fe/stores/status-meta';

View file

@ -2,7 +2,6 @@ import clsx from 'clsx';
import React, { useState, useRef, useLayoutEffect, useMemo, useEffect } from 'react';
import { FormattedMessage } from 'react-intl';
import { useStatusTranslation } from 'pl-fe/api/hooks/statuses/use-status-translation';
import Icon from 'pl-fe/components/icon';
import Button from 'pl-fe/components/ui/button';
import Stack from 'pl-fe/components/ui/stack';
@ -10,6 +9,7 @@ import Text from 'pl-fe/components/ui/text';
import Emojify from 'pl-fe/features/emoji/emojify';
import QuotedStatus from 'pl-fe/features/status/containers/quoted-status-container';
import { useSettings } from 'pl-fe/hooks/use-settings';
import { useStatusTranslation } from 'pl-fe/queries/statuses/use-status-translation';
import { useStatusMetaStore } from 'pl-fe/stores/status-meta';
import { onlyEmoji as isOnlyEmoji } from 'pl-fe/utils/rich-content';

View file

@ -1,8 +1,6 @@
import React, { useEffect } from 'react';
import { FormattedMessage, useIntl } from 'react-intl';
import { useTranslationLanguages } from 'pl-fe/api/hooks/instance/use-translation-languages';
import { useStatusTranslation } from 'pl-fe/api/hooks/statuses/use-status-translation';
import HStack from 'pl-fe/components/ui/hstack';
import Icon from 'pl-fe/components/ui/icon';
import Stack from 'pl-fe/components/ui/stack';
@ -11,6 +9,8 @@ import { useAppSelector } from 'pl-fe/hooks/use-app-selector';
import { useFeatures } from 'pl-fe/hooks/use-features';
import { useInstance } from 'pl-fe/hooks/use-instance';
import { useSettings } from 'pl-fe/hooks/use-settings';
import { useTranslationLanguages } from 'pl-fe/queries/instance/use-translation-languages';
import { useStatusTranslation } from 'pl-fe/queries/statuses/use-status-translation';
import { useStatusMetaStore } from 'pl-fe/stores/status-meta';
import type { Status } from 'pl-fe/normalizers/status';

View file

@ -237,7 +237,7 @@ const Upload: React.FC<IUpload> = ({
/>
)}
<div className='absolute inset-0 -z-[1] size-full'>
<div className='absolute inset-0 z-[-1] size-full'>
{mediaType === 'video' && (
<video className='size-full object-cover' autoPlay playsInline muted loop>
<source src={media.preview_url} />

View file

@ -2,11 +2,11 @@ import React, { useState } from 'react';
import { FormattedMessage } from 'react-intl';
import { useParams } from 'react-router-dom';
import { useAboutPage } from 'pl-fe/api/hooks/pl-fe/use-about-page';
import { Navlinks } from 'pl-fe/components/navlinks';
import Card from 'pl-fe/components/ui/card';
import { usePlFeConfig } from 'pl-fe/hooks/use-pl-fe-config';
import { useSettings } from 'pl-fe/hooks/use-settings';
import { useAboutPage } from 'pl-fe/queries/pl-fe/use-about-page';
import { languages } from '../preferences';

View file

@ -494,7 +494,7 @@ const Audio: React.FC<IAudio> = (props) => {
</div>
<div className='video-player__controls absolute bottom-0 left-0 z-[2] box-border bg-transparent px-4 py-0 pt-2.5 opacity-100 ring-0 transition-opacity duration-100 ease-in-out'>
<div className='-mx-[5px] my-0 flex justify-between pb-2'>
<div className='mx-[-5px] my-0 flex justify-between pb-2'>
<div className='video-player__buttons left'>
<button

View file

@ -1,12 +1,12 @@
import React from 'react';
import { FormattedMessage, defineMessages, useIntl } from 'react-intl';
import { useCreateBookmarkFolder } from 'pl-fe/api/hooks/statuses/use-create-bookmark-folder';
import Button from 'pl-fe/components/ui/button';
import Form from 'pl-fe/components/ui/form';
import HStack from 'pl-fe/components/ui/hstack';
import Input from 'pl-fe/components/ui/input';
import { useTextField } from 'pl-fe/hooks/forms/use-text-field';
import { useCreateBookmarkFolder } from 'pl-fe/queries/statuses/use-bookmark-folders';
import toast from 'pl-fe/toast';
const messages = defineMessages({

View file

@ -2,7 +2,6 @@ import React from 'react';
import { FormattedMessage, defineMessages, useIntl } from 'react-intl';
import { Redirect } from 'react-router-dom';
import { useBookmarkFolders } from 'pl-fe/api/hooks/statuses/use-bookmark-folders';
import List, { ListItem } from 'pl-fe/components/list';
import Column from 'pl-fe/components/ui/column';
import Emoji from 'pl-fe/components/ui/emoji';
@ -11,6 +10,7 @@ import Icon from 'pl-fe/components/ui/icon';
import Spinner from 'pl-fe/components/ui/spinner';
import Stack from 'pl-fe/components/ui/stack';
import { useFeatures } from 'pl-fe/hooks/use-features';
import { useBookmarkFolders } from 'pl-fe/queries/statuses/use-bookmark-folders';
import NewFolderForm from './components/new-folder-form';

View file

@ -4,8 +4,6 @@ import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
import { useHistory } from 'react-router-dom';
import { fetchBookmarkedStatuses, expandBookmarkedStatuses } from 'pl-fe/actions/bookmarks';
import { useBookmarkFolder } from 'pl-fe/api/hooks/statuses/use-bookmark-folder';
import { useDeleteBookmarkFolder } from 'pl-fe/api/hooks/statuses/use-delete-bookmark-folder';
import DropdownMenu from 'pl-fe/components/dropdown-menu';
import PullToRefresh from 'pl-fe/components/pull-to-refresh';
import StatusList from 'pl-fe/components/status-list';
@ -14,6 +12,7 @@ import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch';
import { useAppSelector } from 'pl-fe/hooks/use-app-selector';
import { useIsMobile } from 'pl-fe/hooks/use-is-mobile';
import { useTheme } from 'pl-fe/hooks/use-theme';
import { useBookmarkFolder, useDeleteBookmarkFolder } from 'pl-fe/queries/statuses/use-bookmark-folders';
import { useModalsStore } from 'pl-fe/stores/modals';
import toast from 'pl-fe/toast';

View file

@ -1,13 +1,13 @@
import React from 'react';
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
import { useAcceptEventParticipationRequestMutation, useEventParticipationRequests } from 'pl-fe/api/hooks/account-lists/use-event-participation-requests';
import ScrollableList from 'pl-fe/components/scrollable-list';
import Button from 'pl-fe/components/ui/button';
import HStack from 'pl-fe/components/ui/hstack';
import Spinner from 'pl-fe/components/ui/spinner';
import Stack from 'pl-fe/components/ui/stack';
import AccountContainer from 'pl-fe/containers/account-container';
import { useAcceptEventParticipationRequestMutation, useEventParticipationRequests } from 'pl-fe/queries/account-lists/use-event-participation-requests';
const messages = defineMessages({
authorize: { id: 'compose_event.participation_requests.authorize', defaultMessage: 'Authorize' },

View file

@ -3,7 +3,6 @@ import React from 'react';
import { FormattedMessage, defineMessages, useIntl } from 'react-intl';
import { useSearchParams } from 'react-router-dom-v5-compat';
import { useDirectory } from 'pl-fe/api/hooks/account-lists/use-directory';
import LoadMore from 'pl-fe/components/load-more';
import { RadioGroup, RadioItem } from 'pl-fe/components/radio';
import { CardTitle } from 'pl-fe/components/ui/card';
@ -11,6 +10,7 @@ import Column from 'pl-fe/components/ui/column';
import Stack from 'pl-fe/components/ui/stack';
import { useFeatures } from 'pl-fe/hooks/use-features';
import { useInstance } from 'pl-fe/hooks/use-instance';
import { useDirectory } from 'pl-fe/queries/account-lists/use-directory';
import AccountCard from './components/account-card';

View file

@ -1,9 +1,9 @@
import React from 'react';
import { useAcceptFollowRequestMutation, useRejectFollowRequestMutation } from 'pl-fe/api/hooks/account-lists/use-follow-requests';
import { useAccount } from 'pl-fe/api/hooks/accounts/use-account';
import Account from 'pl-fe/components/account';
import { AuthorizeRejectButtons } from 'pl-fe/components/authorize-reject-buttons';
import { useAcceptFollowRequestMutation, useRejectFollowRequestMutation } from 'pl-fe/queries/account-lists/use-follow-requests';
interface IAccountAuthorize {
id: string;

View file

@ -1,10 +1,10 @@
import React from 'react';
import { defineMessages, useIntl, FormattedMessage } from 'react-intl';
import { useFollowRequests } from 'pl-fe/api/hooks/account-lists/use-follow-requests';
import ScrollableList from 'pl-fe/components/scrollable-list';
import Column from 'pl-fe/components/ui/column';
import Spinner from 'pl-fe/components/ui/spinner';
import { useFollowRequests } from 'pl-fe/queries/account-lists/use-follow-requests';
import AccountAuthorize from './components/account-authorize';

View file

@ -4,7 +4,6 @@ import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
import { Link } from 'react-router-dom';
import { useAccount } from 'pl-fe/api/hooks/accounts/use-account';
import { type MinifiedInteractionRequest, useAuthorizeInteractionRequestMutation, useFlatInteractionRequests, useRejectInteractionRequestMutation } from 'pl-fe/api/hooks/statuses/use-interaction-requests';
import AttachmentThumbs from 'pl-fe/components/attachment-thumbs';
import Icon from 'pl-fe/components/icon';
import PullToRefresh from 'pl-fe/components/pull-to-refresh';
@ -21,6 +20,7 @@ import { buildLink } from 'pl-fe/features/notifications/components/notification'
import { HotKeys } from 'pl-fe/features/ui/components/hotkeys';
import { useAppSelector } from 'pl-fe/hooks/use-app-selector';
import { useOwnAccount } from 'pl-fe/hooks/use-own-account';
import { type MinifiedInteractionRequest, useAuthorizeInteractionRequestMutation, useFlatInteractionRequests, useRejectInteractionRequestMutation } from 'pl-fe/queries/statuses/use-interaction-requests';
import toast from 'pl-fe/toast';
const messages = defineMessages({

View file

@ -2,11 +2,11 @@ import React from 'react';
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
import { useParams } from 'react-router-dom';
import { useStatusQuotes } from 'pl-fe/api/hooks/statuses/use-status-quotes';
import StatusList from 'pl-fe/components/status-list';
import Column from 'pl-fe/components/ui/column';
import { useIsMobile } from 'pl-fe/hooks/use-is-mobile';
import { useTheme } from 'pl-fe/hooks/use-theme';
import { useStatusQuotes } from 'pl-fe/queries/statuses/use-status-quotes';
const messages = defineMessages({
heading: { id: 'column.quotes', defaultMessage: 'Post quotes' },

View file

@ -4,10 +4,6 @@ import { FormattedMessage, defineMessages, useIntl } from 'react-intl';
import { useSearchParams } from 'react-router-dom-v5-compat';
import { useAccount } from 'pl-fe/api/hooks/accounts/use-account';
import { useSearchAccounts, useSearchHashtags, useSearchStatuses } from 'pl-fe/api/hooks/search/use-search';
import { useSuggestedAccounts } from 'pl-fe/api/hooks/trends/use-suggested-accounts';
import { useTrendingLinks } from 'pl-fe/api/hooks/trends/use-trending-links';
import { useTrendingStatuses } from 'pl-fe/api/hooks/trends/use-trending-statuses';
import Hashtag from 'pl-fe/components/hashtag';
import IconButton from 'pl-fe/components/icon-button';
import ScrollableList from 'pl-fe/components/scrollable-list';
@ -21,7 +17,11 @@ import PlaceholderAccount from 'pl-fe/features/placeholder/components/placeholde
import PlaceholderHashtag from 'pl-fe/features/placeholder/components/placeholder-hashtag';
import PlaceholderStatus from 'pl-fe/features/placeholder/components/placeholder-status';
import { useFeatures } from 'pl-fe/hooks/use-features';
import { useSearchAccounts, useSearchHashtags, useSearchStatuses } from 'pl-fe/queries/search/use-search';
import useTrends from 'pl-fe/queries/trends';
import { useSuggestedAccounts } from 'pl-fe/queries/trends/use-suggested-accounts';
import { useTrendingLinks } from 'pl-fe/queries/trends/use-trending-links';
import { useTrendingStatuses } from 'pl-fe/queries/trends/use-trending-statuses';
type SearchFilter = 'accounts' | 'hashtags' | 'statuses' | 'links';

View file

@ -8,13 +8,13 @@ import {
unmuteAccount,
biteAccount,
} from 'pl-fe/actions/accounts';
import { useAcceptFollowRequestMutation, useRejectFollowRequestMutation } from 'pl-fe/api/hooks/account-lists/use-follow-requests';
import { useFollow } from 'pl-fe/api/hooks/accounts/use-follow';
import Button from 'pl-fe/components/ui/button';
import HStack from 'pl-fe/components/ui/hstack';
import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch';
import { useFeatures } from 'pl-fe/hooks/use-features';
import { useLoggedIn } from 'pl-fe/hooks/use-logged-in';
import { useAcceptFollowRequestMutation, useRejectFollowRequestMutation } from 'pl-fe/queries/account-lists/use-follow-requests';
import { useModalsStore } from 'pl-fe/stores/modals';
import toast from 'pl-fe/toast';

View file

@ -1,12 +1,12 @@
import React, { useState } from 'react';
import { FormattedMessage } from 'react-intl';
import { useBirthdayReminders } from 'pl-fe/api/hooks/account-lists/use-birthday-reminders';
import { getCurrentDate } from 'pl-fe/components/birthday-panel';
import ScrollableList from 'pl-fe/components/scrollable-list';
import Modal from 'pl-fe/components/ui/modal';
import Spinner from 'pl-fe/components/ui/spinner';
import Account from 'pl-fe/features/birthdays/account';
import { useBirthdayReminders } from 'pl-fe/queries/account-lists/use-birthday-reminders';
import type { BaseModalProps } from '../modal-root';

View file

@ -1,7 +1,6 @@
import React from 'react';
import { FormattedDate, FormattedMessage } from 'react-intl';
import { useStatusHistory } from 'pl-fe/api/hooks/statuses/use-status-history';
import AttachmentThumbs from 'pl-fe/components/attachment-thumbs';
import { ParsedContent } from 'pl-fe/components/parsed-content';
import HStack from 'pl-fe/components/ui/hstack';
@ -11,6 +10,7 @@ import Stack from 'pl-fe/components/ui/stack';
import Text from 'pl-fe/components/ui/text';
import Emojify from 'pl-fe/features/emoji/emojify';
import { useAppSelector } from 'pl-fe/hooks/use-app-selector';
import { useStatusHistory } from 'pl-fe/queries/statuses/use-status-history';
import type { BaseModalProps } from '../modal-root';

View file

@ -1,11 +1,11 @@
import React, { useRef } from 'react';
import { FormattedMessage } from 'react-intl';
import { useStatusDislikes } from 'pl-fe/api/hooks/account-lists/use-status-interactions';
import ScrollableList from 'pl-fe/components/scrollable-list';
import Modal from 'pl-fe/components/ui/modal';
import Spinner from 'pl-fe/components/ui/spinner';
import AccountContainer from 'pl-fe/containers/account-container';
import { useStatusDislikes } from 'pl-fe/queries/account-lists/use-status-interactions';
import type { BaseModalProps } from '../modal-root';

View file

@ -3,8 +3,6 @@ import React, { useState } from 'react';
import { createPortal } from 'react-dom';
import { FormattedMessage, defineMessages, useIntl } from 'react-intl';
import { useBookmarkFolder } from 'pl-fe/api/hooks/statuses/use-bookmark-folder';
import { useUpdateBookmarkFolder } from 'pl-fe/api/hooks/statuses/use-update-bookmark-folder';
import Emoji from 'pl-fe/components/ui/emoji';
import HStack from 'pl-fe/components/ui/hstack';
import Icon from 'pl-fe/components/ui/icon';
@ -14,6 +12,7 @@ import EmojiPickerDropdown from 'pl-fe/features/emoji/components/emoji-picker-dr
import { messages as emojiMessages } from 'pl-fe/features/emoji/containers/emoji-picker-dropdown-container';
import { useTextField } from 'pl-fe/hooks/forms/use-text-field';
import { useClickOutside } from 'pl-fe/hooks/use-click-outside';
import { useBookmarkFolder, useUpdateBookmarkFolder } from 'pl-fe/queries/statuses/use-bookmark-folders';
import toast from 'pl-fe/toast';
import type { BaseModalProps } from '../modal-root';

View file

@ -1,11 +1,11 @@
import React from 'react';
import { FormattedMessage } from 'react-intl';
import { useEventParticipations } from 'pl-fe/api/hooks/account-lists/use-event-participations';
import ScrollableList from 'pl-fe/components/scrollable-list';
import Modal from 'pl-fe/components/ui/modal';
import Spinner from 'pl-fe/components/ui/spinner';
import AccountContainer from 'pl-fe/containers/account-container';
import { useEventParticipations } from 'pl-fe/queries/account-lists/use-event-participations';
import type { BaseModalProps } from '../modal-root';

View file

@ -1,13 +1,13 @@
import React, { useRef } from 'react';
import { FormattedMessage } from 'react-intl';
import { useFamiliarFollowers } from 'pl-fe/api/hooks/account-lists/use-familiar-followers';
import ScrollableList from 'pl-fe/components/scrollable-list';
import Modal from 'pl-fe/components/ui/modal';
import Spinner from 'pl-fe/components/ui/spinner';
import AccountContainer from 'pl-fe/containers/account-container';
import Emojify from 'pl-fe/features/emoji/emojify';
import { useAppSelector } from 'pl-fe/hooks/use-app-selector';
import { useFamiliarFollowers } from 'pl-fe/queries/account-lists/use-familiar-followers';
import { makeGetAccount } from 'pl-fe/selectors';
import type { BaseModalProps } from '../modal-root';

View file

@ -1,11 +1,11 @@
import React, { useRef } from 'react';
import { FormattedMessage } from 'react-intl';
import { useStatusFavourites } from 'pl-fe/api/hooks/account-lists/use-status-interactions';
import ScrollableList from 'pl-fe/components/scrollable-list';
import Modal from 'pl-fe/components/ui/modal';
import Spinner from 'pl-fe/components/ui/spinner';
import AccountContainer from 'pl-fe/containers/account-container';
import { useStatusFavourites } from 'pl-fe/queries/account-lists/use-status-interactions';
import type { BaseModalProps } from '../modal-root';

View file

@ -2,13 +2,13 @@ import clsx from 'clsx';
import React, { useMemo, useRef, useState } from 'react';
import { FormattedMessage, defineMessages, useIntl } from 'react-intl';
import { useStatusReactions } from 'pl-fe/api/hooks/account-lists/use-status-interactions';
import ScrollableList from 'pl-fe/components/scrollable-list';
import Emoji from 'pl-fe/components/ui/emoji';
import Modal from 'pl-fe/components/ui/modal';
import Spinner from 'pl-fe/components/ui/spinner';
import Tabs from 'pl-fe/components/ui/tabs';
import AccountContainer from 'pl-fe/containers/account-container';
import { useStatusReactions } from 'pl-fe/queries/account-lists/use-status-interactions';
import type { BaseModalProps } from '../modal-root';
import type { Item } from 'pl-fe/components/ui/tabs';

View file

@ -1,11 +1,11 @@
import React, { useRef } from 'react';
import { FormattedMessage } from 'react-intl';
import { useStatusReblogs } from 'pl-fe/api/hooks/account-lists/use-status-interactions';
import ScrollableList from 'pl-fe/components/scrollable-list';
import Modal from 'pl-fe/components/ui/modal';
import Spinner from 'pl-fe/components/ui/spinner';
import AccountContainer from 'pl-fe/containers/account-container';
import { useStatusReblogs } from 'pl-fe/queries/account-lists/use-status-interactions';
import type { BaseModalProps } from '../modal-root';

View file

@ -2,7 +2,6 @@ import React, { useCallback, useState } from 'react';
import { FormattedMessage } from 'react-intl';
import { bookmark } from 'pl-fe/actions/interactions';
import { useBookmarkFolders } from 'pl-fe/api/hooks/statuses/use-bookmark-folders';
import { RadioGroup, RadioItem } from 'pl-fe/components/radio';
import Emoji from 'pl-fe/components/ui/emoji';
import HStack from 'pl-fe/components/ui/hstack';
@ -13,6 +12,7 @@ import Stack from 'pl-fe/components/ui/stack';
import NewFolderForm from 'pl-fe/features/bookmark-folders/components/new-folder-form';
import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch';
import { useAppSelector } from 'pl-fe/hooks/use-app-selector';
import { useBookmarkFolders } from 'pl-fe/queries/statuses/use-bookmark-folders';
import { makeGetStatus } from 'pl-fe/selectors';
import type { BaseModalProps } from '../modal-root';

View file

@ -1,11 +1,11 @@
import React from 'react';
import { FormattedMessage } from 'react-intl';
import { useEndorsedAccounts } from 'pl-fe/api/hooks/account-lists/use-endorsed-accounts';
import Widget from 'pl-fe/components/ui/widget';
import AccountContainer from 'pl-fe/containers/account-container';
import Emojify from 'pl-fe/features/emoji/emojify';
import { WhoToFollowPanel } from 'pl-fe/features/ui/util/async-components';
import { useEndorsedAccounts } from 'pl-fe/queries/account-lists/use-endorsed-accounts';
import type { Account } from 'pl-fe/normalizers/account';

View file

@ -2,7 +2,6 @@ import React from 'react';
import { FormattedList, FormattedMessage } from 'react-intl';
import { Link } from 'react-router-dom';
import { useFamiliarFollowers } from 'pl-fe/api/hooks/account-lists/use-familiar-followers';
import AvatarStack from 'pl-fe/components/avatar-stack';
import HoverAccountWrapper from 'pl-fe/components/hover-account-wrapper';
import HStack from 'pl-fe/components/ui/hstack';
@ -10,6 +9,7 @@ import Text from 'pl-fe/components/ui/text';
import VerificationBadge from 'pl-fe/components/verification-badge';
import Emojify from 'pl-fe/features/emoji/emojify';
import { useAppSelector } from 'pl-fe/hooks/use-app-selector';
import { useFamiliarFollowers } from 'pl-fe/queries/account-lists/use-familiar-followers';
import { makeGetAccount } from 'pl-fe/selectors';
import { useModalsStore } from 'pl-fe/stores/modals';

View file

@ -11,7 +11,6 @@ import { expandNotifications } from 'pl-fe/actions/notifications';
import { register as registerPushNotifications } from 'pl-fe/actions/push-notifications/registerer';
import { fetchScheduledStatuses } from 'pl-fe/actions/scheduled-statuses';
import { fetchHomeTimeline } from 'pl-fe/actions/timelines';
import { prefetchFollowRequests } from 'pl-fe/api/hooks/account-lists/use-follow-requests';
import { useUserStream } from 'pl-fe/api/hooks/streaming/use-user-stream';
import SidebarNavigation from 'pl-fe/components/sidebar-navigation';
import ThumbNavigation from 'pl-fe/components/thumb-navigation';
@ -41,6 +40,7 @@ import ProfileLayout from 'pl-fe/layouts/profile-layout';
import RemoteInstanceLayout from 'pl-fe/layouts/remote-instance-layout';
import SearchLayout from 'pl-fe/layouts/search-layout';
import StatusLayout from 'pl-fe/layouts/status-layout';
import { prefetchFollowRequests } from 'pl-fe/queries/account-lists/use-follow-requests';
import { useUiStore } from 'pl-fe/stores/ui';
import { getVapidKey } from 'pl-fe/utils/auth';
import { isStandalone } from 'pl-fe/utils/state';

View file

@ -505,7 +505,7 @@ const Video: React.FC<IVideo> = ({
/>
</div>
<div className='-mx-[5px] my-0 flex justify-between pb-2'>
<div className='mx-[-5px] my-0 flex justify-between pb-2'>
<div className='video-player__buttons left'>
<button
type='button'

View file

@ -0,0 +1,66 @@
import { useMutation, useQuery } from '@tanstack/react-query';
import { useClient } from 'pl-fe/hooks/use-client';
import { useFeatures } from 'pl-fe/hooks/use-features';
import { queryClient } from '../client';
import type { BookmarkFolder } from 'pl-api';
const useBookmarkFolders = <T>(
select?: ((data: Array<BookmarkFolder>) => T),
) => {
const client = useClient();
const features = useFeatures();
return useQuery({
queryKey: ['bookmarkFolders'],
queryFn: () => client.myAccount.getBookmarkFolders(),
enabled: features.bookmarkFolders,
select,
});
};
const useBookmarkFolder = (folderId?: string) => useBookmarkFolders((data) => folderId ? data.find(folder => folder.id === folderId) : undefined);
interface CreateBookmarkFolderParams {
name: string;
emoji?: string;
}
const useCreateBookmarkFolder = () => {
const client = useClient();
return useMutation({
mutationKey: ['bookmarkFolders', 'create'],
mutationFn: (params: CreateBookmarkFolderParams) => client.myAccount.createBookmarkFolder(params),
onSettled: () => queryClient.invalidateQueries({ queryKey: ['bookmarkFolders'] }),
});
};
const useDeleteBookmarkFolder = () => {
const client = useClient();
return useMutation({
mutationKey: ['bookmarkFolders', 'delete'],
mutationFn: (folderId: string) => client.myAccount.deleteBookmarkFolder(folderId),
onSettled: () => queryClient.invalidateQueries({ queryKey: ['bookmarkFolders'] }),
});
};
interface UpdateBookmarkFolderParams {
name: string;
emoji?: string;
}
const useUpdateBookmarkFolder = (folderId: string) => {
const client = useClient();
return useMutation({
mutationKey: ['bookmarkFolders', 'update', folderId],
mutationFn: (params: UpdateBookmarkFolderParams) => client.myAccount.updateBookmarkFolder(folderId, params),
onSettled: () => queryClient.invalidateQueries({ queryKey: ['bookmarkFolders'] }),
});
};
export { useBookmarkFolders, useBookmarkFolder, useCreateBookmarkFolder, useDeleteBookmarkFolder, useUpdateBookmarkFolder };