Fix importing with not all groups exported

This commit is contained in:
Mitchell McCaffrey 2021-06-14 17:51:07 +10:00
parent a997641628
commit 63a809592e

View File

@ -237,6 +237,7 @@ function SelectDataModal({
function renderMapGroup(group) {
if (group.type === "item") {
const map = maps[group.id];
if (map) {
return (
<Label key={map.id} my={1} pl={4} sx={{ fontFamily: "body2" }}>
<Checkbox
@ -246,7 +247,9 @@ function SelectDataModal({
{map.name}
</Label>
);
}
} else {
if (group.items.every((item) => item.id in maps)) {
return renderGroupContainer(
group,
group.items.some((item) => maps[item.id].checked),
@ -259,17 +262,21 @@ function SelectDataModal({
);
}
}
}
function renderTokenGroup(group) {
if (group.type === "item") {
const token = tokens[group.id];
if (token) {
return (
<Box pl={4} my={1} key={token.id}>
<Label sx={{ fontFamily: "body2" }}>
<Checkbox
checked={token.checked}
onChange={(e) => handleTokensChanged(e, [token])}
disabled={token.type !== "default" && token.id in tokenUsedCount}
disabled={
token.type !== "default" && token.id in tokenUsedCount
}
/>
{token.name}
</Label>
@ -281,7 +288,9 @@ function SelectDataModal({
)}
</Box>
);
}
} else {
if (group.items.every((item) => item.id in tokens)) {
const checked =
group.items.some(
(item) => !(item.id in tokenUsedCount) && tokens[item.id].checked
@ -298,6 +307,7 @@ function SelectDataModal({
);
}
}
}
return (
<Modal