diff --git a/public/index.html b/public/index.html index f9e20ed..16cc9c9 100644 --- a/public/index.html +++ b/public/index.html @@ -28,8 +28,8 @@ - - + + diff --git a/src/components/note/NoteMenu.js b/src/components/note/NoteMenu.js index cc0379e..476616a 100644 --- a/src/components/note/NoteMenu.js +++ b/src/components/note/NoteMenu.js @@ -113,7 +113,7 @@ function NoteMenu({ left={`${menuLeft}px`} onModalContent={handleModalContent} > - + { diff --git a/src/components/token/TokenMenu.js b/src/components/token/TokenMenu.js index b009a81..7e6ed78 100644 --- a/src/components/token/TokenMenu.js +++ b/src/components/token/TokenMenu.js @@ -59,15 +59,14 @@ function TokenMenu({ if (!tokenState) { return; } - const statuses = tokenState.statuses; - let newStatuses = []; - if (statuses.includes(status)) { - newStatuses = statuses.filter((s) => s !== status); + const statuses = new Set(tokenState.statuses.filter((s) => s)); + if (statuses.has(status)) { + statuses.delete(status); } else { - newStatuses = [...statuses, status]; + statuses.add(status); } onTokenStateChange({ - [tokenState.id]: { ...tokenState, statuses: newStatuses }, + [tokenState.id]: { ...tokenState, statuses: [...statuses] }, }); } @@ -130,7 +129,7 @@ function TokenMenu({ left={`${menuLeft}px`} onModalContent={handleModalContent} > - + { diff --git a/src/components/token/TokenStatus.js b/src/components/token/TokenStatus.js index fdea596..8a6c436 100644 --- a/src/components/token/TokenStatus.js +++ b/src/components/token/TokenStatus.js @@ -4,9 +4,11 @@ import { Circle, Group } from "react-konva"; import colors from "../../helpers/colors"; function TokenStatus({ tokenState, width, height }) { + // Ensure statuses is an array and filter empty values + const statuses = [...new Set((tokenState?.statuses || []).filter((s) => s))]; return ( - {tokenState.statuses.map((status, index) => ( + {statuses.map((status, index) => (