sforkowany z mirror/soapbox
TimelineQueueButtonHeader: use shortNumberFormat
rodzic
973d3064b5
commit
606d6297a8
|
@ -33,7 +33,7 @@ describe('<TimelineQueueButtonHeader />', () => {
|
||||||
undefined,
|
undefined,
|
||||||
{ timelines: fromJS({ home: { totalQueuedItemsCount: 1 } }) },
|
{ timelines: fromJS({ home: { totalQueuedItemsCount: 1 } }) },
|
||||||
);
|
);
|
||||||
expect(screen.getByText('Click to see 1 new post', { hidden: true })).toBeInTheDocument();
|
expect(screen.getByText(/Click to see\s+1\s+new post/, { hidden: true })).toBeInTheDocument();
|
||||||
|
|
||||||
render(
|
render(
|
||||||
<TimelineQueueButtonHeader
|
<TimelineQueueButtonHeader
|
||||||
|
@ -45,6 +45,6 @@ describe('<TimelineQueueButtonHeader />', () => {
|
||||||
undefined,
|
undefined,
|
||||||
{ timelines: fromJS({ home: { totalQueuedItemsCount: 9999999 } }) },
|
{ timelines: fromJS({ home: { totalQueuedItemsCount: 9999999 } }) },
|
||||||
);
|
);
|
||||||
expect(screen.getByText('Click to see 9999999 new posts', { hidden: true })).toBeInTheDocument();
|
expect(screen.getByText(/10.*M/, { hidden: true })).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,6 +6,7 @@ import { useIntl, MessageDescriptor } from 'react-intl';
|
||||||
import Icon from 'soapbox/components/icon';
|
import Icon from 'soapbox/components/icon';
|
||||||
import { Text } from 'soapbox/components/ui';
|
import { Text } from 'soapbox/components/ui';
|
||||||
import { useAppSelector, useSettings } from 'soapbox/hooks';
|
import { useAppSelector, useSettings } from 'soapbox/hooks';
|
||||||
|
import { shortNumberFormat } from 'soapbox/utils/numbers';
|
||||||
|
|
||||||
interface ITimelineQueueButtonHeader {
|
interface ITimelineQueueButtonHeader {
|
||||||
onClick: () => void,
|
onClick: () => void,
|
||||||
|
@ -73,7 +74,7 @@ const TimelineQueueButtonHeader: React.FC<ITimelineQueueButtonHeader> = ({
|
||||||
|
|
||||||
{(count > 0) && (
|
{(count > 0) && (
|
||||||
<Text theme='inherit' size='sm'>
|
<Text theme='inherit' size='sm'>
|
||||||
{intl.formatMessage(message, { count })}
|
{intl.formatMessage(message, { count: shortNumberFormat(count) })}
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
</a>
|
</a>
|
||||||
|
|
Ładowanie…
Reference in New Issue