feat: added a twist

This commit is contained in:
2026-04-01 00:53:55 +02:00
parent 0b7deee59e
commit b40c6436cd
76 changed files with 15121 additions and 64 deletions

View File

@@ -0,0 +1,35 @@
import { useEffect, useState } from "react";
export interface GraphNode {
id: string;
published: boolean;
title: string | null;
}
export interface GraphEdge {
source: string;
target: string;
}
export interface GraphData {
nodes: GraphNode[];
edges: GraphEdge[];
}
export function useGraph() {
const [data, setData] = useState<GraphData | null>(null);
const [loading, setLoading] = useState(true);
useEffect(() => {
(async () => {
try {
const res = await fetch("/api/graph");
setData(await res.json());
} finally {
setLoading(false);
}
})();
}, []);
return { data, loading };
}