import Box from "@mui/material/Box"; import Stack from "@mui/material/Stack"; import Typography from "@mui/material/Typography"; import ConfigBox from "@/Components/v1/ConfigBox/index.jsx"; import Search from "@/Components/v1/Inputs/Search/index.jsx"; import timezones from "@/Utils/timezones.json"; // Utils import { useTheme } from "@emotion/react"; import { PropTypes } from "prop-types"; import { useTranslation } from "react-i18next"; import { useCallback, useMemo, useState } from "react"; const SettingsTimeZone = ({ HEADING_SX, handleChange, timezone }) => { const theme = useTheme(); const { t } = useTranslation(); const [rawInput, setRawInput] = useState(""); const selectedTimezone = useMemo( () => timezones.find((tz) => tz._id === timezone) ?? null, [timezone] ); const handleTimezoneChange = useCallback( (newValue) => { setRawInput(""); handleChange({ target: { name: "timezone", value: newValue?._id ?? "", }, }); }, [handleChange] ); return ( {t("settingsPage.timezoneSettings.title")} {t("settingsPage.timezoneSettings.description")} setRawInput(val)} handleChange={handleTimezoneChange} isAdorned={true} unit="timezone" /> ); }; SettingsTimeZone.propTypes = { HEADING_SX: PropTypes.object, handleChange: PropTypes.func, timezone: PropTypes.string, }; export default SettingsTimeZone;