root = Card([header, statusRow, alerts, loadSection, capacitySection, genSection, plantsSection, outagesSection, forecastSection, priceSection, maintenanceSection, regionSection, curtailmentSection, emissionsSection, followups])
header = CardHeader("Power Network Operations", "Live console — National Grid")
statusRow = Card([networkTag, loadTag, genTag, priceTag, emissionsTag], "sunk", "row", "m")
networkTag = Tag("Network Status: Stable", null, "md", "success")
loadTag = Tag("Load: 38.2 GW", null, "md", "info")
genTag = Tag("Generation: 39.1 GW", null, "md", "info")
priceTag = Tag("Price: £42.50/MWh", null, "md", "neutral")
emissionsTag = Tag("Emissions: 12,400 tCO2", null, "md", "warning")
alerts = Card([alertsHeading, alert1, alert2, alert3], "sunk")
alertsHeading = Heading("Live Alerts", "h3")
alert1 = Alert("High demand in South East", "Demand approaching 95% of regional capacity. Consider curtailment.", "warning")
alert2 = Alert("Wind farm offline", "North Sea Wind Farm A tripped at 14:32. 800 MW lost.", "destructive")
alert3 = Alert("Maintenance window open", "Planned maintenance on Line 12 begins at 18:00.", "info")
loadSection = Card([loadHeading, loadChart])
loadHeading = Heading("Current Electricity Load", "h3")
loadChart = AreaChart(["00:00", "02:00", "04:00", "06:00", "08:00", "10:00", "12:00", "14:00", "16:00", "18:00", "20:00", "22:00"], [loadSeries], "natural", "Time", "GW")
loadSeries = Series("Load", [28, 26, 25, 27, 32, 36, 38, 39, 38, 37, 34, 30])
capacitySection = Card([capacityHeading, capacityBar])
capacityHeading = Heading("Capacity Utilization", "h3")
capacityBar = SingleStackedBarChart(["Current Load vs Capacity"], [82])
genSection = Card([genHeading, genPie, genLegend])
genHeading = Heading("Generation Split by Source", "h3")
genPie = PieChart(["Wind", "Solar", "Gas", "Nuclear", "Hydro", "Coal"], [35, 15, 25, 15, 5, 5], "donut")
genLegend = Table([sourceCol, outputCol, pctCol])
sourceCol = Col("Source", ["Wind", "Solar", "Gas", "Nuclear", "Hydro", "Coal"])
outputCol = Col("Output (GW)", [13.7, 5.9, 9.8, 5.9, 2.0, 2.0])
pctCol = Col("Share", ["35%", "15%", "25%", "15%", "5%", "5%"])
plantsSection = Card([plantsHeading, plantsTable])
plantsHeading = Heading("Power Plants", "h3")
plantsTable = Table([plantCol, regionCol, outputCol2, statusCol2])
plantCol = Col("Plant", ["North Sea Wind A", "Solent Solar Farm", "Severn Gas CCGT", "Hartlepool Nuclear", "Lochay Hydro", "Drax Coal"])
regionCol = Col("Region", ["North East", "South Coast", "South West", "North East", "Scotland", "Yorkshire"])
outputCol2 = Col("Output (MW)", [0, 1200, 3500, 2400, 800, 900])
statusCol2 = Col("Status", ["Tripped", "Online", "Online", "Online", "Online", "Online"])
outagesSection = Card([outagesHeading, outagesList])
outagesHeading = Heading("Active Outages", "h3")
outagesList = ListBlock([outage1, outage2])
outage1 = ListItem("North Sea Wind A — Tripped", "Affected region: North East · 800 MW lost at 14:32", null, "View details")
outage2 = ListItem("Transformer T4 — Overheated", "Affected region: Midlands · 200 MW derated at 13:10", null, "View details")
forecastSection = Card([forecastHeading, forecastChart])
forecastHeading = Heading("Demand Forecast — Next 24 Hours", "h3")
forecastChart = LineChart(["Now", "+3h", "+6h", "+9h", "+12h", "+15h", "+18h", "+21h", "+24h"], [forecastSeries], "natural", "Time", "GW")
forecastSeries = Series("Forecast", [38, 36, 34, 33, 35, 37, 39, 38, 37])
priceSection = Card([priceHeading, priceValue, priceTrend])
priceHeading = Heading("Current Market Price", "h3")
priceValue = TextContent("£42.50 per MWh", "large-heavy")
priceTrend = TextContent("▲ 3.2% vs 1 hour ago · Forecast: £45.00 at peak", "small")
maintenanceSection = Card([maintHeading, maintList])
maintHeading = Heading("Maintenance Planned This Month", "h3")
maintList = ListBlock([maint1, maint2, maint3])
maint1 = ListItem("Line 12 inspection", "Today, 18:00–22:00 · Region: South West", null, "Schedule")
maint2 = ListItem("Transformer T7 replacement", "12 May, 08:00–16:00 · Region: Midlands", null, "Schedule")
maint3 = ListItem("Turbine overhaul at Severn Gas", "20 May, 06:00–18:00 · Region: South West", null, "Schedule")
regionSection = Card([regionHeading, regionSelect])
regionHeading = Heading("Focus on a Region", "h3")
regionSelect = Select("region", [regionAll, regionNE, regionSW, regionMid, regionScot], "Select a region to focus")
regionAll = SelectItem("all", "All regions")
regionNE = SelectItem("north-east", "North East")
regionSW = SelectItem("south-west", "South West")
regionMid = SelectItem("midlands", "Midlands")
regionScot = SelectItem("scotland", "Scotland")
curtailmentSection = Card([curtailHeading, curtailForm])
curtailHeading = Heading("Order Curtailment", "h3")
curtailForm = Form("curtailment", curtailButtons, [curtailPlantField, curtailAmountField, curtailReasonField])
curtailPlantField = FormControl("Plant", curtailPlantSelect)
curtailPlantSelect = Select("plant", [curtailPlant1, curtailPlant2, curtailPlant3], "Choose a plant")
curtailPlant1 = SelectItem("north-sea-a", "North Sea Wind A")
curtailPlant2 = SelectItem("sever-gas", "Severn Gas CCGT")
curtailPlant3 = SelectItem("drax-coal", "Drax Coal")
curtailAmountField = FormControl("Curtail amount (MW)", curtailAmount)
curtailAmount = Slider("amount", "discrete", 0, 1000, 50, [200], "MW")
curtailReasonField = FormControl("Reason", curtailReason)
curtailReason = Select("reason", [reason1, reason2, reason3], "Select a reason")
reason1 = SelectItem("congestion", "Congestion")
reason2 = SelectItem("price", "Price management")
reason3 = SelectItem("emergency", "Emergency")
curtailButtons = Buttons([curtailSubmit])
curtailSubmit = Button("Submit curtailment order", null, "primary")
emissionsSection = Card([emissionsHeading, emissionsValue, emissionsChart])
emissionsHeading = Heading("Emissions Today", "h3")
emissionsValue = TextContent("12,400 tonnes CO2", "large-heavy")
emissionsChart = BarChart(["00:00", "04:00", "08:00", "12:00", "16:00", "20:00"], [emissionsSeries], "grouped", "Hour", "tCO2")
emissionsSeries = Series("Emissions", [800, 750, 900, 1100, 1050, 950])
followups = FollowUpBlock([follow1, follow2, follow3])
follow1 = FollowUpItem("Show me the North East region")
follow2 = FollowUpItem("What is the curtailment queue?")
follow3 = FollowUpItem("Explain today's emissions breakdown")