Files
periscope/frontend/src/hooks/use-report.ts
T
Siddharth Kothari 6672d2be57 Pinscope open-source core
Agentic schematic validation: datasheet extraction via Claude Console
Skills, netlist/BOM design graph, per-IC direct datasheet review with
page citations, capacitor derating, Next.js report UI.

Extracted from the Pinscope cloud codebase. Auth and billing live in the
private gateway repo behind stable seams (billing_hook.py, adapter files
listed in CLAUDE.md).
2026-07-16 21:29:45 -07:00

26 lines
803 B
TypeScript

"use client";
import { useState, useEffect } from "react";
import type { ValidationReport, DesignGraph } from "@/lib/types";
import { fetchReport, fetchGraph } from "@/lib/api";
export function useReport(projectId: string) {
const [report, setReport] = useState<ValidationReport | null>(null);
const [graph, setGraph] = useState<DesignGraph | null>(null);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
useEffect(() => {
setLoading(true);
Promise.all([fetchReport(projectId), fetchGraph(projectId)])
.then(([r, g]) => {
setReport(r);
setGraph(g);
})
.catch((e) => setError(e.message))
.finally(() => setLoading(false));
}, [projectId]);
return { report, graph, loading, error };
}