first commit

This commit is contained in:
Rodrigo Bertoldo de Sousa Martins committed 2026-09-07 20:46:08 -03:00
commit 0e854110d3
49 files changed
+2292

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
import { useEffect, useMemo, useState } from "react";
import { api, type AnatomicalSystem, type Structure } from "../lib/api.js";
export function useSystems() {
const [systems, setSystems] = useState<AnatomicalSystem[]>([]);
useEffect(() => {
api.systems().then(setSystems).catch(console.error);
}, []);
return systems;
}
export function useAllStructures() {
const [structures, setStructures] = useState<Structure[]>([]);
useEffect(() => {
api.structures().then(setStructures).catch(console.error);
}, []);
const bySlug = useMemo(() => {
const map = new Map<string, Structure>();
for (const s of structures) map.set(s.slug, s);
return map;
}, [structures]);
return { structures, bySlug };
}