import { AssetView } from "../AssetView/AssetView";
import { useReportAssetListContext } from "../contexts/useReportAssetListContext";

interface Props {
	groupId: string;
	depth: number;
}

export function AssetListView(props: Props) {
	const context = useReportAssetListContext();

	const assets = context.assets.filter((x) =>
		x.groupIds.includes(props.groupId),
	);

	return (
		<>
			{assets.map((asset) => (
				<AssetView key={asset.id} asset={asset} depth={props.depth} />
			))}
		</>
	);
}
