mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-09 23:15:46 +01:00
Fix compilation errors
This commit is contained in:
@@ -17,7 +17,6 @@ import { AreaType } from '../../../../types/area';
|
|||||||
import { IWidget } from '../../../../widgets/widgets';
|
import { IWidget } from '../../../../widgets/widgets';
|
||||||
import { useEditModeStore } from '../../Views/useEditModeStore';
|
import { useEditModeStore } from '../../Views/useEditModeStore';
|
||||||
import { initializeGridstack } from './init-gridstack';
|
import { initializeGridstack } from './init-gridstack';
|
||||||
import { ShapeType } from '../../../../types/shape';
|
|
||||||
|
|
||||||
interface UseGristackReturnType {
|
interface UseGristackReturnType {
|
||||||
apps: AppType[];
|
apps: AppType[];
|
||||||
@@ -81,47 +80,51 @@ export const useGridstack = (
|
|||||||
// change column count depending on the width and the gridRef
|
// change column count depending on the width and the gridRef
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (areaType === 'sidebar') return;
|
if (areaType === 'sidebar') return;
|
||||||
gridRef.current?.column(isLargerThanSm || typeof isLargerThanSm === 'undefined' ? 12 : 6, (column, prevColumn, newNodes, nodes) => {
|
gridRef.current?.column(
|
||||||
let nextRow = 0;
|
isLargerThanSm || typeof isLargerThanSm === 'undefined' ? 12 : 6,
|
||||||
let available = 6;
|
(column, prevColumn, newNodes, nodes) => {
|
||||||
|
let nextRow = 0;
|
||||||
|
let available = 6;
|
||||||
|
|
||||||
if (column === prevColumn) {
|
if (column === prevColumn) {
|
||||||
newNodes.concat(nodes);
|
newNodes.concat(nodes);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
nodes.reverse().forEach(node => {
|
nodes.reverse().forEach((node) => {
|
||||||
const width = parseInt(node.el!.getAttribute('data-gridstack-w')!, 10);
|
const newnode = node;
|
||||||
const height = parseInt(node.el!.getAttribute('data-gridstack-h')!, 10);
|
const width = parseInt(newnode.el!.getAttribute('data-gridstack-w')!, 10);
|
||||||
const x = parseInt(node.el!.getAttribute('data-gridstack-x')!, 10);
|
const height = parseInt(newnode.el!.getAttribute('data-gridstack-h')!, 10);
|
||||||
const y = parseInt(node.el!.getAttribute('data-gridstack-y')!, 10);
|
const x = parseInt(newnode.el!.getAttribute('data-gridstack-x')!, 10);
|
||||||
|
const y = parseInt(newnode.el!.getAttribute('data-gridstack-y')!, 10);
|
||||||
|
|
||||||
if (column === 6) {
|
if (column === 6) {
|
||||||
node.x = available >= width ? 6 - available : 0;
|
newnode.x = available >= width ? 6 - available : 0;
|
||||||
node.y = nextRow;
|
newnode.y = nextRow;
|
||||||
|
|
||||||
if (width > 6) {
|
if (width > 6) {
|
||||||
node.w = 6;
|
newnode.w = 6;
|
||||||
nextRow += 2;
|
|
||||||
available = 6;
|
|
||||||
} else if (available >= width) {
|
|
||||||
available -= width;
|
|
||||||
if (available === 0) {
|
|
||||||
nextRow += 2;
|
nextRow += 2;
|
||||||
available = 6;
|
available = 6;
|
||||||
|
} else if (available >= width) {
|
||||||
|
available -= width;
|
||||||
|
if (available === 0) {
|
||||||
|
nextRow += 2;
|
||||||
|
available = 6;
|
||||||
|
}
|
||||||
|
} else if (available < width) {
|
||||||
|
newnode.y = newnode.y! + 2;
|
||||||
|
available = 6 - width;
|
||||||
|
nextRow += 2;
|
||||||
}
|
}
|
||||||
} else if (available < width) {
|
} else {
|
||||||
node.y = node.y! + 2;
|
newnode.x = y % 2 === 1 ? x + 6 : x;
|
||||||
available = 6 - width;
|
newnode.y = Math.floor(y / 2);
|
||||||
nextRow += 2;
|
|
||||||
}
|
}
|
||||||
} else {
|
newNodes.push(newnode);
|
||||||
node.x = y % 2 === 1 ? x + 6 : x;
|
});
|
||||||
node.y = Math.floor(y / 2);
|
}
|
||||||
}
|
);
|
||||||
newNodes.push(node);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}, [isLargerThanSm]);
|
}, [isLargerThanSm]);
|
||||||
|
|
||||||
const onChange = isEditMode
|
const onChange = isEditMode
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import Consola from 'consola';
|
import Consola from 'consola';
|
||||||
import { ActionIcon, Button, Group, Paper, Popover, Space, Text } from '@mantine/core';
|
import { ActionIcon, Button, Group, Popover, Text } from '@mantine/core';
|
||||||
import { IconEditCircle, IconEditCircleOff, IconX } from '@tabler/icons';
|
import { IconEditCircle, IconEditCircleOff, IconX } from '@tabler/icons';
|
||||||
import { getCookie } from 'cookies-next';
|
import { getCookie } from 'cookies-next';
|
||||||
import { Trans, useTranslation } from 'next-i18next';
|
import { Trans, useTranslation } from 'next-i18next';
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import { CURRENT_VERSION, REPO_URL } from '../../../../data/constants';
|
|||||||
import { useConfigContext } from '../../../config/provider';
|
import { useConfigContext } from '../../../config/provider';
|
||||||
import { Logo } from '../Logo';
|
import { Logo } from '../Logo';
|
||||||
import { useCardStyles } from '../useCardStyles';
|
import { useCardStyles } from '../useCardStyles';
|
||||||
import { AddElementAction } from './Actions/AddElementAction/AddElementAction';
|
|
||||||
import DockerMenuButton from './Actions/Docker/DockerModule';
|
import DockerMenuButton from './Actions/Docker/DockerModule';
|
||||||
import { ToggleEditModeAction } from './Actions/ToggleEditMode/ToggleEditMode';
|
import { ToggleEditModeAction } from './Actions/ToggleEditMode/ToggleEditMode';
|
||||||
import { Search } from './Search';
|
import { Search } from './Search';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ActionIcon, Badge, Menu, Tooltip } from '@mantine/core';
|
import { ActionIcon, Badge, Menu } from '@mantine/core';
|
||||||
import { useDisclosure } from '@mantine/hooks';
|
import { useDisclosure } from '@mantine/hooks';
|
||||||
import { IconInfoCircle, IconMenu2, IconSettings } from '@tabler/icons';
|
import { IconInfoCircle, IconMenu2, IconSettings } from '@tabler/icons';
|
||||||
import { useTranslation } from 'next-i18next';
|
import { useTranslation } from 'next-i18next';
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { PasswordInput, Paper, Title, Text, Container, Group, Button } from '@mantine/core';
|
import { PasswordInput, Paper, Title, Text, Container, Button } from '@mantine/core';
|
||||||
import { setCookie } from 'cookies-next';
|
import { setCookie } from 'cookies-next';
|
||||||
import { showNotification, updateNotification } from '@mantine/notifications';
|
import { showNotification, updateNotification } from '@mantine/notifications';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|||||||
Reference in New Issue
Block a user