fe
This commit is contained in:
1 parent
6bca0ed00b
commit
7b207f2ccb
15 files changed
+204
-15
No files matched your search
@@ -1,13 +1,11 @@
|
||||
import Box from "@mui/material/Box";
|
||||
import Box, { type BoxProps } from "@mui/material/Box";
|
||||
import { useTheme } from "@mui/material/styles";
|
||||
import type { SxProps } from "@mui/material/styles";
|
||||
|
||||
type BaseBoxProps = React.PropsWithChildren<{ sx?: SxProps }>;
|
||||
|
||||
export const BaseBox: React.FC<BaseBoxProps> = ({ children, sx }) => {
|
||||
export const BaseBox = ({ sx, ...rest }: BoxProps) => {
|
||||
const theme = useTheme();
|
||||
return (
|
||||
<Box
|
||||
{...rest}
|
||||
sx={{
|
||||
backgroundColor: theme.palette.primary.main,
|
||||
border: 1,
|
||||
@@ -16,8 +14,6 @@ export const BaseBox: React.FC<BaseBoxProps> = ({ children, sx }) => {
|
||||
borderRadius: theme.shape.borderRadius,
|
||||
...sx,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</Box>
|
||||
/>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,57 @@
|
||||
import Stack from "@mui/material/Stack";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { BaseBox } from "@/components/design-elements";
|
||||
|
||||
import { useTheme } from "@mui/material/styles";
|
||||
import type { Entitlements, PlanKey } from "@/types/entitlements";
|
||||
|
||||
export const PlanCard = ({
|
||||
plan,
|
||||
currentPlan,
|
||||
onClick,
|
||||
}: {
|
||||
plan: Entitlements;
|
||||
currentPlan: PlanKey | null;
|
||||
onClick?: (planKey: PlanKey) => void;
|
||||
}) => {
|
||||
const selected = plan.plan === currentPlan;
|
||||
const theme = useTheme();
|
||||
return (
|
||||
<BaseBox
|
||||
padding={theme.spacing(8)}
|
||||
sx={
|
||||
selected
|
||||
? {
|
||||
border: 2,
|
||||
borderColor: theme.palette.accent.main,
|
||||
}
|
||||
: { cursor: "pointer" }
|
||||
}
|
||||
onClick={selected ? undefined : () => onClick?.(plan.plan)}
|
||||
>
|
||||
<Stack spacing={theme.spacing(2)}>
|
||||
<Typography variant="h6" textTransform="capitalize">
|
||||
{plan.plan}
|
||||
</Typography>
|
||||
<Typography variant="body2" color="text.secondary">
|
||||
Monitors: {plan.monitorsMax}
|
||||
</Typography>
|
||||
<Typography variant="body2" color="text.secondary">
|
||||
Status pages: {plan.statusPagesMax}
|
||||
</Typography>
|
||||
<Typography variant="body2" color="text.secondary">
|
||||
Notification channels: {plan.notificationChannelsMax}
|
||||
</Typography>
|
||||
<Typography variant="body2" color="text.secondary">
|
||||
Teams: {plan.teamsMax}
|
||||
</Typography>
|
||||
<Typography variant="body2" color="text.secondary">
|
||||
Min interval: {Math.round(plan.checksIntervalMsMin / 1000)}s
|
||||
</Typography>
|
||||
<Typography variant="body2" color="text.secondary">
|
||||
Retention: {plan.retentionDays} days
|
||||
</Typography>
|
||||
</Stack>
|
||||
</BaseBox>
|
||||
);
|
||||
};
|
||||
@@ -29,3 +29,4 @@ export { Tabs } from "./Tabs";
|
||||
export { Breadcrumb } from "./Breadcrumb";
|
||||
export { InfoBox } from "./InfoBox";
|
||||
export { Tooltip, TooltipWithInfo } from "./Tooltip";
|
||||
export { PlanCard } from "./PlanCard";
|
||||
@@ -9,6 +9,8 @@ import { useAppSelector } from "@/hooks/AppHooks";
|
||||
import { useState } from "react";
|
||||
import { useTheme } from "@mui/material/styles";
|
||||
import { Tooltip } from "@/components/design-elements";
|
||||
const DEPLOYMENT_MODE = import.meta.env.VITE_APP_DEPLOYMENT_MODE;
|
||||
const IS_SAAS = DEPLOYMENT_MODE === "saas";
|
||||
|
||||
export const SettingsSwitch = () => {
|
||||
const navigate = useNavigate();
|
||||
@@ -105,7 +107,7 @@ export const SettingsSwitch = () => {
|
||||
<Typography>Invite</Typography>
|
||||
</MenuItem>
|
||||
)}
|
||||
{hasBilling && (
|
||||
{hasBilling && IS_SAAS && (
|
||||
<MenuItem onClick={() => handleClick("billing")}>
|
||||
<Typography>Billing</Typography>
|
||||
</MenuItem>
|
||||
|
||||
Reference in new issue
Block a user