mobile v0.1 with deployment for ios (#191)
* 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
This commit was merged in pull request #191.
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
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>;
|
||||
}
|
||||
Reference in New Issue
Block a user