Edit visuals for shop

arthur_shop
Arthur VALIN 2 years ago
parent f9bd286b23
commit b68b1cbe7c

@ -32,10 +32,11 @@
.shopPanel{ .shopPanel{
display:flex; display:flex;
justify-content: center;
} }
.offers { .offers {
width: 100%; width: 50%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-evenly; justify-content: space-evenly;

@ -14,8 +14,7 @@ namespace CraftSharp.Services
{ {
private readonly IAuthService _authService; private readonly IAuthService _authService;
[CascadingParameter] private CurrentUser _currentUser { get; set; }
public CurrentUser UserObject { get; set; }
public CustomStateProvider(IAuthService authService) public CustomStateProvider(IAuthService authService)
{ {
@ -30,7 +29,7 @@ namespace CraftSharp.Services
var userInfo = GetCurrentUser(); var userInfo = GetCurrentUser();
if (userInfo.IsAuthenticated) if (userInfo.IsAuthenticated)
{ {
var claims = new[] { new Claim(ClaimTypes.Name, UserObject.UserName) }.Concat(UserObject.Claims.Select(c => new Claim(c.Key, c.Value))); var claims = new[] { new Claim(ClaimTypes.Name, _currentUser.UserName) }.Concat(_currentUser.Claims.Select(c => new Claim(c.Key, c.Value)));
identity = new ClaimsIdentity(claims, "Server authentication"); identity = new ClaimsIdentity(claims, "Server authentication");
} }
} }
@ -48,15 +47,14 @@ namespace CraftSharp.Services
// No error - Login the user // No error - Login the user
CurrentUser user; CurrentUser user;
user = _authService.GetUser(loginParameters.UserName); user = _authService.GetUser(loginParameters.UserName);
UserObject = user; _currentUser = user;
Console.WriteLine("\t\tLOGIN: " + UserObject.UserName);
NotifyAuthenticationStateChanged(GetAuthenticationStateAsync()); NotifyAuthenticationStateChanged(GetAuthenticationStateAsync());
} }
public async Task Logout() public async Task Logout()
{ {
UserObject = new CurrentUser(); _currentUser = new CurrentUser();
NotifyAuthenticationStateChanged(GetAuthenticationStateAsync()); NotifyAuthenticationStateChanged(GetAuthenticationStateAsync());
} }
@ -66,7 +64,7 @@ namespace CraftSharp.Services
// No error - Login the user // No error - Login the user
var user = _authService.GetUser(registerParameters.UserName); var user = _authService.GetUser(registerParameters.UserName);
UserObject = user; _currentUser = user;
NotifyAuthenticationStateChanged(GetAuthenticationStateAsync()); NotifyAuthenticationStateChanged(GetAuthenticationStateAsync());
} }
@ -74,10 +72,9 @@ namespace CraftSharp.Services
{ {
CurrentUser cacheUser; CurrentUser cacheUser;
if (UserObject != null && UserObject.IsAuthenticated) if (_currentUser != null && _currentUser.IsAuthenticated)
{ {
Console.WriteLine("Return user"); return _currentUser;
return UserObject;
} }
return new CurrentUser(); return new CurrentUser();
} }

@ -30,6 +30,7 @@ namespace CraftSharp.Shared
// Redirect the user to the culture controller to set the cookie // Redirect the user to the culture controller to set the cookie
this.NavigationManager.NavigateTo("/Culture/SetCulture" + query, forceLoad: true); this.NavigationManager.NavigateTo("/Culture/SetCulture" + query, forceLoad: true);
} }
} }
} }

@ -98,7 +98,7 @@ button:hover {
.nav-item { .nav-item {
font-size: 1.1rem; font-size: 1.1rem;
padding-bottom: 0.5rem; padding-bottom: 0.5rem;
font-family: SuperDario; font-family: Minecraft;
} }
.nav-item:first-of-type { .nav-item:first-of-type {

Loading…
Cancel
Save