TimelineQueueButtonHeader --> ScrollTopButton

This commit is contained in:
Alex Gleason 2022-06-03 12:34:30 -05:00
parent 2aa4b41528
commit 6da72d874e
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
4 changed files with 15 additions and 15 deletions

View file

@ -3,17 +3,17 @@ import React from 'react';
import { defineMessages } from 'react-intl'; import { defineMessages } from 'react-intl';
import { render, screen } from '../../jest/test-helpers'; import { render, screen } from '../../jest/test-helpers';
import TimelineQueueButtonHeader from '../timeline_queue_button_header'; import ScrollTopButton from '../scroll-top-button';
const messages = defineMessages({ const messages = defineMessages({
queue: { id: 'status_list.queue_label', defaultMessage: 'Click to see {count} new {count, plural, one {post} other {posts}}' }, queue: { id: 'status_list.queue_label', defaultMessage: 'Click to see {count} new {count, plural, one {post} other {posts}}' },
}); });
describe('<TimelineQueueButtonHeader />', () => { describe('<ScrollTopButton />', () => {
it('renders correctly', async() => { it('renders correctly', async() => {
render( render(
<TimelineQueueButtonHeader <ScrollTopButton
key='timeline-queue-button-header' key='scroll-top-button'
onClick={() => {}} // eslint-disable-line react/jsx-no-bind onClick={() => {}} // eslint-disable-line react/jsx-no-bind
timelineId='home' timelineId='home'
message={messages.queue} message={messages.queue}
@ -24,8 +24,8 @@ describe('<TimelineQueueButtonHeader />', () => {
expect(screen.queryAllByRole('link')).toHaveLength(0); expect(screen.queryAllByRole('link')).toHaveLength(0);
render( render(
<TimelineQueueButtonHeader <ScrollTopButton
key='timeline-queue-button-header' key='scroll-top-button'
onClick={() => {}} // eslint-disable-line react/jsx-no-bind onClick={() => {}} // eslint-disable-line react/jsx-no-bind
timelineId='home' timelineId='home'
message={messages.queue} message={messages.queue}
@ -36,8 +36,8 @@ describe('<TimelineQueueButtonHeader />', () => {
expect(screen.getByText(/Click to see\s+1\s+new post/, { hidden: true })).toBeInTheDocument(); expect(screen.getByText(/Click to see\s+1\s+new post/, { hidden: true })).toBeInTheDocument();
render( render(
<TimelineQueueButtonHeader <ScrollTopButton
key='timeline-queue-button-header' key='scroll-top-button'
onClick={() => {}} // eslint-disable-line react/jsx-no-bind onClick={() => {}} // eslint-disable-line react/jsx-no-bind
timelineId='home' timelineId='home'
message={messages.queue} message={messages.queue}

View file

@ -8,7 +8,7 @@ import { Text } from 'soapbox/components/ui';
import { useAppSelector, useSettings } from 'soapbox/hooks'; import { useAppSelector, useSettings } from 'soapbox/hooks';
import { shortNumberFormat } from 'soapbox/utils/numbers'; import { shortNumberFormat } from 'soapbox/utils/numbers';
interface ITimelineQueueButtonHeader { interface IScrollTopButton {
onClick: () => void, onClick: () => void,
timelineId: string, timelineId: string,
message: MessageDescriptor, message: MessageDescriptor,
@ -16,7 +16,7 @@ interface ITimelineQueueButtonHeader {
autoloadThreshold?: number, autoloadThreshold?: number,
} }
const TimelineQueueButtonHeader: React.FC<ITimelineQueueButtonHeader> = ({ const ScrollTopButton: React.FC<IScrollTopButton> = ({
onClick, onClick,
timelineId, timelineId,
message, message,
@ -82,4 +82,4 @@ const TimelineQueueButtonHeader: React.FC<ITimelineQueueButtonHeader> = ({
); );
}; };
export default TimelineQueueButtonHeader; export default ScrollTopButton;

View file

@ -14,8 +14,8 @@ import {
dequeueNotifications, dequeueNotifications,
} from 'soapbox/actions/notifications'; } from 'soapbox/actions/notifications';
import { getSettings } from 'soapbox/actions/settings'; import { getSettings } from 'soapbox/actions/settings';
import ScrollTopButton from 'soapbox/components/scroll-top-button';
import ScrollableList from 'soapbox/components/scrollable_list'; import ScrollableList from 'soapbox/components/scrollable_list';
import TimelineQueueButtonHeader from 'soapbox/components/timeline_queue_button_header';
import { Column } from 'soapbox/components/ui'; import { Column } from 'soapbox/components/ui';
import PlaceholderNotification from 'soapbox/features/placeholder/components/placeholder_notification'; import PlaceholderNotification from 'soapbox/features/placeholder/components/placeholder_notification';
@ -195,7 +195,7 @@ class Notifications extends React.PureComponent {
return ( return (
<Column ref={this.setColumnRef} label={intl.formatMessage(messages.title)} withHeader={false}> <Column ref={this.setColumnRef} label={intl.formatMessage(messages.title)} withHeader={false}>
{filterBarContainer} {filterBarContainer}
<TimelineQueueButtonHeader <ScrollTopButton
onClick={this.handleDequeueNotifications} onClick={this.handleDequeueNotifications}
count={totalQueuedNotificationsCount} count={totalQueuedNotificationsCount}
message={messages.queue} message={messages.queue}

View file

@ -5,8 +5,8 @@ import { defineMessages } from 'react-intl';
import { dequeueTimeline } from 'soapbox/actions/timelines'; import { dequeueTimeline } from 'soapbox/actions/timelines';
import { scrollTopTimeline } from 'soapbox/actions/timelines'; import { scrollTopTimeline } from 'soapbox/actions/timelines';
import ScrollTopButton from 'soapbox/components/scroll-top-button';
import StatusList, { IStatusList } from 'soapbox/components/status_list'; import StatusList, { IStatusList } from 'soapbox/components/status_list';
import TimelineQueueButtonHeader from 'soapbox/components/timeline_queue_button_header';
import { useAppSelector, useAppDispatch } from 'soapbox/hooks'; import { useAppSelector, useAppDispatch } from 'soapbox/hooks';
import { makeGetStatusIds } from 'soapbox/selectors'; import { makeGetStatusIds } from 'soapbox/selectors';
@ -46,7 +46,7 @@ const Timeline: React.FC<ITimeline> = ({
return ( return (
<> <>
<TimelineQueueButtonHeader <ScrollTopButton
key='timeline-queue-button-header' key='timeline-queue-button-header'
onClick={handleDequeueTimeline} onClick={handleDequeueTimeline}
timelineId={timelineId} timelineId={timelineId}