ScrollTopButton: restore `count` prop so it works in Notifications again

dnd
Alex Gleason 2022-06-03 12:38:54 -05:00
rodzic 6da72d874e
commit aad192d150
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
2 zmienionych plików z 5 dodań i 5 usunięć

Wyświetl plik

@ -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;

Wyświetl plik

@ -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}
/>