Changes: Made showURL boolean and removed console log

This commit is contained in:
Asim Ahmed Siddiqui committed 2025-05-26 00:19:49 +05:30
1 parent e8d636dcfd
commit e7ed85405b
9 files changed
+24 -20

No files matched your search

+6 -6
View File
@@ -9,7 +9,7 @@ import { useTheme } from "@emotion/react";
import { PropTypes } from "prop-types";
import { useTranslation } from "react-i18next";
const SettingsURL = ({ HEADING_SX, handleChange, statusURL }) => {
const SettingsURL = ({ HEADING_SX, handleChange, showURL }) => {
const { t } = useTranslation();
const theme = useTheme();
return (
@@ -20,13 +20,13 @@ const SettingsURL = ({ HEADING_SX, handleChange, statusURL }) => {
</Box>
<Stack gap={theme.spacing(20)}>
<Select
name="statusURL"
name="showURL"
label={t("settingsURLSelectTitle")}
value={statusURL}
value={showURL}
onChange={handleChange}
items={[
{ _id: "enabled", name: "Enabled" },
{ _id: "disabled", name: "Disabled" },
{ _id: true, name: t("settingsURLEnabled") },
{ _id: false, name: t("settingURLDisabled") },
]}
></Select>
</Stack>
@@ -37,7 +37,7 @@ const SettingsURL = ({ HEADING_SX, handleChange, statusURL }) => {
SettingsURL.propTypes = {
HEADING_SX: PropTypes.object,
handleChange: PropTypes.func,
statusURL: PropTypes.string,
showURL: PropTypes.bool,
};
export default SettingsURL;
+5 -6
View File
@@ -16,7 +16,7 @@ import { useState } from "react";
import { useTheme } from "@emotion/react";
import { useTranslation } from "react-i18next";
import { useSelector, useDispatch } from "react-redux";
import { setTimezone, setMode, setLanguage, setStatusURL } from "../../Features/UI/uiSlice";
import { setTimezone, setMode, setLanguage, setShowURL } from "../../Features/UI/uiSlice";
import SettingsStats from "./SettingsStats";
import {
deleteMonitorChecksByTeamId,
@@ -32,7 +32,7 @@ const BREADCRUMBS = [{ name: `Settings`, path: "/settings" }];
const Settings = () => {
// Redux state
const { mode, language, timezone, statusURL } = useSelector((state) => state.ui);
const { mode, language, timezone, showURL } = useSelector((state) => state.ui);
const { user } = useSelector((state) => state.auth);
// Local state
@@ -68,7 +68,6 @@ const Settings = () => {
const { error } = settingsValidation.validate(newSettingsData.settings, {
abortEarly: false,
});
console.log(error)
if (!error || error.details.length === 0) {
setErrors({});
} else {
@@ -87,8 +86,8 @@ const Settings = () => {
dispatch(setMode(value));
}
if (name === "statusURL") {
dispatch(setStatusURL(value));
if (name === "showURL") {
dispatch(setShowURL(value));
}
if (name === "language") {
@@ -173,7 +172,7 @@ const Settings = () => {
<SettingsURL
HEADING_SX={HEADING_SX}
handleChange={handleChange}
statusURL={statusURL}
showURL={showURL}
/>
<SettingsStats
isAdmin={isAdmin}
@@ -15,8 +15,7 @@ const MonitorsList = ({ isLoading = false, shouldRender = true, monitors = [] })
const theme = useTheme();
const { determineState } = useUtils();
const { statusURL } = useSelector((state) => state.ui);
const showURL = statusURL === "enabled";
const { showURL } = useSelector((state) => state.ui);
return (
<>