This commit is contained in:
femsci 2023-10-01 12:00:22 +02:00
parent 291d143328
commit 271b144501
Signed by: femsci
GPG key ID: 08F7911F0E650C67
13 changed files with 246 additions and 200 deletions

View file

@ -66,7 +66,7 @@
}
usr.SetUser(user);
this.StateHasChanged();
nav.NavigateTo("/");
nav.NavigateTo("/", true);
return;
}

View file

@ -12,6 +12,7 @@
{
usr.SetUser(null!);
}
nav.NavigateTo("/login");
this.StateHasChanged();
nav.NavigateTo("/login", true);
}
}

View file

@ -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;
}

View file

@ -17,8 +17,10 @@ else
if (_user != null)
{
<div class="user-profile">
<img class="background" src="images/background.jpg" alt="Background" />
<img class="profile-img" src="images/kuba.jpg" alt="Profile Picture" />
<div class="bkg-img">
<img class="background" src="images/background.jpg" alt="Background" />
<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)
{

View file

@ -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;

View file

@ -1,83 +1,85 @@
.page {
position: relative;
display: flex;
flex-direction: column;
position: relative;
display: flex;
flex-direction: column;
}
main {
flex: 1;
flex: 1;
}
.sidebar {
background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
}
.top-row {
background-color: #f7f7f7;
border-bottom: 1px solid #d6d5d5;
justify-content: flex-end;
height: 3.5rem;
display: flex;
align-items: center;
background-color: #f7f7f7;
border-bottom: 1px solid #d6d5d5;
justify-content: flex-end;
height: 3.5rem;
display: flex;
align-items: center;
}
.top-row ::deep a, .top-row ::deep .btn-link {
white-space: nowrap;
margin-left: 1.5rem;
text-decoration: none;
}
.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 {
text-decoration: underline;
}
.top-row ::deep a:hover,
.top-row ::deep .btn-link:hover {
text-decoration: underline;
}
.top-row ::deep a:first-child {
overflow: hidden;
text-overflow: ellipsis;
}
.top-row ::deep a:first-child {
overflow: hidden;
text-overflow: ellipsis;
}
@media (max-width: 640.98px) {
.top-row:not(.auth) {
display: none;
}
.top-row:not(.auth) {
display: none;
}
.top-row.auth {
justify-content: space-between;
}
.top-row.auth {
justify-content: space-between;
}
.top-row ::deep a, .top-row ::deep .btn-link {
margin-left: 0;
}
.top-row ::deep a,
.top-row ::deep .btn-link {
margin-left: 0;
}
}
@media (min-width: 641px) {
.page {
flex-direction: row;
}
.page {
flex-direction: row;
}
.sidebar {
width: 250px;
height: 100vh;
position: sticky;
top: 0;
}
.sidebar {
width: 250px;
height: 100vh;
position: sticky;
top: 0;
}
.top-row {
position: sticky;
top: 0;
z-index: 1;
}
.top-row {
position: sticky;
top: 0;
z-index: 20;
}
.top-row.auth ::deep a:first-child {
flex: 1;
text-align: right;
width: 0;
}
.top-row.auth ::deep a:first-child {
flex: 1;
text-align: right;
width: 0;
}
.top-row, article {
padding-left: 2rem !important;
padding-right: 1.5rem !important;
}
}
.top-row,
article {
padding-left: 2rem !important;
padding-right: 1.5rem !important;
}
}

View file

@ -1,86 +1,89 @@
.page {
position: relative;
display: flex;
flex-direction: column;
position: relative;
display: flex;
flex-direction: column;
}
main {
flex: 1;
flex: 1;
}
.top-row {
background-color: #f7f7f7;
border-bottom: 1px solid #d6d5d5;
justify-content: flex-end;
height: 3.5rem;
display: flex;
align-items: center;
z-index: 20;
background-color: #f7f7f7;
border-bottom: 1px solid #d6d5d5;
justify-content: flex-end;
height: 3.5rem;
display: flex;
align-items: center;
}
.top-row ::deep a, .top-row ::deep .btn-link {
white-space: nowrap;
margin-left: 1.5rem;
text-decoration: none;
}
.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 {
text-decoration: underline;
}
.top-row ::deep a:hover,
.top-row ::deep .btn-link:hover {
text-decoration: underline;
}
.top-row ::deep a:first-child {
overflow: hidden;
text-overflow: ellipsis;
}
.top-row ::deep a:first-child {
overflow: hidden;
text-overflow: ellipsis;
}
@media (max-width: 640.98px) {
.top-row:not(.auth) {
display: none;
}
.top-row:not(.auth) {
display: none;
}
.top-row.auth {
justify-content: space-between;
}
.top-row.auth {
justify-content: space-between;
}
.top-row ::deep a, .top-row ::deep .btn-link {
margin-left: 0;
}
.top-row ::deep a,
.top-row ::deep .btn-link {
margin-left: 0;
}
}
@media (min-width: 641px) {
.page {
flex-direction: row;
}
.page {
flex-direction: row;
}
.sidebar {
width: 250px;
height: 100vh;
position: sticky;
top: 0;
}
.sidebar {
width: 250px;
height: 100vh;
position: sticky;
top: 0;
}
.top-row {
position: sticky;
top: 0;
z-index: 1;
}
.top-row {
position: sticky;
top: 0;
z-index: 20;
}
.top-row.auth ::deep a:first-child {
flex: 1;
text-align: right;
width: 0;
}
.top-row.auth ::deep a:first-child {
flex: 1;
text-align: right;
width: 0;
}
.top-row, article {
padding-left: 2rem !important;
padding-right: 1.5rem !important;
}
.top-row,
article {
padding-left: 2rem !important;
padding-right: 1.5rem !important;
}
}
.form {
min-width: 100%;
min-height: 100%;
flex-wrap: wrap;
flex-direction: column;
}
min-width: 100%;
min-height: 100%;
flex-wrap: wrap;
flex-direction: column;
}

View file

@ -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,30 +12,51 @@
<div class="@NavMenuCssClass nav-scrollable" @onclick="ToggleNavMenu">
<nav class="flex-column">
<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>
</div>
@if (user != null)
{
<div class="nav-item px-3">
<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
</NavLink>
@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">
<span class="oi oi-info" aria-hidden="true"></span> About
<NavLink class="nav-link" href="about">
<span class="oi oi-info" aria-hidden="true"></span> About
</NavLink>
</div>
</nav>
</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;

View file

@ -1,68 +1,69 @@
.navbar-toggler {
background-color: rgba(255, 255, 255, 0.1);
background-color: rgba(255, 255, 255, 0.1);
}
.top-row {
height: 3.5rem;
background-color: rgba(0,0,0,0.4);
height: 3.5rem;
background-color: rgba(0, 0, 0, 0.4);
z-index: 20;
}
.navbar-brand {
font-size: 1.1rem;
font-size: 1.1rem;
}
.oi {
width: 2rem;
font-size: 1.1rem;
vertical-align: text-top;
top: -2px;
width: 2rem;
font-size: 1.1rem;
vertical-align: text-top;
top: -2px;
}
.nav-item {
font-size: 0.9rem;
padding-bottom: 0.5rem;
font-size: 0.9rem;
padding-bottom: 0.5rem;
}
.nav-item:first-of-type {
padding-top: 1rem;
}
.nav-item:first-of-type {
padding-top: 1rem;
}
.nav-item:last-of-type {
padding-bottom: 1rem;
}
.nav-item:last-of-type {
padding-bottom: 1rem;
}
.nav-item ::deep a {
color: #d7d7d7;
border-radius: 4px;
height: 3rem;
display: flex;
align-items: center;
line-height: 3rem;
}
.nav-item ::deep a {
color: #d7d7d7;
border-radius: 4px;
height: 3rem;
display: flex;
align-items: center;
line-height: 3rem;
}
.nav-item ::deep a.active {
background-color: rgba(255,255,255,0.25);
color: white;
background-color: rgba(255, 255, 255, 0.25);
color: white;
}
.nav-item ::deep a:hover {
background-color: rgba(255,255,255,0.1);
color: white;
background-color: rgba(255, 255, 255, 0.1);
color: white;
}
@media (min-width: 641px) {
.navbar-toggler {
display: none;
}
.navbar-toggler {
display: none;
}
.collapse {
/* Never collapse the sidebar for wide screens */
display: block;
}
.nav-scrollable {
/* Allow sidebar to scroll for tall menus */
height: calc(100vh - 3.5rem);
overflow-y: auto;
}
.collapse {
/* Never collapse the sidebar for wide screens */
display: block;
}
.nav-scrollable {
/* Allow sidebar to scroll for tall menus */
height: calc(100vh - 3.5rem);
overflow-y: auto;
}
}

View file

@ -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; }
}

View file

@ -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,7 +130,17 @@ a,
color: gray;
}
.background-img{
.profile-location-info {
margin-top: 0.3rem;
color: gray;
font-size: 1rem;
}
.bkg-img {
position: relative;
}
.background-img {
min-width: 100%;
max-height: 300px;
object-fit: cover;
@ -136,6 +151,6 @@ a,
max-height: 450px;
}
.aboutme{
.aboutme {
flex-wrap: wrap;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

View file

@ -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();
}