fix: Add K display for new logs count values over 1000

This commit is contained in:
TzeYiing
2022-04-20 18:57:52 +02:00
committed by Ziinc
parent d54a156a91
commit 7ed284fb7b
2 changed files with 9 additions and 1 deletions

View File

@@ -84,7 +84,7 @@ const PreviewFilterPanel: FC<Props> = ({
>
<div className="absolute z-20">
<Typography.Text style={{ fontSize: '0.6rem' }} className="opacity-80">
{newCount}
{newCount > 1000 ? `${Math.floor(newCount / 100) / 10}K` : newCount}
</Typography.Text>
</div>
<div className="bg-green-800 rounded-full w-full h-full animate-ping opacity-60"></div>

View File

@@ -93,3 +93,11 @@ test.todo('timestamp to/from filter value change')
// await screen.findByText('Custom')
// await screen.findByTitle(/Clear timestamp filter/)
// })
test('shortened count to K', async () => {
render(<PreviewFilterPanel newCount={1234} />)
await screen.findByText(/1\.2K/)
})