kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Virtuoso Proof of Concept
rodzic
0aa74ba882
commit
a4df7f356a
|
@ -1,13 +1,16 @@
|
|||
import { OrderedSet as ImmutableOrderedSet } from 'immutable';
|
||||
import React from 'react';
|
||||
import { defineMessages, useIntl, FormattedMessage } from 'react-intl';
|
||||
import { defineMessages, useIntl } from 'react-intl';
|
||||
import { useDispatch } from 'react-redux';
|
||||
import { Virtuoso } from 'react-virtuoso';
|
||||
|
||||
import { importFetchedStatuses } from 'soapbox/actions/importer';
|
||||
import { expandTimelineSuccess } from 'soapbox/actions/timelines';
|
||||
import SubNavigation from 'soapbox/components/sub_navigation';
|
||||
import StatusContainer from 'soapbox/containers/status_container';
|
||||
import { useAppSelector } from 'soapbox/hooks';
|
||||
|
||||
import { Column } from '../../components/ui';
|
||||
import StatusListContainer from '../ui/containers/status_list_container';
|
||||
|
||||
const messages = defineMessages({
|
||||
title: { id: 'column.test', defaultMessage: 'Test timeline' },
|
||||
|
@ -26,11 +29,12 @@ const MOCK_STATUSES: any[] = [
|
|||
];
|
||||
|
||||
const timelineId = 'test';
|
||||
const onlyMedia = false;
|
||||
// const onlyMedia = false;
|
||||
|
||||
const TestTimeline: React.FC = () => {
|
||||
const intl = useIntl();
|
||||
const dispatch = useDispatch();
|
||||
const statusIds = useAppSelector((state) => state.timelines.getIn([timelineId, 'items'], ImmutableOrderedSet()));
|
||||
|
||||
React.useEffect(() => {
|
||||
dispatch(importFetchedStatuses(MOCK_STATUSES));
|
||||
|
@ -40,11 +44,13 @@ const TestTimeline: React.FC = () => {
|
|||
return (
|
||||
<Column label={intl.formatMessage(messages.title)} transparent>
|
||||
<SubNavigation message={intl.formatMessage(messages.title)} />
|
||||
<StatusListContainer
|
||||
scrollKey={`${timelineId}_timeline`}
|
||||
timelineId={`${timelineId}${onlyMedia ? ':media' : ''}`}
|
||||
emptyMessage={<FormattedMessage id='empty_column.test' defaultMessage='The test timeline is empty.' />}
|
||||
divideType='space'
|
||||
<Virtuoso
|
||||
useWindowScroll
|
||||
data={statusIds.toArray()}
|
||||
itemContent={(index, statusId) => (
|
||||
// @ts-ignore
|
||||
<StatusContainer id={statusId} />
|
||||
)}
|
||||
/>
|
||||
</Column>
|
||||
);
|
||||
|
|
|
@ -169,6 +169,7 @@
|
|||
"react-swipeable-views": "^0.14.0",
|
||||
"react-textarea-autosize": "^8.3.3",
|
||||
"react-toggle": "^4.0.1",
|
||||
"react-virtuoso": "^2.9.1",
|
||||
"redux": "^4.1.1",
|
||||
"redux-immutable": "^4.0.0",
|
||||
"redux-thunk": "^2.2.0",
|
||||
|
|
20
yarn.lock
20
yarn.lock
|
@ -2388,6 +2388,18 @@
|
|||
"@typescript-eslint/types" "5.15.0"
|
||||
eslint-visitor-keys "^3.0.0"
|
||||
|
||||
"@virtuoso.dev/react-urx@^0.2.12":
|
||||
version "0.2.13"
|
||||
resolved "https://registry.yarnpkg.com/@virtuoso.dev/react-urx/-/react-urx-0.2.13.tgz#e2cfc42d259d2a002695e7517d34cb97b64ee9c4"
|
||||
integrity sha512-MY0ugBDjFb5Xt8v2HY7MKcRGqw/3gTpMlLXId2EwQvYJoC8sP7nnXjAxcBtTB50KTZhO0SbzsFimaZ7pSdApwA==
|
||||
dependencies:
|
||||
"@virtuoso.dev/urx" "^0.2.13"
|
||||
|
||||
"@virtuoso.dev/urx@^0.2.12", "@virtuoso.dev/urx@^0.2.13":
|
||||
version "0.2.13"
|
||||
resolved "https://registry.yarnpkg.com/@virtuoso.dev/urx/-/urx-0.2.13.tgz#a65e7e8d923cb03397ac876bfdd45c7f71c8edf1"
|
||||
integrity sha512-iirJNv92A1ZWxoOHHDYW/1KPoi83939o83iUBQHIim0i3tMeSKEh+bxhJdTHQ86Mr4uXx9xGUTq69cp52ZP8Xw==
|
||||
|
||||
"@webassemblyjs/ast@1.11.1":
|
||||
version "1.11.1"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.11.1.tgz#2bfd767eae1a6996f432ff7e8d7fc75679c0b6a7"
|
||||
|
@ -8979,6 +8991,14 @@ react-transition-group@^2.2.1:
|
|||
prop-types "^15.6.2"
|
||||
react-lifecycles-compat "^3.0.4"
|
||||
|
||||
react-virtuoso@^2.9.1:
|
||||
version "2.9.1"
|
||||
resolved "https://registry.yarnpkg.com/react-virtuoso/-/react-virtuoso-2.9.1.tgz#9a4279824d07ea3e0ebd76be932f55f7244b10ad"
|
||||
integrity sha512-TtaCj0qGVCicti2o/ScN5Pqe7ARw6cAGQzd9vDcJcbS2ZpOWNe248Ifn+QP0lk92VP/ROgDwWajH1aEZz056Ow==
|
||||
dependencies:
|
||||
"@virtuoso.dev/react-urx" "^0.2.12"
|
||||
"@virtuoso.dev/urx" "^0.2.12"
|
||||
|
||||
react@^16.13.1:
|
||||
version "16.14.0"
|
||||
resolved "https://registry.yarnpkg.com/react/-/react-16.14.0.tgz#94d776ddd0aaa37da3eda8fc5b6b18a4c9a3114d"
|
||||
|
|
Ładowanie…
Reference in New Issue