import { useState } from "react" import { cn } from "@lib/utils" import { Tabs, TabsList, TabsTrigger } from "@ui/components/tabs" export interface MemoryEntry { id: string memory: string title?: string url?: string version: number isForgotten: boolean forgetAfter: string | null isLatest: boolean isStatic: boolean } function VersionStatus({ status, }: { status: "latest" | "static" | "expiring" | "forgotten" }) { return ( <> { { latest: (
Latest Latest
), static: (
Static Static
), expiring: (
Expiring Expiring
), forgotten: (
Forgotten Forgotten
), }[status] } ) } export function GraphListMemories({ memoryEntries, }: { memoryEntries: MemoryEntry[] }) { const [expandedMemories, setExpandedMemories] = useState>( new Set(), ) const toggleMemory = (memoryId: string) => { setExpandedMemories((prev) => { const next = new Set(prev) if (next.has(memoryId)) { next.delete(memoryId) } else { next.add(memoryId) } return next }) } return (
Graph

Graph

List

List

{memoryEntries.map((memory, idx) => { const isClickable = memory.url && (memory.url.startsWith("http://") || memory.url.startsWith("https://")) const status = memory.isForgotten ? "forgotten" : memory.forgetAfter ? "expiring" : memory.isStatic ? "static" : "latest" const content = (
{memory.title && (
{memory.title}
)} {memory.memory && ( )} {memory.url && (
{memory.url}
)}
v{memory.version}
) if (isClickable) { return ( {content} ) } return (
{content}
) })}
) }