This commit is contained in:
Ryan Peters 2023-03-19 01:58:26 +00:00
commit a17694c7de
4 changed files with 31 additions and 12 deletions

View File

@ -4,7 +4,7 @@
} }
<div class="location"> <div class="location">
<div>@Model.Location.Name, @Model.Location.Region</div> @*<div>@Model.Location.Name, @Model.Location.Region</div>*@
<small>Last updated on @Model.Current.LastUpdated</small> <small>Last updated on @Model.Current.LastUpdated</small>
</div> </div>
@ -17,10 +17,20 @@
@foreach (var forecast in Model.Forecast) @foreach (var forecast in Model.Forecast)
{ {
var displayHours = new[] { 6, 11, 15, 22 }; var displayHours = new Dictionary<int, string>
{
[6] = "Morning",
[12] = "Noon",
[17] = "Evening",
[22] = "Night"
};
var hourForecasts = forecast.HourForecasts var hourForecasts = forecast.HourForecasts
.Where(f => displayHours.Contains(f.Time.Value.Hour)) .Join(displayHours, f => f.Time.Value.Hour, d => d.Key, (f, d) => new
{
TimeOfDay = d.Value,
Forecast = f
})
.ToList(); .ToList();
<div class="row day-summary"> <div class="row day-summary">
@ -31,9 +41,8 @@
@foreach (var hourForecast in hourForecasts) @foreach (var hourForecast in hourForecasts)
{ {
<div class="row day-detail"> <div class="row day-detail">
<div class="col">@hourForecast.Time</div> <div class="col">@hourForecast.TimeOfDay</div>
<div class="col">@hourForecast.ConditionName</div> <div class="col">@hourForecast.Forecast.ConditionName / @hourForecast.Forecast.Temperature</div>
<div class="col">@hourForecast.Temperature</div>
</div> </div>
} }
} }

View File

@ -26,6 +26,7 @@ body {
.location small { .location small {
font-size: 14px; font-size: 14px;
opacity: 0.3;
} }
.degrees { .degrees {
@ -47,7 +48,16 @@ body {
font-size: 30px; font-size: 30px;
} }
.detailed-conditions .day-summary .col:last-of-type {
text-align: right;
}
.detailed-conditions .day-detail { .detailed-conditions .day-detail {
font-size: 13px; font-size: 13px;
opacity: 0.5; opacity: 0.5;
} }
.detailed-conditions .day-detail .col:last-of-type {
text-align: right;
font-weight: bold;
}

View File

@ -12,16 +12,16 @@ namespace WeatherDashboard
public DateTime? Time { get; set; } public DateTime? Time { get; set; }
[JsonProperty("temp_f")] [JsonProperty("temp_f")]
public decimal Temperature { get; set; } public int Temperature { get; set; }
[JsonProperty("feelslike_f")] [JsonProperty("feelslike_f")]
public decimal FeelsLike { get; set; } public int FeelsLike { get; set; }
[JsonProperty("humidity")] [JsonProperty("humidity")]
public decimal Humidity { get; set; } public int Humidity { get; set; }
[JsonProperty("wind_mph")] [JsonProperty("wind_mph")]
public decimal WindSpeed { get; set; } public int WindSpeed { get; set; }
[JsonProperty("wind_dir")] [JsonProperty("wind_dir")]
public string WindDirection { get; set; } public string WindDirection { get; set; }

View File

@ -9,9 +9,9 @@ namespace WeatherDashboard
public string ConditionName { get; set; } public string ConditionName { get; set; }
[JsonProperty("maxtemp_f")] [JsonProperty("maxtemp_f")]
public decimal HighTemp { get; set; } public int HighTemp { get; set; }
[JsonProperty("mintemp_f")] [JsonProperty("mintemp_f")]
public decimal LowTemp { get; set; } public int LowTemp { get; set; }
} }
} }