- Make status page url disabled and read from env
- Use ColorPicker for color selection
This commit is contained in:
1 parent
df4a7f6720
commit
df86c926c7
3 files changed
+29
-21
No files matched your search
@@ -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 (
|
||||
<TabPanel
|
||||
value="General settings"
|
||||
>
|
||||
<TabPanel value="General settings">
|
||||
<Stack
|
||||
component="form"
|
||||
className="status-general-settings-form"
|
||||
@@ -170,13 +176,13 @@ const GeneralSettingsPanel = () => {
|
||||
type="url"
|
||||
label="Your status page address"
|
||||
disabled
|
||||
value={SUBDOAMIN_PREFIX+ STATUS_PAGE}
|
||||
// startAdornment={
|
||||
// <HttpAdornment
|
||||
// prefix={SUBDOAMIN_PREFIX}
|
||||
// https={false}
|
||||
// />
|
||||
// }
|
||||
value={form.url ?? STATUS_PAGE}
|
||||
startAdornment={
|
||||
<HttpAdornment
|
||||
prefix={SUBDOAMIN_PREFIX}
|
||||
https={false}
|
||||
/>
|
||||
}
|
||||
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 = () => {
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
<TextInput
|
||||
<ColorPicker
|
||||
id="color"
|
||||
label="Color"
|
||||
value={form.color}
|
||||
error={errors["color"]}
|
||||
onChange={handleChange}
|
||||
onChange={handleColorChange}
|
||||
onBlur={handleBlur}
|
||||
/>
|
||||
></ColorPicker>
|
||||
</Stack>
|
||||
</ConfigBox>
|
||||
</Stack>
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user