dash
This commit is contained in:
parent
291d143328
commit
271b144501
13 changed files with 246 additions and 200 deletions
|
@ -66,7 +66,7 @@
|
|||
}
|
||||
usr.SetUser(user);
|
||||
this.StateHasChanged();
|
||||
nav.NavigateTo("/");
|
||||
nav.NavigateTo("/", true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
{
|
||||
usr.SetUser(null!);
|
||||
}
|
||||
nav.NavigateTo("/login");
|
||||
this.StateHasChanged();
|
||||
nav.NavigateTo("/login", true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
{
|
||||
if (await usr.GetUser() != null)
|
||||
{
|
||||
nav.NavigateTo("/");
|
||||
nav.NavigateTo("/", true);
|
||||
return;
|
||||
}
|
||||
Model ??= new();
|
||||
|
@ -77,7 +77,7 @@
|
|||
}
|
||||
usr.SetUser(user);
|
||||
this.StateHasChanged();
|
||||
nav.NavigateTo("/");
|
||||
nav.NavigateTo("/", true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,8 +17,10 @@ else
|
|||
if (_user != null)
|
||||
{
|
||||
<div class="user-profile">
|
||||
<div class="bkg-img">
|
||||
<img class="background" src="images/background.jpg" alt="Background" />
|
||||
<img class="profile-img" src="images/kuba.jpg" alt="Profile Picture" />
|
||||
<img class="profile-img" src="images/pfp.jpg" alt="Profile Picture" />
|
||||
</div>
|
||||
<div class="profile-names">
|
||||
<h1 class="profile-username">@($"@{_user.Username}")</h1>
|
||||
@if (_user.Name != null)
|
||||
|
@ -26,6 +28,12 @@ else
|
|||
<h3 class="profile-fullname">(@_user.Name)</h3>
|
||||
}
|
||||
</div>
|
||||
@if (_user.City != null && _user.CountryCode != null)
|
||||
{
|
||||
<div class="profile-location-info">
|
||||
<span class="profile-loc">@($"{_user.City}, {_user.CountryCode}")</span>
|
||||
</div>
|
||||
}
|
||||
<p>@(_user.Bio ?? "~")</p>
|
||||
@if (_user.Interests != null)
|
||||
{
|
||||
|
|
|
@ -22,6 +22,13 @@ public class UserManager
|
|||
|
||||
public async Task InitAsync()
|
||||
{
|
||||
await sem.WaitAsync();
|
||||
if (_init)
|
||||
{
|
||||
sem.Release();
|
||||
return;
|
||||
}
|
||||
|
||||
using var scope = _serv.CreateAsyncScope();
|
||||
var resp = await scope.ServiceProvider.GetRequiredService<HttpClient>().GetAsync("/api/auth/userdata");
|
||||
if (resp.StatusCode == HttpStatusCode.OK)
|
||||
|
@ -29,6 +36,10 @@ public class UserManager
|
|||
this.User = (await resp.Content.ReadFromJsonAsync<UserModel>())!;
|
||||
Console.WriteLine($"User: {User.Id}");
|
||||
}
|
||||
|
||||
_init = true;
|
||||
|
||||
sem.Release();
|
||||
}
|
||||
|
||||
private UserModel User { get; set; } = default!;
|
||||
|
@ -36,12 +47,10 @@ public class UserManager
|
|||
{
|
||||
if (User == null)
|
||||
{
|
||||
await sem.WaitAsync();
|
||||
if (!_init)
|
||||
{
|
||||
await InitAsync();
|
||||
}
|
||||
sem.Release();
|
||||
}
|
||||
|
||||
return User;
|
||||
|
|
|
@ -12,8 +12,6 @@ main {
|
|||
background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
|
||||
}
|
||||
|
||||
|
||||
|
||||
.top-row {
|
||||
background-color: #f7f7f7;
|
||||
border-bottom: 1px solid #d6d5d5;
|
||||
|
@ -23,13 +21,15 @@ main {
|
|||
align-items: center;
|
||||
}
|
||||
|
||||
.top-row ::deep a, .top-row ::deep .btn-link {
|
||||
.top-row ::deep a,
|
||||
.top-row ::deep .btn-link {
|
||||
white-space: nowrap;
|
||||
margin-left: 1.5rem;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.top-row ::deep a:hover, .top-row ::deep .btn-link:hover {
|
||||
.top-row ::deep a:hover,
|
||||
.top-row ::deep .btn-link:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,8 @@ main {
|
|||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.top-row ::deep a, .top-row ::deep .btn-link {
|
||||
.top-row ::deep a,
|
||||
.top-row ::deep .btn-link {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
|
@ -67,7 +68,7 @@ main {
|
|||
.top-row {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
z-index: 20;
|
||||
}
|
||||
|
||||
.top-row.auth ::deep a:first-child {
|
||||
|
@ -76,7 +77,8 @@ main {
|
|||
width: 0;
|
||||
}
|
||||
|
||||
.top-row, article {
|
||||
.top-row,
|
||||
article {
|
||||
padding-left: 2rem !important;
|
||||
padding-right: 1.5rem !important;
|
||||
}
|
||||
|
|
|
@ -8,9 +8,8 @@ main {
|
|||
flex: 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.top-row {
|
||||
z-index: 20;
|
||||
background-color: #f7f7f7;
|
||||
border-bottom: 1px solid #d6d5d5;
|
||||
justify-content: flex-end;
|
||||
|
@ -19,13 +18,15 @@ main {
|
|||
align-items: center;
|
||||
}
|
||||
|
||||
.top-row ::deep a, .top-row ::deep .btn-link {
|
||||
.top-row ::deep a,
|
||||
.top-row ::deep .btn-link {
|
||||
white-space: nowrap;
|
||||
margin-left: 1.5rem;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.top-row ::deep a:hover, .top-row ::deep .btn-link:hover {
|
||||
.top-row ::deep a:hover,
|
||||
.top-row ::deep .btn-link:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
|
@ -43,7 +44,8 @@ main {
|
|||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.top-row ::deep a, .top-row ::deep .btn-link {
|
||||
.top-row ::deep a,
|
||||
.top-row ::deep .btn-link {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +65,7 @@ main {
|
|||
.top-row {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
z-index: 20;
|
||||
}
|
||||
|
||||
.top-row.auth ::deep a:first-child {
|
||||
|
@ -72,7 +74,8 @@ main {
|
|||
width: 0;
|
||||
}
|
||||
|
||||
.top-row, article {
|
||||
.top-row,
|
||||
article {
|
||||
padding-left: 2rem !important;
|
||||
padding-right: 1.5rem !important;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<div class="top-row ps-3 navbar navbar-dark">
|
||||
@inject UserManager usr
|
||||
|
||||
<div class="top-row ps-3 navbar navbar-dark">
|
||||
<div class="container-fluid">
|
||||
<img src="images/InterlinkedLogoWhite.png" style="max-width: 8vw;
|
||||
">
|
||||
|
@ -10,20 +12,34 @@
|
|||
|
||||
<div class="@NavMenuCssClass nav-scrollable" @onclick="ToggleNavMenu">
|
||||
<nav class="flex-column">
|
||||
@if (user != null)
|
||||
{
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
|
||||
<span class="oi oi-home" aria-hidden="true"></span> Your community
|
||||
<NavLink class="nav-link" href="@($"/profile/{user.Username}")" Match="NavLinkMatch.All">
|
||||
<span class="oi oi-home" aria-hidden="true"></span> Your profile
|
||||
</NavLink>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="project">
|
||||
<span class="oi oi-plus" aria-hidden="true"></span> Projects
|
||||
</NavLink>
|
||||
</div>
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="/user/This could be you!">
|
||||
<span class="oi oi-list-rich" aria-hidden="true"></span> Your Profile
|
||||
@if (user != null)
|
||||
{
|
||||
<NavLink class="nav-link" href="/dashboard">
|
||||
<span class="oi oi-cog" aria-hidden="true"></span> Settings
|
||||
</NavLink>
|
||||
}
|
||||
else
|
||||
{
|
||||
<NavLink class="nav-link" href="/login">
|
||||
<span class="oi oi-account-login" aria-hidden="true"></span> Log in
|
||||
</NavLink>
|
||||
}
|
||||
|
||||
</div>
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="about">
|
||||
|
@ -34,6 +50,13 @@
|
|||
</div>
|
||||
|
||||
@code {
|
||||
private UserModel? user = null;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
user = await usr.GetUser();
|
||||
}
|
||||
|
||||
private bool collapseNavMenu = true;
|
||||
|
||||
private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
.top-row {
|
||||
height: 3.5rem;
|
||||
background-color: rgba(0, 0, 0, 0.4);
|
||||
z-index: 20;
|
||||
}
|
||||
|
||||
.navbar-brand {
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
<div class="alert alert-secondary mt-4">
|
||||
<span class="oi oi-pencil me-2" aria-hidden="true"></span>
|
||||
<strong>@Title</strong>
|
||||
|
||||
<span class="text-nowrap">
|
||||
Please take our
|
||||
<a target="_blank" class="font-weight-bold link-dark" href="https://go.microsoft.com/fwlink/?linkid=2186157">brief survey</a>
|
||||
</span>
|
||||
and tell us what you think.
|
||||
</div>
|
||||
|
||||
@code {
|
||||
// Demonstrates how a parent component can supply parameters
|
||||
[Parameter]
|
||||
public string? Title { get; set; }
|
||||
}
|
|
@ -97,21 +97,26 @@ a,
|
|||
}
|
||||
}
|
||||
|
||||
.user-profile {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.profile-img {
|
||||
position: absolute;
|
||||
object-fit: cover;
|
||||
transform: translate(10%, 25%);
|
||||
z-index: 1; /* Place the profile picture above the background image */
|
||||
max-width: 200px;
|
||||
min-width: 200px;
|
||||
max-height: 200px;
|
||||
min-height: 200px;
|
||||
border-radius: 200px;
|
||||
bottom: -1.5rem;
|
||||
left: 1rem;
|
||||
}
|
||||
|
||||
.profile-names {
|
||||
width: fit-content;
|
||||
margin-top: 0.5rem;
|
||||
margin-top: 2.5rem;
|
||||
}
|
||||
|
||||
.profile-username {
|
||||
|
@ -125,6 +130,16 @@ a,
|
|||
color: gray;
|
||||
}
|
||||
|
||||
.profile-location-info {
|
||||
margin-top: 0.3rem;
|
||||
color: gray;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.bkg-img {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.background-img {
|
||||
min-width: 100%;
|
||||
max-height: 300px;
|
||||
|
|
BIN
src/Interlinked.Core/wwwroot/images/pfp.jpg
Normal file
BIN
src/Interlinked.Core/wwwroot/images/pfp.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 40 KiB |
|
@ -12,7 +12,7 @@ public class StoreContext : DbContext
|
|||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder o)
|
||||
{
|
||||
o.UseSqlite("Data Source=./store.db;Cache=Shared");
|
||||
o.UseSqlite("Data Source=/data/store.db;Cache=Shared");
|
||||
o.EnableDetailedErrors();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue