Fix rendering of sub groups in group tiles

This commit is contained in:
Mitchell McCaffrey 2021-05-21 16:14:11 +10:00
parent f496adae1d
commit 549ecbf65a
2 changed files with 14 additions and 6 deletions

View File

@ -14,7 +14,11 @@ import SortableTiles from "../drag/SortableTiles";
import useResponsiveLayout from "../../hooks/useResponsiveLayout";
import { groupsFromIds, itemsFromGroups } from "../../helpers/select";
import {
groupsFromIds,
itemsFromGroups,
getGroupItems,
} from "../../helpers/select";
function MapTiles({
maps,
@ -90,13 +94,12 @@ function MapTiles({
);
} else {
const isSelected = selectedGroupIds.includes(group.id);
const items = getGroupItems(group);
return (
<MapTileGroup
key={group.id}
group={group}
maps={group.items.map((item) =>
maps.find((map) => map.id === item.id)
)}
maps={items.map((item) => maps.find((map) => map.id === item.id))}
isSelected={isSelected}
onSelect={onTileSelect}
/>

View File

@ -15,7 +15,11 @@ import SortableTiles from "../drag/SortableTiles";
import useResponsiveLayout from "../../hooks/useResponsiveLayout";
import { groupsFromIds, itemsFromGroups } from "../../helpers/select";
import {
groupsFromIds,
itemsFromGroups,
getGroupItems,
} from "../../helpers/select";
function TokenTiles({
tokens,
@ -70,11 +74,12 @@ function TokenTiles({
);
} else {
const isSelected = selectedGroupIds.includes(group.id);
const items = getGroupItems(group);
return (
<TokenTileGroup
key={group.id}
group={group}
tokens={group.items.map((item) =>
tokens={items.map((item) =>
tokens.find((token) => token.id === item.id)
)}
isSelected={isSelected}