diff --git a/Client/src/App.jsx b/Client/src/App.jsx index aee0fb84b..dbac0bc82 100644 --- a/Client/src/App.jsx +++ b/Client/src/App.jsx @@ -12,7 +12,7 @@ import { logger } from "./Utils/Logger"; // Import the logger import { networkService } from "./main"; import { Routes } from "./Routes"; -import CreateStatus from "./Pages/Status/CreateStatus"; +import CreateStatus from "./Pages/StatusPage/CreateStatus"; function App() { const mode = useSelector((state) => state.ui.mode); const { authToken } = useSelector((state) => state.auth); diff --git a/Client/src/Components/Inputs/ColorPicker/index.jsx b/Client/src/Components/Inputs/ColorPicker/index.jsx index de63400bc..64b878400 100644 --- a/Client/src/Components/Inputs/ColorPicker/index.jsx +++ b/Client/src/Components/Inputs/ColorPicker/index.jsx @@ -21,15 +21,17 @@ import { MuiColorInput } from "mui-color-input"; * > * */ -const ColorPicker = ({ id, value, error, onChange, onBlur }) => { +const ColorPicker = ({ id, name, value, error, onChange, onBlur }) => { const theme = useTheme(); return ( onChange({ target: { name, value: color } })} onBlur={onBlur} /> {error && ( @@ -54,7 +56,7 @@ ColorPicker.propTypes = { value: PropTypes.string, error: PropTypes.string, onChange: PropTypes.func.isRequired, - onBlur: PropTypes.func.isRequired, + onBlur: PropTypes.func, }; export default ColorPicker; diff --git a/Client/src/Components/TabPanels/Status/ContentPanel.jsx b/Client/src/Components/TabPanels/Status/ContentPanel.jsx index 37833f55c..4b8b92aa5 100644 --- a/Client/src/Components/TabPanels/Status/ContentPanel.jsx +++ b/Client/src/Components/TabPanels/Status/ContentPanel.jsx @@ -4,7 +4,7 @@ import { useTheme } from "@emotion/react"; import TabPanel from "@mui/lab/TabPanel"; import ConfigBox from "../../../Components/ConfigBox"; -import { StatusFormContext } from "../../../Pages/Status/CreateStatusContext"; +import { StatusFormContext } from "../../../Pages/StatusPage/CreateStatusContext"; import { useSelector } from "react-redux"; import { logger } from "../../../Utils/Logger"; import { createToast } from "../../../Utils/toastUtils"; @@ -22,14 +22,8 @@ import { buildErrors } from "../../../Validation/error"; */ const ContentPanel = () => { const theme = useTheme(); - const { - form, - setForm, - errors, - setErrors, - handleBlur, - handelCheckboxChange, - } = useContext(StatusFormContext); + const { form, setForm, errors, setErrors, handleBlur, handelCheckboxChange } = + useContext(StatusFormContext); const [cards, setCards] = useState([]); const { user, authToken } = useSelector((state) => state.auth); const [monitors, setMonitors] = useState([]); @@ -80,7 +74,7 @@ const ContentPanel = () => { const handleServersBlur = () => { const { error } = publicPageSettingsValidation.validate( - { "monitors": form.monitors }, + { monitors: form.monitors }, { abortEarly: false, } @@ -88,7 +82,7 @@ const ContentPanel = () => { setErrors((prev) => { return buildErrors(prev, "monitors", error); }); - }; + }; return ( { form={form} setForm={setForm} removeItem={removeCard} - onBlur= {handleServersBlur} + onBlur={handleServersBlur} /> {errors["monitors"] && ( diff --git a/Client/src/Components/TabPanels/Status/GeneralSettingsPanel.jsx b/Client/src/Components/TabPanels/Status/GeneralSettingsPanel.jsx index af0f9c81f..46410e82e 100644 --- a/Client/src/Components/TabPanels/Status/GeneralSettingsPanel.jsx +++ b/Client/src/Components/TabPanels/Status/GeneralSettingsPanel.jsx @@ -12,7 +12,7 @@ import Select from "../../Inputs/Select"; import { logoImageValidation } from "../../../Validation/validation"; import { formatBytes } from "../../../Utils/fileUtils"; import ProgressUpload from "../../ProgressBars"; -import { StatusFormContext } from "../../../Pages/Status/CreateStatusContext"; +import { StatusFormContext } from "../../../Pages/StatusPage/CreateStatusContext"; import ColorPicker from "../../Inputs/ColorPicker"; import Checkbox from "../../Inputs/Checkbox"; @@ -22,8 +22,15 @@ import Checkbox from "../../Inputs/Checkbox"; */ const GeneralSettingsPanel = () => { const theme = useTheme(); - const { form, setForm, errors, setErrors, handleBlur, handleChange, handelCheckboxChange } = - useContext(StatusFormContext); + const { + form, + setForm, + errors, + setErrors, + handleBlur, + handleChange, + handelCheckboxChange, + } = useContext(StatusFormContext); const [logo, setLogo] = useState(form.logo); const [progress, setProgress] = useState({ value: 0, isLoading: false }); @@ -213,7 +220,7 @@ const GeneralSettingsPanel = () => { width: "100%", maxWidth: "200px", alignSelf: "center", - mt: theme.spacing(4) + mt: theme.spacing(4), }} > Remove Logo diff --git a/Client/src/Pages/Account/index.jsx b/Client/src/Pages/Account/index.jsx index 9fd38b5ef..0a1d2c104 100644 --- a/Client/src/Pages/Account/index.jsx +++ b/Client/src/Pages/Account/index.jsx @@ -87,33 +87,6 @@ const Account = ({ open = "profile" }) => { onKeyDown={handleKeyDown} onFocus={() => handleFocus(label.toLowerCase())} tabIndex={index} - sx={{ - fontSize: 13, - color: theme.palette.tertiary.contrastText, - backgroundColor: theme.palette.tertiary.main, - textTransform: "none", - minWidth: "fit-content", - paddingY: theme.spacing(6), - fontWeight: 400, - borderBottom: "2px solid transparent", - borderRight: `1px solid ${theme.palette.primary.lowContrast}`, - "&:first-child": { borderTopLeftRadius: "8px" }, - "&:last-child": { borderTopRightRadius: "8px", borderRight: 0 }, - "&:focus-visible": { - color: theme.palette.primary.contrastText, - borderColor: theme.palette.tertiary.contrastText, - borderRightColor: theme.palette.primary.lowContrast, - }, - "&.Mui-selected": { - backgroundColor: theme.palette.secondary.main, - color: theme.palette.secondary.contrastText, - borderColor: theme.palette.secondary.contrastText, - borderRightColor: theme.palette.primary.lowContrast, - }, - "&:hover": { - borderColor: theme.palette.primary.lowContrast, - }, - }} /> ))} diff --git a/Client/src/Pages/StatusPage/Create/Components/Progress/index.jsx b/Client/src/Pages/StatusPage/Create/Components/Progress/index.jsx new file mode 100644 index 000000000..d85225551 --- /dev/null +++ b/Client/src/Pages/StatusPage/Create/Components/Progress/index.jsx @@ -0,0 +1,37 @@ +import { Button, Box } from "@mui/material"; +import ProgressUpload from "../../../../../Components/ProgressBars"; +import ImageIcon from "@mui/icons-material/Image"; + +import { formatBytes } from "../../../../../Utils/fileUtils"; +const Progress = ({ isLoading, progressValue, logo, logoType, removeLogo, errors }) => { + if (isLoading) { + return ( + } + label={logo?.name} + size={formatBytes(logo?.size)} + progress={progressValue} + onClick={removeLogo} + /> + ); + } + + if (logo && logoType) { + return ( + + + + ); + } +}; + +export default Progress; diff --git a/Client/src/Pages/StatusPage/Create/Components/Tabs/Content.jsx b/Client/src/Pages/StatusPage/Create/Components/Tabs/Content.jsx new file mode 100644 index 000000000..763863ec7 --- /dev/null +++ b/Client/src/Pages/StatusPage/Create/Components/Tabs/Content.jsx @@ -0,0 +1,14 @@ +import { Stack, Typography } from "@mui/material"; +import { TabPanel } from "@mui/lab"; + +const Content = ({ tabValue }) => { + return ( + + + Content + + + ); +}; + +export default Content; diff --git a/Client/src/Pages/StatusPage/Create/Components/Tabs/Settings.jsx b/Client/src/Pages/StatusPage/Create/Components/Tabs/Settings.jsx new file mode 100644 index 000000000..2dbf3f2b2 --- /dev/null +++ b/Client/src/Pages/StatusPage/Create/Components/Tabs/Settings.jsx @@ -0,0 +1,128 @@ +// Components +import { Stack, Typography } from "@mui/material"; +import { TabPanel } from "@mui/lab"; +import ConfigBox from "../../../../../Components/ConfigBox"; +import Checkbox from "../../../../../Components/Inputs/Checkbox"; +import TextInput from "../../../../../Components/Inputs/TextInput"; +import Select from "../../../../../Components/Inputs/Select"; +import ImageField from "../../../../../Components/Inputs/Image"; +import ColorPicker from "../../../../../Components/Inputs/ColorPicker"; +import Progress from "../Progress"; +// Utils +import { useTheme } from "@emotion/react"; +import timezones from "../../../../../Utils/timezones.json"; + +const TabSettings = ({ + tabValue, + form, + handleFormChange, + handleImageChange, + progress, + removeLogo, + errors, +}) => { + // Utils + const theme = useTheme(); + + return ( + + + + + Access + + If your status page is ready, you can mark it as published. + + + + + + + + + Basic Information + + Define company name and the subdomain that your status page points to. + + + + + + + + + + Timezone + + Select the timezone that your status page will be displayed in. + + + +