- Remove Color picker OOTB label, add custom label

- Add label for logo
- Replace react beautiful dnd with hello-pangea to fix the  "defaultProps will not be supported " console warning due to react beatuful dnd deprecation
- Add all the checkboxes and respective validation
- Remove subdomain from UI display
- Pass Handlers as context for both tabs to ease code scalability
- All Status page fields are now ready for submission
This commit is contained in:
Shemy Gan committed 2025-01-17 14:34:29 -05:00
1 parent 642c5f0479
commit 045a9cff3a
11 files changed
+243 -257

No files matched your search

@@ -3,12 +3,13 @@ import Search from "../../../../Inputs/Search";
import {useState} from "react"
import React from "react";
import { Stack } from "@mui/material";
import PropTypes from "prop-types";
/**
*
* @param {*} id The Id of the Server component
* @param {*} monitors The server monitors options
* @param {*} value the option label of the server/monitor, namely the monitor name field
* @param {*} value - Current input value for the Autocomplete
* @param {*} removeItem The function used to remove a single server
* @param {*} onChange The Change handler function to handle when the server value is changed
* used to update the server(monitor) lists*
@@ -49,9 +50,9 @@ const Server = ({ id, value, monitors, onChange, removeItem, dragHandleProps })
Server.propTypes = {
id: PropTypes.string.isRequired,
monitors: PropTypes.array.isRequired,
value: PropTypes.string.isRequired,
removeItem: PropTypes.function.isRequired,
onChange: PropTypes.function.isRequired,
value: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
removeItem: PropTypes.func.isRequired,
onChange: PropTypes.func.isRequired,
dragHandleProps: PropTypes.object.isRequired,
};
@@ -1,6 +1,8 @@
import { DragDropContext, Droppable, Draggable } from "react-beautiful-dnd";
import { DragDropContext, Droppable, Draggable } from "@hello-pangea/dnd";
import Server from "./Server";
import update from "immutability-helper";
import PropTypes from "prop-types";
import { Stack, useTheme } from "@mui/material";
/**
*
@@ -16,7 +18,8 @@ import update from "immutability-helper";
const ServersList = ({ monitors, cards, setCards, form, setForm, removeItem }) => {
const grid = 8;
const theme = useTheme()
const grid = parseInt(theme.spacing(4));
const handleCardChange = (event, val) => {
let newCards;
@@ -63,11 +66,11 @@ const ServersList = ({ monitors, cards, setCards, form, setForm, removeItem }) =
const getItemStyle = (isDragging, draggableStyle) => ({
// some basic styles to make the items look a bit nicer
userSelect: "none",
padding: grid * 2,
padding: grid,
margin: `0 0 ${grid}px 0`,
// change background colour if dragging
background: isDragging ? "lightgreen" : "lightgrey",
background: isDragging ? "#D0D5DD" : "#F8F9F8",
// styles we need to apply on draggables
...draggableStyle,
@@ -76,17 +79,17 @@ const ServersList = ({ monitors, cards, setCards, form, setForm, removeItem }) =
const getListStyle = (isDraggingOver) => ({
background: isDraggingOver ? "lightblue" : "white",
padding: grid,
width: 550,
});
return (
<DragDropContext onDragEnd={handleDragEnd}>
<Droppable droppableId="droppable">
{(provided, snapshot) => (
<div
<Stack
{...provided.droppableProps}
ref={provided.innerRef}
style={getListStyle(snapshot.isDraggingOver)}
sx={{...getListStyle(snapshot.isDraggingOver)}}
>
{cards.map((item, index) => (
<Draggable
@@ -95,13 +98,13 @@ const ServersList = ({ monitors, cards, setCards, form, setForm, removeItem }) =
index={index}
>
{(provided, snapshot) => (
<div
<Stack
ref={provided.innerRef}
{...provided.draggableProps}
style={getItemStyle(
sx={{...getItemStyle(
snapshot.isDragging,
provided.draggableProps.style
)}
)}}
>
<Server
key={index}
@@ -112,12 +115,12 @@ const ServersList = ({ monitors, cards, setCards, form, setForm, removeItem }) =
removeItem={removeItem}
dragHandleProps={provided.dragHandleProps}
/>
</div>
</Stack>
)}
</Draggable>
))}
{provided.placeholder}
</div>
</Stack>
)}
</Droppable>
</DragDropContext>
@@ -127,10 +130,10 @@ const ServersList = ({ monitors, cards, setCards, form, setForm, removeItem }) =
ServersList.propTypes = {
monitors: PropTypes.array.isRequired,
cards: PropTypes.array.isRequired,
setCards: PropTypes.function.isRequired,
setCards: PropTypes.func.isRequired,
form: PropTypes.object.isRequired,
setForm: PropTypes.function.isRequired,
removeItem: PropTypes.function.isRequired
setForm: PropTypes.func.isRequired,
removeItem: PropTypes.func.isRequired
};
export default ServersList;