| import { type ClassValue, clsx } from "clsx";
|
| import { twMerge } from "tailwind-merge";
|
|
|
| export function cn(...inputs: ClassValue[]) {
|
| return twMerge(clsx(inputs));
|
| }
|
|
|
|
|
| export const themedFont = "font-mondwest";
|
|
|
|
|
| export const themedBody = "font-mondwest normal-case";
|
|
|
|
|
| export const themedChrome = "font-mondwest text-display";
|
|
|
|
|
| export function timeAgo(ts: number): string {
|
| const delta = Date.now() / 1000 - ts;
|
| if (delta < 60) return "just now";
|
| if (delta < 3600) return `${Math.floor(delta / 60)}m ago`;
|
| if (delta < 86400) return `${Math.floor(delta / 3600)}h ago`;
|
| if (delta < 172800) return "yesterday";
|
| return `${Math.floor(delta / 86400)}d ago`;
|
| }
|
|
|
|
|
| export function isoTimeAgo(iso: string): string {
|
| const delta = (Date.now() - new Date(iso).getTime()) / 1000;
|
| if (delta < 0 || Number.isNaN(delta)) return "unknown";
|
| if (delta < 60) return "just now";
|
| if (delta < 3600) return `${Math.floor(delta / 60)}m ago`;
|
| if (delta < 86400) return `${Math.floor(delta / 3600)}h ago`;
|
| return `${Math.floor(delta / 86400)}d ago`;
|
| }
|
|
|