Modified Integrations component to include props.

This commit is contained in:
M M committed 2024-06-10 12:44:10 -07:00
commit aa8a9a33c8
9 files changed
+254 -550

No files matched your search

+61 -31
View File
@@ -1,40 +1,70 @@
import IntegrationsComponent from '../../Components/Integrations';
import { Box, Typography, useTheme } from '@mui/material';
import IntegrationsComponent from '../../Components/Integrations';
/**
* Integrations Page Component
* @returns {JSX.Element}
* @returns {JSX.Element} The JSX representation of the Integrations page.
*/
const Integrations = () => {
const theme = useTheme();
return (
const theme = useTheme();
const integrations = [
{
url: 'https://via.placeholder.com/100',
header: 'Integration 1',
info: 'Info about Integration 1',
onClick: () => {}
},
{
url: 'https://via.placeholder.com/100',
header: 'Integration 2',
info: 'Info about Integration 2',
onClick: () => {}
},
{
url: 'https://via.placeholder.com/100',
header: 'Integration 2',
info: 'Info about Integration 2',
onClick: () => {}
}
// Add more integrations as needed
];
return (
<Box
display="flex"
flexDirection="column"
alignItems="flex-start"
justifyContent="flex-start"
height="100vh"
p={theme.spacing(4)}
mt={theme.spacing(8)}
>
<Typography variant="h4" component="h1" gutterBottom style={{ fontSize: '16px' }}>
Integrations
</Typography>
<Typography variant="h6" component="h2" gutterBottom style={{ fontSize: '13px' }}>
Connect Uptime Genie to your favorite service
</Typography>
<Box
display="flex"
flexDirection="column"
alignItems="flex-start"
justifyContent="flex-start"
height="100vh"
p={theme.spacing(4)}
mt={theme.spacing(8)}
display="flex"
flexWrap="wrap"
gap={theme.spacing(4)}
>
<Typography variant="h4" component="h1" gutterBottom>
Integrations
</Typography>
<Typography variant="h6" component="h2" gutterBottom>
Connect Uptime Genie to your favorite service
</Typography>
<Box
display="flex"
flexWrap="wrap"
gap={theme.spacing(4)}
>
<IntegrationsComponent />
<IntegrationsComponent />
<IntegrationsComponent />
</Box>
{integrations.map((integration, index) => (
<IntegrationsComponent
key={index}
url={integration.url}
header={integration.header}
info={integration.info}
onClick={integration.onClick}
/>
))}
</Box>
);
};
export default Integrations;
</Box>
);
};
export default Integrations;
+12 -2
View File
@@ -50,10 +50,21 @@ const Register = () => {
return { ...acc, [err.path[0]]: err.message };
}, {});
setErrors(validationErrors);
} else {
setErrors({});
}
}, []);
const handleInput = (e) => {
const fieldName = idMap[e.target.id];
// Extract and validate individual fields as input changes
const fieldSchema = registerValidation.extract(fieldName);
const { error } = fieldSchema.validate(e.target.value);
let errMsg = "";
if (error) {
errMsg = error.message;
}
setErrors({ ...errors, [fieldName]: errMsg });
const newForm = { ...form, [idMap[e.target.id]]: e.target.value };
setForm(newForm);
};
@@ -77,8 +88,7 @@ const Register = () => {
} catch (error) {
if (error.name === "ValidationError") {
// TODO Handle validation errors
console.log(error);
alert("Invalid input");
alert(error);
} else if (error.response) {
// TODO handle dispatch errors
alert(error.response.msg);