* stage 1: project init * stage 2: skeleton with navigation * step 2.5: streams list * step 4: stream playback experience * step 5-6: compose experience * fix: broken record * transcode media particles to mp4 * build: reproducible go generate * build: rename skaffold module for particle processor worker * infra: increase particle processor worker resources Was dealing with OOM errors * tweaks to mobile * log transcode work * view on desktop placeholder * tweak padding * cap video resolution to save on memory * infra: bump memory limits as insurance * ux improvements * update bundle id for mobile * config for mobile
25 lines
722 B
TypeScript
25 lines
722 B
TypeScript
import { useEffect, useState } from "react";
|
|
import { Text, type TextProps } from "react-native";
|
|
import { formatDistanceToNow } from "@/lib/time-utils";
|
|
|
|
const MINUTE_MS = 60_000;
|
|
|
|
interface RelativeTimestampProps extends Omit<TextProps, "children"> {
|
|
date: Date;
|
|
}
|
|
|
|
/**
|
|
* Re-renders once per minute so labels like "5m ago" stay accurate without
|
|
* any per-card timer wiring at the call site.
|
|
*/
|
|
export function RelativeTimestamp({ date, ...rest }: RelativeTimestampProps) {
|
|
const [, force] = useState(0);
|
|
|
|
useEffect(() => {
|
|
const interval = setInterval(() => force((n) => n + 1), MINUTE_MS);
|
|
return () => clearInterval(interval);
|
|
}, []);
|
|
|
|
return <Text {...rest}>{formatDistanceToNow(date)}</Text>;
|
|
}
|