nicolium: experimental timelines: account timeline
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
@ -16,6 +16,7 @@ import { useFeatures } from '@/hooks/use-features';
|
||||
import { useAccounts } from '@/queries/accounts/use-accounts';
|
||||
import { type SelectedStatus, useStatus } from '@/queries/statuses/use-status';
|
||||
import {
|
||||
useAccountTimeline,
|
||||
useAntennaTimeline,
|
||||
useBubbleTimeline,
|
||||
useCircleTimeline,
|
||||
@ -364,6 +365,20 @@ const WrenchedTimelineColumn = () => {
|
||||
return <Timeline query={timelineQuery} contextType='public' />;
|
||||
};
|
||||
|
||||
interface IAccountTimelineColumn {
|
||||
accountId: string;
|
||||
excludeReplies?: boolean;
|
||||
}
|
||||
|
||||
const AccountTimelineColumn: React.FC<IAccountTimelineColumn> = ({
|
||||
accountId,
|
||||
excludeReplies = false,
|
||||
}) => {
|
||||
const timelineQuery = useAccountTimeline(accountId, { exclude_replies: excludeReplies });
|
||||
|
||||
return <Timeline query={timelineQuery} contextType='public' />;
|
||||
};
|
||||
|
||||
export {
|
||||
HomeTimelineColumn,
|
||||
PublicTimelineColumn,
|
||||
@ -375,4 +390,5 @@ export {
|
||||
AntennaTimelineColumn,
|
||||
CircleTimelineColumn,
|
||||
WrenchedTimelineColumn,
|
||||
AccountTimelineColumn,
|
||||
};
|
||||
|
||||
@ -2,6 +2,7 @@ import React, { useEffect } from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
|
||||
import { fetchAccountTimeline } from '@/actions/timelines';
|
||||
import { AccountTimelineColumn } from '@/columns/timeline';
|
||||
import MissingIndicator from '@/components/missing-indicator';
|
||||
import StatusList from '@/components/statuses/status-list';
|
||||
import Card, { CardBody } from '@/components/ui/card';
|
||||
@ -12,6 +13,7 @@ import { useAppDispatch } from '@/hooks/use-app-dispatch';
|
||||
import { useAppSelector } from '@/hooks/use-app-selector';
|
||||
import { useFeatures } from '@/hooks/use-features';
|
||||
import { useAccountLookup } from '@/queries/accounts/use-account-lookup';
|
||||
import { usePinnedStatuses } from '@/queries/status-lists/use-pinned-statuses';
|
||||
import { makeGetStatusIds } from '@/selectors';
|
||||
import { useSettings } from '@/stores/settings';
|
||||
|
||||
@ -32,12 +34,7 @@ const AccountTimelinePage: React.FC = () => {
|
||||
const statusIds = useAppSelector((state) =>
|
||||
getStatusIds(state, { type: `account:${path}`, prefix: 'account_timeline' }),
|
||||
);
|
||||
const featuredStatusIds = useAppSelector((state) =>
|
||||
getStatusIds(state, {
|
||||
type: `account:${account?.id}:with_replies:pinned`,
|
||||
prefix: 'account_timeline',
|
||||
}),
|
||||
);
|
||||
const { data: featuredStatusIds } = usePinnedStatuses(account?.id || '');
|
||||
|
||||
const isBlocked = account?.relationship?.blocked_by && !features.blockersVisible;
|
||||
const isLoading = useAppSelector((state) => state.timelines[`account:${path}`]?.isLoading);
|
||||
@ -83,7 +80,13 @@ const AccountTimelinePage: React.FC = () => {
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
return settings.experimentalTimeline ? (
|
||||
<AccountTimelineColumn
|
||||
accountId={account.id}
|
||||
excludeReplies={withReplies}
|
||||
// featuredStatusIds={showPins ? featuredStatusIds : undefined}
|
||||
/>
|
||||
) : (
|
||||
<StatusList
|
||||
timelineId={`account:${path}`}
|
||||
scrollKey='account_timeline'
|
||||
|
||||
@ -5,6 +5,7 @@ import { useTimeline } from './use-timeline';
|
||||
import type {
|
||||
AntennaTimelineParams,
|
||||
BubbleTimelineParams,
|
||||
GetAccountStatusesParams,
|
||||
GetCircleStatusesParams,
|
||||
GroupTimelineParams,
|
||||
HashtagTimelineParams,
|
||||
@ -142,6 +143,22 @@ const useWrenchedTimeline = (params?: Omit<WrenchedTimelineParams, keyof Paginat
|
||||
);
|
||||
};
|
||||
|
||||
const useAccountTimeline = (
|
||||
accountId: string,
|
||||
params?: Omit<GetAccountStatusesParams, keyof PaginationParams>,
|
||||
) => {
|
||||
const client = useClient();
|
||||
|
||||
return useTimeline(
|
||||
`account:${accountId}${params?.exclude_replies ? ':exclude_replies' : ''}`,
|
||||
(paginationParams) =>
|
||||
client.accounts.getAccountStatuses(accountId, {
|
||||
...params,
|
||||
...paginationParams,
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
||||
export {
|
||||
useHomeTimeline,
|
||||
usePublicTimeline,
|
||||
@ -153,4 +170,5 @@ export {
|
||||
useAntennaTimeline,
|
||||
useCircleTimeline,
|
||||
useWrenchedTimeline,
|
||||
useAccountTimeline,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user