Refactored peer sync logic to use the data providers

This commit is contained in:
Mitchell McCaffrey
2020-05-19 22:15:08 +10:00
parent 0f5f90faa6
commit 887bce81d1
4 changed files with 131 additions and 113 deletions

View File

@@ -30,7 +30,7 @@ function SelectMapModal({
}) {
const { userId } = useContext(AuthContext);
const {
maps,
ownedMaps,
mapStates,
addMap,
removeMap,
@@ -44,7 +44,7 @@ function SelectMapModal({
// The map selected in the modal
const [selectedMapId, setSelectedMapId] = useState(null);
const selectedMap = maps.find((map) => map.id === selectedMapId);
const selectedMap = ownedMaps.find((map) => map.id === selectedMapId);
const selectedMapState = mapStates.find(
(state) => state.mapId === selectedMapId
);
@@ -189,7 +189,7 @@ function SelectMapModal({
Select or import a map
</Label>
<MapTiles
maps={maps}
maps={ownedMaps}
onMapAdd={openImageDialog}
onMapRemove={handleMapRemove}
selectedMap={selectedMap}