Fixed design and functional issues

This commit is contained in:
Dmitriy Shishkov 2021-09-05 00:51:37 +03:00
parent dcdc49e8e0
commit 5228bbae8f
No known key found for this signature in database
GPG Key ID: 14358F96FCDD8060
4 changed files with 17 additions and 3 deletions

View File

@ -1,7 +1,7 @@
import { useEffect, useRef, useState } from "react"; import { useEffect, useRef, useState } from "react";
import { makeStyles, Grid, useTheme } from "@material-ui/core"; import { makeStyles, Grid, useTheme } from "@material-ui/core";
import { RoomContextProvider, useRoomContext } from "./context"; import { RoomContextProvider } from "./context";
import { BuildingPlan } from "./components/BuildingPlan"; import { BuildingPlan } from "./components/BuildingPlan";
import { RoomList } from "./components/RoomList"; import { RoomList } from "./components/RoomList";
import { AppTheme } from "./theme"; import { AppTheme } from "./theme";
@ -11,6 +11,10 @@ const useStyles = makeStyles((theme) => ({
root: { root: {
padding: theme.spacing(10, 2, 2, 2), padding: theme.spacing(10, 2, 2, 2),
height: "100vh", height: "100vh",
overflow: "hidden",
"& > div": {
height: "100%",
},
"& > div > *": { "& > div > *": {
height: "100%", height: "100%",
}, },

View File

@ -58,7 +58,7 @@ export const BuildingPlan = ({ width, height }: BuildingPlanProps) => {
const clickCb = (x: number, y: number) => { const clickCb = (x: number, y: number) => {
const index = getRoomByCoord(x, y, state.map); const index = getRoomByCoord(x, y, state.map);
if (index >= 0) toggleFree(index); if (index >= 0) toggleFree(index + 1);
}; };
return ( return (

View File

@ -20,6 +20,12 @@ const useStyles = makeStyles((theme) => ({
width: "100%", width: "100%",
height: `calc(100% - ${theme.spacing(1)}px)`, height: `calc(100% - ${theme.spacing(1)}px)`,
padding: theme.spacing(2), padding: theme.spacing(2),
overflow: "auto",
"-ms-overflow-style": "none",
scrollbarWidth: "none",
"&::-webkit-scrollbar": {
display: "none",
},
}, },
filterBox: { filterBox: {
display: "flex", display: "flex",

View File

@ -49,7 +49,11 @@ export const RoomContextProvider: FC = ({ children }) => {
free, free,
id, id,
} of message.args) { } of message.args) {
map.push({ coordinates: { x, y }, size: { w, h }, title: title }); map.push({
coordinates: { x, y },
size: { w, h },
title: title,
});
char.push({ free }); char.push({ free });
ids[id] = map.length - 1; ids[id] = map.length - 1;
} }