Added owner to map and token keys, added map cache

This commit is contained in:
Mitchell McCaffrey
2020-04-30 11:25:33 +10:00
parent 88b4785307
commit 58bee3085d
4 changed files with 67 additions and 13 deletions
+5 -1
View File
@@ -1,4 +1,4 @@
import React, { useState } from "react";
import React, { useState, useContext } from "react";
import { Box } from "theme-ui";
import shortid from "shortid";
import SimpleBar from "simplebar-react";
@@ -9,10 +9,13 @@ import NumberInput from "../NumberInput";
import { fromEntries } from "../../helpers/shared";
import AuthContext from "../../contexts/AuthContext";
const listTokenClassName = "list-token";
function Tokens({ onCreateMapTokenState, tokens }) {
const [tokenSize, setTokenSize] = useState(1);
const { userId } = useContext(AuthContext);
function handleProxyDragEnd(isOnMap, token) {
if (isOnMap && onCreateMapTokenState) {
@@ -20,6 +23,7 @@ function Tokens({ onCreateMapTokenState, tokens }) {
onCreateMapTokenState({
id: shortid.generate(),
tokenId: token.id,
owner: userId,
size: tokenSize,
label: "",
statuses: [],