2022-04-14 12:46:07 -07:00
|
|
|
import React from 'react';
|
|
|
|
import { defineMessages, useIntl, FormattedMessage } from 'react-intl';
|
|
|
|
import { useDispatch } from 'react-redux';
|
|
|
|
|
|
|
|
import { importFetchedStatuses } from 'soapbox/actions/importer';
|
|
|
|
import { expandTimelineSuccess } from 'soapbox/actions/timelines';
|
2022-11-15 08:00:49 -08:00
|
|
|
import SubNavigation from 'soapbox/components/sub-navigation';
|
2022-04-14 12:46:07 -07:00
|
|
|
|
|
|
|
import { Column } from '../../components/ui';
|
2022-06-03 10:31:23 -07:00
|
|
|
import Timeline from '../ui/components/timeline';
|
2022-04-14 12:46:07 -07:00
|
|
|
|
|
|
|
const messages = defineMessages({
|
|
|
|
title: { id: 'column.test', defaultMessage: 'Test timeline' },
|
|
|
|
});
|
|
|
|
|
|
|
|
/**
|
|
|
|
* List of mock statuses to display in the timeline.
|
|
|
|
* These get embedded into the build, but only in this chunk, so it's okay.
|
|
|
|
*/
|
|
|
|
const MOCK_STATUSES: any[] = [
|
2022-08-18 11:23:34 -07:00
|
|
|
require('soapbox/__fixtures__/pleroma-status.json'),
|
2022-04-14 12:46:07 -07:00
|
|
|
require('soapbox/__fixtures__/pleroma-status-with-poll.json'),
|
|
|
|
require('soapbox/__fixtures__/pleroma-status-vertical-video-without-metadata.json'),
|
|
|
|
require('soapbox/__fixtures__/pleroma-status-with-poll-with-emojis.json'),
|
|
|
|
require('soapbox/__fixtures__/pleroma-quote-of-quote-post.json'),
|
|
|
|
require('soapbox/__fixtures__/truthsocial-status-with-external-video.json'),
|
2022-08-18 11:23:34 -07:00
|
|
|
require('soapbox/__fixtures__/truthsocial-status-in-moderation.json'),
|
2022-04-14 12:46:07 -07:00
|
|
|
];
|
|
|
|
|
|
|
|
const timelineId = 'test';
|
|
|
|
const onlyMedia = false;
|
|
|
|
|
|
|
|
const TestTimeline: React.FC = () => {
|
|
|
|
const intl = useIntl();
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
dispatch(importFetchedStatuses(MOCK_STATUSES));
|
|
|
|
dispatch(expandTimelineSuccess(timelineId, MOCK_STATUSES, null, false, false, false));
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
return (
|
2022-07-15 15:03:21 -07:00
|
|
|
<Column label={intl.formatMessage(messages.title)} transparent withHeader={false}>
|
2022-04-14 12:46:07 -07:00
|
|
|
<SubNavigation message={intl.formatMessage(messages.title)} />
|
2022-06-03 10:31:23 -07:00
|
|
|
<Timeline
|
2022-04-14 12:46:07 -07:00
|
|
|
scrollKey={`${timelineId}_timeline`}
|
|
|
|
timelineId={`${timelineId}${onlyMedia ? ':media' : ''}`}
|
|
|
|
emptyMessage={<FormattedMessage id='empty_column.test' defaultMessage='The test timeline is empty.' />}
|
|
|
|
divideType='space'
|
|
|
|
/>
|
|
|
|
</Column>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default TestTimeline;
|