Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Realtime Monitoring/Chart component to TS #33076

Merged
merged 5 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const InterchangeableChart = ({
});
}, [chartName, departmentId, draw, end, start, t, loadData]);

return <Chart ref={canvas} {...props} />;
return <Chart canvasRef={canvas} {...props} />;
};

export default InterchangeableChart;
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const AgentStatusChart = ({ params, reloadRef, ...props }) => {
}
}, [available, away, busy, offline, state, t, updateChartData]);

return <Chart ref={canvas} {...props} />;
return <Chart canvasRef={canvas} {...props} />;
};

export default AgentStatusChart;

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Box } from '@rocket.chat/fuselage';
import type { MutableRefObject } from 'react';
import React from 'react';

type ChartProps = { canvasRef: MutableRefObject<HTMLCanvasElement | null> };

const style = {
minHeight: '250px',
};
const Chart = ({ canvasRef, ...props }: ChartProps) => (
<Box padding='x20' height='x300' {...props}>
<canvas ref={canvasRef} style={style}></canvas>
</Box>
);

export default Chart;
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const ChatDurationChart = ({ params, reloadRef, ...props }) => {
}
}, [avg, longest, state, t, updateChartData]);

return <Chart ref={canvas} {...props} />;
return <Chart canvasRef={canvas} {...props} />;
};

export default ChatDurationChart;
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const ChatsChart = ({ params, reloadRef, ...props }) => {
}
}, [closed, open, queued, onhold, state, t, updateChartData]);

return <Chart ref={canvas} {...props} />;
return <Chart canvasRef={canvas} {...props} />;
};

export default ChatsChart;
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const ChatsPerAgentChart = ({ params, reloadRef, ...props }) => {
}
}, [chartData, state, t, updateChartData]);

return <Chart ref={canvas} {...props} />;
return <Chart canvasRef={canvas} {...props} />;
};

export default ChatsPerAgentChart;
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const ChatsPerDepartmentChart = ({ params, reloadRef, ...props }) => {
}
}, [chartData, state, t, updateChartData]);

return <Chart ref={canvas} {...props} />;
return <Chart canvasRef={canvas} {...props} />;
};

export default ChatsPerDepartmentChart;
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const ResponseTimesChart = ({ params, reloadRef, ...props }) => {
}
}, [reactionAvg, reactionLongest, responseAvg, responseLongest, state, t, updateChartData]);

return <Chart ref={canvas} {...props} />;
return <Chart canvasRef={canvas} {...props} />;
};

export default ResponseTimesChart;
Loading