Merge pull request #12 from jcreek/3-add-user-details-page

chore(#3): Add user profile page
This commit is contained in:
Josh Creek
2023-09-14 21:37:29 +01:00
committed by GitHub
6 changed files with 119 additions and 12 deletions
-5
View File
@@ -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()
{
+39
View File
@@ -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);
}
}
}
+18
View File
@@ -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
}
-6
View File
@@ -1,6 +0,0 @@
@{
ViewData["Title"] = "Privacy Policy";
}
<h1>@ViewData["Title"]</h1>
<p>Use this page to detail your site's privacy policy.</p>
+1 -1
View File
@@ -23,7 +23,7 @@
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Home</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
<a class="nav-link text-dark" asp-area="" asp-controller="User" asp-action="Profile">User Profile</a>
</li>
</ul>
</div>
+61
View File
@@ -0,0 +1,61 @@
@model UserProfileViewModel
@{
ViewData["Title"] = "User Profile";
}
<div class="container">
<h1>User Profile</h1>
<div class="row">
<div class="col-md-6">
<h2>Personal Information</h2>
<dl class="row">
<dt class="col-sm-4">Name:</dt>
<dd class="col-sm-8">@Model.Name</dd>
<dt class="col-sm-4">Pronouns:</dt>
<dd class="col-sm-8">@Model.Pronouns</dd>
<dt class="col-sm-4">Name Pronunciation:</dt>
<dd class="col-sm-8">
@if (!string.IsNullOrEmpty(Model.NamePronunciationPath))
{
<audio controls>
<source src="@Model.NamePronunciationPath" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
}
else
{
<span>No pronunciation available</span>
}
</dd>
<!-- Add more personal details here -->
</dl>
</div>
<div class="col-md-6">
<h2>Professional Information</h2>
<dl class="row">
<dt class="col-sm-4">Areas of Knowledge:</dt>
<dd class="col-sm-8">@Model.AreasOfKnowledge</dd>
<dt class="col-sm-4">Projects:</dt>
<dd class="col-sm-8">@Model.Projects</dd>
<dt class="col-sm-4">Team:</dt>
<dd class="col-sm-8">@Model.Team</dd>
<dt class="col-sm-4">Working Hours:</dt>
<dd class="col-sm-8">@Model.WorkingHours</dd>
<dt class="col-sm-4">Time Zone:</dt>
<dd class="col-sm-8">@Model.TimeZone</dd>
<!-- Add more professional details here -->
</dl>
</div>
</div>
</div>