/
githubmirror
/
tldraw
Обзор
Документация
Войти
/
githubmirror
/
tldraw
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/commenting/src/ui/reply-count.ts
16 строк
685 B
Jessica Claire Edwards
feat: commenting (#9471)
30 июл 2026, 14:08
Не верифицирован
30 июл 2026, 14:08
584d9b1
Код
Авторство
О чём код?
import { useTranslation } from 'tldraw' /** * The localized "N replies" label (e.g. "1 reply", "3 replies") for a thread with `replyCount` * replies — the comments after the opening one. Returns null when there are none, so callers render * nothing rather than "0 replies". Shared by the sidebar row and the hover preview so both read the * same, with each site owning where it puts the text. */ export function replyCountLabel( msg: ReturnType<typeof useTranslation>, replyCount: number ): string | null { if (replyCount <= 0) return null const key = replyCount === 1 ? 'comments.replies-one' : 'comments.replies' return msg(key).replace('{count}', String(replyCount)) }