remove useWindowSize

This commit is contained in:
Proddy
2023-04-29 16:26:07 +02:00
parent 63d105437f
commit 6f681aa451

View File

@@ -18,18 +18,18 @@ import { useRest, updateValueDirty, extractErrorMessage } from 'utils';
export const LOG_EVENTSOURCE_URL = EVENT_SOURCE_ROOT + 'log'; export const LOG_EVENTSOURCE_URL = EVENT_SOURCE_ROOT + 'log';
const useWindowSize = () => { // const useWindowSize = () => {
const [size, setSize] = useState([0, 0]); // const [size, setSize] = useState([0, 0]);
useLayoutEffect(() => { // useLayoutEffect(() => {
function updateSize() { // function updateSize() {
setSize([window.innerWidth, window.innerHeight]); // setSize([window.innerWidth, window.innerHeight]);
} // }
window.addEventListener('resize', updateSize); // window.addEventListener('resize', updateSize);
updateSize(); // updateSize();
return () => window.removeEventListener('resize', updateSize); // return () => window.removeEventListener('resize', updateSize);
}, []); // }, []);
return size; // return size;
}; // };
const LogEntryLine = styled('div')(() => ({ const LogEntryLine = styled('div')(() => ({
color: '#bbbbbb', color: '#bbbbbb',
@@ -62,7 +62,7 @@ const levelLabel = (level: LogLevel) => {
}; };
const SystemLog: FC = () => { const SystemLog: FC = () => {
useWindowSize(); // useWindowSize();
const { LL } = useI18nContext(); const { LL } = useI18nContext();
@@ -238,7 +238,7 @@ const SystemLog: FC = () => {
<Box <Box
sx={{ sx={{
backgroundColor: 'black', backgroundColor: 'black',
overflow: 'scroll', overflowY: 'scroll',
position: 'absolute', position: 'absolute',
right: 18, right: 18,
bottom: 18, bottom: 18,