Skip to content

Aayush create line chart showing total injuries over time frontend#3995

Open
aayushshetty12 wants to merge 20 commits intodevelopmentfrom
aayush-create-line-chart-showing-total-injuries-over-time-frontend
Open

Aayush create line chart showing total injuries over time frontend#3995
aayushshetty12 wants to merge 20 commits intodevelopmentfrom
aayush-create-line-chart-showing-total-injuries-over-time-frontend

Conversation

@aayushshetty12
Copy link
Copy Markdown
Contributor

@aayushshetty12 aayushshetty12 commented Aug 30, 2025

Description

Screenshot 2025-08-30 021327

Related PRS (if any):

This frontend PR is related to the #1687 backend PR.

Main changes explained:

  • Developed a UI using Chart.js to display the Line chart
  • Module.css for styling
  • Route to navigate to a new page
  • Axios calls to the backend to retrieve data
  • Actions and Reducers for redux store management

How to test:

  1. check into current branch
  2. do npm install and ... to run this PR locally
  3. Clear site data/cache
  4. log as admin user
  5. go to /bmdashboard/injuriesovertimechart
  6. test with different dropdown filters.
  7. verify this new feature works in dark mode

Screenshots or videos of changes:

demo.mp4

@netlify
Copy link
Copy Markdown

netlify bot commented Aug 30, 2025

Deploy Preview for highestgoodnetwork-dev ready!

Name Link
🔨 Latest commit c542414
🔍 Latest deploy log https://app.netlify.com/projects/highestgoodnetwork-dev/deploys/68b2a34b6f7f3100085ee412
😎 Deploy Preview https://deploy-preview-3995--highestgoodnetwork-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

laharinandipati
laharinandipati previously approved these changes Oct 3, 2025
Copy link
Copy Markdown

@laharinandipati laharinandipati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new injuries-over-time API, schema, and router work as described and return the expected time-series per project; no regressions observed.

Screen.Recording.2025-10-03.at.1.02.52.PM.mov

Copy link
Copy Markdown

@ShradhaMBhadrannavar ShradhaMBhadrannavar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue: Graph doesn’t render and filters don’t populate or affect results.

Steps:

npm install → npm run start:local

Cleared cache/site data, logged in as Admin

Navigate to /bmdashboard/injuriesovertimechart/

Expected: graph visible; filters show options and update results

Actual: graph area blank; filters show no options / no effect on change

Please address and let me know when to retest.

Screenshot 2025-10-07 at 21 41 34 Screenshot 2025-10-07 at 21 41 48

@apoorvajainrp21
Copy link
Copy Markdown
Contributor

No data is loading:
Screenshot 2025-10-19 205349

@sanjeev29
Copy link
Copy Markdown
Contributor

Tested the PR changes locally on the Chrome browser. The line chart renders correctly in light and dark mode. The filters on the data work as expected.
Screenshot 2025-10-22 at 11 33 29 AM
Screenshot 2025-10-22 at 11 34 55 AM

sanjeev29
sanjeev29 previously approved these changes Oct 22, 2025
@tomkkl
Copy link
Copy Markdown

tomkkl commented Oct 24, 2025

Hi Aayush,

When I tested this, it says that there are no data available. Unlike the others, there were no existing projects to test from. I am not sure if this is an error or if this was intentional. Please check and see if you get similar results on your end

Screenshot 2025-10-24 at 2 25 12 AM

@Vinay944924
Copy link
Copy Markdown
Contributor

Hi Aayush,

I ran this PR locally but the graphs are not being rendered and they are blank and I cant see any options. So could you please verify this issue.

Screenshot 2025-11-01 at 5 54 07 PM

@Sriamshreddy000
Copy link
Copy Markdown
Contributor

Tested this PR along with Backend PR #1687.
Left my feedback there regarding a build issue on ARM64 (Apple Silicon) systems.

Copy link
Copy Markdown

@Anusha-Gali Anusha-Gali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Aayush,

I have reviewed this PR locally, similar to other i too am not able to see any projects and the screen says "No Data Available"
Screenshot 2025-11-13 at 11 11 05 PM

Copy link
Copy Markdown
Contributor

@bhanuanishakkineni bhanuanishakkineni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello Aayush,
I have tested this PR's frontend and backend. Please find the requested changes from backend PR#1687.
Apart from that, the chart is working fine in both light and dark mode and is responsive. Filters are working fine. But below are the UI issues I identified.
In the dark mode, increase the filters text contrast as it is hard to read them.
While changing projects filter, that is while adding or removing projects from the filter, the lines from the graph are changing colors which is a bit confusing. Please look into it and assign fixed color to the projects.
Also, in smaller screen sizes (mobile) its date selector is going out of window and is not able to choose dates from previous months.
image

PR.3995+.1687.mp4

@SwathiAngadi
Copy link
Copy Markdown
Contributor

Hi Aayush,

Tried to review your PR. Similar to others I am also not able to see any projects and the page says "No Data Available".

Screenshot 2025-12-09 180639

@netlify
Copy link
Copy Markdown

netlify bot commented Dec 31, 2025

Deploy Preview for highestgoodnetwork-dev ready!

Name Link
🔨 Latest commit 55bd4b8
🔍 Latest deploy log https://app.netlify.com/projects/highestgoodnetwork-dev/deploys/69d85068cdc90a000813fd2a
😎 Deploy Preview https://deploy-preview-3995--highestgoodnetwork-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Jan 1, 2026

Anusha-Gali
Anusha-Gali previously approved these changes Jan 3, 2026
Copy link
Copy Markdown

@Anusha-Gali Anusha-Gali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Aayush,

I have re-reviewed your PR locally and it works as per requirement in both the modes.
Screenshot 2026-01-03 at 3 33 09 PM
Screenshot 2026-01-03 at 3 33 47 PM
Screenshot 2026-01-03 at 3 34 42 PM
Screenshot 2026-01-03 at 3 35 05 PM
Screenshot 2026-01-03 at 3 39 41 PM
Screenshot 2026-01-03 at 3 42 42 PM

@aayushshetty12 aayushshetty12 requested review from bhanuanishakkineni and removed request for bhanuanishakkineni January 3, 2026 21:36
@abhinav-TB
Copy link
Copy Markdown
Member

Hi Ayush , I have tested this PR locally. I did not find any data for injuries

image

Copy link
Copy Markdown

@Vikas-8055 Vikas-8055 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Aayush, I tested this PR locally along with backend PR #1687. Similar to other reviewers, I am also not able to see any projects and the page displays "No Data Available"

Screenshot 2026-01-15 at 6 52 28 PM

Copy link
Copy Markdown

@Shravan-neelamsetty Shravan-neelamsetty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @aayushshetty12, I have tested this PR locally by checking out the aayush-create-line-chart-showing-total-injuries-over-time-frontend branch and navigating to /bmdashboard/injuriesovertimechart. The page loads successfully and displays the title "Injuries over time (Jan 1 2024 - Dec 31 2024)" along with all filter dropdowns (Projects, Start date, End date, Injury Types, Departments, Severity) which render correctly and are functional. However, the chart area displays "No Data Available" and no line chart is rendered

Screenshot 2026-01-17 at 1 10 21 PM

Copy link
Copy Markdown

@Ganesh112001 Ganesh112001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested the Injuries Over Time line chart feature which consists of frontend PR #3995 on the aayush-create-line-chart-showing-total-injuries-over-time-frontend branch and backend PR #1687. After checking out both branches, installing dependencies, and starting both servers, I logged in as admin and navigated to /bmdashboard/injuriesovertimechart. However, the line chart does not display any data despite the page loading correctly. The chart area renders but remains empty with no injury data points visible. I tested all five filters (Project, Date, Type, Department, Severity) but none populate the chart with data. This suggests either the backend is not returning data, the API endpoint is not working correctly, or there's a data fetching issue between frontend and backend. I verified dark mode styling works for the empty chart container, and no console errors were observed. The feature cannot be fully verified until the data display issue is resolved.
Screenshot 2026-01-22 at 9 50 00 PM

Copy link
Copy Markdown

@roshini1212 roshini1212 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Aayush,

Tested PR #3995 locally on branch aayush-create-line-chart-showing-total-injuries-over-time-frontend. The /bmdashboard/injuriesovertimechart page loads correctly, but there are no options in the dropdown box and also I am getting "No Data Available".

Image

@maithili20
Copy link
Copy Markdown
Contributor

maithili20 commented Feb 6, 2026

Hi @aayushshetty12 ,
I have re-reviewed your PR locally Kudos to the amazing work. It works as per requirement in both dark and light modes.

video1372896020.mp4

Suggestion: it would be helpful if the UI visually distinguished selected filter values (similar to how projects are differentiated by line color on the chart). Currently, when multiple values are selected under Injury Type/Department/Severity, it’s not clear which count maps to which selection. For instance, in the attached image I selected Fall and Slip, but the displayed numbers don’t indicate which one is Fall vs Slip. Could we add labels for the selected filter values?

Screenshot 2026-02-06 at 4 28 30 PM

@Sakshitapkir03
Copy link
Copy Markdown

I reviewd the PR locally on my Chrome browser, cleared the cache, even though after rendering it says No Data Available, it should show the line graph chart. It shows same for each drop down and date select.
Below are the screenshot in both light and dark mode.

Screenshot 2026-02-17 at 9 30 40 PM Screenshot 2026-02-17 at 9 31 13 PM

Copy link
Copy Markdown

@Vishnu10-hub Vishnu10-hub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Aayush,

Tried to review your PR. I am not able to see any projects and the page says

Image Image

No Data Available.

Copy link
Copy Markdown

@naznin07 naznin07 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed parameter bug.

PR # 3995

department: selDepts,
severity: selSeverities,
}),
).finally(() => setLoading(false));
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no .catch() block, so if the API call fails the loading spinner will stop but the user sees nothing — no error message, no empty state explanation.


return (
<div className={`${styles.wrapper} ${darkMode ? styles.wrapperDark : ''}`}>
<h2 className={styles.title}>Injuries over time (Jan 1 2024 - Dec 31 2024)</h2>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The title is hardcoded but the component has a dynamic dateRange filter. The title should reflect the actual selected range

const [selSeverities, setSelSeverities] = useState([]);

useEffect(() => {
setLoading(true);
Copy link
Copy Markdown

@naznin07 naznin07 Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useEffect loading handling.

PR # 3995

useEffect(() => {
setLoading(true);
dispatch(
fetchInjuriesOverTime({
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested the chart filter flow, and the filter UI looks added properly, but the selected values are dispatched as projectId, date, injuryType, department, and severity, while the API action reads projectIds, startDate, endDate, types, departments, and severities. I also see the severity block writing into params.departments instead of a severity param. Filter request mapping could be checked if the selected filters are not being serialized correctly for the API call in this flow.

@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible

Projects

None yet

Development

Successfully merging this pull request may close these issues.