Files
bsky-social-app/src/view/com/util/TimeElapsed.tsx
T
Ansh c5b6f88e9a Hindi Internationalization (#1914)
* get basic hindi support to work

* get web app language switcher in

* Refactor i18n implementation and remove unused
code

* add missing strings

* add dropdowns and modals missing strings

* complete all hindi translations

* fix merge conflicts

* fix legeacy persisted state

* fix data in RecommendedFeeds

* fix lint
2023-11-20 13:29:27 -08:00

23 lines
548 B
TypeScript

import React from 'react'
import {ago} from 'lib/strings/time'
import {useTickEveryMinute} from '#/state/shell'
// FIXME(dan): Figure out why the false positives
export function TimeElapsed({
timestamp,
children,
}: {
timestamp: string
children: ({timeElapsed}: {timeElapsed: string}) => JSX.Element
}) {
const tick = useTickEveryMinute()
const [timeElapsed, setTimeAgo] = React.useState(ago(timestamp))
React.useEffect(() => {
setTimeAgo(ago(timestamp))
}, [timestamp, setTimeAgo, tick])
return children({timeElapsed})
}