@attribute [StreamRendering]
@rendermode InteractiveServer

<div>
    @if (TemperatureDays is null || TemperatureRanges is null)
    {
        <Loading />
    }
    else
    {

        <div class="">
            <h3 class="text-xl font-bold mb-4">Temperature Blanket Visualizer</h3>

            <div class="d-flex"> 
                <div style="display: flex; overflow-x: auto; background-color: black; padding: 10px;">
                    @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>

                <TemperatureRangeEditor TempRanges="@TemperatureRanges" OnRangesChanged="HandleRangesChanged" /> 
            </div>
        </div>
    }
</div>

