c5b6f88e9a
* 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
23 lines
548 B
TypeScript
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})
|
|
}
|