From 9e768e80ef66e63fbe694b10a3bff9cc07ad91d9 Mon Sep 17 00:00:00 2001 From: Ryan Date: Sat, 18 Mar 2023 13:30:55 -0400 Subject: [PATCH 1/2] style changes to hourly forecast --- WeatherDashboard.Web/Views/Home/Index.cshtml | 19 ++++++++++++++----- WeatherDashboard.Web/wwwroot/css/site.css | 9 +++++++++ 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/WeatherDashboard.Web/Views/Home/Index.cshtml b/WeatherDashboard.Web/Views/Home/Index.cshtml index 468d741..874a314 100644 --- a/WeatherDashboard.Web/Views/Home/Index.cshtml +++ b/WeatherDashboard.Web/Views/Home/Index.cshtml @@ -17,10 +17,20 @@ @foreach (var forecast in Model.Forecast) { - var displayHours = new[] { 6, 11, 15, 22 }; + var displayHours = new Dictionary + { + [6] = "Morning", + [12] = "Noon", + [17] = "Evening", + [22] = "Night" + }; 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();
@@ -31,9 +41,8 @@ @foreach (var hourForecast in hourForecasts) {
-
@hourForecast.Time
-
@hourForecast.ConditionName
-
@hourForecast.Temperature
+
@hourForecast.TimeOfDay
+
@hourForecast.Forecast.ConditionName / @hourForecast.Forecast.Temperature
} } diff --git a/WeatherDashboard.Web/wwwroot/css/site.css b/WeatherDashboard.Web/wwwroot/css/site.css index 5540922..f553354 100644 --- a/WeatherDashboard.Web/wwwroot/css/site.css +++ b/WeatherDashboard.Web/wwwroot/css/site.css @@ -47,7 +47,16 @@ body { font-size: 30px; } + .detailed-conditions .day-summary .col:last-of-type { + text-align: right; + } + .detailed-conditions .day-detail { font-size: 13px; opacity: 0.5; } + + .detailed-conditions .day-detail .col:last-of-type { + text-align: right; + font-weight: bold; + } From 5738b9b44d069030370bdeba81486e3c9ce2d327 Mon Sep 17 00:00:00 2001 From: Ryan Date: Sat, 18 Mar 2023 13:37:48 -0400 Subject: [PATCH 2/2] ints instead of decimal, style changes --- WeatherDashboard.Web/Views/Home/Index.cshtml | 2 +- WeatherDashboard.Web/wwwroot/css/site.css | 1 + WeatherDashboard/Forecast.cs | 8 ++++---- WeatherDashboard/ForecastSummary.cs | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/WeatherDashboard.Web/Views/Home/Index.cshtml b/WeatherDashboard.Web/Views/Home/Index.cshtml index 874a314..c690010 100644 --- a/WeatherDashboard.Web/Views/Home/Index.cshtml +++ b/WeatherDashboard.Web/Views/Home/Index.cshtml @@ -4,7 +4,7 @@ }
-
@Model.Location.Name, @Model.Location.Region
+ @*
@Model.Location.Name, @Model.Location.Region
*@ Last updated on @Model.Current.LastUpdated
diff --git a/WeatherDashboard.Web/wwwroot/css/site.css b/WeatherDashboard.Web/wwwroot/css/site.css index f553354..f8b4e4a 100644 --- a/WeatherDashboard.Web/wwwroot/css/site.css +++ b/WeatherDashboard.Web/wwwroot/css/site.css @@ -26,6 +26,7 @@ body { .location small { font-size: 14px; + opacity: 0.3; } .degrees { diff --git a/WeatherDashboard/Forecast.cs b/WeatherDashboard/Forecast.cs index 58fe110..8a8ace9 100644 --- a/WeatherDashboard/Forecast.cs +++ b/WeatherDashboard/Forecast.cs @@ -12,16 +12,16 @@ namespace WeatherDashboard public DateTime? Time { get; set; } [JsonProperty("temp_f")] - public decimal Temperature { get; set; } + public int Temperature { get; set; } [JsonProperty("feelslike_f")] - public decimal FeelsLike { get; set; } + public int FeelsLike { get; set; } [JsonProperty("humidity")] - public decimal Humidity { get; set; } + public int Humidity { get; set; } [JsonProperty("wind_mph")] - public decimal WindSpeed { get; set; } + public int WindSpeed { get; set; } [JsonProperty("wind_dir")] public string WindDirection { get; set; } diff --git a/WeatherDashboard/ForecastSummary.cs b/WeatherDashboard/ForecastSummary.cs index 3b4a50f..f870660 100644 --- a/WeatherDashboard/ForecastSummary.cs +++ b/WeatherDashboard/ForecastSummary.cs @@ -9,9 +9,9 @@ namespace WeatherDashboard public string ConditionName { get; set; } [JsonProperty("maxtemp_f")] - public decimal HighTemp { get; set; } + public int HighTemp { get; set; } [JsonProperty("mintemp_f")] - public decimal LowTemp { get; set; } + public int LowTemp { get; set; } } } \ No newline at end of file