Components For visualisations and Sidebar#53
Components For visualisations and Sidebar#53psankhe28 wants to merge 5 commits intosamagra-comms:monitoring-dashboardfrom
Conversation
|
@psankhe28 is attempting to deploy a commit to the UCI Team on Vercel. A member of the Team first needs to authorize it. |
| import React, { useEffect, useRef } from "react"; | ||
| import Chart from "chart.js/auto"; | ||
| import useWindowSize from "../../hooks/useWindow"; | ||
|
|
There was a problem hiding this comment.
can you move this function to some util function
There was a problem hiding this comment.
It's a hook so I have kept it in the hooks folder. Should I change?
src/components/visualisation/pie.tsx
Outdated
| const { height } = useWindowSize(); | ||
|
|
||
| useEffect(() => { | ||
| // Generate dynamic background colors for each segment based on labels |
There was a problem hiding this comment.
since it's reading data from props,so there are chances that when you reload or during initiation time data may be undefined which will break the condition data.labels.map and return error.So I suggest you to use optional chaining like data?.labels?.map
There was a problem hiding this comment.
I have updated it in the recent push.
| data: { | ||
| labels: data.labels, | ||
| datasets: [ | ||
| { |
There was a problem hiding this comment.
here also add optional chaining
There was a problem hiding this comment.
I have updated it in the recent push.
src/components/visualisation/pie.tsx
Outdated
|
|
||
| return ( | ||
| <div | ||
| style={{ |
There was a problem hiding this comment.
move inline styles to a style class
There was a problem hiding this comment.
I have updated it in the recent push.
In visualization: Bar, Line and Pie Chart.
For sidebar, added submenus.