Added null check to token status

This commit is contained in:
Mitchell McCaffrey 2021-01-21 07:14:32 +11:00
parent cf63034c0e
commit af3839c9ff

View File

@ -6,19 +6,20 @@ import colors from "../../helpers/colors";
function TokenStatus({ tokenState, width, height }) {
return (
<Group x={width} y={height} offsetX={width / 2} offsetY={height / 2}>
{tokenState.statuses.map((status, index) => (
<Circle
key={status}
width={width}
height={height}
stroke={colors[status]}
strokeWidth={width / 20 / tokenState.size}
scaleX={1 - index / 10 / tokenState.size}
scaleY={1 - index / 10 / tokenState.size}
opacity={0.8}
fillEnabled={false}
/>
))}
{tokenState &&
tokenState.statuses.map((status, index) => (
<Circle
key={status}
width={width}
height={height}
stroke={colors[status]}
strokeWidth={width / 20 / tokenState.size}
scaleX={1 - index / 10 / tokenState.size}
scaleY={1 - index / 10 / tokenState.size}
opacity={0.8}
fillEnabled={false}
/>
))}
</Group>
);
}