refactor: rename NewStatusList and NewStatus to PureStatusList and PureStatus

This commit is contained in:
P. Reis 2024-12-02 18:14:13 -03:00
parent ffe99335e8
commit a9e31c0041
5 changed files with 24 additions and 11 deletions

View File

@ -3,7 +3,7 @@ import { useRef } from 'react';
import { VirtuosoHandle } from 'react-virtuoso';
import LoadGap from 'soapbox/components/load-gap.tsx';
import NewStatus from 'soapbox/components/new-status.tsx';
import PureStatus from 'soapbox/components/pure-status.tsx';
import ScrollableList, { IScrollableList } from 'soapbox/components/scrollable-list.tsx';
import StatusContainer from 'soapbox/containers/status-container.tsx';
import { EntityTypes, Entities } from 'soapbox/entity-store/entities.ts';
@ -12,7 +12,7 @@ import PendingStatus from 'soapbox/features/ui/components/pending-status.tsx';
import { useSoapboxConfig } from 'soapbox/hooks/useSoapboxConfig.ts';
interface INewStatusList extends Omit<IScrollableList, 'onLoadMore' | 'children'>{
interface IPureStatusList extends Omit<IScrollableList, 'onLoadMore' | 'children'>{
/** List of statuses to display. */
statuses: readonly EntityTypes[Entities.STATUSES][]|null;
/** Pinned statuses to show at the top of the feed. */
@ -26,7 +26,10 @@ interface INewStatusList extends Omit<IScrollableList, 'onLoadMore' | 'children'
[key: string]: any;
}
const NewStatusList: React.FC<INewStatusList> = ({
/**
* Feed of statuses, built atop ScrollableList.
*/
const PureStatusList: React.FC<IPureStatusList> = ({
statuses,
featuredStatusIds,
isLoading,
@ -85,7 +88,7 @@ const NewStatusList: React.FC<INewStatusList> = ({
const renderStatus = (status: EntityTypes[Entities.STATUSES]) => {
return (
<NewStatus
<PureStatus
status={status}
key={status.id}
id={status.id}
@ -197,4 +200,4 @@ const NewStatusList: React.FC<INewStatusList> = ({
);
};
export default NewStatusList;
export default PureStatusList;

View File

@ -44,7 +44,7 @@ const messages = defineMessages({
reblogged_by: { id: 'status.reblogged_by', defaultMessage: '{name} reposted' },
});
export interface INewStatus {
export interface IPureStatus {
id?: string;
avatarSize?: number;
status: EntityTypes[Entities.STATUSES];
@ -63,7 +63,10 @@ export interface INewStatus {
accountAction?: React.ReactElement;
}
const NewStatus: React.FC<INewStatus> = (props) => {
/**
* Status accepting the full status entity in pure format.
*/
const PureStatus: React.FC<IPureStatus> = (props) => {
const {
status,
accountAction,
@ -496,4 +499,4 @@ const NewStatus: React.FC<INewStatus> = (props) => {
);
};
export default NewStatus;
export default PureStatus;

View File

@ -44,7 +44,10 @@ interface IStatusList extends Omit<IScrollableList, 'onLoadMore' | 'children'> {
showGroup?: boolean;
}
/** Feed of statuses, built atop ScrollableList. */
/**
* Legacy Feed of statuses, built atop ScrollableList.
* @deprecated Use the PureStatusList component.
*/
const StatusList: React.FC<IStatusList> = ({
statusIds,
lastStatusId,

View File

@ -60,6 +60,10 @@ export interface IStatus {
accountAction?: React.ReactElement;
}
/**
* Legacy Status accepting a the full entity in immutable.
* @deprecated Use the PureStatus component.
*/
const Status: React.FC<IStatus> = (props) => {
const {
status,

View File

@ -4,8 +4,8 @@ import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
import { fetchBookmarkedStatuses, expandBookmarkedStatuses } from 'soapbox/actions/bookmarks.ts';
import { useBookmarks } from 'soapbox/api/hooks/index.ts';
import NewStatusList from 'soapbox/components/new-status-list.tsx';
import PullToRefresh from 'soapbox/components/pull-to-refresh.tsx';
import PureStatusList from 'soapbox/components/pure-status-list.tsx';
import { Column } from 'soapbox/components/ui/column.tsx';
import { useAppDispatch } from 'soapbox/hooks/useAppDispatch.ts';
import { useAppSelector } from 'soapbox/hooks/useAppSelector.ts';
@ -51,7 +51,7 @@ const Bookmarks: React.FC<IBookmarks> = ({ params }) => {
return (
<Column label={intl.formatMessage(messages.heading)} transparent>
<PullToRefresh onRefresh={handleRefresh}>
<NewStatusList
<PureStatusList
className='black:p-4 black:sm:p-5'
statuses={bookmarks}
scrollKey='bookmarked_statuses'