MVP: Pulse, Memory, History modules
- Mobile-first PWA with dark glassmorphic theme - Pulse: status card, recent sessions, memory snapshot - Memory: view/edit agent + user memory with usage bars - History: session list, platform filter, search, session replay - TanStack Query hooks for all Hermes WebAPI endpoints - Bottom tab navigation, safe-area support
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
export function timeAgo(ts: number): string {
|
||||
const now = Date.now() / 1000;
|
||||
const diff = now - ts;
|
||||
if (diff < 60) return "just now";
|
||||
if (diff < 3600) return `${Math.floor(diff / 60)}m ago`;
|
||||
if (diff < 86400) return `${Math.floor(diff / 3600)}h ago`;
|
||||
if (diff < 604800) return `${Math.floor(diff / 86400)}d ago`;
|
||||
return new Date(ts * 1000).toLocaleDateString();
|
||||
}
|
||||
|
||||
export function formatTokens(n: number): string {
|
||||
if (n >= 1_000_000) return `${(n / 1_000_000).toFixed(1)}M`;
|
||||
if (n >= 1_000) return `${(n / 1_000).toFixed(1)}k`;
|
||||
return String(n);
|
||||
}
|
||||
|
||||
export function platformColor(source: string): string {
|
||||
const map: Record<string, string> = {
|
||||
cli: "#f59e0b",
|
||||
telegram: "#38bdf8",
|
||||
discord: "#8b5cf6",
|
||||
whatsapp: "#22c55e",
|
||||
web: "#a78bfa",
|
||||
webapi: "#a78bfa",
|
||||
};
|
||||
return map[source] || "#6b7280";
|
||||
}
|
||||
|
||||
export function platformBadgeClass(source: string): string {
|
||||
const map: Record<string, string> = {
|
||||
cli: "badge-cli",
|
||||
telegram: "badge-telegram",
|
||||
discord: "badge-discord",
|
||||
whatsapp: "badge-whatsapp",
|
||||
web: "badge-web",
|
||||
webapi: "badge-web",
|
||||
};
|
||||
return map[source] || "badge-cli";
|
||||
}
|
||||
Reference in New Issue
Block a user