- Merge feedback works from status page 1 and status page 2 branches

This commit is contained in:
Shemy Gan committed 2024-12-13 11:29:50 -05:00
1 parent fdca92e543
commit 406fa6ed9f
4 files changed
+15 -19

No files matched your search

@@ -21,6 +21,7 @@ import "./index.css";
* @param {string} [props.value] - Optional value associated with the checkbox * @param {string} [props.value] - Optional value associated with the checkbox
* @param {Function} [props.onChange] - Callback function triggered when checkbox state changes * @param {Function} [props.onChange] - Callback function triggered when checkbox state changes
* @param {boolean} [props.isDisabled] - Determines if the checkbox is disabled * @param {boolean} [props.isDisabled] - Determines if the checkbox is disabled
* @param {boolean} [props.alignSelf] - Whether the checkbox label should be positioned on flex-start.
* *
* @returns {React.ReactElement} Rendered Checkbox component * @returns {React.ReactElement} Rendered Checkbox component
* *
@@ -42,6 +43,7 @@ import "./index.css";
* isChecked={isAdvanced} * isChecked={isAdvanced}
* isDisabled={!canModify} * isDisabled={!canModify}
* onChange={handleAdvancedToggle} * onChange={handleAdvancedToggle}
* alignSelf = {alignSelf}
* /> * />
*/ */
const Checkbox = ({ const Checkbox = ({
@@ -53,11 +55,12 @@ const Checkbox = ({
value, value,
onChange, onChange,
isDisabled, isDisabled,
alignSelf
}) => { }) => {
/* TODO move sizes to theme */ /* TODO move sizes to theme */
const sizes = { small: "14px", medium: "16px", large: "18px" }; const sizes = { small: "14px", medium: "16px", large: "18px" };
const theme = useTheme(); const theme = useTheme();
const override = typeof label == "string" ? {} : { alignSelf: "flex-start" }; const override = alignSelf? { alignSelf: "flex-start" } : {}
return ( return (
<FormControlLabel <FormControlLabel
className="checkbox-wrapper" className="checkbox-wrapper"
@@ -115,6 +118,7 @@ Checkbox.propTypes = {
value: PropTypes.string, value: PropTypes.string,
onChange: PropTypes.func, onChange: PropTypes.func,
isDisabled: PropTypes.bool, isDisabled: PropTypes.bool,
alignSelf: PropTypes.bool,
}; };
export default Checkbox; export default Checkbox;
+7 -3
View File
@@ -11,12 +11,15 @@ import { checkImage } from "../../../Utils/fileUtils";
* @param {string} props.id - The unique identifier for the input field. * @param {string} props.id - The unique identifier for the input field.
* @param {string} props.src - The URL of the image to display. * @param {string} props.src - The URL of the image to display.
* @param {function} props.onChange - The function to handle file input change. * @param {function} props.onChange - The function to handle file input change.
* @param {string} props.isRound - The shape of the image to display.
* @returns {JSX.Element} The rendered component. * @returns {JSX.Element} The rendered component.
*/ */
const ImageField = ({ id, src, loading, onChange, error }) => { const ImageField = ({ id, src, loading, onChange, error, isRound = true }) => {
const theme = useTheme(); const theme = useTheme();
const error_border_style = error? {borderColor: theme.palette.error.main}: {} const error_border_style = error ? { borderColor: theme.palette.error.main } : {};
const roundShape = isRound ? { borderRadius: "50%" } : {};
const [isDragging, setIsDragging] = useState(false); const [isDragging, setIsDragging] = useState(false);
const handleDragEnter = () => { const handleDragEnter = () => {
@@ -148,10 +151,10 @@ const ImageField = ({ id, src, loading, onChange, error }) => {
sx={{ sx={{
width: "250px", width: "250px",
height: "250px", height: "250px",
borderRadius: "50%",
overflow: "hidden", overflow: "hidden",
backgroundImage: `url(${src})`, backgroundImage: `url(${src})`,
backgroundSize: "cover", backgroundSize: "cover",
...roundShape,
}} }}
></Box> ></Box>
</Stack> </Stack>
@@ -164,6 +167,7 @@ ImageField.propTypes = {
id: PropTypes.string.isRequired, id: PropTypes.string.isRequired,
src: PropTypes.string, src: PropTypes.string,
onChange: PropTypes.func.isRequired, onChange: PropTypes.func.isRequired,
isRound: PropTypes.bool,
}; };
export default ImageField; export default ImageField;
@@ -31,7 +31,6 @@ const GeneralSettingsPanel = () => {
url: "", url: "",
timezone: "America/Toronto", timezone: "America/Toronto",
color: "#4169E1", color: "#4169E1",
theme: "light",
//which fields matching below? //which fields matching below?
publish: false, publish: false,
logo: null, logo: null,
@@ -68,7 +67,6 @@ const GeneralSettingsPanel = () => {
const handleSubmit = () => { const handleSubmit = () => {
//validate rest of the form //validate rest of the form
delete localData.logo; delete localData.logo;
delete localData.publish;
if (hasValidationErrors(localData, publicPageGeneralSettingsValidation, setErrors)) { if (hasValidationErrors(localData, publicPageGeneralSettingsValidation, setErrors)) {
return; return;
} }
@@ -162,7 +160,6 @@ const GeneralSettingsPanel = () => {
id="published-to-public" id="published-to-public"
label={`Published and visible to the public`} label={`Published and visible to the public`}
isChecked={localData.publish} isChecked={localData.publish}
value={"localData.publish"}
onChange={handleChange} onChange={handleChange}
onBlur={handleBlur} onBlur={handleBlur}
/> />
@@ -226,6 +223,7 @@ const GeneralSettingsPanel = () => {
src={localData.logo?.src ?? logo?.src} src={localData.logo?.src ?? logo?.src}
loading={progress.isLoading && progress.value !== 100} loading={progress.isLoading && progress.value !== 100}
onChange={handleLogo} onChange={handleLogo}
isRound={false}
/> />
{progress.isLoading || progress.value !== 0 || errors["logo"] ? ( {progress.isLoading || progress.value !== 0 || errors["logo"] ? (
<ProgressUpload <ProgressUpload
@@ -247,17 +245,6 @@ const GeneralSettingsPanel = () => {
onChange={handleChange} onChange={handleChange}
onBlur={handleBlur} onBlur={handleBlur}
/> />
<Select
id="theme"
label="Theme"
value={localData.theme}
onChange={handleChange}
onBlur={handleBlur}
items={[
{ _id: "light", name: "Light" },
{ _id: "dark", name: "Dark" },
]}
/>
</Stack> </Stack>
</ConfigBox> </ConfigBox>
<Stack <Stack
+2 -1
View File
@@ -154,7 +154,8 @@ const publicPageGeneralSettingsValidation = joi.object({
url: joi.string().trim().messages({ "string.empty": "URL is required." }), url: joi.string().trim().messages({ "string.empty": "URL is required." }),
timezone: joi.string().trim().messages({ "string.empty": "Timezone is required." }), timezone: joi.string().trim().messages({ "string.empty": "Timezone is required." }),
color: joi.string().trim().messages({ "string.empty": "Color is required." }), color: joi.string().trim().messages({ "string.empty": "Color is required." }),
theme: joi.string().trim().messages({ "string.empty": "Theme is required." }) publish: joi.bool()
} }
) )