diff --git a/Client/src/Components/TabPanels/Status/GeneralSettingsPanel.jsx b/Client/src/Components/TabPanels/Status/GeneralSettingsPanel.jsx index 3fe0bc611..737b75500 100644 --- a/Client/src/Components/TabPanels/Status/GeneralSettingsPanel.jsx +++ b/Client/src/Components/TabPanels/Status/GeneralSettingsPanel.jsx @@ -17,6 +17,7 @@ import ProgressUpload from "../../ProgressBars"; import ImageIcon from "@mui/icons-material/Image"; import { HttpAdornment } from "../../Inputs/TextInput/Adornments"; import { StatusFormContext } from "../../../Pages/Status/CreateStatusContext"; +import ColorPicker from "../../Inputs/ColorPicker"; /** * General settings panel is ued to compose part of the public static page @@ -53,6 +54,13 @@ const GeneralSettingsPanel = () => { setProgress({ value: 0, isLoading: false }); }; + const handleColorChange = (newValue) => { + setForm((prev) => ({ + ...prev, + color: newValue, + })); + } + const handleChange = (event) => { event.preventDefault(); const { value, id, name } = event.target; @@ -114,9 +122,7 @@ const GeneralSettingsPanel = () => { }; return ( - + { type="url" label="Your status page address" disabled - value={SUBDOAMIN_PREFIX+ STATUS_PAGE} - // startAdornment={ - // - // } + value={form.url ?? STATUS_PAGE} + startAdornment={ + + } onChange={handleChange} onBlur={handleBlur} helperText={errors["url"]} @@ -227,8 +233,8 @@ const GeneralSettingsPanel = () => { onClick={removeLogo} sx={{ width: "100%", - maxWidth:"200px", - alignSelf: "center" + maxWidth: "200px", + alignSelf: "center", }} > Remove Logo @@ -236,14 +242,14 @@ const GeneralSettingsPanel = () => { ) : ( "" )} - + > diff --git a/Client/src/Pages/Status/CreateStatus/index.jsx b/Client/src/Pages/Status/CreateStatus/index.jsx index c2019c802..9d2ed6bc3 100644 --- a/Client/src/Pages/Status/CreateStatus/index.jsx +++ b/Client/src/Pages/Status/CreateStatus/index.jsx @@ -31,12 +31,13 @@ import { networkService } from "../../../main"; ]; const tabList = ["General settings", "Contents"]; const hasInitForm = initForm && Object.keys(initForm).length > 0; + const STATUS_PAGE = import.meta.env.VITE_STATU_PAGE_URL?? "status-page"; const [form, setForm] = useState( hasInitForm ? initForm : { companyName: "", - url: "", + url: STATUS_PAGE, timezone: "America/Toronto", color: "#4169E1", //which fields matching below? @@ -77,7 +78,7 @@ import { networkService } from "../../../main"; theme: mode, logo: { type: form.logo?.type ?? "", size: form.logo?.size ?? "" }, }; - //delete localData.logo + delete localData.logo if ( hasValidationErrors(localData, publicPageGeneralSettingsValidation, setErrors) ) { @@ -85,8 +86,9 @@ import { networkService } from "../../../main"; return; } - //form.logo = { ...logo, size: formatBytes(logo?.size) }; - let config = { authToken: authToken, url: "status-page", data: localData }; + //localData.logo = form.logo + localData.url = STATUS_PAGE + let config = { authToken: authToken, url: STATUS_PAGE, data: localData }; try { const res = await networkService.createStatusPage(config); if (!res.status === 200) { diff --git a/Client/src/Pages/Status/index.jsx b/Client/src/Pages/Status/index.jsx index f1fa20f4d..db37a2aac 100644 --- a/Client/src/Pages/Status/index.jsx +++ b/Client/src/Pages/Status/index.jsx @@ -17,11 +17,11 @@ const Status = () => { const theme = useTheme(); const navigate = useNavigate(); const {authToken} = useSelector((state) => state.auth); - const {apiBaseUrl} = useSelector((state) => state.settings); const [initForm, setInitForm] = useState({}); + const STATUS_PAGE = import.meta.env.VITE_STATU_PAGE_URL?? "status-page"; useEffect(() => { const getStatusPage = async () => { - let config = { authToken: authToken, url: "status-page" }; + let config = { authToken: authToken, url: STATUS_PAGE }; try { let res = await networkService.getStatusPageByUrl(config); if(res && res.data)