import { useState, useEffect } from "react"; import { useLocation } from "react-router-dom"; import { CardPage } from "./CardPage"; import { ItemsApi } from "../../types"; import { getValue } from "../../Utils/GetValue"; type breadcrumb = { name: string, path: string } export const ItemViewPage = ({ api, parents, itemNameField, itemTextField, itemImageField, itemSymbolField }: { api: ItemsApi, parents: Array, itemNameField: string, itemTextField: string, itemImageField: string, itemSymbolField: string }) => { const [item, setItem] = useState(); let location = useLocation(); const loadProject = async () => { if (api?.getItem) { const project: unknown = await api?.getItem(location.pathname.split("/")[2]); setItem(project as any); } } useEffect(() => { loadProject(); }, [api]) return ( {item && <> {getValue(item, itemImageField) ?
:
{getValue(item, itemSymbolField)}
}

{getValue(item, itemTextField)}

}
) }