Added hide in sidebar option for custom tokens

This commit is contained in:
Mitchell McCaffrey 2020-05-28 16:23:20 +10:00
parent 8864ef4494
commit 49c18e8cf7
4 changed files with 29 additions and 13 deletions

View File

@ -39,18 +39,32 @@ function TokenSettings({
my={1}
/>
</Box>
<Box my={2}>
<Label>
<Checkbox
checked={token && token.isVehicle}
disabled={!token || token.type === "default"}
onChange={(e) =>
onSettingsChange("isVehicle", e.target.checked)
}
/>
Vehicle / Mount
</Label>
</Box>
<Flex my={2}>
<Box sx={{ flexGrow: 1 }}>
<Label>
<Checkbox
checked={token && token.isVehicle}
disabled={!token || token.type === "default"}
onChange={(e) =>
onSettingsChange("isVehicle", e.target.checked)
}
/>
Vehicle / Mount
</Label>
</Box>
<Box sx={{ flexGrow: 1 }}>
<Label>
<Checkbox
checked={token && token.hideInSidebar}
disabled={!token || token.type === "default"}
onChange={(e) =>
onSettingsChange("hideInSidebar", e.target.checked)
}
/>
Hide in Sidebar
</Label>
</Box>
</Flex>
</>
)}
<IconButton

View File

@ -49,7 +49,7 @@ function Tokens({ onMapTokenStateCreate }) {
>
<SimpleBar style={{ height: "calc(100% - 48px)", overflowX: "hidden" }}>
{ownedTokens
.filter((token) => token.owner === userId)
.filter((token) => !token.hideInSidebar)
.map((token) => (
<ListToken
key={token.id}

View File

@ -65,6 +65,7 @@ function SelectTokensModal({ isOpen, onRequestClose }) {
owner: userId,
defaultSize: 1,
isVehicle: false,
hideInSidebar: false,
});
setImageLoading(false);
};

View File

@ -86,6 +86,7 @@ export const tokens = Object.keys(tokenSources).map((key) => ({
type: "default",
defaultSize: getDefaultTokenSize(key),
isVehicle: false,
hideInSidebar: false,
}));
export const unknownSource = unknown;