Skip to content

Conversation

@m4dm4rtig4n
Copy link
Contributor

Summary

  • Added submenu with kWh and Euro tabs to the consumption page
  • Restructured routes: /consumption redirects to /consumption_kwh
  • Created ConsumptionEuro page as a coming-soon placeholder
  • Removed "Wh" display from yearly consumption cards and fixed spacing

Test Plan

  • Navigate to /consumption_kwh to see the new kWh tab (active)
  • Click the Euro tab to view the coming-soon page
  • Verify menu highlights "Consommation" when on either tab
  • Check PDL selector filters correctly for consumption pages

🤖 Generated with Claude Code

Implemented a new submenu structure for the consumption page with two tabs: kWh and Euro. The /consumption route now redirects to /consumption_kwh. ConsumptionEuro is a placeholder for future implementation. Removed "Wh" display from yearly consumption cards and fixed spacing inconsistencies between tabs and content.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings December 1, 2025 00:10
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a consumption submenu to organize the consumption page into kWh and Euro views. The implementation includes route restructuring, a new tab navigation component, and proper menu highlighting when on any consumption page.

Key changes:

  • Restructured routes: /consumption now redirects to /consumption_kwh
  • Added ConsumptionTabs component for kWh/Euro navigation
  • Created ConsumptionEuro as a coming-soon placeholder page
  • Updated layout and header components to detect consumption pages

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
apps/web/src/App.tsx Added route redirect and split consumption into kWh and Euro routes
apps/web/src/components/ConsumptionTabs.tsx New tab navigation component for consumption submenu
apps/web/src/components/Layout.tsx Updated to highlight "Consommation" menu item on any consumption page
apps/web/src/components/PageHeader.tsx Updated PDL filtering logic for consumption pages
apps/web/src/pages/ConsumptionKwh/index.tsx Renamed from Consumption with full functionality preserved
apps/web/src/pages/ConsumptionEuro/index.tsx New placeholder page for future Euro functionality
Various component files Supporting components for the ConsumptionKwh page

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 159 to 167
{monthlyHcHpByYear.map((yearData, _idx) => {
const isSelected = selectedYears.has(_idx)
return (
<ModernButton
key={yearData.year}
variant="tab"
size="md"
isActive={isSelected}
onClick={() => toggleYearSelection(_idx)}
Copy link

Copilot AI Dec 1, 2025

Choose a reason for hiding this comment

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

The _idx parameter in the map function is prefixed with underscore but is actually used in the component (line 272). According to TypeScript conventions, underscore-prefixed parameters indicate intentionally unused variables.

Either remove the underscore prefix since the variable is used, or use a more descriptive name like yearIndex.

Suggested change
{monthlyHcHpByYear.map((yearData, _idx) => {
const isSelected = selectedYears.has(_idx)
return (
<ModernButton
key={yearData.year}
variant="tab"
size="md"
isActive={isSelected}
onClick={() => toggleYearSelection(_idx)}
{monthlyHcHpByYear.map((yearData, yearIndex) => {
const isSelected = selectedYears.has(yearIndex)
return (
<ModernButton
key={yearData.year}
variant="tab"
size="md"
isActive={isSelected}
onClick={() => toggleYearSelection(yearIndex)}

Copilot uses AI. Check for mistakes.
/>
<Legend />
{/* Dynamically create bars for each selected year */}
{selectedYearsData.map((yearData, _yearIndex) => {
Copy link

Copilot AI Dec 1, 2025

Choose a reason for hiding this comment

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

The _yearIndex parameter in the map function is prefixed with underscore but is actually used on lines 272 and 277. According to TypeScript conventions, underscore-prefixed parameters indicate intentionally unused variables.

Either remove the underscore prefix since the variable is used, or use a more descriptive name like yearIndex.

Copilot uses AI. Check for mistakes.
<div key={year.year} className="p-3 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg">
<p className="text-sm text-amber-800 dark:text-amber-200">
<strong>⚠️ {year.year} - Données partielles :</strong> {year.dataAvailable} jours de données disponibles sur 365 jours pour cette période glissante.
{year.dataAvailable! < 100 && ' Les valeurs affichées peuvent être significativement incomplètes.'}
Copy link

Copilot AI Dec 1, 2025

Choose a reason for hiding this comment

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

The condition year.dataAvailable! < 100 uses a non-null assertion operator on a potentially undefined value. This could cause a runtime error if dataAvailable is undefined.

Consider using optional chaining instead:

{year.dataAvailable && year.dataAvailable < 100 && ' Les valeurs affichées peuvent être significativement incomplètes.'}
Suggested change
{year.dataAvailable! < 100 && ' Les valeurs affichées peuvent être significativement incomplètes.'}
{year.dataAvailable < 100 && ' Les valeurs affichées peuvent être significativement incomplètes.'}

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,67 @@
import { useState, useEffect } from 'react'
import { Euro, Database, ArrowRight, AlertCircle } from 'lucide-react'
Copy link

Copilot AI Dec 1, 2025

Choose a reason for hiding this comment

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

Unused import Database.

Suggested change
import { Euro, Database, ArrowRight, AlertCircle } from 'lucide-react'
import { Euro, ArrowRight, AlertCircle } from 'lucide-react'

Copilot uses AI. Check for mistakes.
import { usePdlStore } from '@/stores/pdlStore'

export default function ConsumptionEuro() {
const { selectedPdl: selectedPDL } = usePdlStore()
Copy link

Copilot AI Dec 1, 2025

Choose a reason for hiding this comment

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

Unused variable selectedPDL.

Suggested change
const { selectedPdl: selectedPDL } = usePdlStore()

Copilot uses AI. Check for mistakes.

export default function ConsumptionEuro() {
const { selectedPdl: selectedPDL } = usePdlStore()
const [isDarkMode, setIsDarkMode] = useState(false)
Copy link

Copilot AI Dec 1, 2025

Choose a reason for hiding this comment

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

Unused variable isDarkMode.

Suggested change
const [isDarkMode, setIsDarkMode] = useState(false)
const [, setIsDarkMode] = useState(false)

Copilot uses AI. Check for mistakes.
@m4dm4rtig4n m4dm4rtig4n merged commit d324a0e into main Dec 1, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants