about summary refs log tree commit diff
path: root/src/components/PostControls/util.ts
diff options
context:
space:
mode:
authorSamuel Newman <mozzius@protonmail.com>2025-09-05 17:29:10 +0300
committerGitHub <noreply@github.com>2025-09-05 09:29:10 -0500
commit0c4b9080207b0ca35a85ffa1e4f6a67189314ac8 (patch)
tree959570602fda6123478665f0356721914781786b /src/components/PostControls/util.ts
parent457cd3d0fb4074401eb4df12a5d27fd7cc1387cc (diff)
downloadvoidsky-0c4b9080207b0ca35a85ffa1e4f6a67189314ac8.tar.zst
Simplify post number formatting (#8978)
* revert number formatting change

* use formatPostStatCount in repost web
Diffstat (limited to 'src/components/PostControls/util.ts')
-rw-r--r--src/components/PostControls/util.ts26
1 files changed, 1 insertions, 25 deletions
diff --git a/src/components/PostControls/util.ts b/src/components/PostControls/util.ts
index b8050a85a..c220cea39 100644
--- a/src/components/PostControls/util.ts
+++ b/src/components/PostControls/util.ts
@@ -1,5 +1,4 @@
 import {useCallback} from 'react'
-import {msg} from '@lingui/macro'
 import {useLingui} from '@lingui/react'
 
 /**
@@ -12,36 +11,13 @@ export function useFormatPostStatCount() {
 
   return useCallback(
     (postStatCount: number) => {
-      const isOver1k = postStatCount >= 1_000
       const isOver10k = postStatCount >= 10_000
-      const isOver1M = postStatCount >= 1_000_000
-      const formatted = i18n.number(postStatCount, {
+      return i18n.number(postStatCount, {
         notation: 'compact',
         maximumFractionDigits: isOver10k ? 0 : 1,
         // @ts-expect-error - roundingMode not in the types
         roundingMode: 'trunc',
       })
-      const count = formatted.replace(/\D+$/g, '')
-
-      if (isOver1M) {
-        return i18n._(
-          msg({
-            message: `${count}M`,
-            comment:
-              'For post statistics. Indicates a number in the millions. Please use the shortest format appropriate for your language.',
-          }),
-        )
-      } else if (isOver1k) {
-        return i18n._(
-          msg({
-            message: `${count}K`,
-            comment:
-              'For post statistics. Indicates a number in the thousands. Please use the shortest format appropriate for your language.',
-          }),
-        )
-      } else {
-        return count
-      }
     },
     [i18n],
   )