Skip to content

Commit 2594908

Browse files
authored
Merge pull request #15 from MyElectricalData/gitbutler/workspace
Adapt consumption charts to pricing option type
2 parents 4b693ad + 94db4f7 commit 2594908

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

apps/web/src/components/PageHeader.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ export default function PageHeader() {
159159
<div className="text-sm text-gray-600 dark:text-gray-400 italic">
160160
{location.pathname === '/production'
161161
? 'Aucun PDL de production non lié trouvé'
162+
: location.pathname === '/consumption'
163+
? 'Aucun PDL avec l\'option consommation activée'
162164
: 'Aucun point de livraison actif trouvé'}
163165
</div>
164166
) : (

apps/web/src/pages/Consumption/components/HcHpDistribution.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,14 @@ interface HcHpDistributionProps {
1919
export function HcHpDistribution({ hcHpByYear, selectedPDLDetails }: HcHpDistributionProps) {
2020
const [selectedHcHpPeriod, setSelectedHcHpPeriod] = useState(0)
2121

22-
if (hcHpByYear.length === 0 || !selectedPDLDetails?.offpeak_hours) {
22+
// Don't show HC/HP distribution if:
23+
// - No data available
24+
// - No offpeak hours configured
25+
// - User has BASE pricing (no HC/HP distinction)
26+
const pricingOption = selectedPDLDetails?.pricing_option
27+
const isBasePricing = pricingOption === 'BASE'
28+
29+
if (hcHpByYear.length === 0 || !selectedPDLDetails?.offpeak_hours || isBasePricing) {
2330
return null
2431
}
2532

apps/web/src/pages/Consumption/components/MonthlyHcHp.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,14 @@ export function MonthlyHcHp({ monthlyHcHpByYear, selectedPDLDetails, isDarkMode
4343
const [refAreaRight, setRefAreaRight] = useState<string>('')
4444
const [zoomDomain, setZoomDomain] = useState<{ left: number; right: number } | null>(null)
4545

46-
if (monthlyHcHpByYear.length === 0 || !selectedPDLDetails?.offpeak_hours) {
46+
// Don't show Monthly HC/HP if:
47+
// - No data available
48+
// - No offpeak hours configured
49+
// - User has BASE pricing (no HC/HP distinction)
50+
const pricingOption = selectedPDLDetails?.pricing_option
51+
const isBasePricing = pricingOption === 'BASE'
52+
53+
if (monthlyHcHpByYear.length === 0 || !selectedPDLDetails?.offpeak_hours || isBasePricing) {
4754
return null
4855
}
4956

0 commit comments

Comments
 (0)