Files
Checkmate/Client/src/Pages/Integrations/index.jsx
T

131 lines
3.6 KiB
React
Raw Normal View History

2024-07-26 12:39:18 -04:00
import PropTypes from "prop-types";
2024-07-31 19:23:52 -04:00
import { Stack, Typography, Grid } from "@mui/material";
2024-07-26 12:39:18 -04:00
import Button from "../../Components/Button";
import { useTheme } from "@emotion/react";
2024-07-31 19:20:50 -04:00
import Discord from "../../assets/icons/discord-icon.svg?react";
import Slack from "../../assets/icons/slack-icon.svg?react";
import Zapier from "../../assets/icons/zapier-icon.svg?react";
2024-07-26 12:39:18 -04:00
import "./index.css";
/**
* Integrations component
* @param {Object} props - Props for the IntegrationsComponent.
2024-07-31 19:20:50 -04:00
* @param {string} props.icon - The icon for the integration image.
2024-07-26 12:39:18 -04:00
* @param {string} props.header - The header for the integration.
* @param {string} props.info - Information about the integration.
* @param {Function} props.onClick - The onClick handler for the integration button.
* @returns {JSX.Element} The JSX representation of the IntegrationsComponent.
*/
2024-07-31 19:20:50 -04:00
const IntegrationsComponent = ({ icon, header, info, onClick }) => {
2024-07-26 12:39:18 -04:00
const theme = useTheme();
return (
<Grid item lg={6} flexGrow={1}>
<Stack
direction="row"
justifyContent="space-between"
gap={theme.gap.large}
2024-07-28 16:51:47 -04:00
p={theme.gap.ml}
2024-07-31 19:20:50 -04:00
pl={theme.gap.large}
height="100%"
2024-07-26 12:39:18 -04:00
>
2024-07-31 19:23:52 -04:00
{icon}
2024-07-26 12:39:18 -04:00
<Stack gap={theme.gap.xs} flex={1}>
<Typography component="h1">{header}</Typography>
<Typography
sx={{
maxWidth: "300px",
wordWrap: "break-word",
}}
>
{info}
</Typography>
</Stack>
<Button
label="Add"
level="primary"
onClick={onClick}
sx={{ alignSelf: "center" }}
2024-07-31 19:20:50 -04:00
disabled={true}
2024-07-26 12:39:18 -04:00
/>
</Stack>
</Grid>
);
};
// PropTypes for IntegrationsComponent
IntegrationsComponent.propTypes = {
2024-07-31 19:20:50 -04:00
icon: PropTypes.object.isRequired,
2024-07-26 12:39:18 -04:00
header: PropTypes.string.isRequired,
info: PropTypes.string.isRequired,
onClick: PropTypes.func.isRequired,
};
2024-06-09 23:37:47 -07:00
/**
* Integrations Page Component
* @returns {JSX.Element} The JSX representation of the Integrations page.
2024-06-09 23:37:47 -07:00
*/
2024-07-26 12:39:18 -04:00
const Integrations = () => {
const theme = useTheme();
const integrations = [
2024-07-26 12:39:18 -04:00
{
2024-07-31 19:20:50 -04:00
icon: (
<Slack
alt="slack integration"
2024-07-31 19:23:52 -04:00
style={{ width: "45px", height: "45px", alignSelf: "center" }}
2024-07-31 19:20:50 -04:00
/>
),
2024-07-26 12:39:18 -04:00
header: "Slack",
info: "Connect with Slack and see incidents in a channel",
onClick: () => {},
},
{
2024-07-31 19:20:50 -04:00
icon: (
<Discord
alt="discord integration"
2024-07-31 19:23:52 -04:00
style={{ width: "42px", height: "42px", alignSelf: "center" }}
2024-07-31 19:20:50 -04:00
/>
),
2024-07-26 12:39:18 -04:00
header: "Discord",
info: "Connect with Discord and view incidents directly in a channel",
onClick: () => {},
},
{
2024-07-31 19:20:50 -04:00
icon: (
<Zapier
alt="zapier integration"
2024-07-31 19:23:52 -04:00
style={{ width: "42px", height: "42px", alignSelf: "center" }}
2024-07-31 19:20:50 -04:00
/>
),
2024-07-26 12:39:18 -04:00
header: "Zapier",
info: "Send all incidents to Zapier, and then see them everywhere",
onClick: () => {},
},
// Add more integrations as needed
];
return (
2024-07-26 12:39:18 -04:00
<Stack className="integrations" gap={theme.gap.xs}>
<Typography component="h1">Integrations</Typography>
2024-07-28 16:51:47 -04:00
<Typography mb={theme.gap.large}>
Connect Uptime Genie to your favorite service
</Typography>
<Grid container spacing={theme.gap.large}>
{integrations.map((integration, index) => (
2024-07-26 12:39:18 -04:00
<IntegrationsComponent
key={index}
2024-07-31 19:20:50 -04:00
icon={integration.icon}
header={integration.header}
info={integration.info}
onClick={integration.onClick}
/>
))}
2024-07-26 12:39:18 -04:00
</Grid>
</Stack>
);
};
export default Integrations;