Shorten number for replies count

This commit is contained in:
Lim Chee Aun 2022-12-19 17:38:20 +08:00
parent 509c1d971e
commit 99357dc887

View file

@ -11,6 +11,7 @@ import { useSnapshot } from 'valtio';
import Icon from '../components/icon'; import Icon from '../components/icon';
import Loader from '../components/loader'; import Loader from '../components/loader';
import Status from '../components/status'; import Status from '../components/status';
import shortenNumber from '../utils/shorten-number';
import states from '../utils/states'; import states from '../utils/states';
import useTitle from '../utils/useTitle'; import useTitle from '../utils/useTitle';
@ -236,7 +237,10 @@ function StatusPage({ id }) {
{descendant && replies?.length > 0 && ( {descendant && replies?.length > 0 && (
<details class="replies" open={!hasManyStatuses}> <details class="replies" open={!hasManyStatuses}>
<summary hidden={!hasManyStatuses}> <summary hidden={!hasManyStatuses}>
{replies.length} repl{replies.length === 1 ? 'y' : 'ies'} <span title={replies.length}>
{shortenNumber(replies.length)}
</span>{' '}
repl{replies.length === 1 ? 'y' : 'ies'}
</summary> </summary>
<ul> <ul>
{replies.map((replyID) => ( {replies.map((replyID) => (