From 2825ff4019d1cbd637f814358ee95a780ce55b7d Mon Sep 17 00:00:00 2001 From: Shemy Gan Date: Thu, 5 Dec 2024 15:57:45 -0500 Subject: [PATCH] - WIP contents tab adding servers list --- .../Inputs/TextInput/Adornments/index.jsx | 5 +- .../TabPanels/Status/ContentPanel.jsx | 69 ++++++++++++++----- .../TabPanels/Status/Server/index.jsx | 3 +- 3 files changed, 55 insertions(+), 22 deletions(-) diff --git a/Client/src/Components/Inputs/TextInput/Adornments/index.jsx b/Client/src/Components/Inputs/TextInput/Adornments/index.jsx index a89500bda..1faf784c9 100644 --- a/Client/src/Components/Inputs/TextInput/Adornments/index.jsx +++ b/Client/src/Components/Inputs/TextInput/Adornments/index.jsx @@ -1,11 +1,10 @@ import { Stack, Typography, InputAdornment, IconButton } from "@mui/material"; import { useTheme } from "@mui/material/styles"; -import { useState } from "react"; import PropTypes from "prop-types"; import VisibilityOff from "@mui/icons-material/VisibilityOff"; import Visibility from "@mui/icons-material/Visibility"; import Docs from "../../../../assets/icons/docs.svg?react"; -import DeleteTwoToneIcon from '@mui/icons-material/DeleteTwoTone'; +import DeleteIcon from "../../../../assets/icons/trash-bin.svg?react"; export const HttpAdornment = ({ https }) => { const theme = useTheme(); @@ -96,7 +95,7 @@ export const ServerEndAdornment = ({ id, removeItem }) => { }, }} > - + ); diff --git a/Client/src/Components/TabPanels/Status/ContentPanel.jsx b/Client/src/Components/TabPanels/Status/ContentPanel.jsx index 4209b3fdc..b0bc80610 100644 --- a/Client/src/Components/TabPanels/Status/ContentPanel.jsx +++ b/Client/src/Components/TabPanels/Status/ContentPanel.jsx @@ -40,6 +40,17 @@ const ContentPanel = () => { } }; + const handleAddNew = () => { + let arr = localData.monitors; + arr.push({ id: "" + Math.random() }); + setLocalData({ ...localData, monitors: arr }); + } + + const removeItem = (id) =>{ + const currentMonitors = localData.monitors.filter(m => m.id !=id) + setLocalData({...localData, monitors: currentMonitors}) + } + const handleBlur = (event) => { event.preventDefault(); const { value, id } = event.target; @@ -82,9 +93,9 @@ const ContentPanel = () => { - { "&:hover": { borderColor: theme.palette.primary.main, backgroundColor: "hsl(215, 87%, 51%, 0.05)", - } - }}> - - + + - {" "} - Servers list{" "} - - - - + + {" "} + Servers list{" "} + + + + {localData.monitors.length > 0 && ( + + {localData.monitors.map((m, idx) => ( + + ))} + + )} + diff --git a/Client/src/Components/TabPanels/Status/Server/index.jsx b/Client/src/Components/TabPanels/Status/Server/index.jsx index 2c6d6fc75..4bc5155b5 100644 --- a/Client/src/Components/TabPanels/Status/Server/index.jsx +++ b/Client/src/Components/TabPanels/Status/Server/index.jsx @@ -2,7 +2,7 @@ import TextInput from "../../../Inputs/TextInput"; import { ServerStartAdornment, ServerEndAdornment } from "../../../Inputs/TextInput/Adornments"; -const Server = ({ id, removeItem }) => { +const Server = ({ id, removeItem, value }) => { return ( { /> } id={id} + value= {value} > ); };