From 7774cb862ee53be871fc58b5413c92d19722b71e Mon Sep 17 00:00:00 2001 From: punkouter24 Date: Thu, 11 Apr 2024 16:06:55 -0400 Subject: [PATCH] fixes --- PoMad/Components/Layout/NavMenu.razor | 7 +--- PoMad/Components/Pages/Calendar.razor | 4 +- PoMad/Components/Pages/Home.razor | 45 ++-------------------- PoMad/Components/Pages/UserSettings.razor | 7 +++- PoMad/Data/ApplicationUser.cs | 8 ++++ PoMad/PoMad.csproj | 10 +++++ PoMad/app.db | Bin 102400 -> 102400 bytes PoMad/app.db-shm | Bin 32768 -> 32768 bytes PoMad/app.db-wal | Bin 28872 -> 0 bytes PoMad/wwwroot/app.css | 17 +++++++- 10 files changed, 47 insertions(+), 51 deletions(-) diff --git a/PoMad/Components/Layout/NavMenu.razor b/PoMad/Components/Layout/NavMenu.razor index afbe4c7..a08071b 100644 --- a/PoMad/Components/Layout/NavMenu.razor +++ b/PoMad/Components/Layout/NavMenu.razor @@ -17,15 +17,12 @@ Home - - - - *@ diff --git a/PoMad/Components/Pages/Calendar.razor b/PoMad/Components/Pages/Calendar.razor index b3467c7..595a86c 100644 --- a/PoMad/Components/Pages/Calendar.razor +++ b/PoMad/Components/Pages/Calendar.razor @@ -34,9 +34,9 @@ @for (int day = 0; day < 7; day++) { var date = _dates[week * 7 + day]; - var dailyData = _dailyDataList?.FirstOrDefault(d => d.Date == date); + var dailyData = _dailyDataList?.FirstOrDefault(d => d.Date.Date == date.Date); -
+
@date.Day
@if (dailyData != null) { diff --git a/PoMad/Components/Pages/Home.razor b/PoMad/Components/Pages/Home.razor index 4b755ec..8a63c96 100644 --- a/PoMad/Components/Pages/Home.razor +++ b/PoMad/Components/Pages/Home.razor @@ -12,18 +12,11 @@

Dashboard

-@*
- - - - -
*@ -

Monthly Weight

- + @@ -55,44 +48,12 @@ -
@code { - - // class DataItem - // { - // public string Quarter { get; set; } - // public double Revenue { get; set; } - // } - - // DataItem[] revenue1 = new DataItem[] - // { - // new DataItem { Quarter = "Q1", Revenue = 234000 }, - // new DataItem { Quarter = "Q2", Revenue = 284000 }, - // new DataItem { Quarter = "Q3", Revenue = 274000 }, - // new DataItem { Quarter = "Q4", Revenue = 294000 } - // }; - - // DataItem[] revenue2 = new DataItem[] - // { - // new DataItem { Quarter = "Q1", Revenue = 324000 }, - // new DataItem { Quarter = "Q2", Revenue = 224000 }, - // new DataItem { Quarter = "Q3", Revenue = 444000 }, - // new DataItem { Quarter = "Q4", Revenue = 564000 } - // }; - - - - - - - - - private List _dailyDataList; private List _monthlyWeightData; private List _monthlyCaloriesData; @@ -116,7 +77,7 @@ .Select(g => new MonthlyWeightData { Month = $"{g.Key.Year}-{g.Key.Month:D2}", - Weight = g.Average(d => d.Weight) + Weight = (int)g.Average(d => d.Weight) }) .ToList(); } @@ -136,7 +97,7 @@ public class MonthlyWeightData { public string Month { get; set; } - public double Weight { get; set; } + public int Weight { get; set; } } public class MonthlyCaloriesData diff --git a/PoMad/Components/Pages/UserSettings.razor b/PoMad/Components/Pages/UserSettings.razor index 4dc0db9..462542a 100644 --- a/PoMad/Components/Pages/UserSettings.razor +++ b/PoMad/Components/Pages/UserSettings.razor @@ -5,6 +5,7 @@ @using PoMad.Services @inject UserManager UserManager @inject AuthenticationStateProvider AuthenticationStateProvider +@inject NavigationManager NavigationManager

User Settings

@@ -39,6 +40,10 @@ { var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync(); user = await UserManager.GetUserAsync(authState.User); + if (user.Birthday == DateTime.MinValue) + { + user.Birthday = new DateTime(1975, 1, 1); + } // Assuming user is not null, otherwise handle null case } @@ -51,7 +56,7 @@ } else { - // Optionally, redirect or show a success message + NavigationManager.NavigateTo("/"); } } } \ No newline at end of file diff --git a/PoMad/Data/ApplicationUser.cs b/PoMad/Data/ApplicationUser.cs index e1d1a15..e2a06e8 100644 --- a/PoMad/Data/ApplicationUser.cs +++ b/PoMad/Data/ApplicationUser.cs @@ -1,13 +1,21 @@ using Microsoft.AspNetCore.Identity; +using System.ComponentModel.DataAnnotations; namespace PoMad.Data { // Add profile data for application users by adding properties to the ApplicationUser class public class ApplicationUser : IdentityUser { + [Range(50, 500, ErrorMessage = "Weight must be between 50 and 500 lbs.")] public int IdealWeight { get; set; } + + [Range(50, 100, ErrorMessage = "Height must be between 50 and 100 inches.")] public int Height { get; set; } + + [Range(10, 100, ErrorMessage = "Age must be between 10 and 100.")] public int Age { get; set; } + + [Range(typeof(DateTime), "1/1/1900", "12/31/9999", ErrorMessage = "Birthday must be after January 1, 1900.")] public DateTime Birthday { get; set; } } diff --git a/PoMad/PoMad.csproj b/PoMad/PoMad.csproj index 5215a91..2f7ce4e 100644 --- a/PoMad/PoMad.csproj +++ b/PoMad/PoMad.csproj @@ -7,6 +7,16 @@ aspnet-PoMad-d3e2d5e7-1bbb-4efd-9a35-ca370c1fc7ce + + + + + + + PreserveNewest + + + diff --git a/PoMad/app.db b/PoMad/app.db index 3ad26564ef29569cd740386693c93f699f53d86e..99884f4adeeb21c0f86dc90e86708536ad691a01 100644 GIT binary patch delta 506 zcmZozz}B#UZ39aH8zbLA2EK!v1qHVA)i>ENiiR>VG8&r$0cWGBZzux?2LmUEL82uP zn49XFm>U`Cnphed>sneQr|FtmB$}m~o0(de8JaMha5FFjsWC9sHMCSPFt7rng3`R~ z{L+%tA|n%r^xVYE9KGcH+<;I&Z~xE`*C3#vyRW0CkDjx?Z$W82u}U2S9f82p(J?YH z9mI0=^vTE!ajc9;t}rnxbIi*sOm-_vF?MpV&@T5Vb4+$N@(R!Os5DQ?stgUPD9Q?n zNHWi}aLLIEadUMJ&+*MHx3x8KGV>1hbvB9!GW9febMgoZ@-mI|HFF8`H46)L3yAWz zOfj%Dv`jM9O|mpe0fvNWvTmY@k*ThQv1v+bVzPyClBp#Z0|Nsi{|yHI8^8cP$FHf* z9Lh;d;PGx|boej7C_rFQfWaaMAQIT*z$mbtQGt;e7(@Ke8Tg-X7BslauPniA&WSbj MAU4AlO5#)q01_{ZP5=M^ delta 21 ccmZozz}B#UZ39cdVip61W|o4@ECzq%0a5t}K>z>% diff --git a/PoMad/app.db-shm b/PoMad/app.db-shm index 7efeb0312da5f6f2cacf428cc855d7ec8a17111e..fe9ac2845eca6fe6da8a63cd096d9cf9e24ece10 100644 GIT binary patch delta 89 zcmZo@U}|V!;+1%$%K!t66BkO0TChv7nNGgVi7uf4lYpuIj|Mg_)OX*wA<_Z>$}Jx4 delta 203 zcmZo@U}|V!s+V}A%K!t63=9J7K#n93KaSDXu;bF0%E>)hdYh!y>CM+P+s{4DN+wl3 z%xsXk|B(PxT!{fB0Rn753}QjmqrIj0~(G LJ|ok{MqX_IvQRE( diff --git a/PoMad/app.db-wal b/PoMad/app.db-wal index 7dc8a664799594615ef742e9ba9d1a4fe49fc778..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 GIT binary patch literal 0 HcmV?d00001 literal 28872 zcmeI)&rcIU6bJBaFt9}hFD4K@Xgr9LA=B;d>?{eyZA)o^6{sygjF;VQ7hBqbDE;BZ zh$o|7G$bDU2TTk%{RfOE^=1rbf51f(PhLFe6eU`sgrlY3mub?z>|y6K+sn(_r{8E@ zk;uC)Njf6c!hi6=v1i?9Uw*mXas29??`4r{{WHJL2iMY@ZI2F%q_5+JBo+b!5P$## zAOHafKmY;|fB*y_@P7-eaNp6CEXzS%gnU!8Qj#o7ewo^a2wfwpt|&w`0zqPM*CUME zETc1xvw%t|4UnyMg3|u2wYXfIUs%4DSyI$r8#Meh@0lDJy-iS6d${sO`6pix1zF=S5LL;j#L3tSVKk6tl<5W!=;C18YKOaBFZlNPz`a-W&0@RA`8wAnu@De| z00bZa0SG_<0uX=z1Rwwb2sD_$>6Vm#FJ%$2EzwKxyDsqf(Ay7A|C60y_!u z8v+o300bZa0SG_<0uX=z1R&6`0=v}(>gEf~e|>G=QX=;;U!Y;n8aECB2tWV=5P$## zAOHafK%n^q>gEghF<;=-_0uX=z1Rwwb2tWV=5P(4Q3H-Az@B==!7}@{; diff --git a/PoMad/wwwroot/app.css b/PoMad/wwwroot/app.css index e8f52dd..7711e50 100644 --- a/PoMad/wwwroot/app.css +++ b/PoMad/wwwroot/app.css @@ -76,6 +76,9 @@ h1:focus { border: 1px solid #ccc; padding: 5px; text-align: center; + width: 100px; /* Fixed width */ + height: 100px; /* Fixed height */ + overflow: hidden; /* Prevents content overflow */ } .calendar-cell.inactive { @@ -90,4 +93,16 @@ h1:focus { .calendar-cell .weight, .calendar-cell .omad { font-size: 12px; - } \ No newline at end of file + } + +.omad-true { + background-color: green; +} + +.omad-false { + background-color: red; +} + +.no-data { + background-color: white; +} \ No newline at end of file