diff --git a/src/components/token/TokenMenu.tsx b/src/components/token/TokenMenu.tsx index 0c9cd6e..f56924d 100644 --- a/src/components/token/TokenMenu.tsx +++ b/src/components/token/TokenMenu.tsx @@ -12,6 +12,10 @@ import LockIcon from "../../icons/TokenLockIcon"; import UnlockIcon from "../../icons/TokenUnlockIcon"; import ShowIcon from "../../icons/TokenShowIcon"; import HideIcon from "../../icons/TokenHideIcon"; +import TokenCharacterIcon from "../../icons/TokenCharacterIcon"; +import TokenPropIcon from "../../icons/TokenPropIcon"; +import TokenMountIcon from "../../icons/TokenMountIcon"; +import TokenAttachmentIcon from "../../icons/TokenAttachmentIcon"; import { useUserId } from "../../contexts/UserIdContext"; @@ -21,6 +25,33 @@ import { } from "../../types/Events"; import { TokenState } from "../../types/TokenState"; import { Map } from "../../types/Map"; +import { TokenCategory } from "../../types/Token"; + +const tokenCategories: Record< + TokenCategory, + { title: string; icon: React.ReactNode; next: TokenCategory } +> = { + character: { + title: "Character", + icon: , + next: "prop", + }, + prop: { + title: "Prop", + icon: , + next: "vehicle", + }, + vehicle: { + title: "Mount", + icon: , + next: "attachment", + }, + attachment: { + title: "Attachment", + icon: , + next: "character", + }, +}; type TokenMenuProps = { isOpen: boolean; @@ -98,6 +129,15 @@ function TokenMenu({ }); } + function handleCategoryChange() { + tokenState && + onTokenStateChange({ + [tokenState.id]: { + category: tokenCategories[tokenState.category].next, + }, + }); + } + function handleModalContent(node: HTMLElement) { if (node) { // Focus input @@ -206,29 +246,28 @@ function TokenMenu({ ))} {/* Only show hide and lock token actions to map owners */} - {map && map.owner === userId && ( + {map && map.owner === userId && tokenState && ( - {tokenState && tokenState.visible ? : } + {tokenState.visible ? : } - {tokenState && tokenState.locked ? : } + {tokenState.locked ? : } + + + {tokenCategories[tokenState.category].icon} )} diff --git a/src/icons/TokenAttachmentIcon.tsx b/src/icons/TokenAttachmentIcon.tsx new file mode 100644 index 0000000..08c6ed0 --- /dev/null +++ b/src/icons/TokenAttachmentIcon.tsx @@ -0,0 +1,16 @@ +function TokenAttachmentIcon() { + return ( + + + + + ); +} + +export default TokenAttachmentIcon; diff --git a/src/icons/TokenCharacterIcon.tsx b/src/icons/TokenCharacterIcon.tsx new file mode 100644 index 0000000..1f18e28 --- /dev/null +++ b/src/icons/TokenCharacterIcon.tsx @@ -0,0 +1,16 @@ +function TokenCharacterIcon() { + return ( + + + + + ); +} + +export default TokenCharacterIcon; diff --git a/src/icons/TokenMountIcon.tsx b/src/icons/TokenMountIcon.tsx new file mode 100644 index 0000000..6926e6d --- /dev/null +++ b/src/icons/TokenMountIcon.tsx @@ -0,0 +1,16 @@ +function TokenMountIcon() { + return ( + + + + + ); +} + +export default TokenMountIcon; diff --git a/src/icons/TokenPropIcon.tsx b/src/icons/TokenPropIcon.tsx new file mode 100644 index 0000000..e632beb --- /dev/null +++ b/src/icons/TokenPropIcon.tsx @@ -0,0 +1,16 @@ +function TokenPropIcon() { + return ( + + + + + ); +} + +export default TokenPropIcon;