sforkowany z mirror/soapbox
ScrollTopButton: restore `count` prop so it works in Notifications again
rodzic
6da72d874e
commit
aad192d150
|
@ -5,12 +5,12 @@ import { useIntl, MessageDescriptor } from 'react-intl';
|
|||
|
||||
import Icon from 'soapbox/components/icon';
|
||||
import { Text } from 'soapbox/components/ui';
|
||||
import { useAppSelector, useSettings } from 'soapbox/hooks';
|
||||
import { useSettings } from 'soapbox/hooks';
|
||||
import { shortNumberFormat } from 'soapbox/utils/numbers';
|
||||
|
||||
interface IScrollTopButton {
|
||||
onClick: () => void,
|
||||
timelineId: string,
|
||||
count: number,
|
||||
message: MessageDescriptor,
|
||||
threshold?: number,
|
||||
autoloadThreshold?: number,
|
||||
|
@ -18,14 +18,13 @@ interface IScrollTopButton {
|
|||
|
||||
const ScrollTopButton: React.FC<IScrollTopButton> = ({
|
||||
onClick,
|
||||
timelineId,
|
||||
count,
|
||||
message,
|
||||
threshold = 400,
|
||||
autoloadThreshold = 50,
|
||||
}) => {
|
||||
const intl = useIntl();
|
||||
const settings = useSettings();
|
||||
const count = useAppSelector(state => state.timelines.getIn([timelineId, 'totalQueuedItemsCount']));
|
||||
|
||||
const [scrolled, setScrolled] = useState<boolean>(false);
|
||||
const autoload = settings.get('autoloadTimelines') === true;
|
||||
|
|
|
@ -31,6 +31,7 @@ const Timeline: React.FC<ITimeline> = ({
|
|||
const isLoading = useAppSelector(state => state.timelines.getIn([timelineId, 'isLoading'], true) === true);
|
||||
const isPartial = useAppSelector(state => state.timelines.getIn([timelineId, 'isPartial'], false) === true);
|
||||
const hasMore = useAppSelector(state => state.timelines.getIn([timelineId, 'hasMore']) === true);
|
||||
const totalQueuedItemsCount = useAppSelector(state => state.timelines.getIn([timelineId, 'totalQueuedItemsCount']));
|
||||
|
||||
const handleDequeueTimeline = () => {
|
||||
dispatch(dequeueTimeline(timelineId, onLoadMore));
|
||||
|
@ -49,7 +50,7 @@ const Timeline: React.FC<ITimeline> = ({
|
|||
<ScrollTopButton
|
||||
key='timeline-queue-button-header'
|
||||
onClick={handleDequeueTimeline}
|
||||
timelineId={timelineId}
|
||||
count={totalQueuedItemsCount}
|
||||
message={messages.queue}
|
||||
/>
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue