refactor: rename NewStatusList and NewStatus to PureStatusList and PureStatus
This commit is contained in:
parent
ffe99335e8
commit
a9e31c0041
|
@ -3,7 +3,7 @@ import { useRef } from 'react';
|
||||||
import { VirtuosoHandle } from 'react-virtuoso';
|
import { VirtuosoHandle } from 'react-virtuoso';
|
||||||
|
|
||||||
import LoadGap from 'soapbox/components/load-gap.tsx';
|
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 ScrollableList, { IScrollableList } from 'soapbox/components/scrollable-list.tsx';
|
||||||
import StatusContainer from 'soapbox/containers/status-container.tsx';
|
import StatusContainer from 'soapbox/containers/status-container.tsx';
|
||||||
import { EntityTypes, Entities } from 'soapbox/entity-store/entities.ts';
|
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';
|
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. */
|
/** List of statuses to display. */
|
||||||
statuses: readonly EntityTypes[Entities.STATUSES][]|null;
|
statuses: readonly EntityTypes[Entities.STATUSES][]|null;
|
||||||
/** Pinned statuses to show at the top of the feed. */
|
/** Pinned statuses to show at the top of the feed. */
|
||||||
|
@ -26,7 +26,10 @@ interface INewStatusList extends Omit<IScrollableList, 'onLoadMore' | 'children'
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
const NewStatusList: React.FC<INewStatusList> = ({
|
/**
|
||||||
|
* Feed of statuses, built atop ScrollableList.
|
||||||
|
*/
|
||||||
|
const PureStatusList: React.FC<IPureStatusList> = ({
|
||||||
statuses,
|
statuses,
|
||||||
featuredStatusIds,
|
featuredStatusIds,
|
||||||
isLoading,
|
isLoading,
|
||||||
|
@ -85,7 +88,7 @@ const NewStatusList: React.FC<INewStatusList> = ({
|
||||||
|
|
||||||
const renderStatus = (status: EntityTypes[Entities.STATUSES]) => {
|
const renderStatus = (status: EntityTypes[Entities.STATUSES]) => {
|
||||||
return (
|
return (
|
||||||
<NewStatus
|
<PureStatus
|
||||||
status={status}
|
status={status}
|
||||||
key={status.id}
|
key={status.id}
|
||||||
id={status.id}
|
id={status.id}
|
||||||
|
@ -197,4 +200,4 @@ const NewStatusList: React.FC<INewStatusList> = ({
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default NewStatusList;
|
export default PureStatusList;
|
|
@ -44,7 +44,7 @@ const messages = defineMessages({
|
||||||
reblogged_by: { id: 'status.reblogged_by', defaultMessage: '{name} reposted' },
|
reblogged_by: { id: 'status.reblogged_by', defaultMessage: '{name} reposted' },
|
||||||
});
|
});
|
||||||
|
|
||||||
export interface INewStatus {
|
export interface IPureStatus {
|
||||||
id?: string;
|
id?: string;
|
||||||
avatarSize?: number;
|
avatarSize?: number;
|
||||||
status: EntityTypes[Entities.STATUSES];
|
status: EntityTypes[Entities.STATUSES];
|
||||||
|
@ -63,7 +63,10 @@ export interface INewStatus {
|
||||||
accountAction?: React.ReactElement;
|
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 {
|
const {
|
||||||
status,
|
status,
|
||||||
accountAction,
|
accountAction,
|
||||||
|
@ -496,4 +499,4 @@ const NewStatus: React.FC<INewStatus> = (props) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default NewStatus;
|
export default PureStatus;
|
|
@ -44,7 +44,10 @@ interface IStatusList extends Omit<IScrollableList, 'onLoadMore' | 'children'> {
|
||||||
showGroup?: boolean;
|
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> = ({
|
const StatusList: React.FC<IStatusList> = ({
|
||||||
statusIds,
|
statusIds,
|
||||||
lastStatusId,
|
lastStatusId,
|
||||||
|
|
|
@ -60,6 +60,10 @@ export interface IStatus {
|
||||||
accountAction?: React.ReactElement;
|
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: React.FC<IStatus> = (props) => {
|
||||||
const {
|
const {
|
||||||
status,
|
status,
|
||||||
|
|
|
@ -4,8 +4,8 @@ import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
||||||
|
|
||||||
import { fetchBookmarkedStatuses, expandBookmarkedStatuses } from 'soapbox/actions/bookmarks.ts';
|
import { fetchBookmarkedStatuses, expandBookmarkedStatuses } from 'soapbox/actions/bookmarks.ts';
|
||||||
import { useBookmarks } from 'soapbox/api/hooks/index.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 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 { Column } from 'soapbox/components/ui/column.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';
|
||||||
|
@ -51,7 +51,7 @@ const Bookmarks: React.FC<IBookmarks> = ({ params }) => {
|
||||||
return (
|
return (
|
||||||
<Column label={intl.formatMessage(messages.heading)} transparent>
|
<Column label={intl.formatMessage(messages.heading)} transparent>
|
||||||
<PullToRefresh onRefresh={handleRefresh}>
|
<PullToRefresh onRefresh={handleRefresh}>
|
||||||
<NewStatusList
|
<PureStatusList
|
||||||
className='black:p-4 black:sm:p-5'
|
className='black:p-4 black:sm:p-5'
|
||||||
statuses={bookmarks}
|
statuses={bookmarks}
|
||||||
scrollKey='bookmarked_statuses'
|
scrollKey='bookmarked_statuses'
|
||||||
|
|
Loading…
Reference in New Issue