diff --git a/FRONTEND/src/components/BottomToolBar.tsx b/FRONTEND/src/components/BottomToolBar.tsx index 01b1c3d..356a74f 100644 --- a/FRONTEND/src/components/BottomToolBar.tsx +++ b/FRONTEND/src/components/BottomToolBar.tsx @@ -6,21 +6,22 @@ import { Flex, Grid, Input, - Menu, ScrollArea, Tabs, Text, + Card, + Badge, } from "@mantine/core"; import { useEffect, useMemo, useRef, useState } from "react"; import classes from "./Component.module.css"; import type { IScenario, TLine, TStation } from "../untils/types"; import type { Socket } from "socket.io-client"; -import { ButtonDPELP, ButtonScenario, ButtonSelect } from "./ButtonAction"; +import { ButtonDPELP, ButtonSelect } from "./ButtonAction"; import DrawerLogs from "./DrawerLogs"; import { DrawerAPCControl, DrawerSwitchControl } from "./DrawerControl"; import { isJsonString } from "../untils/helper"; import { motion } from "motion/react"; -import { IconCaretDown, IconCaretUp } from "@tabler/icons-react"; +import { IconCaretDown, IconCaretUp, IconPlayerPlay } from "@tabler/icons-react"; interface TabsProps { selectedLines: TLine[]; @@ -65,6 +66,7 @@ const BottomToolBar = ({ }, []); const [valueInput, setValueInput] = useState(""); const inputRef = useRef(null); + const [openScenarioModal, setOpenScenarioModal] = useState(false); // const [activeTabBottom, setActiveTabBottom] = useState("command"); // const [isExpand, setIsExpand] = useState(true); @@ -75,21 +77,205 @@ const BottomToolBar = ({ }, [selectedLines?.length]); return ( - + <> + {/* Modal chọn Scenario - Custom Simple Modal */} + {openScenarioModal && ( +
setOpenScenarioModal(false)} + > +
e.stopPropagation()} + > + {/* Header */} + + + 🎯 Select Scenario to Run + + setOpenScenarioModal(false)} + /> + + + {/* Content */} +
+ {scenarios.length > 0 ? ( + + {scenarios.map((scenario, index) => ( + + + + + + {scenario.title} + + + #{index + 1} + + + + + + Timeout: {scenario.timeout}ms + + {scenario.isReboot && ( + + Reboot + + )} + + {JSON.parse(scenario.body || "[]").length} steps + + + + + {JSON.parse(scenario.body || "[]") + .slice(0, 2) + .map((step: { send: string }) => step.send) + .join(" → ")} + {JSON.parse(scenario.body || "[]").length > 2 && + " ..."} + + + + + + + ))} + + ) : ( + + + 📋 + + + No scenarios available + + + Please create a new scenario to get started + + + )} +
+
+
+ )} + + - setOpenScenarioModal(true)} > - - - - - - {scenarios.map((el, i) => ( - - !el?.userEmailOpenCLI || - el?.userEmailOpenCLI === user?.email - )} - isDisable={ - isDisable || - selectedLines.filter( - (el) => - !el?.userEmailOpenCLI || - el?.userEmailOpenCLI === user?.email - ).length === 0 - } - onClick={() => { - // setSelectedLines([]); - setIsDisable(true); - setTimeout(() => { - setIsDisable(false); - }, 5000); - }} - scenario={el} - /> - ))} - - - + Scenario + - +
+ ); }; diff --git a/FRONTEND/src/components/Component.module.css b/FRONTEND/src/components/Component.module.css index eb66c15..8170f41 100644 --- a/FRONTEND/src/components/Component.module.css +++ b/FRONTEND/src/components/Component.module.css @@ -109,8 +109,13 @@ border-top: solid rgba(201, 201, 201, 0.377) 1px; */ } +.hideScrollBar { + -ms-overflow-style: none; /* IE and Edge */ + scrollbar-width: none; /* Firefox */ +} + .hideScrollBar::-webkit-scrollbar { - display: none; + display: none; /* Chrome, Safari and Opera */ } .containerBottom { @@ -148,3 +153,15 @@ padding-right: 4px !important; padding-left: 4px !important; } + +.scenarioCard { + border: 2px solid transparent; + background: linear-gradient(white, white) padding-box, + linear-gradient(145deg, #e0e0e0, #f5f5f5) border-box; +} + +.scenarioCard:hover { + border-color: #4dabf7; + transform: translateY(-2px); + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); +}