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).
26 lines
803 B
TypeScript
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 };
|
|
}
|