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

This commit is contained in:
TzeYiing authored and Ziinc committed 2022-04-27 14:14:31 +02:00
1 parent d54a156a91
commit 7ed284fb7b
2 files changed
+9 -1

No files matched your search

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