Add energy sensor selection buttons #1186

Merged
a24julot merged 8 commits from issue-1174-energy-sensor-buttons into both_teams_week_8 2026-05-28 10:44:26 +00:00
Collaborator

Frontend implementation is ready and committed.

Sensor buttons are implemented and use the existing /api/energy/sensors/ endpoint as described in the issue.

I could not fully test the API integration locally because the Docker/backend setup fails to resolve the database host (Name or service not known) in my environment, so the frontend API calls currently fail locally.

Frontend implementation is ready and committed. Sensor buttons are implemented and use the existing `/api/energy/sensors/` endpoint as described in the issue. I could not fully test the API integration locally because the Docker/backend setup fails to resolve the database host (`Name or service not known`) in my environment, so the frontend API calls currently fail locally.
Collaborator

Review on #1174

Whats done

Tested on Windows using Firefox

  • App starts
    • Energy view loads, sensor buttons appear
    • Switching between sensors works
    • Sensors display in reverse order (not super important)

Inspected following files

  • frontend/src/features/energy/sensor/EnergyView.js
    • Naming convention
      • Follows wiki standard
    • Comments
      • Follows wiki standard
    • General code quality
      • The sensor buttons markup is duplicated across all four return blocks. Should be extracted into a variable or component
      • The issue says to look at TemperatureView for inspiration, TemperatureView uses a dedicated hook with the shared useApi. This should do the same
      • console.error left in the catch block
      • Hardcoded fallback sensors in the catch block, would display wrong data instead of an error
  • frontend/src/features/energy/sensor/EnergyView.module.css
    • CSS standard
      • Follows wiki standard
    • Comments
      • Missing comments above rule sets

What needs to be done

  • Extract sensor buttons to avoid duplicating
  • Create a hook using useApi for fetching sensors
  • Remove console.error
  • Remove hardcoded fallback sensors
  • Add comments to CSS rule sets
  • Fix sensor order

Conclusion

  • It works but needs cleanup and changes before merge.
# Review on #1174 ## Whats done ### Tested on Windows using Firefox + App starts + Energy view loads, sensor buttons appear + Switching between sensors works + Sensors display in reverse order (not super important) ### Inspected following files + frontend/src/features/energy/sensor/EnergyView.js + Naming convention + Follows wiki standard + Comments + Follows wiki standard + General code quality + The sensor buttons markup is duplicated across all four return blocks. Should be extracted into a variable or component + The issue says to look at TemperatureView for inspiration, TemperatureView uses a dedicated hook with the shared useApi. This should do the same + console.error left in the catch block + Hardcoded fallback sensors in the catch block, would display wrong data instead of an error + frontend/src/features/energy/sensor/EnergyView.module.css + CSS standard + Follows wiki standard + Comments + Missing comments above rule sets ## What needs to be done + Extract sensor buttons to avoid duplicating + Create a hook using useApi for fetching sensors + Remove console.error + Remove hardcoded fallback sensors + Add comments to CSS rule sets + Fix sensor order ## Conclusion + It works but needs cleanup and changes before merge.
Author
Collaborator

Thank you for the review. I will fix it once I finish the issue I’m currently working on.

Thank you for the review. I will fix it once I finish the issue I’m currently working on.
Collaborator

I'm getting build errors , something wrong with frontend. Can't do re- review on this PR right now.

I'm getting build errors , something wrong with frontend. Can't do re- review on this PR right now.
Collaborator

image

![image](/attachments/50091731-08ad-45d9-9414-f7914bdfbc93)
Collaborator

After fixing the error I could see the buttons, the buttons we had in mind were the same buttons that are implemented on TemperatureMonthView for example as mentioned in the issue #1174 !

After fixing the error I could see the buttons, the buttons we had in mind were the same buttons that are implemented on TemperatureMonthView for example as mentioned in the issue https://git.webug.se/Andras/BoundlessFlowCampus2K/issues/1174 !
Author
Collaborator

fixed

fixed
Author
Collaborator

jag ska fixa konflikten bara

jag ska fixa konflikten bara
Collaborator

Looks good now, the mentioned issues are fixed.
Package-lock.json seems to have accidentally been included in the PR causing a conflict
EDIT: ok i see you have fixed it

Looks good now, the mentioned issues are fixed. Package-lock.json seems to have accidentally been included in the PR causing a conflict EDIT: ok i see you have fixed it
a24julot merged commit 777c4f76c6 into both_teams_week_8 2026-05-28 10:44:26 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
6 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Andras/BoundlessFlowCampus2K!1186
No description provided.