sforkowany z mirror/soapbox
TimelineQueueButtonHeader --> ScrollTopButton
rodzic
2aa4b41528
commit
6da72d874e
|
@ -3,17 +3,17 @@ import React from 'react';
|
|||
import { defineMessages } from 'react-intl';
|
||||
|
||||
import { render, screen } from '../../jest/test-helpers';
|
||||
import TimelineQueueButtonHeader from '../timeline_queue_button_header';
|
||||
import ScrollTopButton from '../scroll-top-button';
|
||||
|
||||
const messages = defineMessages({
|
||||
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() => {
|
||||
render(
|
||||
<TimelineQueueButtonHeader
|
||||
key='timeline-queue-button-header'
|
||||
<ScrollTopButton
|
||||
key='scroll-top-button'
|
||||
onClick={() => {}} // eslint-disable-line react/jsx-no-bind
|
||||
timelineId='home'
|
||||
message={messages.queue}
|
||||
|
@ -24,8 +24,8 @@ describe('<TimelineQueueButtonHeader />', () => {
|
|||
expect(screen.queryAllByRole('link')).toHaveLength(0);
|
||||
|
||||
render(
|
||||
<TimelineQueueButtonHeader
|
||||
key='timeline-queue-button-header'
|
||||
<ScrollTopButton
|
||||
key='scroll-top-button'
|
||||
onClick={() => {}} // eslint-disable-line react/jsx-no-bind
|
||||
timelineId='home'
|
||||
message={messages.queue}
|
||||
|
@ -36,8 +36,8 @@ describe('<TimelineQueueButtonHeader />', () => {
|
|||
expect(screen.getByText(/Click to see\s+1\s+new post/, { hidden: true })).toBeInTheDocument();
|
||||
|
||||
render(
|
||||
<TimelineQueueButtonHeader
|
||||
key='timeline-queue-button-header'
|
||||
<ScrollTopButton
|
||||
key='scroll-top-button'
|
||||
onClick={() => {}} // eslint-disable-line react/jsx-no-bind
|
||||
timelineId='home'
|
||||
message={messages.queue}
|
|
@ -8,7 +8,7 @@ import { Text } from 'soapbox/components/ui';
|
|||
import { useAppSelector, useSettings } from 'soapbox/hooks';
|
||||
import { shortNumberFormat } from 'soapbox/utils/numbers';
|
||||
|
||||
interface ITimelineQueueButtonHeader {
|
||||
interface IScrollTopButton {
|
||||
onClick: () => void,
|
||||
timelineId: string,
|
||||
message: MessageDescriptor,
|
||||
|
@ -16,7 +16,7 @@ interface ITimelineQueueButtonHeader {
|
|||
autoloadThreshold?: number,
|
||||
}
|
||||
|
||||
const TimelineQueueButtonHeader: React.FC<ITimelineQueueButtonHeader> = ({
|
||||
const ScrollTopButton: React.FC<IScrollTopButton> = ({
|
||||
onClick,
|
||||
timelineId,
|
||||
message,
|
||||
|
@ -82,4 +82,4 @@ const TimelineQueueButtonHeader: React.FC<ITimelineQueueButtonHeader> = ({
|
|||
);
|
||||
};
|
||||
|
||||
export default TimelineQueueButtonHeader;
|
||||
export default ScrollTopButton;
|
|
@ -14,8 +14,8 @@ import {
|
|||
dequeueNotifications,
|
||||
} from 'soapbox/actions/notifications';
|
||||
import { getSettings } from 'soapbox/actions/settings';
|
||||
import ScrollTopButton from 'soapbox/components/scroll-top-button';
|
||||
import ScrollableList from 'soapbox/components/scrollable_list';
|
||||
import TimelineQueueButtonHeader from 'soapbox/components/timeline_queue_button_header';
|
||||
import { Column } from 'soapbox/components/ui';
|
||||
import PlaceholderNotification from 'soapbox/features/placeholder/components/placeholder_notification';
|
||||
|
||||
|
@ -195,7 +195,7 @@ class Notifications extends React.PureComponent {
|
|||
return (
|
||||
<Column ref={this.setColumnRef} label={intl.formatMessage(messages.title)} withHeader={false}>
|
||||
{filterBarContainer}
|
||||
<TimelineQueueButtonHeader
|
||||
<ScrollTopButton
|
||||
onClick={this.handleDequeueNotifications}
|
||||
count={totalQueuedNotificationsCount}
|
||||
message={messages.queue}
|
||||
|
|
|
@ -5,8 +5,8 @@ import { defineMessages } from 'react-intl';
|
|||
|
||||
import { dequeueTimeline } 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 TimelineQueueButtonHeader from 'soapbox/components/timeline_queue_button_header';
|
||||
import { useAppSelector, useAppDispatch } from 'soapbox/hooks';
|
||||
import { makeGetStatusIds } from 'soapbox/selectors';
|
||||
|
||||
|
@ -46,7 +46,7 @@ const Timeline: React.FC<ITimeline> = ({
|
|||
|
||||
return (
|
||||
<>
|
||||
<TimelineQueueButtonHeader
|
||||
<ScrollTopButton
|
||||
key='timeline-queue-button-header'
|
||||
onClick={handleDequeueTimeline}
|
||||
timelineId={timelineId}
|
||||
|
|
Ładowanie…
Reference in New Issue