Skip to content

Conversation

@m4dm4rtig4n
Copy link
Contributor

Summary

  • Hide the selected offer card when no consumption data is in cache
  • Make the info block always visible with auto-expand when data is absent
  • Standardize info block text and styling with the kWh consumption page for consistency

🤖 Generated with Claude Code

…n data

- Hide "Offre sélectionnée" card when no consumption data in cache
- Make info block always visible with auto-expand when no data
- Standardize info block text and colors with kWh consumption page

🤖 Generated with Claude Code

Co-Authored-By: Claude <[email protected]>
Copilot AI review requested due to automatic review settings December 2, 2025 08:01
🤖 Generated with Claude Code

Co-Authored-By: Claude <[email protected]>
@m4dm4rtig4n m4dm4rtig4n merged commit 823f338 into main Dec 2, 2025
4 checks passed
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 improves the user experience on the ConsumptionEuro page by hiding irrelevant UI elements when consumption data is unavailable and standardizing the InfoBlock component with the ConsumptionKwh page.

Key changes:

  • Auto-expands InfoBlock when no consumption data is present to guide users
  • Hides the offer pricing card when no data is cached to avoid confusion
  • Standardizes InfoBlock styling (orange → yellow) and messaging with ConsumptionKwh page

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
apps/web/src/pages/ConsumptionEuro/index.tsx Adds auto-expand logic for InfoBlock, conditions offer card on data presence, makes InfoBlock always visible
apps/web/src/pages/ConsumptionEuro/components/InfoBlock.tsx Updates cache information styling from orange to yellow and revises text to match ConsumptionKwh page
apps/web/package-lock.json Automatic npm cleanup removing duplicate tree-sitter dependency entries

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

Comment on lines +168 to +171
// Expand info block when no data, collapse when data is available
useEffect(() => {
setIsInfoExpanded(!hasDataInCache)
}, [hasDataInCache])
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

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

This useEffect will override user preferences whenever hasDataInCache changes. If a user manually collapses the info block while no data is present, it will be re-expanded when data loads (or vice versa).

Consider using a flag to track whether the user has manually toggled the info block, and only auto-expand on the initial mount when there's no data:

const [hasManuallyToggled, setHasManuallyToggled] = useState(false)

// Expand info block only on initial load when no data
useEffect(() => {
  if (!hasManuallyToggled) {
    setIsInfoExpanded(!hasDataInCache)
  }
}, [hasDataInCache, hasManuallyToggled])

Then update the toggle handler:

onToggle={() => {
  setHasManuallyToggled(true)
  setIsInfoExpanded(!isInfoExpanded)
}}

Copilot uses AI. Check for mistakes.
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