feat: fixing table

This commit is contained in:
Caio Cabral committed 2025-01-09 12:19:28 -05:00
1 parent 7686b1ecf5
commit 07641a2bd8
7 files changed
+47 -17

No files matched your search

+6 -5
View File
@@ -28,15 +28,16 @@ const Breadcrumbs = ({ list }) => {
px={theme.spacing(2)} px={theme.spacing(2)}
py={theme.spacing(3.5)} py={theme.spacing(3.5)}
width="fit-content" width="fit-content"
backgroundColor={ backgroundColor={theme.palette.secondary.main}
theme.palette.secondary.main /* theme.palette.primary.lowContrast */
}
borderRadius={theme.shape.borderRadius} borderRadius={theme.shape.borderRadius}
lineHeight="18px" lineHeight="18px"
sx={{ sx={{
"& .MuiBreadcrumbs-li a": {
transition: "background-color 0.2s ease-in-out, color 0.2s ease-in-out",
},
"& .MuiBreadcrumbs-li:not(:last-of-type):hover a": { "& .MuiBreadcrumbs-li:not(:last-of-type):hover a": {
backgroundColor: theme.palette.primary.lowContrast, backgroundColor: theme.palette.secondary.contrastText,
opacity: 1, color: theme.palette.secondary.main,
}, },
}} }}
> >
@@ -39,6 +39,7 @@ const BarChart = ({ checks = [] }) => {
> >
{checks.map((check, index) => {checks.map((check, index) =>
check === "placeholder" ? ( check === "placeholder" ? (
/* TODO what is the purpose of this box? */
<Box <Box
key={`${check}-${index}`} key={`${check}-${index}`}
position="relative" position="relative"
@@ -67,8 +68,8 @@ const BarChart = ({ checks = [] }) => {
height={theme.spacing(4)} height={theme.spacing(4)}
backgroundColor={ backgroundColor={
check.status check.status
? theme.palette.success.main ? theme.palette.success.accent
: theme.palette.error.contrastText : theme.palette.error.accent
} }
sx={{ borderRadius: "50%" }} sx={{ borderRadius: "50%" }}
/> />
@@ -120,16 +121,18 @@ const BarChart = ({ checks = [] }) => {
borderRadius: theme.shape.borderRadius, borderRadius: theme.shape.borderRadius,
boxShadow: theme.shape.boxShadow, boxShadow: theme.shape.boxShadow,
px: theme.spacing(4), px: theme.spacing(4),
py: theme.spacing(2), py: theme.spacing(3),
}, },
"& .MuiTooltip-tooltip p": { "& .MuiTooltip-tooltip p": {
/* TODO Font size should point to theme */
fontSize: 12, fontSize: 12,
color: theme.palette.primary.contrastText.tertiary, color: theme.palette.secondary.contrastText,
fontWeight: 500, fontWeight: 500,
}, },
"& .MuiTooltip-tooltip span": { "& .MuiTooltip-tooltip span": {
/* TODO Font size should point to theme */
fontSize: 11, fontSize: 11,
color: theme.palette.primary.contrastText.tertiary, color: theme.palette.secondary.contrastText,
fontWeight: 600, fontWeight: 600,
}, },
}, },
@@ -143,13 +146,15 @@ const BarChart = ({ checks = [] }) => {
backgroundColor={ backgroundColor={
check.status check.status
? theme.palette.success.contrastText ? theme.palette.success.contrastText
: theme.palette.error.dark : theme.palette.error.contrastText
} }
sx={{ sx={{
borderRadius: theme.spacing(1.5), borderRadius: theme.spacing(1.5),
/*
TODO this doesn't seem to be used
"&:hover > .MuiBox-root": { "&:hover > .MuiBox-root": {
filter: "brightness(0.8)", filter: "brightness(0.8)",
}, }, */
}} }}
> >
<Box <Box
@@ -158,7 +163,7 @@ const BarChart = ({ checks = [] }) => {
width="100%" width="100%"
height={`${animate ? check.responseTime : 0}%`} height={`${animate ? check.responseTime : 0}%`}
backgroundColor={ backgroundColor={
check.status ? theme.palette.success.main : theme.palette.error.main check.status ? theme.palette.success.accent : theme.palette.error.accent
} }
sx={{ sx={{
borderRadius: theme.spacing(1.5), borderRadius: theme.spacing(1.5),
@@ -178,7 +178,14 @@ const MonitorTable = ({ isAdmin, filter, setIsSearching, isSearching, handlePaus
</> </>
)} )}
<TableContainer component={Paper}> <TableContainer component={Paper}>
<Table> <Table
sx={{
backgroundColor: theme.palette.primary.main,
"& :is(th, td)": {
color: theme.palette.primary.contrastText.main,
},
}}
>
<TableHead> <TableHead>
<TableRow> <TableRow>
<TableCell <TableCell
@@ -241,13 +248,14 @@ const MonitorTable = ({ isAdmin, filter, setIsSearching, isSearching, handlePaus
: (monitor.uptimePercentage * 100).toFixed(2); : (monitor.uptimePercentage * 100).toFixed(2);
percentageColor = percentageColor =
/* TODO colors update */
monitor.uptimePercentage < 0.25 monitor.uptimePercentage < 0.25
? theme.palette.percentage.uptimePoor ? theme.palette.percentage.uptimePoor
: monitor.uptimePercentage < 0.5 : monitor.uptimePercentage < 0.5
? theme.palette.percentage.uptimeFair ? theme.palette.percentage.uptimeFair
: monitor.uptimePercentage < 0.75 : monitor.uptimePercentage < 0.75
? theme.palette.percentage.uptimeGood ? theme.palette.percentage.uptimeGood
: theme.palette.success.accent; : theme.palette.success.main;
} }
const params = { const params = {
+1
View File
@@ -42,6 +42,7 @@ const Host = ({ url, title, percentageColor, percentage }) => {
sx={{ sx={{
color: percentageColor, color: percentageColor,
fontWeight: 500, fontWeight: 500,
/* TODO point font weight to theme */
ml: "15px", ml: "15px",
}} }}
> >
+8 -1
View File
@@ -64,7 +64,14 @@ const UptimeMonitors = () => {
onClick={() => { onClick={() => {
navigate("/uptime/create"); navigate("/uptime/create");
}} }}
sx={{ fontWeight: 500, whiteSpace: "nowrap" }} sx={{
fontWeight: 500,
whiteSpace: "nowrap",
/*
TODO Problem, could not make button mui work
backgroundColor: theme.palette.accent.main,
color: theme.palette.accent.contrastText, */
}}
> >
Create new Create new
</Button> </Button>
+1 -1
View File
@@ -319,7 +319,7 @@ const newSemanticColors = {
secondary: { secondary: {
main: { main: {
light: newColors.gray100, light: newColors.gray100,
dark: newColors.gray100, dark: newColors.blueGray600,
}, },
contrastText: { contrastText: {
light: newColors.blueGray600, light: newColors.blueGray600,
+8
View File
@@ -41,6 +41,7 @@ const baseTheme = (palette) => ({
defaultProps: { defaultProps: {
disableRipple: true, disableRipple: true,
}, },
styleOverrides: { styleOverrides: {
root: ({ theme }) => ({ root: ({ theme }) => ({
variants: [ variants: [
@@ -61,6 +62,13 @@ const baseTheme = (palette) => ({
backgroundColor: theme.palette.secondary.main, backgroundColor: theme.palette.secondary.main,
}, },
}, },
/* {
props: (props) => props.variant === "contained",
style: {
backgroundColor: `${theme.palette.accent.main} !important`,
},
}, */
{ {
props: (props) => props: (props) =>
props.variant === "contained" && props.color === "secondary", props.variant === "contained" && props.color === "secondary",