From 5fdc21f4ff35542bb1f20012833afc2503b4dffc Mon Sep 17 00:00:00 2001 From: Josh Creek <8179928+jcreek@users.noreply.github.com> Date: Thu, 14 Sep 2023 21:37:09 +0100 Subject: [PATCH] chore(#3): Add user profile page --- WhoAtX/Controllers/HomeController.cs | 5 --- WhoAtX/Controllers/UserController.cs | 39 +++++++++++++++++ WhoAtX/Models/UserProfileViewModel.cs | 18 ++++++++ WhoAtX/Views/Home/Privacy.cshtml | 6 --- WhoAtX/Views/Shared/_Layout.cshtml | 2 +- WhoAtX/Views/User/Profile.cshtml | 61 +++++++++++++++++++++++++++ 6 files changed, 119 insertions(+), 12 deletions(-) create mode 100644 WhoAtX/Controllers/UserController.cs create mode 100644 WhoAtX/Models/UserProfileViewModel.cs delete mode 100644 WhoAtX/Views/Home/Privacy.cshtml create mode 100644 WhoAtX/Views/User/Profile.cshtml diff --git a/WhoAtX/Controllers/HomeController.cs b/WhoAtX/Controllers/HomeController.cs index 953bd9e..01c9170 100644 --- a/WhoAtX/Controllers/HomeController.cs +++ b/WhoAtX/Controllers/HomeController.cs @@ -18,11 +18,6 @@ public class HomeController : Controller return View(); } - public IActionResult Privacy() - { - return View(); - } - [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] public IActionResult Error() { diff --git a/WhoAtX/Controllers/UserController.cs b/WhoAtX/Controllers/UserController.cs new file mode 100644 index 0000000..8029501 --- /dev/null +++ b/WhoAtX/Controllers/UserController.cs @@ -0,0 +1,39 @@ +using Microsoft.AspNetCore.Mvc; +using WhoAtX.Models; + +namespace WhoAtX.Controllers +{ + public class UserController : Controller + { + // TODO(#8): Get data from database rather than hard-coding it + private UserProfileViewModel GetUserProfile() + { + // Sample user profile data + var userProfile = new UserProfileViewModel + { + Name = "John Doe", + Pronouns = "He/Him", + NamePronunciationPath = "/audio/john_doe_pronunciation.mp3", + // NamePronunciationPath = null, + // Add more user profile data here + AreasOfKnowledge = "Web Development", + Projects = "Project X", + Team = "Development Team", + WorkingHours = "9:00 AM - 5:00 PM", + TimeZone = "UTC-05:00", + // Add more professional details here + }; + + return userProfile; + } + + public IActionResult Profile() + { + // Retrieve user profile data + var userProfile = GetUserProfile(); + + // Pass the user profile data to the view + return View(userProfile); + } + } +} diff --git a/WhoAtX/Models/UserProfileViewModel.cs b/WhoAtX/Models/UserProfileViewModel.cs new file mode 100644 index 0000000..b5a5fd1 --- /dev/null +++ b/WhoAtX/Models/UserProfileViewModel.cs @@ -0,0 +1,18 @@ +namespace WhoAtX.Models; + +public class UserProfileViewModel +{ + public string Name { get; set; } + public string Pronouns { get; set; } + public string NamePronunciationPath { get; set; } + + // Add more personal details here + + public string AreasOfKnowledge { get; set; } + public string Projects { get; set; } + public string Team { get; set; } + public string WorkingHours { get; set; } + public string TimeZone { get; set; } + + // Add more professional details here +} diff --git a/WhoAtX/Views/Home/Privacy.cshtml b/WhoAtX/Views/Home/Privacy.cshtml deleted file mode 100644 index 2479fb7..0000000 --- a/WhoAtX/Views/Home/Privacy.cshtml +++ /dev/null @@ -1,6 +0,0 @@ -@{ - ViewData["Title"] = "Privacy Policy"; -} -
Use this page to detail your site's privacy policy.
diff --git a/WhoAtX/Views/Shared/_Layout.cshtml b/WhoAtX/Views/Shared/_Layout.cshtml index b09677a..afa6713 100644 --- a/WhoAtX/Views/Shared/_Layout.cshtml +++ b/WhoAtX/Views/Shared/_Layout.cshtml @@ -23,7 +23,7 @@ Home