/* eslint-disable @typescript-eslint/no-unsafe-return, @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment */ import { useCallback } from 'react'; import { FormattedMessage } from 'react-intl'; import { toggleStatusSpoilers } from 'mastodon/actions/statuses'; import { DetailedStatus } from 'mastodon/features/status/components/detailed_status'; import { me } from 'mastodon/initial_state'; import type { TopStatuses } from 'mastodon/models/annual_report'; import { makeGetStatus, makeGetPictureInPicture } from 'mastodon/selectors'; import { useAppSelector, useAppDispatch } from 'mastodon/store'; const getStatus = makeGetStatus() as unknown as (arg0: any, arg1: any) => any; const getPictureInPicture = makeGetPictureInPicture() as unknown as ( arg0: any, arg1: any, ) => any; export const HighlightedPost: React.FC<{ data: TopStatuses; }> = ({ data }) => { let statusId, label; if (data.by_reblogs) { statusId = data.by_reblogs; label = ( ); } else if (data.by_favourites) { statusId = data.by_favourites; label = ( ); } else { statusId = data.by_replies; label = ( ); } const dispatch = useAppDispatch(); const domain = useAppSelector((state) => state.meta.get('domain')); const status = useAppSelector((state) => statusId ? getStatus(state, { id: statusId }) : undefined, ); const pictureInPicture = useAppSelector((state) => statusId ? getPictureInPicture(state, { id: statusId }) : undefined, ); const account = useAppSelector((state) => me ? state.accounts.get(me) : undefined, ); const handleToggleHidden = useCallback(() => { dispatch(toggleStatusSpoilers(statusId)); }, [dispatch, statusId]); if (!status) { return (
); } const displayName = ( ), }} /> {label} ); return (
); };