Remove legacy useAccount hook
This commit is contained in:
parent
69d8817b6d
commit
5f61a624c6
|
@ -2,21 +2,25 @@ import React from 'react';
|
|||
import { defineMessages, useIntl } from 'react-intl';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
import { useAccount } from 'soapbox/api/hooks';
|
||||
import VerificationBadge from 'soapbox/components/verification-badge';
|
||||
import { useAccount, useAppSelector } from 'soapbox/hooks';
|
||||
import { useAppSelector } from 'soapbox/hooks';
|
||||
|
||||
import { Card, CardBody, CardTitle, HStack, Stack, Text } from '../../components/ui';
|
||||
import ActionButton from '../ui/components/action-button';
|
||||
|
||||
import type { Account } from 'soapbox/types/entities';
|
||||
|
||||
const messages = defineMessages({
|
||||
heading: { id: 'feed_suggestions.heading', defaultMessage: 'Suggested Profiles' },
|
||||
viewAll: { id: 'feed_suggestions.view_all', defaultMessage: 'View all' },
|
||||
});
|
||||
|
||||
const SuggestionItem = ({ accountId }: { accountId: string }) => {
|
||||
const account = useAccount(accountId) as Account;
|
||||
interface ISuggestionItem {
|
||||
accountId: string
|
||||
}
|
||||
|
||||
const SuggestionItem: React.FC<ISuggestionItem> = ({ accountId }) => {
|
||||
const { account } = useAccount(accountId);
|
||||
if (!account) return null;
|
||||
|
||||
return (
|
||||
<Stack space={3} className='w-52 shrink-0 rounded-md border border-solid border-gray-300 p-4 dark:border-gray-800 md:w-full md:shrink md:border-transparent md:p-0 dark:md:border-transparent'>
|
||||
|
|
|
@ -4,13 +4,14 @@ import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
|||
import { blockAccount } from 'soapbox/actions/accounts';
|
||||
import { submitReport, submitReportSuccess, submitReportFail, ReportableEntities } from 'soapbox/actions/reports';
|
||||
import { expandAccountTimeline } from 'soapbox/actions/timelines';
|
||||
import { useAccount } from 'soapbox/api/hooks';
|
||||
import AttachmentThumbs from 'soapbox/components/attachment-thumbs';
|
||||
import GroupCard from 'soapbox/components/group-card';
|
||||
import List, { ListItem } from 'soapbox/components/list';
|
||||
import StatusContent from 'soapbox/components/status-content';
|
||||
import { Avatar, HStack, Icon, Modal, ProgressBar, Stack, Text } from 'soapbox/components/ui';
|
||||
import AccountContainer from 'soapbox/containers/account-container';
|
||||
import { useAccount, useAppDispatch, useAppSelector } from 'soapbox/hooks';
|
||||
import { useAppDispatch, useAppSelector } from 'soapbox/hooks';
|
||||
|
||||
import ConfirmationStep from './steps/confirmation-step';
|
||||
import OtherActionsStep from './steps/other-actions-step';
|
||||
|
@ -100,7 +101,7 @@ const ReportModal = ({ onClose }: IReportModal) => {
|
|||
const intl = useIntl();
|
||||
|
||||
const accountId = useAppSelector((state) => state.reports.new.account_id);
|
||||
const account = useAccount(accountId as string);
|
||||
const { account } = useAccount(accountId || undefined);
|
||||
|
||||
const entityType = useAppSelector((state) => state.reports.new.entityType);
|
||||
const isBlocked = useAppSelector((state) => state.reports.new.block);
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
export { useAccount } from './useAccount';
|
||||
export { useApi } from './useApi';
|
||||
export { useAppDispatch } from './useAppDispatch';
|
||||
export { useAppSelector } from './useAppSelector';
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
import { useAppSelector } from 'soapbox/hooks';
|
||||
import { makeGetAccount } from 'soapbox/selectors';
|
||||
|
||||
export const useAccount = (id: string) => {
|
||||
const getAccount = makeGetAccount();
|
||||
|
||||
return useAppSelector((state) => getAccount(state, id));
|
||||
};
|
Loading…
Reference in New Issue