Skip to content

Conversation

Copy link

Copilot AI commented Dec 5, 2025

Integrates the new backend /sunset and /sunset/range endpoints into the weather forecast table.

Changes

  • SunsetInfo.cs: Model matching backend response schema
  • SunsetClient.cs: HTTP client wrapping sunset endpoints
  • Program.cs: Registers SunsetClient in DI container
  • FetchData.razor: Adds "Sunset Time" column with Dictionary-based lookup for O(1) access
// Efficient lookup instead of linear search per row
var sunsetTimes = await SunsetClient.GetSunsetRangeAsync(startDate, 5);
sunsetLookup = sunsetTimes.ToDictionary(s => s.Date);

// In render loop
sunsetLookup.TryGetValue(forecast.Date, out var sunset);
<td>@(sunset?.FormattedTime ?? "N/A")</td>

Screenshot

Weather forecast with sunset times

Original prompt

Update the UI to support the newly added controller endpoint of returnning the sunset time of a day


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI self-assigned this Dec 5, 2025
Copilot AI and others added 2 commits December 5, 2025 00:29
Co-authored-by: GuoyuHao <9014236+GuoyuHao@users.noreply.github.com>
…ment

Co-authored-by: GuoyuHao <9014236+GuoyuHao@users.noreply.github.com>
Copilot AI changed the title [WIP] Update UI for sunset time controller endpoint Add sunset time display to weather forecast UI Dec 5, 2025
Copilot AI requested a review from GuoyuHao December 5, 2025 00:35
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