refactor: rename Status to LegacyStatus and EntityTypes[Entities.STATUSES] to StatusEntity

This commit is contained in:
P. Reis 2024-12-11 16:24:23 -03:00
parent 6a44582c9c
commit 45a81a937c
22 changed files with 69 additions and 73 deletions

View File

@ -9,9 +9,9 @@ import { closeDropdownMenu as closeDropdownMenuRedux, openDropdownMenu } from 's
import { closeModal, openModal } from 'soapbox/actions/modals.ts'; import { closeModal, openModal } from 'soapbox/actions/modals.ts';
import IconButton from 'soapbox/components/ui/icon-button.tsx'; import IconButton from 'soapbox/components/ui/icon-button.tsx';
import Portal from 'soapbox/components/ui/portal.tsx'; import Portal from 'soapbox/components/ui/portal.tsx';
import { Entities, EntityTypes } from 'soapbox/entity-store/entities.ts';
import { useAppDispatch } from 'soapbox/hooks/useAppDispatch.ts'; import { useAppDispatch } from 'soapbox/hooks/useAppDispatch.ts';
import { userTouching } from 'soapbox/is-mobile.ts'; import { userTouching } from 'soapbox/is-mobile.ts';
import { Status as StatusEntity } from 'soapbox/schemas/index.ts';
import DropdownMenuItem, { MenuItem } from './dropdown-menu-item.tsx'; import DropdownMenuItem, { MenuItem } from './dropdown-menu-item.tsx';
@ -27,7 +27,7 @@ interface IDropdownMenu {
onShiftClick?: React.EventHandler<React.MouseEvent | React.KeyboardEvent>; onShiftClick?: React.EventHandler<React.MouseEvent | React.KeyboardEvent>;
placement?: Placement; placement?: Placement;
src?: string; src?: string;
status?: EntityTypes[Entities.STATUSES]; status?: StatusEntity;
title?: string; title?: string;
} }

View File

@ -7,7 +7,6 @@ import Button from 'soapbox/components/ui/button.tsx';
import HStack from 'soapbox/components/ui/hstack.tsx'; import HStack from 'soapbox/components/ui/hstack.tsx';
import Stack from 'soapbox/components/ui/stack.tsx'; import Stack from 'soapbox/components/ui/stack.tsx';
import Text from 'soapbox/components/ui/text.tsx'; import Text from 'soapbox/components/ui/text.tsx';
import { EntityTypes, Entities } from 'soapbox/entity-store/entities.ts';
import PureEventActionButton from 'soapbox/features/event/components/pure-event-action-button.tsx'; import PureEventActionButton from 'soapbox/features/event/components/pure-event-action-button.tsx';
import PureEventDate from 'soapbox/features/event/components/pure-event-date.tsx'; import PureEventDate from 'soapbox/features/event/components/pure-event-date.tsx';
import { useAppSelector } from 'soapbox/hooks/useAppSelector.ts'; import { useAppSelector } from 'soapbox/hooks/useAppSelector.ts';
@ -15,6 +14,7 @@ import { useAppSelector } from 'soapbox/hooks/useAppSelector.ts';
import Icon from './icon.tsx'; import Icon from './icon.tsx';
import VerificationBadge from './verification-badge.tsx'; import VerificationBadge from './verification-badge.tsx';
import type { Status as StatusEntity } from 'soapbox/schemas/index.ts';
const messages = defineMessages({ const messages = defineMessages({
eventBanner: { id: 'event.banner', defaultMessage: 'Event banner' }, eventBanner: { id: 'event.banner', defaultMessage: 'Event banner' },
@ -23,7 +23,7 @@ const messages = defineMessages({
}); });
interface IPureEventPreview { interface IPureEventPreview {
status: EntityTypes[Entities.STATUSES]; status: StatusEntity;
className?: string; className?: string;
hideAction?: boolean; hideAction?: boolean;
floatingAction?: boolean; floatingAction?: boolean;

View File

@ -4,7 +4,7 @@ import { useState, useRef, useLayoutEffect, useMemo, memo } from 'react';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import Icon from 'soapbox/components/icon.tsx'; import Icon from 'soapbox/components/icon.tsx';
import { Entities, EntityTypes } from 'soapbox/entity-store/entities.ts'; import { Status as StatusEntity } from 'soapbox/schemas/index.ts';
import { isOnlyEmoji as _isOnlyEmoji } from 'soapbox/utils/only-emoji.ts'; import { isOnlyEmoji as _isOnlyEmoji } from 'soapbox/utils/only-emoji.ts';
import { getTextDirection } from 'soapbox/utils/rtl.ts'; import { getTextDirection } from 'soapbox/utils/rtl.ts';
@ -28,7 +28,7 @@ const ReadMoreButton: React.FC<IReadMoreButton> = ({ onClick }) => (
); );
interface IPureStatusContent { interface IPureStatusContent {
status: EntityTypes[Entities.STATUSES]; status: StatusEntity;
onClick?: () => void; onClick?: () => void;
collapsable?: boolean; collapsable?: boolean;
translatable?: boolean; translatable?: boolean;

View File

@ -6,11 +6,11 @@ import { FormattedMessage } from 'react-intl';
import LoadGap from 'soapbox/components/load-gap.tsx'; import LoadGap from 'soapbox/components/load-gap.tsx';
import PureStatus from 'soapbox/components/pure-status.tsx'; import PureStatus from 'soapbox/components/pure-status.tsx';
import ScrollableList from 'soapbox/components/scrollable-list.tsx'; import ScrollableList from 'soapbox/components/scrollable-list.tsx';
import { EntityTypes, Entities } from 'soapbox/entity-store/entities.ts';
import FeedSuggestions from 'soapbox/features/feed-suggestions/feed-suggestions.tsx'; import FeedSuggestions from 'soapbox/features/feed-suggestions/feed-suggestions.tsx';
import PlaceholderStatus from 'soapbox/features/placeholder/components/placeholder-status.tsx'; import PlaceholderStatus from 'soapbox/features/placeholder/components/placeholder-status.tsx';
import PendingStatus from 'soapbox/features/ui/components/pending-status.tsx'; import PendingStatus from 'soapbox/features/ui/components/pending-status.tsx';
import { useSoapboxConfig } from 'soapbox/hooks/useSoapboxConfig.ts'; import { useSoapboxConfig } from 'soapbox/hooks/useSoapboxConfig.ts';
import { Status as StatusEntity } from 'soapbox/schemas/index.ts';
import type { VirtuosoHandle } from 'react-virtuoso'; import type { VirtuosoHandle } from 'react-virtuoso';
import type { IScrollableList } from 'soapbox/components/scrollable-list.tsx'; import type { IScrollableList } from 'soapbox/components/scrollable-list.tsx';
@ -19,11 +19,11 @@ interface IPureStatusList extends Omit<IScrollableList, 'onLoadMore' | 'children
/** Unique key to preserve the scroll position when navigating back. */ /** Unique key to preserve the scroll position when navigating back. */
scrollKey: string; scrollKey: string;
/** List of statuses to display. */ /** List of statuses to display. */
statuses: readonly EntityTypes[Entities.STATUSES][]; statuses: readonly StatusEntity[];
/** Last _unfiltered_ status ID (maxId) for pagination. */ /** Last _unfiltered_ status ID (maxId) for pagination. */
lastStatusId?: string; lastStatusId?: string;
/** Pinned statuses to show at the top of the feed. */ /** Pinned statuses to show at the top of the feed. */
featuredStatuses?: readonly EntityTypes[Entities.STATUSES][]; featuredStatuses?: readonly StatusEntity[];
/** Pagination callback when the end of the list is reached. */ /** Pagination callback when the end of the list is reached. */
onLoadMore?: (lastStatusId: string) => void; onLoadMore?: (lastStatusId: string) => void;
/** Whether the data is currently being fetched. */ /** Whether the data is currently being fetched. */
@ -124,7 +124,7 @@ const PureStatusList: React.FC<IPureStatusList> = ({
); );
}; };
const renderStatus = (status: EntityTypes[Entities.STATUSES]) => { const renderStatus = (status: StatusEntity) => {
return ( return (
<PureStatus <PureStatus
status={status} status={status}

View File

@ -4,13 +4,12 @@ import { Link } from 'react-router-dom';
import { openModal } from 'soapbox/actions/modals.ts'; import { openModal } from 'soapbox/actions/modals.ts';
import HoverRefWrapper from 'soapbox/components/hover-ref-wrapper.tsx'; import HoverRefWrapper from 'soapbox/components/hover-ref-wrapper.tsx';
import HoverStatusWrapper from 'soapbox/components/hover-status-wrapper.tsx'; import HoverStatusWrapper from 'soapbox/components/hover-status-wrapper.tsx';
import { Entities, EntityTypes } from 'soapbox/entity-store/entities.ts';
import { useAppDispatch } from 'soapbox/hooks/useAppDispatch.ts'; import { useAppDispatch } from 'soapbox/hooks/useAppDispatch.ts';
import { Status as StatusEntity } from 'soapbox/schemas/index.ts';
import { shortenNostr } from 'soapbox/utils/nostr.ts'; import { shortenNostr } from 'soapbox/utils/nostr.ts';
interface IPureStatusReplyMentions { interface IPureStatusReplyMentions {
status: EntityTypes[Entities.STATUSES]; status: StatusEntity;
hoverable?: boolean; hoverable?: boolean;
} }

View File

@ -18,7 +18,6 @@ import Icon from 'soapbox/components/ui/icon.tsx';
import Stack from 'soapbox/components/ui/stack.tsx'; import Stack from 'soapbox/components/ui/stack.tsx';
import Text from 'soapbox/components/ui/text.tsx'; import Text from 'soapbox/components/ui/text.tsx';
import AccountContainer from 'soapbox/containers/account-container.tsx'; import AccountContainer from 'soapbox/containers/account-container.tsx';
import { EntityTypes, Entities } from 'soapbox/entity-store/entities.ts';
import QuotedStatus from 'soapbox/features/status/containers/quoted-status-container.tsx'; import QuotedStatus from 'soapbox/features/status/containers/quoted-status-container.tsx';
import { HotKeys } from 'soapbox/features/ui/components/hotkeys.tsx'; import { HotKeys } from 'soapbox/features/ui/components/hotkeys.tsx';
import { useAppDispatch } from 'soapbox/hooks/useAppDispatch.ts'; import { useAppDispatch } from 'soapbox/hooks/useAppDispatch.ts';
@ -29,7 +28,8 @@ import { useReplyCompose } from 'soapbox/hooks/useReplyCompose.ts';
import { useSettings } from 'soapbox/hooks/useSettings.ts'; import { useSettings } from 'soapbox/hooks/useSettings.ts';
import { useStatusHidden } from 'soapbox/hooks/useStatusHidden.ts'; import { useStatusHidden } from 'soapbox/hooks/useStatusHidden.ts';
import { normalizeStatus } from 'soapbox/normalizers/index.ts'; import { normalizeStatus } from 'soapbox/normalizers/index.ts';
import { Status } from 'soapbox/types/entities.ts'; import { Status as StatusEntity } from 'soapbox/schemas/index.ts';
import { Status as LegacyStatus } from 'soapbox/types/entities.ts';
import { emojifyText } from 'soapbox/utils/emojify.tsx'; import { emojifyText } from 'soapbox/utils/emojify.tsx';
import { defaultMediaVisibility, textForScreenReader, getActualStatus } from 'soapbox/utils/status.ts'; import { defaultMediaVisibility, textForScreenReader, getActualStatus } from 'soapbox/utils/status.ts';
@ -48,7 +48,7 @@ const messages = defineMessages({
export interface IPureStatus { export interface IPureStatus {
id?: string; id?: string;
avatarSize?: number; avatarSize?: number;
status: EntityTypes[Entities.STATUSES]; status: StatusEntity;
onClick?: () => void; onClick?: () => void;
muted?: boolean; muted?: boolean;
hidden?: boolean; hidden?: boolean;
@ -126,7 +126,7 @@ const PureStatus: React.FC<IPureStatus> = (props) => {
} }
}, [overlay.current]); }, [overlay.current]);
const statusImmutable = normalizeStatus(status) as Status; // TODO: remove this line, it will be removed once all components in this file are pure. const statusImmutable = normalizeStatus(status) as LegacyStatus; // TODO: remove this line, it will be removed once all components in this file are pure.
const handleToggleMediaVisibility = (): void => { const handleToggleMediaVisibility = (): void => {
setShowMedia(!showMedia); setShowMedia(!showMedia);

View File

@ -5,14 +5,14 @@ import { translateStatus, undoStatusTranslation } from 'soapbox/actions/statuses
import Button from 'soapbox/components/ui/button.tsx'; import Button from 'soapbox/components/ui/button.tsx';
import Stack from 'soapbox/components/ui/stack.tsx'; import Stack from 'soapbox/components/ui/stack.tsx';
import Text from 'soapbox/components/ui/text.tsx'; import Text from 'soapbox/components/ui/text.tsx';
import { Entities, EntityTypes } from 'soapbox/entity-store/entities.ts';
import { useAppDispatch } from 'soapbox/hooks/useAppDispatch.ts'; import { useAppDispatch } from 'soapbox/hooks/useAppDispatch.ts';
import { useAppSelector } from 'soapbox/hooks/useAppSelector.ts'; import { useAppSelector } from 'soapbox/hooks/useAppSelector.ts';
import { useFeatures } from 'soapbox/hooks/useFeatures.ts'; import { useFeatures } from 'soapbox/hooks/useFeatures.ts';
import { useInstance } from 'soapbox/hooks/useInstance.ts'; import { useInstance } from 'soapbox/hooks/useInstance.ts';
import { Status as StatusEntity } from 'soapbox/schemas/index.ts';
interface IPureTranslateButton { interface IPureTranslateButton {
status: EntityTypes[Entities.STATUSES]; status: StatusEntity;
} }
const PureTranslateButton: React.FC<IPureTranslateButton> = ({ status }) => { const PureTranslateButton: React.FC<IPureTranslateButton> = ({ status }) => {

View File

@ -7,8 +7,8 @@ import { useHistory } from 'react-router-dom';
import StatusMedia from 'soapbox/components/status-media.tsx'; import StatusMedia from 'soapbox/components/status-media.tsx';
import Stack from 'soapbox/components/ui/stack.tsx'; import Stack from 'soapbox/components/ui/stack.tsx';
import AccountContainer from 'soapbox/containers/account-container.tsx'; import AccountContainer from 'soapbox/containers/account-container.tsx';
import { Entities, EntityTypes } from 'soapbox/entity-store/entities.ts';
import { useSettings } from 'soapbox/hooks/useSettings.ts'; import { useSettings } from 'soapbox/hooks/useSettings.ts';
import { Status as StatusEntity } from 'soapbox/schemas/index.ts';
import { defaultMediaVisibility } from 'soapbox/utils/status.ts'; import { defaultMediaVisibility } from 'soapbox/utils/status.ts';
import EventPreview from './event-preview.tsx'; import EventPreview from './event-preview.tsx';
@ -18,7 +18,7 @@ import StatusContent from './status-content.tsx';
import StatusReplyMentions from './status-reply-mentions.tsx'; import StatusReplyMentions from './status-reply-mentions.tsx';
import SensitiveContentOverlay from './statuses/sensitive-content-overlay.tsx'; import SensitiveContentOverlay from './statuses/sensitive-content-overlay.tsx';
import type { Status as StatusEntity } from 'soapbox/types/entities.ts'; import type { Status as LegacyStatus } from 'soapbox/types/entities.ts';
const messages = defineMessages({ const messages = defineMessages({
cancel: { id: 'reply_indicator.cancel', defaultMessage: 'Cancel' }, cancel: { id: 'reply_indicator.cancel', defaultMessage: 'Cancel' },
@ -26,7 +26,7 @@ const messages = defineMessages({
interface IQuotedStatus { interface IQuotedStatus {
/** The quoted status entity. */ /** The quoted status entity. */
status?: StatusEntity; status?: LegacyStatus;
/** Callback when cancelled (during compose). */ /** Callback when cancelled (during compose). */
onCancel?: Function; onCancel?: Function;
/** Whether the status is shown in the post composer. */ /** Whether the status is shown in the post composer. */
@ -139,7 +139,7 @@ const QuotedStatus: React.FC<IQuotedStatus> = ({ status, onCancel, compose }) =>
{status.media_attachments.size > 0 && ( {status.media_attachments.size > 0 && (
<StatusMedia <StatusMedia
status={status.toJS() as EntityTypes[Entities.STATUSES]} status={status.toJS() as StatusEntity}
muted={compose} muted={compose}
showMedia={showMedia} showMedia={showMedia}
onToggleVisibility={handleToggleMediaVisibility} onToggleVisibility={handleToggleMediaVisibility}

View File

@ -49,20 +49,20 @@ import DropdownMenu from 'soapbox/components/dropdown-menu/index.ts';
import StatusActionButton from 'soapbox/components/status-action-button.tsx'; import StatusActionButton from 'soapbox/components/status-action-button.tsx';
import StatusReactionWrapper from 'soapbox/components/status-reaction-wrapper.tsx'; import StatusReactionWrapper from 'soapbox/components/status-reaction-wrapper.tsx';
import HStack from 'soapbox/components/ui/hstack.tsx'; import HStack from 'soapbox/components/ui/hstack.tsx';
import { Entities, EntityTypes } from 'soapbox/entity-store/entities.ts';
import { useAppDispatch } from 'soapbox/hooks/useAppDispatch.ts'; import { useAppDispatch } from 'soapbox/hooks/useAppDispatch.ts';
import { useAppSelector } from 'soapbox/hooks/useAppSelector.ts'; import { useAppSelector } from 'soapbox/hooks/useAppSelector.ts';
import { useFeatures } from 'soapbox/hooks/useFeatures.ts'; import { useFeatures } from 'soapbox/hooks/useFeatures.ts';
import { useOwnAccount } from 'soapbox/hooks/useOwnAccount.ts'; import { useOwnAccount } from 'soapbox/hooks/useOwnAccount.ts';
import { useSettings } from 'soapbox/hooks/useSettings.ts'; import { useSettings } from 'soapbox/hooks/useSettings.ts';
import { GroupRoles } from 'soapbox/schemas/group-member.ts'; import { GroupRoles } from 'soapbox/schemas/group-member.ts';
import { Status as StatusEntity } from 'soapbox/schemas/index.ts';
import toast from 'soapbox/toast.tsx'; import toast from 'soapbox/toast.tsx';
import copy from 'soapbox/utils/copy.ts'; import copy from 'soapbox/utils/copy.ts';
import GroupPopover from './groups/popover/group-popover.tsx'; import GroupPopover from './groups/popover/group-popover.tsx';
import type { Menu } from 'soapbox/components/dropdown-menu/index.ts'; import type { Menu } from 'soapbox/components/dropdown-menu/index.ts';
import type { Group, Status } from 'soapbox/types/entities.ts'; import type { Group, Status as LegacyStatus } from 'soapbox/types/entities.ts';
const messages = defineMessages({ const messages = defineMessages({
adminAccount: { id: 'status.admin_account', defaultMessage: 'Moderate @{name}' }, adminAccount: { id: 'status.admin_account', defaultMessage: 'Moderate @{name}' },
@ -141,7 +141,7 @@ const messages = defineMessages({
}); });
interface IStatusActionBar { interface IStatusActionBar {
status: Status; status: LegacyStatus;
expandable?: boolean; expandable?: boolean;
space?: 'sm' | 'md' | 'lg'; space?: 'sm' | 'md' | 'lg';
statusActionButtonTheme?: 'default' | 'inverse'; statusActionButtonTheme?: 'default' | 'inverse';
@ -827,7 +827,7 @@ const StatusActionBar: React.FC<IStatusActionBar> = ({
/> />
)} )}
<DropdownMenu items={menu} status={status.toJS() as EntityTypes[Entities.STATUSES]}> <DropdownMenu items={menu} status={status.toJS() as StatusEntity}>
<StatusActionButton <StatusActionButton
title={intl.formatMessage(messages.more)} title={intl.formatMessage(messages.more)}
icon={dotsIcon} icon={dotsIcon}

View File

@ -4,16 +4,15 @@ import { Suspense } from 'react';
import { openModal } from 'soapbox/actions/modals.ts'; import { openModal } from 'soapbox/actions/modals.ts';
import AttachmentThumbs from 'soapbox/components/attachment-thumbs.tsx'; import AttachmentThumbs from 'soapbox/components/attachment-thumbs.tsx';
import PreviewCard from 'soapbox/components/preview-card.tsx'; import PreviewCard from 'soapbox/components/preview-card.tsx';
import { Entities, EntityTypes } from 'soapbox/entity-store/entities.ts';
import { GroupLinkPreview } from 'soapbox/features/groups/components/group-link-preview.tsx'; import { GroupLinkPreview } from 'soapbox/features/groups/components/group-link-preview.tsx';
import PlaceholderCard from 'soapbox/features/placeholder/components/placeholder-card.tsx'; import PlaceholderCard from 'soapbox/features/placeholder/components/placeholder-card.tsx';
import { MediaGallery, Video, Audio } from 'soapbox/features/ui/util/async-components.ts'; import { MediaGallery, Video, Audio } from 'soapbox/features/ui/util/async-components.ts';
import { useAppDispatch } from 'soapbox/hooks/useAppDispatch.ts'; import { useAppDispatch } from 'soapbox/hooks/useAppDispatch.ts';
import { Attachment } from 'soapbox/schemas/index.ts'; import { Status as StatusEntity, Attachment } from 'soapbox/schemas/index.ts';
interface IStatusMedia { interface IStatusMedia {
/** Status entity to render media for. */ /** Status entity to render media for. */
status: EntityTypes[Entities.STATUSES]; status: StatusEntity;
/** Whether to display compact media. */ /** Whether to display compact media. */
muted?: boolean; muted?: boolean;
/** Callback when compact media is clicked. */ /** Callback when compact media is clicked. */

View File

@ -16,11 +16,11 @@ import Icon from 'soapbox/components/ui/icon.tsx';
import Stack from 'soapbox/components/ui/stack.tsx'; import Stack from 'soapbox/components/ui/stack.tsx';
import Text from 'soapbox/components/ui/text.tsx'; import Text from 'soapbox/components/ui/text.tsx';
import AccountContainer from 'soapbox/containers/account-container.tsx'; import AccountContainer from 'soapbox/containers/account-container.tsx';
import { Entities, EntityTypes } from 'soapbox/entity-store/entities.ts';
import QuotedStatus from 'soapbox/features/status/containers/quoted-status-container.tsx'; import QuotedStatus from 'soapbox/features/status/containers/quoted-status-container.tsx';
import { HotKeys } from 'soapbox/features/ui/components/hotkeys.tsx'; import { HotKeys } from 'soapbox/features/ui/components/hotkeys.tsx';
import { useAppDispatch } from 'soapbox/hooks/useAppDispatch.ts'; import { useAppDispatch } from 'soapbox/hooks/useAppDispatch.ts';
import { useSettings } from 'soapbox/hooks/useSettings.ts'; import { useSettings } from 'soapbox/hooks/useSettings.ts';
import { Status as StatusEntity } from 'soapbox/schemas/index.ts';
import { emojifyText } from 'soapbox/utils/emojify.tsx'; import { emojifyText } from 'soapbox/utils/emojify.tsx';
import { defaultMediaVisibility, textForScreenReader, getActualStatus } from 'soapbox/utils/status.ts'; import { defaultMediaVisibility, textForScreenReader, getActualStatus } from 'soapbox/utils/status.ts';
@ -33,7 +33,7 @@ import SensitiveContentOverlay from './statuses/sensitive-content-overlay.tsx';
import StatusInfo from './statuses/status-info.tsx'; import StatusInfo from './statuses/status-info.tsx';
import Tombstone from './tombstone.tsx'; import Tombstone from './tombstone.tsx';
import type { Status as StatusEntity } from 'soapbox/types/entities.ts'; import type { Status as LegacyStatus } from 'soapbox/types/entities.ts';
// Defined in components/scrollable-list // Defined in components/scrollable-list
export type ScrollPosition = { height: number; top: number }; export type ScrollPosition = { height: number; top: number };
@ -45,7 +45,7 @@ const messages = defineMessages({
export interface IStatus { export interface IStatus {
id?: string; id?: string;
avatarSize?: number; avatarSize?: number;
status: StatusEntity; status: LegacyStatus;
onClick?: () => void; onClick?: () => void;
muted?: boolean; muted?: boolean;
hidden?: boolean; hidden?: boolean;
@ -466,7 +466,7 @@ const Status: React.FC<IStatus> = (props) => {
{(quote || actualStatus.card || actualStatus.media_attachments.size > 0) && ( {(quote || actualStatus.card || actualStatus.media_attachments.size > 0) && (
<Stack space={4}> <Stack space={4}>
<StatusMedia <StatusMedia
status={actualStatus.toJS() as EntityTypes[Entities.STATUSES]} status={actualStatus.toJS() as StatusEntity}
muted={muted} muted={muted}
onClick={handleClick} onClick={handleClick}
showMedia={showMedia} showMedia={showMedia}

View File

@ -13,15 +13,14 @@ import DropdownMenu from 'soapbox/components/dropdown-menu/index.ts';
import Button from 'soapbox/components/ui/button.tsx'; import Button from 'soapbox/components/ui/button.tsx';
import HStack from 'soapbox/components/ui/hstack.tsx'; import HStack from 'soapbox/components/ui/hstack.tsx';
import Text from 'soapbox/components/ui/text.tsx'; import Text from 'soapbox/components/ui/text.tsx';
import { Entities, EntityTypes } from 'soapbox/entity-store/entities.ts';
import { useAppDispatch } from 'soapbox/hooks/useAppDispatch.ts'; import { useAppDispatch } from 'soapbox/hooks/useAppDispatch.ts';
import { useOwnAccount } from 'soapbox/hooks/useOwnAccount.ts'; import { useOwnAccount } from 'soapbox/hooks/useOwnAccount.ts';
import { useSettings } from 'soapbox/hooks/useSettings.ts'; import { useSettings } from 'soapbox/hooks/useSettings.ts';
import { useSoapboxConfig } from 'soapbox/hooks/useSoapboxConfig.ts'; import { useSoapboxConfig } from 'soapbox/hooks/useSoapboxConfig.ts';
import { Status as StatusEntity } from 'soapbox/schemas/index.ts';
import { emojifyText } from 'soapbox/utils/emojify.tsx'; import { emojifyText } from 'soapbox/utils/emojify.tsx';
import { defaultMediaVisibility } from 'soapbox/utils/status.ts'; import { defaultMediaVisibility } from 'soapbox/utils/status.ts';
const messages = defineMessages({ const messages = defineMessages({
delete: { id: 'status.delete', defaultMessage: 'Delete' }, delete: { id: 'status.delete', defaultMessage: 'Delete' },
deleteConfirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' }, deleteConfirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' },
@ -37,7 +36,7 @@ const messages = defineMessages({
}); });
interface IPureSensitiveContentOverlay { interface IPureSensitiveContentOverlay {
status: EntityTypes[Entities.STATUSES]; status: StatusEntity;
onToggleVisibility?(): void; onToggleVisibility?(): void;
visible?: boolean; visible?: boolean;
} }

View File

@ -9,10 +9,10 @@ import StatusContent from 'soapbox/components/status-content.tsx';
import StatusMedia from 'soapbox/components/status-media.tsx'; import StatusMedia from 'soapbox/components/status-media.tsx';
import HStack from 'soapbox/components/ui/hstack.tsx'; import HStack from 'soapbox/components/ui/hstack.tsx';
import Stack from 'soapbox/components/ui/stack.tsx'; import Stack from 'soapbox/components/ui/stack.tsx';
import { Entities, EntityTypes } from 'soapbox/entity-store/entities.ts';
import { useAppDispatch } from 'soapbox/hooks/useAppDispatch.ts'; import { useAppDispatch } from 'soapbox/hooks/useAppDispatch.ts';
import { Status as StatusEntity } from 'soapbox/schemas/index.ts';
import type { AdminReport, Status } from 'soapbox/types/entities.ts'; import type { AdminReport, Status as LegacyStatus } from 'soapbox/types/entities.ts';
const messages = defineMessages({ const messages = defineMessages({
viewStatus: { id: 'admin.reports.actions.view_status', defaultMessage: 'View post' }, viewStatus: { id: 'admin.reports.actions.view_status', defaultMessage: 'View post' },
@ -20,7 +20,7 @@ const messages = defineMessages({
}); });
interface IReportStatus { interface IReportStatus {
status: Status; status: LegacyStatus;
report?: AdminReport; report?: AdminReport;
} }
@ -53,7 +53,7 @@ const ReportStatus: React.FC<IReportStatus> = ({ status }) => {
<HStack space={2} alignItems='start'> <HStack space={2} alignItems='start'>
<Stack space={2} className='overflow-hidden' grow> <Stack space={2} className='overflow-hidden' grow>
<StatusContent status={status} /> <StatusContent status={status} />
<StatusMedia status={status.toJS() as EntityTypes[Entities.STATUSES]} /> <StatusMedia status={status.toJS() as StatusEntity} />
</Stack> </Stack>
<div className='flex-none'> <div className='flex-none'>

View File

@ -5,12 +5,12 @@ import AttachmentThumbs from 'soapbox/components/attachment-thumbs.tsx';
import Markup from 'soapbox/components/markup.tsx'; import Markup from 'soapbox/components/markup.tsx';
import Stack from 'soapbox/components/ui/stack.tsx'; import Stack from 'soapbox/components/ui/stack.tsx';
import AccountContainer from 'soapbox/containers/account-container.tsx'; import AccountContainer from 'soapbox/containers/account-container.tsx';
import { Entities, EntityTypes } from 'soapbox/entity-store/entities.ts'; import { Status as StatusEntity } from 'soapbox/schemas/index.ts';
import { getTextDirection } from 'soapbox/utils/rtl.ts'; import { getTextDirection } from 'soapbox/utils/rtl.ts';
interface IReplyIndicator { interface IReplyIndicator {
className?: string; className?: string;
status?: EntityTypes[Entities.STATUSES]; status?: StatusEntity;
onCancel?: () => void; onCancel?: () => void;
hideActions: boolean; hideActions: boolean;
} }

View File

@ -1,13 +1,14 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { cancelReplyCompose } from 'soapbox/actions/compose.ts'; import { cancelReplyCompose } from 'soapbox/actions/compose.ts';
import { Entities, EntityTypes } from 'soapbox/entity-store/entities.ts'; import { Status as StatusEntity } from 'soapbox/schemas/index.ts';
import { makeGetStatus } from 'soapbox/selectors/index.ts'; import { makeGetStatus } from 'soapbox/selectors/index.ts';
import ReplyIndicator from '../components/reply-indicator.tsx'; import ReplyIndicator from '../components/reply-indicator.tsx';
import type { AppDispatch, RootState } from 'soapbox/store.ts'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
import type { Status } from 'soapbox/types/entities.ts'; import type { Status as LegacyStatus } from 'soapbox/types/entities.ts';
const makeMapStateToProps = () => { const makeMapStateToProps = () => {
const getStatus = makeGetStatus(); const getStatus = makeGetStatus();
@ -17,7 +18,7 @@ const makeMapStateToProps = () => {
const editing = !!state.compose.get(composeId)?.id; const editing = !!state.compose.get(composeId)?.id;
return { return {
status: (getStatus(state, { id: statusId }) as Status)?.toJS() as EntityTypes[Entities.STATUSES], status: (getStatus(state, { id: statusId }) as LegacyStatus)?.toJS() as StatusEntity,
hideActions: editing, hideActions: editing,
}; };
}; };

View File

@ -5,9 +5,9 @@ import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
import { joinEvent, leaveEvent } from 'soapbox/actions/events.ts'; import { joinEvent, leaveEvent } from 'soapbox/actions/events.ts';
import { openModal } from 'soapbox/actions/modals.ts'; import { openModal } from 'soapbox/actions/modals.ts';
import Button from 'soapbox/components/ui/button.tsx'; import Button from 'soapbox/components/ui/button.tsx';
import { Entities, EntityTypes } from 'soapbox/entity-store/entities.ts';
import { useAppDispatch } from 'soapbox/hooks/useAppDispatch.ts'; import { useAppDispatch } from 'soapbox/hooks/useAppDispatch.ts';
import { useAppSelector } from 'soapbox/hooks/useAppSelector.ts'; import { useAppSelector } from 'soapbox/hooks/useAppSelector.ts';
import { Status as StatusEntity } from 'soapbox/schemas/index.ts';
import type { ButtonThemes } from 'soapbox/components/ui/useButtonStyles.ts'; import type { ButtonThemes } from 'soapbox/components/ui/useButtonStyles.ts';
@ -17,7 +17,7 @@ const messages = defineMessages({
}); });
interface IPureEventAction { interface IPureEventAction {
status: EntityTypes[Entities.STATUSES]; status: StatusEntity;
theme?: ButtonThemes; theme?: ButtonThemes;
} }

View File

@ -3,11 +3,10 @@ import { FormattedDate } from 'react-intl';
import Icon from 'soapbox/components/icon.tsx'; import Icon from 'soapbox/components/icon.tsx';
import HStack from 'soapbox/components/ui/hstack.tsx'; import HStack from 'soapbox/components/ui/hstack.tsx';
import { Entities, EntityTypes } from 'soapbox/entity-store/entities.ts'; import { Status as StatusEntity } from 'soapbox/schemas/index.ts';
interface IPureEventDate { interface IPureEventDate {
status: EntityTypes[Entities.STATUSES]; status: StatusEntity;
} }
const PureEventDate: React.FC<IPureEventDate> = ({ status }) => { const PureEventDate: React.FC<IPureEventDate> = ({ status }) => {

View File

@ -15,16 +15,16 @@ import HStack from 'soapbox/components/ui/hstack.tsx';
import Icon from 'soapbox/components/ui/icon.tsx'; import Icon from 'soapbox/components/ui/icon.tsx';
import Stack from 'soapbox/components/ui/stack.tsx'; import Stack from 'soapbox/components/ui/stack.tsx';
import Text from 'soapbox/components/ui/text.tsx'; import Text from 'soapbox/components/ui/text.tsx';
import { Entities, EntityTypes } from 'soapbox/entity-store/entities.ts';
import QuotedStatus from 'soapbox/features/status/containers/quoted-status-container.tsx'; import QuotedStatus from 'soapbox/features/status/containers/quoted-status-container.tsx';
import { useAppDispatch } from 'soapbox/hooks/useAppDispatch.ts'; import { useAppDispatch } from 'soapbox/hooks/useAppDispatch.ts';
import { useAppSelector } from 'soapbox/hooks/useAppSelector.ts'; import { useAppSelector } from 'soapbox/hooks/useAppSelector.ts';
import { useSettings } from 'soapbox/hooks/useSettings.ts'; import { useSettings } from 'soapbox/hooks/useSettings.ts';
import { useSoapboxConfig } from 'soapbox/hooks/useSoapboxConfig.ts'; import { useSoapboxConfig } from 'soapbox/hooks/useSoapboxConfig.ts';
import { Status as StatusEntity } from 'soapbox/schemas/index.ts';
import { makeGetStatus } from 'soapbox/selectors/index.ts'; import { makeGetStatus } from 'soapbox/selectors/index.ts';
import { defaultMediaVisibility } from 'soapbox/utils/status.ts'; import { defaultMediaVisibility } from 'soapbox/utils/status.ts';
import type { Status as StatusEntity } from 'soapbox/types/entities.ts'; import type { Status as StatusLegacy } from 'soapbox/types/entities.ts';
type RouteParams = { statusId: string }; type RouteParams = { statusId: string };
@ -36,7 +36,7 @@ const EventInformation: React.FC<IEventInformation> = ({ params }) => {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const getStatus = useCallback(makeGetStatus(), []); const getStatus = useCallback(makeGetStatus(), []);
const status = useAppSelector(state => getStatus(state, { id: params.statusId })) as StatusEntity; const status = useAppSelector(state => getStatus(state, { id: params.statusId })) as StatusLegacy;
const { tileServer } = useSoapboxConfig(); const { tileServer } = useSoapboxConfig();
const { displayMedia } = useSettings(); const { displayMedia } = useSettings();
@ -209,7 +209,7 @@ const EventInformation: React.FC<IEventInformation> = ({ params }) => {
)} )}
<StatusMedia <StatusMedia
status={status.toJS() as EntityTypes[Entities.STATUSES]} status={status.toJS() as StatusEntity}
showMedia={showMedia} showMedia={showMedia}
onToggleVisibility={handleToggleMediaVisibility} onToggleVisibility={handleToggleMediaVisibility}
/> />

View File

@ -16,19 +16,19 @@ import HStack from 'soapbox/components/ui/hstack.tsx';
import Icon from 'soapbox/components/ui/icon.tsx'; import Icon from 'soapbox/components/ui/icon.tsx';
import Stack from 'soapbox/components/ui/stack.tsx'; import Stack from 'soapbox/components/ui/stack.tsx';
import Text from 'soapbox/components/ui/text.tsx'; import Text from 'soapbox/components/ui/text.tsx';
import { Entities, EntityTypes } from 'soapbox/entity-store/entities.ts';
import QuotedStatus from 'soapbox/features/status/containers/quoted-status-container.tsx'; import QuotedStatus from 'soapbox/features/status/containers/quoted-status-container.tsx';
import { Status as StatusEntity } from 'soapbox/schemas/index.ts';
import { getActualStatus } from 'soapbox/utils/status.ts'; import { getActualStatus } from 'soapbox/utils/status.ts';
import StatusInteractionBar from './status-interaction-bar.tsx'; import StatusInteractionBar from './status-interaction-bar.tsx';
import type { Group, Status as StatusEntity } from 'soapbox/types/entities.ts'; import type { Group, Status as LegacyStatus } from 'soapbox/types/entities.ts';
interface IDetailedStatus { interface IDetailedStatus {
status: StatusEntity; status: LegacyStatus;
showMedia?: boolean; showMedia?: boolean;
withMedia?: boolean; withMedia?: boolean;
onOpenCompareHistoryModal: (status: StatusEntity) => void; onOpenCompareHistoryModal: (status: LegacyStatus) => void;
onToggleMediaVisibility: () => void; onToggleMediaVisibility: () => void;
} }
@ -163,7 +163,7 @@ const DetailedStatus: React.FC<IDetailedStatus> = ({
{(withMedia && (quote || actualStatus.card || actualStatus.media_attachments.size > 0)) && ( {(withMedia && (quote || actualStatus.card || actualStatus.media_attachments.size > 0)) && (
<Stack space={4}> <Stack space={4}>
<StatusMedia <StatusMedia
status={actualStatus.toJS() as EntityTypes[Entities.STATUSES]} status={actualStatus.toJS() as StatusEntity}
showMedia={showMedia} showMedia={showMedia}
onToggleVisibility={onToggleMediaVisibility} onToggleVisibility={onToggleMediaVisibility}
/> />

View File

@ -4,15 +4,15 @@ import { spring } from 'react-motion';
import HStack from 'soapbox/components/ui/hstack.tsx'; import HStack from 'soapbox/components/ui/hstack.tsx';
import SvgIcon from 'soapbox/components/ui/svg-icon.tsx'; import SvgIcon from 'soapbox/components/ui/svg-icon.tsx';
import { Entities, EntityTypes } from 'soapbox/entity-store/entities.ts';
import ReplyIndicator from 'soapbox/features/compose/components/reply-indicator.tsx'; import ReplyIndicator from 'soapbox/features/compose/components/reply-indicator.tsx';
import { Status as StatusEntity } from 'soapbox/schemas/index.ts';
import Motion from '../../util/optional-motion.tsx'; import Motion from '../../util/optional-motion.tsx';
import type { Menu, MenuItem } from 'soapbox/components/dropdown-menu/index.ts'; import type { Menu, MenuItem } from 'soapbox/components/dropdown-menu/index.ts';
interface IActionsModal { interface IActionsModal {
status: EntityTypes[Entities.STATUSES]; status: StatusEntity;
actions: Menu; actions: Menu;
onClick: () => void; onClick: () => void;
onClose: () => void; onClose: () => void;

View File

@ -5,10 +5,10 @@ import Icon from 'soapbox/components/icon.tsx';
import Modal from 'soapbox/components/ui/modal.tsx'; import Modal from 'soapbox/components/ui/modal.tsx';
import Stack from 'soapbox/components/ui/stack.tsx'; import Stack from 'soapbox/components/ui/stack.tsx';
import Text from 'soapbox/components/ui/text.tsx'; import Text from 'soapbox/components/ui/text.tsx';
import { Entities, EntityTypes } from 'soapbox/entity-store/entities.ts';
import ReplyIndicator from 'soapbox/features/compose/components/reply-indicator.tsx'; import ReplyIndicator from 'soapbox/features/compose/components/reply-indicator.tsx';
import { Status as StatusEntity } from 'soapbox/schemas/index.ts';
import type { Status as StatusEntity } from 'soapbox/types/entities.ts'; import type { Status as LegacyStatus } from 'soapbox/types/entities.ts';
const messages = defineMessages({ const messages = defineMessages({
cancel_reblog: { id: 'status.cancel_reblog_private', defaultMessage: 'Un-repost' }, cancel_reblog: { id: 'status.cancel_reblog_private', defaultMessage: 'Un-repost' },
@ -16,8 +16,8 @@ const messages = defineMessages({
}); });
interface IBoostModal { interface IBoostModal {
status: StatusEntity; status: LegacyStatus;
onReblog: (status: StatusEntity) => void; onReblog: (status: LegacyStatus) => void;
onClose: () => void; onClose: () => void;
} }
@ -38,7 +38,7 @@ const BoostModal: React.FC<IBoostModal> = ({ status, onReblog, onClose }) => {
confirmationText={intl.formatMessage(buttonText)} confirmationText={intl.formatMessage(buttonText)}
> >
<Stack space={4}> <Stack space={4}>
<ReplyIndicator status={status.toJS() as EntityTypes[Entities.STATUSES]} hideActions /> <ReplyIndicator status={status.toJS() as StatusEntity} hideActions />
<Text> <Text>
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */} {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}

View File

@ -19,7 +19,6 @@ import HStack from 'soapbox/components/ui/hstack.tsx';
import IconButton from 'soapbox/components/ui/icon-button.tsx'; import IconButton from 'soapbox/components/ui/icon-button.tsx';
import Icon from 'soapbox/components/ui/icon.tsx'; import Icon from 'soapbox/components/ui/icon.tsx';
import Stack from 'soapbox/components/ui/stack.tsx'; import Stack from 'soapbox/components/ui/stack.tsx';
import { Entities, EntityTypes } from 'soapbox/entity-store/entities.ts';
import Audio from 'soapbox/features/audio/index.tsx'; import Audio from 'soapbox/features/audio/index.tsx';
import PlaceholderStatus from 'soapbox/features/placeholder/components/placeholder-status.tsx'; import PlaceholderStatus from 'soapbox/features/placeholder/components/placeholder-status.tsx';
import Thread from 'soapbox/features/status/components/thread.tsx'; import Thread from 'soapbox/features/status/components/thread.tsx';
@ -27,8 +26,8 @@ import Video from 'soapbox/features/video/index.tsx';
import { useAppDispatch } from 'soapbox/hooks/useAppDispatch.ts'; import { useAppDispatch } from 'soapbox/hooks/useAppDispatch.ts';
import { userTouching } from 'soapbox/is-mobile.ts'; import { userTouching } from 'soapbox/is-mobile.ts';
import { normalizeStatus } from 'soapbox/normalizers/index.ts'; import { normalizeStatus } from 'soapbox/normalizers/index.ts';
import { Attachment } from 'soapbox/schemas/index.ts'; import { Status as StatusEntity, Attachment } from 'soapbox/schemas/index.ts';
import { Status } from 'soapbox/types/entities.ts'; import { Status as LegacyStatus } from 'soapbox/types/entities.ts';
import { getActualStatus } from 'soapbox/utils/status.ts'; import { getActualStatus } from 'soapbox/utils/status.ts';
import ImageLoader from '../image-loader.tsx'; import ImageLoader from '../image-loader.tsx';
@ -56,7 +55,7 @@ const containerStyle: React.CSSProperties = {
interface IMediaModal { interface IMediaModal {
media: readonly Attachment[]; media: readonly Attachment[];
status?: EntityTypes[Entities.STATUSES]; status?: StatusEntity;
index: number; index: number;
time?: number; time?: number;
onClose(): void; onClose(): void;
@ -343,7 +342,7 @@ const MediaModal: React.FC<IMediaModal> = (props) => {
className={clsx('absolute bottom-2 flex w-full transition-opacity', navigationHiddenClassName)} className={clsx('absolute bottom-2 flex w-full transition-opacity', navigationHiddenClassName)}
> >
<StatusActionBar <StatusActionBar
status={normalizeStatus(actualStatus) as Status} status={normalizeStatus(actualStatus) as LegacyStatus}
space='md' space='md'
statusActionButtonTheme='inverse' statusActionButtonTheme='inverse'
/> />
@ -361,7 +360,7 @@ const MediaModal: React.FC<IMediaModal> = (props) => {
} }
> >
<Thread <Thread
status={normalizeStatus(actualStatus) as Status} status={normalizeStatus(actualStatus) as LegacyStatus}
withMedia={false} withMedia={false}
useWindowScroll={false} useWindowScroll={false}
itemClassName='px-4' itemClassName='px-4'