fc -> plain

This commit is contained in:
Alex Holliday committed 2025-12-15 22:19:00 +00:00
1 parent 660346d2bc
commit 666d522ee9
21 files changed
+45 -58

No files matched your search

+2 -2
View File
@@ -13,12 +13,12 @@ interface AuthBasePageProps extends StackProps {
children: React.ReactNode; children: React.ReactNode;
} }
export const AuthBasePage: React.FC<AuthBasePageProps> = ({ export const AuthBasePage = ({
children, children,
title, title,
subtitle, subtitle,
...props ...props
}) => { }: AuthBasePageProps) => {
const theme = useTheme(); const theme = useTheme();
return ( return (
<Stack gap={theme.spacing(10)} minHeight="100vh" {...props}> <Stack gap={theme.spacing(10)} minHeight="100vh" {...props}>
@@ -6,10 +6,13 @@ import { useAppSelector } from "@/hooks/AppHooks";
import type { LatestCheck } from "@/types/check"; import type { LatestCheck } from "@/types/check";
import { useTheme } from "@mui/material/styles"; import { useTheme } from "@mui/material/styles";
export const HeatmapResponseTimeTooltip: React.FC<{ export const HeatmapResponseTimeTooltip = ({
children,
check,
}: {
children: React.ReactElement; children: React.ReactElement;
check: LatestCheck; check: LatestCheck;
}> = ({ children, check }) => { }) => {
const uiTimezone = useAppSelector((state: any) => state.ui.timezone); const uiTimezone = useAppSelector((state: any) => state.ui.timezone);
const theme = useTheme(); const theme = useTheme();
@@ -13,10 +13,7 @@ interface BaseFallbackProps extends StackProps {
children: React.ReactNode; children: React.ReactNode;
} }
export const BaseFallback: React.FC<BaseFallbackProps> = ({ export const BaseFallback = ({ children, ...props }: BaseFallbackProps) => {
children,
...props
}) => {
const theme = useTheme(); const theme = useTheme();
const isSmall = useMediaQuery(theme.breakpoints.down("md")); const isSmall = useMediaQuery(theme.breakpoints.down("md"));
@@ -8,7 +8,7 @@ interface InfoBoxProps {
description: string; description: string;
} }
export const InfoBox: React.FC<InfoBoxProps> = ({ title, description }) => { export const InfoBox = ({ title, description }: InfoBoxProps) => {
const theme = useTheme(); const theme = useTheme();
return ( return (
@@ -1,8 +1,7 @@
import React from "react";
import { Box, Stack, useTheme } from "@mui/material"; import { Box, Stack, useTheme } from "@mui/material";
interface SkeletonCardProps { interface SkeletonCardProps {
width?: number | string; width?: number | string | { xs?: number | string; md?: number | string };
showHalo?: boolean; showHalo?: boolean;
} }
@@ -11,10 +10,10 @@ interface SkeletonCardProps {
* Shows an animated stacked card design with pulsing skeleton elements * Shows an animated stacked card design with pulsing skeleton elements
* Default size is 60% of original design * Default size is 60% of original design
*/ */
const SkeletonCard: React.FC<SkeletonCardProps> = ({ const SkeletonCard = ({
width = { xs: 130, md: 216 }, width = { xs: 130, md: 216 },
showHalo = true, showHalo = true,
}) => { }: SkeletonCardProps) => {
const theme = useTheme(); const theme = useTheme();
const pulseAnimation = { const pulseAnimation = {
"@keyframes pulse": { "@keyframes pulse": {
@@ -13,11 +13,7 @@ type GradientBox = React.PropsWithChildren<{
sx?: SxProps; sx?: SxProps;
}>; }>;
export const GradientBox: React.FC<GradientBox> = ({ export const GradientBox = ({ children, palette, sx }: GradientBox) => {
children,
palette,
sx,
}) => {
const theme = useTheme(); const theme = useTheme();
const isSmall = useMediaQuery(theme.breakpoints.down("md")); const isSmall = useMediaQuery(theme.breakpoints.down("md"));
const isLight = theme.palette.mode === "light"; const isLight = theme.palette.mode === "light";
@@ -51,7 +47,7 @@ type StatBoxProps = React.PropsWithChildren<{
onClick?: () => void; onClick?: () => void;
}>; }>;
export const StatBox: React.FC<StatBoxProps> = ({ export const StatBox = ({
title, title,
subtitle, subtitle,
palette, palette,
@@ -59,7 +55,7 @@ export const StatBox: React.FC<StatBoxProps> = ({
sx, sx,
tooltip, tooltip,
onClick, onClick,
}) => { }: StatBoxProps) => {
const theme = useTheme(); const theme = useTheme();
const textColor = palette ? theme.palette[palette].contrastText : "inherit"; const textColor = palette ? theme.palette[palette].contrastText : "inherit";
@@ -9,7 +9,7 @@ import { useTheme } from "@mui/material/styles";
type StatusBoxProps = React.PropsWithChildren<{ children: React.ReactNode }>; type StatusBoxProps = React.PropsWithChildren<{ children: React.ReactNode }>;
export const BGBox: React.FC<StatusBoxProps> = ({ children }) => { export const BGBox = ({ children }: StatusBoxProps) => {
const theme = useTheme(); const theme = useTheme();
return ( return (
<BaseBox <BaseBox
@@ -322,7 +322,7 @@ function TablePaginationActions(props: TablePaginationActionsProps) {
); );
} }
export const Pagination: React.FC<TablePaginationProps> = ({ ...props }) => { export const Pagination = ({ ...props }: TablePaginationProps) => {
const isSmall = useMediaQuery((theme: any) => theme.breakpoints.down("sm")); const isSmall = useMediaQuery((theme: any) => theme.breakpoints.down("sm"));
const theme = useTheme(); const theme = useTheme();
return ( return (
@@ -6,10 +6,7 @@ import type { TooltipProps } from "@mui/material/Tooltip";
type StyledTooltipProps = TooltipProps; type StyledTooltipProps = TooltipProps;
export const Tooltip: React.FC<StyledTooltipProps> = ({ export const Tooltip = ({ placement = "top", ...props }: StyledTooltipProps) => {
placement = "top",
...props
}) => {
const theme = useTheme(); const theme = useTheme();
return ( return (
@@ -44,11 +41,11 @@ export interface TooltipWithInfoProps
iconColor?: string; iconColor?: string;
} }
export const TooltipWithInfo: React.FC<TooltipWithInfoProps> = ({ export const TooltipWithInfo = ({
iconSize = 14, iconSize = 14,
iconColor, iconColor,
...props ...props
}) => { }: TooltipWithInfoProps) => {
const theme = useTheme(); const theme = useTheme();
const defaultColor = theme.palette.text.secondary; const defaultColor = theme.palette.text.secondary;
@@ -21,12 +21,12 @@ type AutoCompleteInputProps = Omit<
required?: boolean; required?: boolean;
}; };
export const AutoCompleteInput: React.FC<AutoCompleteInputProps> = ({ export const AutoCompleteInput = ({
fieldLabel, fieldLabel,
required, required,
renderInput, renderInput,
...props ...props
}) => { }: AutoCompleteInputProps) => {
const theme = useTheme(); const theme = useTheme();
const multiple = props.multiple; const multiple = props.multiple;
+2 -2
View File
@@ -6,12 +6,12 @@ import MenuItem from "@mui/material/MenuItem";
import type { ButtonGroupProps } from "@mui/material/ButtonGroup"; import type { ButtonGroupProps } from "@mui/material/ButtonGroup";
import { ChevronDown } from "lucide-react"; import { ChevronDown } from "lucide-react";
export const ButtonGroupInput: React.FC<ButtonGroupProps> = ({ export const ButtonGroupInput = ({
orientation, orientation,
children, children,
sx, sx,
...props ...props
}) => { }: ButtonGroupProps) => {
const isVertical = orientation === "vertical"; const isVertical = orientation === "vertical";
if (!isVertical) { if (!isVertical) {
+2 -2
View File
@@ -7,11 +7,11 @@ interface FieldLabelProps {
htmlFor?: string; htmlFor?: string;
} }
export const FieldLabel: React.FC<FieldLabelProps> = ({ export const FieldLabel = ({
children, children,
required = false, required = false,
htmlFor, htmlFor,
}) => { }: FieldLabelProps) => {
const theme = useTheme(); const theme = useTheme();
return ( return (
@@ -1,9 +1,7 @@
import MuiFormControlLabel from "@mui/material/FormControlLabel"; import MuiFormControlLabel from "@mui/material/FormControlLabel";
import type { FormControlLabelProps } from "@mui/material/FormControlLabel"; import type { FormControlLabelProps } from "@mui/material/FormControlLabel";
export const FormControlLabel: React.FC<FormControlLabelProps> = ({ export const FormControlLabel = ({ ...props }: FormControlLabelProps) => {
...props
}) => {
return ( return (
<MuiFormControlLabel <MuiFormControlLabel
{...props} {...props}
+2 -2
View File
@@ -9,12 +9,12 @@ interface FormFieldProps {
htmlFor?: string; htmlFor?: string;
} }
export const FormField: React.FC<FormFieldProps> = ({ export const FormField = ({
label, label,
required = false, required = false,
children, children,
htmlFor, htmlFor,
}) => { }: FormFieldProps) => {
const theme = useTheme(); const theme = useTheme();
return ( return (
+6 -4
View File
@@ -7,7 +7,7 @@ import Typography from "@mui/material/Typography";
interface RadioInputProps extends RadioProps {} interface RadioInputProps extends RadioProps {}
export const RadioInput: React.FC<RadioInputProps> = ({ ...props }) => { export const RadioInput = ({ ...props }: RadioInputProps) => {
const theme = useTheme(); const theme = useTheme();
return ( return (
<Radio <Radio
@@ -39,9 +39,11 @@ export const RadioInput: React.FC<RadioInputProps> = ({ ...props }) => {
); );
}; };
export const RadioWithDescription: React.FC< export const RadioWithDescription = ({
RadioInputProps & { label: string; description: string } label,
> = ({ label, description, ...props }) => { description,
...props
}: RadioInputProps & { label: string; description: string }) => {
const theme = useTheme(); const theme = useTheme();
return ( return (
<FormControlLabel <FormControlLabel
@@ -9,7 +9,6 @@ import { Tooltip } from "@/components/design-elements";
import { useState, useEffect } from "react"; import { useState, useEffect } from "react";
import { useAppSelector, useAppDispatch } from "@/hooks/AppHooks"; import { useAppSelector, useAppDispatch } from "@/hooks/AppHooks";
import { setSelectedTeamId } from "@/features/authSlice"; import { setSelectedTeamId } from "@/features/authSlice";
import { useNavigate } from "react-router";
import { useGet } from "@/hooks/UseApi"; import { useGet } from "@/hooks/UseApi";
import type { ApiResponse } from "@/hooks/UseApi"; import type { ApiResponse } from "@/hooks/UseApi";
import { useTheme } from "@mui/material/styles"; import { useTheme } from "@mui/material/styles";
@@ -17,7 +16,6 @@ import { useTranslation } from "react-i18next";
export const TeamSwitch = () => { export const TeamSwitch = () => {
const { t } = useTranslation(); const { t } = useTranslation();
const navigate = useNavigate();
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const theme = useTheme(); const theme = useTheme();
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null); const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
+2 -2
View File
@@ -12,13 +12,13 @@ type BaseChartProps = React.PropsWithChildren<{
maxWidth?: number | string; maxWidth?: number | string;
}>; }>;
export const BaseChart: React.FC<BaseChartProps> = ({ export const BaseChart = ({
children, children,
icon, icon,
title, title,
width = "100%", width = "100%",
maxWidth = "100%", maxWidth = "100%",
}) => { }: BaseChartProps) => {
const theme = useTheme(); const theme = useTheme();
return ( return (
@@ -29,7 +29,7 @@ type XTickProps = {
range: string; range: string;
}; };
export const XTick: React.FC<XTickProps> = ({ x, y, payload, range }) => { export const XTick = ({ x, y, payload, range }: XTickProps) => {
const format = tickDateFormatLookup(range); const format = tickDateFormatLookup(range);
const theme = useTheme(); const theme = useTheme();
const uiTimezone = useAppSelector((state: any) => state.ui.timezone); const uiTimezone = useAppSelector((state: any) => state.ui.timezone);
@@ -56,14 +56,14 @@ type ResponseTimeToolTipProps = {
uiTimezone: string; uiTimezone: string;
}; };
const ResponseTimeToolTip: React.FC<ResponseTimeToolTipProps> = ({ const ResponseTimeToolTip = ({
active, active,
payload, payload,
label, label,
range, range,
theme, theme,
uiTimezone, uiTimezone,
}) => { }: ResponseTimeToolTipProps) => {
if (!label) return null; if (!label) return null;
if (!payload) return null; if (!payload) return null;
if (!active) return null; if (!active) return null;
@@ -88,7 +88,7 @@ export const HistogramInfrastructure = ({
range, range,
title, title,
type, type,
idx, idx: _idx,
checks, checks,
xKey, xKey,
yDomain, yDomain,
@@ -156,7 +156,7 @@ export const HistogramInfrastructure = ({
{dataKeys?.map((dataKey, index) => { {dataKeys?.map((dataKey, index) => {
const gradientId = `gradient-${uniqueId}-${index}`; const gradientId = `gradient-${uniqueId}-${index}`;
return ( return (
<Fragment key={dataKey}> <Fragment key={`${dataKey}-${index}`}>
{gradient === true && {gradient === true &&
createGradient({ createGradient({
id: gradientId, id: gradientId,
@@ -2,9 +2,7 @@ import { useAppSelector } from "@/hooks/AppHooks";
import { Navigate } from "react-router"; import { Navigate } from "react-router";
import NotFound from "@/pages/errors/NotFound"; import NotFound from "@/pages/errors/NotFound";
export const ProtectedRoute: React.FC<React.PropsWithChildren> = ({ export const ProtectedRoute = ({ children }: React.PropsWithChildren) => {
children,
}) => {
const isAuthenticated = useAppSelector((state) => state.auth.isAuthenticated); const isAuthenticated = useAppSelector((state) => state.auth.isAuthenticated);
const user = useAppSelector((state) => state.auth.user); const user = useAppSelector((state) => state.auth.user);
if (!isAuthenticated) { if (!isAuthenticated) {
@@ -22,9 +20,7 @@ export const ProtectedRoute: React.FC<React.PropsWithChildren> = ({
return <>{children}</>; return <>{children}</>;
}; };
export const MasterRoute: React.FC<React.PropsWithChildren> = ({ export const MasterRoute = ({ children }: React.PropsWithChildren) => {
children,
}) => {
const user = useAppSelector((state) => state.auth.user); const user = useAppSelector((state) => state.auth.user);
if (user?.teams.length === 0) { if (user?.teams.length === 0) {
@@ -104,6 +104,7 @@ export const InfraDetailsNetGraphs = ({
<HistogramInfrastructure <HistogramInfrastructure
range={range} range={range}
title={config.type} title={config.type}
type={"net"}
idx={config.idx} idx={config.idx}
key={`${config.type}-${config.idx ?? ""}`} key={`${config.type}-${config.idx ?? ""}`}
checks={checks} checks={checks}