Skip to content

Commit

Permalink
Merge branch 'develop' into feat/fe/statuspage-3
Browse files Browse the repository at this point in the history
  • Loading branch information
jennifer-gan committed Jan 3, 2025
2 parents 5226f3c + 6774958 commit a544a0f
Show file tree
Hide file tree
Showing 69 changed files with 3,558 additions and 1,591 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
**(when sending your PR, only remove this line. Do not remove any lines below. Check all the items before sending your PR)**
**(when sending your PR, only remove this line. Do not remove any lines below. Check all the relevant items before sending your PR)**

## Describe your changes

Expand Down
36 changes: 20 additions & 16 deletions Client/src/Components/Charts/MonitorDetailsAreaChart/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ import "./index.css";

const CustomToolTip = ({ active, payload, label }) => {
const uiTimezone = useSelector((state) => state.ui.timezone);

const theme = useTheme();
if (active && payload && payload.length) {
const responseTime = payload[0]?.payload?.originalAvgResponseTime
? payload[0]?.payload?.originalAvgResponseTime
: (payload[0]?.payload?.avgResponseTime ?? 0);
return (
<Box
className="area-tooltip"
Expand Down Expand Up @@ -69,7 +71,7 @@ const CustomToolTip = ({ active, payload, label }) => {
Response Time
</Typography>{" "}
<Typography component="span">
{payload[0].payload.originalResponseTime}
{Math.floor(responseTime)}
<Typography
component="span"
sx={{ opacity: 0.8 }}
Expand All @@ -87,11 +89,24 @@ const CustomToolTip = ({ active, payload, label }) => {
return null;
};

CustomToolTip.propTypes = {
active: PropTypes.bool,
payload: PropTypes.arrayOf(
PropTypes.shape({
value: PropTypes.number,
payload: PropTypes.shape({
_id: PropTypes.string,
avgResponseTime: PropTypes.number,
originalAvgResponseTime: PropTypes.number,
}),
})
),
label: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
};
const CustomTick = ({ x, y, payload, index }) => {
const theme = useTheme();

const uiTimezone = useSelector((state) => state.ui.timezone);

// Render nothing for the first tick
if (index === 0) return null;
return (
Expand Down Expand Up @@ -168,7 +183,7 @@ const MonitorDetailsAreaChart = ({ checks }) => {
</defs>
<XAxis
stroke={theme.palette.border.dark}
dataKey="createdAt"
dataKey="_id"
tick={<CustomTick />}
minTickGap={0}
axisLine={false}
Expand All @@ -183,7 +198,7 @@ const MonitorDetailsAreaChart = ({ checks }) => {
/>
<Area
type="monotone"
dataKey="responseTime"
dataKey="avgResponseTime"
stroke={theme.palette.primary.main}
fill="url(#colorUv)"
strokeWidth={isHovered ? 2.5 : 1.5}
Expand All @@ -198,15 +213,4 @@ MonitorDetailsAreaChart.propTypes = {
checks: PropTypes.array,
};

CustomToolTip.propTypes = {
active: PropTypes.bool,
payload: PropTypes.arrayOf(
PropTypes.shape({
payload: PropTypes.shape({
originalResponseTime: PropTypes.number.isRequired,
}).isRequired,
})
),
label: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
};
export default MonitorDetailsAreaChart;
3 changes: 1 addition & 2 deletions Client/src/Components/Charts/Utils/chartUtils.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { Box, Stack, Typography } from "@mui/material";
*/
export const TzTick = ({ x, y, payload, index }) => {
const theme = useTheme();

const uiTimezone = useSelector((state) => state.ui.timezone);
return (
<Text
Expand Down Expand Up @@ -163,7 +162,7 @@ export const InfrastructureTooltip = ({
>
{yIdx >= 0
? `${yLabel} ${getFormattedPercentage(payload[0].payload[hardwareType][yIdx][metric])}`
: `${yLabel} ${getFormattedPercentage(payload[0].payload[hardwareType][metric])}`}
: `${yLabel} ${getFormattedPercentage(payload[0].payload[yKey])}`}
</Typography>
</Stack>
</Box>
Expand Down
7 changes: 5 additions & 2 deletions Client/src/Components/Sidebar/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -574,9 +574,12 @@ function Sidebar() {
ml: "auto",
mr: "-8px",
"&:focus": { outline: "none" },
alignSelf: "center",
padding: '10px',

"& svg": {
width: "20px",
height: "20px",
width: "22px",
height: "22px",
},
"& svg path": {
stroke: theme.palette.other.icon,
Expand Down
Loading

0 comments on commit a544a0f

Please sign in to comment.