diff --git a/FRONTEND/src/components/Drawer/DrawerControl.tsx b/FRONTEND/src/components/Drawer/DrawerControl.tsx index 2638398..b914a9b 100644 --- a/FRONTEND/src/components/Drawer/DrawerControl.tsx +++ b/FRONTEND/src/components/Drawer/DrawerControl.tsx @@ -7,7 +7,6 @@ import { Group, Loader, Radio, - ScrollArea, Text, } from "@mantine/core"; import { IconRepeat } from "@tabler/icons-react"; @@ -15,6 +14,7 @@ import { useEffect, useState } from "react"; import classes from "../Component.module.css"; import type { APCProps, SwitchPortsProps, TStation } from "../../untils/types"; import type { Socket } from "socket.io-client"; +import { legend } from "motion/react-client"; interface DrawerProps { stationAPI: TStation; @@ -893,6 +893,7 @@ export const DrawerSwitchControl: React.FC = ({ } }; + console.log("listPorts::", listPorts); return loading ? ( = ({ {listPorts?.length > 0 && ( - + {listPorts?.map((group, key) => { - const isMini = group?.length > 0 && group?.length < 4; const isLarge = group?.length > 20; + // console.log("isLarge::", isLarge); + // console.log("group::", group); + // console.log("checkFilterPort::", sortedPorts(group) + // .filter((el) => + // checkFilterPort(el.status, el.name) + // )); return ( - {isLarge ? (
@@ -1189,10 +1199,16 @@ export const DrawerSwitchControl: React.FC = ({ {group[0]?.name.substring(0, 2) || ""} - + {sortedPorts(group) - .slice(0, sortedPorts(group).length / 2) + .slice(0, Math.ceil(sortedPorts(group).length / 2)) .filter((el) => checkFilterPort(el.status, el.name) ) @@ -1261,7 +1277,7 @@ export const DrawerSwitchControl: React.FC = ({ {sortedPorts(group) .slice( - sortedPorts(group).length / 2, + Math.ceil(sortedPorts(group).length / 2), sortedPorts(group).length ) .filter((el) => @@ -1329,12 +1345,15 @@ export const DrawerSwitchControl: React.FC = ({ ))} - +
) : (
@@ -1344,98 +1363,157 @@ export const DrawerSwitchControl: React.FC = ({ - {sortedPorts(group) - ?.filter((el) => - checkFilterPort(el.status, el.name) - ) - ?.map((port, i) => ( - el.name === port.name - )?.name - ? "1px solid #0018ff" - : "", - }} - className={`${ - isSubmit ? classes.isDisabled : "" - }`} - onClick={() => { - toggleSelect(port); - }} - > - + {sortedPorts(group) + .slice(0, Math.ceil(sortedPorts(group).length / 2)) + .filter((el) => + checkFilterPort(el.status, el.name) + ) + ?.map((port, i) => ( + el.name === port.name + )?.name + ? "1px solid #0018ff" + : "", + }} + className={`${ + isSubmit ? classes.isDisabled : "" + }`} + onClick={() => { + toggleSelect(port); }} > - {/* */} - - {normalizePortName(port.name)} - - - + + {normalizePortName(port.name)} + + + + + poe + + + + ))} + + + {sortedPorts(group) + .slice( + Math.ceil(sortedPorts(group).length / 2), + sortedPorts(group).length + ) + .filter((el) => + checkFilterPort(el.status, el.name) + ) + ?.map((port, i) => ( + el.name === port.name + )?.name + ? "1px solid #0018ff" + : "", + }} + className={`${ + isSubmit ? classes.isDisabled : "" + }`} + onClick={() => { + toggleSelect(port); }} > - - poe - - - - ))} + + + {normalizePortName(port.name)} + + + + + poe + + + + ))} +
)} -
+
); })} - +
)}