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} my={1}
/> />
</Box> </Box>
<Box my={2}> <Flex my={2}>
<Label> <Box sx={{ flexGrow: 1 }}>
<Checkbox <Label>
checked={token && token.isVehicle} <Checkbox
disabled={!token || token.type === "default"} checked={token && token.isVehicle}
onChange={(e) => disabled={!token || token.type === "default"}
onSettingsChange("isVehicle", e.target.checked) onChange={(e) =>
} onSettingsChange("isVehicle", e.target.checked)
/> }
Vehicle / Mount />
</Label> Vehicle / Mount
</Box> </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 <IconButton

View File

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

View File

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

View File

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