@attribute [StreamRendering]
@rendermode InteractiveServer

<div class="pt-4">
    @if (TemperatureDays is null || TemperatureRanges is null)
    {
        <Loading />
    }
    else
    {
        <div class="container">
            <h3 class="text-xl font-bold mb-4 mt-4">Temperature Blanket Visualizer</h3>
            <div class="row">
                <div class="col-10">
                    <div class="d-flex">
                        <div class="temperature-blanket">
                            @foreach (var day in TemperatureDays)
                            {
                                var color = GetColorForTemp(day.AvgTemp);
                                <div style="width: 6px; height: 600px; background-color:@color; margin-right: 1px;"
                                     title="@day.Date.ToString("MMM dd") - @day.AvgTemp°F (@color)">
                                </div>
                            }
                        </div>
                    </div>
                </div>
                <div class="col d-flex align-items-center">
                    <TemperatureRangeEditor TempRanges="@TemperatureRanges" OnRangesChanged="HandleRangesChanged" />
                </div>
            </div>
        </div>
    }
</div>

