From 0ae52e91ceaf1af41f12bfa6e76c7d719be5e0e5 Mon Sep 17 00:00:00 2001
From: Eric Bailey <git@esb.lol>
Date: Wed, 19 Jul 2023 12:16:57 -0500
Subject: #984 Updating `indexedAt` timestamps (#1024)

* add TimeElapsed util component, integrate into PostThreadItem

* integrate into posts

* use consistent naming

* use mobx and single interval for TimeElapsed
---
 src/view/com/util/PostMeta.tsx | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

(limited to 'src/view/com/util/PostMeta.tsx')

diff --git a/src/view/com/util/PostMeta.tsx b/src/view/com/util/PostMeta.tsx
index 7f8abebd7..5df6b3983 100644
--- a/src/view/com/util/PostMeta.tsx
+++ b/src/view/com/util/PostMeta.tsx
@@ -2,12 +2,13 @@ import React from 'react'
 import {StyleSheet, View} from 'react-native'
 import {Text} from './text/Text'
 import {DesktopWebTextLink} from './Link'
-import {ago, niceDate} from 'lib/strings/time'
+import {niceDate} from 'lib/strings/time'
 import {usePalette} from 'lib/hooks/usePalette'
 import {UserAvatar} from './UserAvatar'
 import {observer} from 'mobx-react-lite'
 import {sanitizeDisplayName} from 'lib/strings/display-names'
 import {isAndroid} from 'platform/detection'
+import {TimeElapsed} from './TimeElapsed'
 
 interface PostMetaOpts {
   authorAvatar?: string
@@ -64,15 +65,19 @@ export const PostMeta = observer(function (opts: PostMetaOpts) {
           &middot;
         </Text>
       )}
-      <DesktopWebTextLink
-        type="md"
-        style={pal.textLight}
-        lineHeight={1.2}
-        text={ago(opts.timestamp)}
-        accessibilityLabel={niceDate(opts.timestamp)}
-        accessibilityHint=""
-        href={opts.postHref}
-      />
+      <TimeElapsed timestamp={opts.timestamp}>
+        {({timeElapsed}) => (
+          <DesktopWebTextLink
+            type="md"
+            style={pal.textLight}
+            lineHeight={1.2}
+            text={timeElapsed}
+            accessibilityLabel={niceDate(opts.timestamp)}
+            accessibilityHint=""
+            href={opts.postHref}
+          />
+        )}
+      </TimeElapsed>
     </View>
   )
 })
-- 
cgit 1.4.1

