diff --git a/lib/src/Components/Profile/Subcomponents/RelationsView.tsx b/lib/src/Components/Profile/Subcomponents/RelationsView.tsx index 2348b646..caffba3e 100644 --- a/lib/src/Components/Profile/Subcomponents/RelationsView.tsx +++ b/lib/src/Components/Profile/Subcomponents/RelationsView.tsx @@ -1,6 +1,9 @@ +import { useEffect } from 'react' + import { useItems } from '#components/Map/hooks/useItems' import type { Item } from '#types/Item' +import { Link } from 'react-router-dom' interface Props { item: Item @@ -10,22 +13,28 @@ interface Props { export const RelationsView = ({ item, relation }: Props) => { const items = useItems() + useEffect(() => { + console.log(relatedItems) + }, []) + if (!item.relations) return const relationsOfRightType = item.relations.filter((r) => r.type === relation) - const relatedItems = items.filter((i) => relationsOfRightType.some((r) => r.id === i.id)) + const relatedItems = items.filter((i) => + relationsOfRightType.some((r) => r.related_items_id === i.id), + ) const hasRelatedItems = relatedItems.length > 0 return ( -
-

{relation}

+
+

{relation}

{hasRelatedItems ? (