feat: Implement Zalo and MktX services with API controllers, add web client pages for Auth and Products, and update client navigation and styling.

This commit is contained in:
Ho Ngoc Hai
2026-01-19 01:23:09 +07:00
parent d285f1f9eb
commit 37db21fbc0
31 changed files with 3328 additions and 134 deletions

View File

@@ -1,16 +1,60 @@
@inherits LayoutComponentBase
<div class="page">
<div class="sidebar">
@inject IJSRuntime JS
@*
EN: Main layout with sidebar navigation and theme toggle.
VI: Layout chính với sidebar navigation và theme toggle.
*@
<div class="page" data-theme="@currentTheme">
<aside class="sidebar">
<NavMenu />
</div>
</aside>
<main>
<div class="top-row px-4">
<a href="https://learn.microsoft.com/aspnet/core/" target="_blank">About</a>
</div>
<header class="top-row">
<button class="theme-toggle" @onclick="ToggleTheme" title="Toggle theme / Đổi theme">
@if (currentTheme == "dark")
{
<span>☀️ Light</span>
}
else
{
<span>🌙 Dark</span>
}
</button>
</header>
<article class="content px-4">
<article class="content">
@Body
</article>
</main>
</div>
@code {
private string currentTheme = "light";
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
// EN: Load saved theme from localStorage
// VI: Tải theme đã lưu từ localStorage
var savedTheme = await JS.InvokeAsync<string>("localStorage.getItem", "theme");
if (!string.IsNullOrEmpty(savedTheme))
{
currentTheme = savedTheme;
StateHasChanged();
}
}
}
private async Task ToggleTheme()
{
currentTheme = currentTheme == "dark" ? "light" : "dark";
// EN: Save theme to localStorage
// VI: Lưu theme vào localStorage
await JS.InvokeVoidAsync("localStorage.setItem", "theme", currentTheme);
}
}

View File

@@ -1,39 +1,30 @@
<div class="top-row ps-3 navbar navbar-dark">
<div class="container-fluid">
<a class="navbar-brand" href="">WebClientBase.Client</a>
<button title="Navigation menu" class="navbar-toggler" @onclick="ToggleNavMenu">
<span class="navbar-toggler-icon"></span>
</button>
</div>
@*
EN: Navigation menu with Products and Auth links.
VI: Menu navigation với các link Products và Auth.
*@
<div class="nav-brand">
GoodGo
</div>
<div class="@NavMenuCssClass nav-scrollable" @onclick="ToggleNavMenu">
<nav class="nav flex-column">
<div class="nav-item px-3">
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
<span class="bi bi-house-door-fill-nav-menu" aria-hidden="true"></span> Home
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="counter">
<span class="bi bi-plus-square-fill-nav-menu" aria-hidden="true"></span> Counter
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="weather">
<span class="bi bi-list-nested-nav-menu" aria-hidden="true"></span> Weather
</NavLink>
</div>
</nav>
</div>
@code {
private bool collapseNavMenu = true;
private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null;
private void ToggleNavMenu()
{
collapseNavMenu = !collapseNavMenu;
}
}
<nav class="nav-menu">
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
<span>🏠</span> Home
</NavLink>
<NavLink class="nav-link" href="products">
<span>📦</span> Products / Sản phẩm
</NavLink>
<NavLink class="nav-link" href="auth">
<span>🔐</span> Auth / Xác thực
</NavLink>
<NavLink class="nav-link" href="counter">
<span></span> Counter
</NavLink>
<NavLink class="nav-link" href="weather">
<span>🌤️</span> Weather
</NavLink>
</nav>

View File

@@ -0,0 +1,201 @@
@page "/auth"
@inject HttpClient Http
@inject NavigationManager Navigation
@*
EN: Authentication page with Register and Login forms.
VI: Trang xác thực với form Đăng ký và Đăng nhập.
*@
<PageTitle>Authentication / Xác thực</PageTitle>
<div class="auth-container">
<div class="auth-tabs">
<button class="tab-btn @(activeTab == "login" ? "active" : "")" @onclick="@(() => activeTab = "login")">
Login / Đăng nhập
</button>
<button class="tab-btn @(activeTab == "register" ? "active" : "")" @onclick="@(() => activeTab = "register")">
Register / Đăng ký
</button>
</div>
@* ═══════════════════════════════════════════════════════════════════════════════
EN: Login Form
VI: Form đăng nhập
═══════════════════════════════════════════════════════════════════════════════ *@
@if (activeTab == "login")
{
<section class="glass-card auth-card">
<h2>Welcome Back / Chào mừng trở lại</h2>
<p class="subtitle">Sign in to your account / Đăng nhập vào tài khoản</p>
<EditForm Model="@loginModel" OnValidSubmit="HandleLogin" FormName="Login">
<DataAnnotationsValidator />
<div class="form-group">
<label for="login-email">Email *</label>
<InputText id="login-email" @bind-Value="loginModel.Email" class="form-input" placeholder="email@example.com" />
<ValidationMessage For="() => loginModel.Email" class="validation-message" />
</div>
<div class="form-group">
<label for="login-password">Password / Mật khẩu *</label>
<InputText id="login-password" @bind-Value="loginModel.Password" type="password" class="form-input" placeholder="••••••••" />
<ValidationMessage For="() => loginModel.Password" class="validation-message" />
</div>
<div class="form-group checkbox-group">
<InputCheckbox id="remember-me" @bind-Value="loginModel.RememberMe" class="form-checkbox" />
<label for="remember-me">Remember me / Ghi nhớ đăng nhập</label>
</div>
<button type="submit" class="btn btn-primary btn-full" disabled="@isSubmitting">
@if (isSubmitting)
{
<span class="spinner"></span>
}
Sign In / Đăng nhập
</button>
</EditForm>
</section>
}
@* ═══════════════════════════════════════════════════════════════════════════════
EN: Register Form
VI: Form đăng ký
═══════════════════════════════════════════════════════════════════════════════ *@
@if (activeTab == "register")
{
<section class="glass-card auth-card">
<h2>Create Account / Tạo tài khoản</h2>
<p class="subtitle">Join us today / Tham gia với chúng tôi</p>
<EditForm Model="@registerModel" OnValidSubmit="HandleRegister" FormName="Register">
<DataAnnotationsValidator />
<ValidationSummary class="validation-summary" />
<div class="form-group">
<label for="reg-name">Display Name / Tên hiển thị *</label>
<InputText id="reg-name" @bind-Value="registerModel.DisplayName" class="form-input" placeholder="John Doe" />
<ValidationMessage For="() => registerModel.DisplayName" class="validation-message" />
</div>
<div class="form-group">
<label for="reg-email">Email *</label>
<InputText id="reg-email" @bind-Value="registerModel.Email" class="form-input" placeholder="email@example.com" />
<ValidationMessage For="() => registerModel.Email" class="validation-message" />
</div>
<div class="form-group">
<label for="reg-password">Password / Mật khẩu *</label>
<InputText id="reg-password" @bind-Value="registerModel.Password" type="password" class="form-input" placeholder="••••••••" />
<ValidationMessage For="() => registerModel.Password" class="validation-message" />
<small class="form-hint">Min 8 chars, uppercase, lowercase, digit / Tối thiểu 8 ký tự, chữ hoa, chữ thường, số</small>
</div>
<div class="form-group">
<label for="reg-confirm">Confirm Password / Xác nhận mật khẩu *</label>
<InputText id="reg-confirm" @bind-Value="registerModel.ConfirmPassword" type="password" class="form-input" placeholder="••••••••" />
<ValidationMessage For="() => registerModel.ConfirmPassword" class="validation-message" />
</div>
<button type="submit" class="btn btn-primary btn-full" disabled="@isSubmitting">
@if (isSubmitting)
{
<span class="spinner"></span>
}
Create Account / Tạo tài khoản
</button>
</EditForm>
</section>
}
@if (!string.IsNullOrEmpty(message))
{
<div class="alert @(success ? "alert-success" : "alert-error")">
@message
</div>
}
</div>
@code {
private string activeTab = "login";
private LoginDto loginModel = new();
private RegisterDto registerModel = new();
private bool isSubmitting = false;
private string message = "";
private bool success = false;
private async Task HandleLogin()
{
isSubmitting = true;
message = "";
try
{
var response = await Http.PostAsJsonAsync("api/Auth/login", loginModel);
if (response.IsSuccessStatusCode)
{
var result = await response.Content.ReadFromJsonAsync<ApiResponse<UserProfileDto>>();
if (result?.Success == true)
{
success = true;
message = $"Welcome back, {result.Data?.DisplayName}! / Chào mừng trở lại, {result.Data?.DisplayName}!";
}
}
else
{
success = false;
message = "Login failed. Please check your credentials. / Đăng nhập thất bại.";
}
}
catch (Exception ex)
{
success = false;
message = $"Error: {ex.Message}";
}
finally
{
isSubmitting = false;
}
}
private async Task HandleRegister()
{
isSubmitting = true;
message = "";
try
{
var response = await Http.PostAsJsonAsync("api/Auth/register", registerModel);
if (response.IsSuccessStatusCode)
{
var result = await response.Content.ReadFromJsonAsync<ApiResponse<UserProfileDto>>();
if (result?.Success == true)
{
success = true;
message = "Account created successfully! / Tạo tài khoản thành công!";
activeTab = "login";
registerModel = new();
}
}
else
{
success = false;
var content = await response.Content.ReadAsStringAsync();
message = $"Registration failed: {content}";
}
}
catch (Exception ex)
{
success = false;
message = $"Error: {ex.Message}";
}
finally
{
isSubmitting = false;
}
}
}

View File

@@ -0,0 +1,201 @@
@page "/products"
@inject HttpClient Http
@*
EN: Products page demonstrating shared validation between Client and Server.
VI: Trang sản phẩm demo validation được chia sẻ giữa Client và Server.
*@
<PageTitle>Products / Sản phẩm</PageTitle>
<div class="container">
<h1 class="page-title">Products Management / Quản lý sản phẩm</h1>
@* ═══════════════════════════════════════════════════════════════════════════════
EN: Create Product Form with shared validation
VI: Form tạo sản phẩm với validation được chia sẻ
═══════════════════════════════════════════════════════════════════════════════ *@
<section class="glass-card">
<h2>Create Product / Tạo sản phẩm</h2>
<EditForm Model="@newProduct" OnValidSubmit="HandleSubmit" OnInvalidSubmit="HandleInvalid" FormName="CreateProduct">
@* EN: DataAnnotationsValidator uses the same validation rules as the Server
VI: DataAnnotationsValidator sử dụng cùng validation rules với Server *@
<DataAnnotationsValidator />
@* EN: Display all validation errors
VI: Hiển thị tất cả lỗi validation *@
<ValidationSummary class="validation-summary" />
<div class="form-group">
<label for="name">Product Name / Tên sản phẩm *</label>
<InputText id="name" @bind-Value="newProduct.Name" class="form-input" placeholder="Enter product name..." />
<ValidationMessage For="() => newProduct.Name" class="validation-message" />
</div>
<div class="form-group">
<label for="description">Description / Mô tả</label>
<InputTextArea id="description" @bind-Value="newProduct.Description" class="form-input" rows="3" placeholder="Enter description..." />
<ValidationMessage For="() => newProduct.Description" class="validation-message" />
</div>
<div class="form-row">
<div class="form-group">
<label for="price">Price / Giá *</label>
<InputNumber id="price" @bind-Value="newProduct.Price" class="form-input" placeholder="0.00" />
<ValidationMessage For="() => newProduct.Price" class="validation-message" />
</div>
<div class="form-group">
<label for="quantity">Quantity / Số lượng</label>
<InputNumber id="quantity" @bind-Value="newProduct.Quantity" class="form-input" placeholder="0" />
<ValidationMessage For="() => newProduct.Quantity" class="validation-message" />
</div>
</div>
<div class="form-group">
<label for="category">Category ID / ID Danh mục *</label>
<InputText id="category" @bind-Value="categoryIdString" class="form-input" placeholder="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" />
<ValidationMessage For="() => newProduct.CategoryId" class="validation-message" />
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary" disabled="@isSubmitting">
@if (isSubmitting)
{
<span class="spinner"></span>
<span>Submitting...</span>
}
else
{
<span>Create Product / Tạo sản phẩm</span>
}
</button>
<button type="button" class="btn btn-secondary" @onclick="ResetForm">Reset</button>
</div>
</EditForm>
@if (!string.IsNullOrEmpty(submitMessage))
{
<div class="alert @(submitSuccess ? "alert-success" : "alert-error")">
@submitMessage
</div>
}
</section>
@* ═══════════════════════════════════════════════════════════════════════════════
EN: Product List
VI: Danh sách sản phẩm
═══════════════════════════════════════════════════════════════════════════════ *@
<section class="glass-card">
<h2>Product List / Danh sách sản phẩm</h2>
@if (products == null)
{
<p class="loading">Loading products... / Đang tải sản phẩm...</p>
}
else if (!products.Any())
{
<p class="empty-state">No products found. / Không tìm thấy sản phẩm.</p>
}
else
{
<div class="product-grid">
@foreach (var product in products)
{
<div class="product-card">
<h3>@product.Name</h3>
<p class="description">@(product.Description ?? "No description")</p>
<div class="product-details">
<span class="price">@product.Price.ToString("C")</span>
<span class="quantity">Stock: @product.Quantity</span>
</div>
</div>
}
</div>
}
</section>
</div>
@code {
private CreateProductDto newProduct = new();
private List<ProductDto>? products;
private bool isSubmitting = false;
private string submitMessage = "";
private bool submitSuccess = false;
private string categoryIdString = "";
protected override async Task OnInitializedAsync()
{
await LoadProducts();
}
private async Task LoadProducts()
{
try
{
var response = await Http.GetFromJsonAsync<ApiResponse<List<ProductDto>>>("api/Products");
if (response?.Success == true)
{
products = response.Data ?? new List<ProductDto>();
}
}
catch (Exception ex)
{
Console.WriteLine($"Error loading products: {ex.Message}");
products = new List<ProductDto>();
}
}
private async Task HandleSubmit()
{
isSubmitting = true;
submitMessage = "";
// Parse category ID
if (Guid.TryParse(categoryIdString, out var categoryId))
{
newProduct.CategoryId = categoryId;
}
try
{
var response = await Http.PostAsJsonAsync("api/Products", newProduct);
if (response.IsSuccessStatusCode)
{
submitSuccess = true;
submitMessage = "Product created successfully! / Tạo sản phẩm thành công!";
ResetForm();
await LoadProducts();
}
else
{
submitSuccess = false;
var content = await response.Content.ReadAsStringAsync();
submitMessage = $"Error: {response.StatusCode} - {content}";
}
}
catch (Exception ex)
{
submitSuccess = false;
submitMessage = $"Error: {ex.Message}";
}
finally
{
isSubmitting = false;
}
}
private void HandleInvalid()
{
submitMessage = "Please fix the validation errors. / Vui lòng sửa các lỗi validation.";
submitSuccess = false;
}
private void ResetForm()
{
newProduct = new CreateProductDto();
categoryIdString = "";
}
}

View File

@@ -8,3 +8,6 @@
@using Microsoft.JSInterop
@using WebClientBase.Client
@using WebClientBase.Client.Layout
@using WebClientBase.Shared
@using WebClientBase.Shared.DTOs

View File

@@ -1,115 +1,553 @@
html, body {
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
/* ═══════════════════════════════════════════════════════════════════════════════
WebClientBase Design System
EN: GoodGo branding with Dark/Light mode support
VI: GoodGo branding với hỗ trợ Dark/Light mode
═══════════════════════════════════════════════════════════════════════════════ */
/* ═══════════════════════════════════════════════════════════════════════════════
CSS Variables / Biến CSS
═══════════════════════════════════════════════════════════════════════════════ */
:root {
/* Light Mode Colors */
--bg-primary: #ffffff;
--bg-secondary: #f5f5f7;
--bg-tertiary: #e5e5ea;
--bg-elevated: #ffffff;
--text-primary: #1d1d1f;
--text-secondary: #6e6e73;
--text-tertiary: #8e8e93;
--accent-primary: #3b82f6;
--accent-primary-hover: #2563eb;
--accent-success: #22c55e;
--accent-warning: #f59e0b;
--accent-error: #ef4444;
--border-default: rgba(0, 0, 0, 0.1);
--border-strong: rgba(0, 0, 0, 0.2);
/* Glass Effects */
--glass-bg: rgba(255, 255, 255, 0.7);
--glass-border: rgba(255, 255, 255, 0.3);
--glass-blur: 20px;
--glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
/* Brand */
--brand-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
/* Typography */
--font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
--font-mono: 'JetBrains Mono', 'SF Mono', monospace;
--text-xs: 0.75rem;
--text-sm: 0.875rem;
--text-base: 1rem;
--text-lg: 1.125rem;
--text-xl: 1.25rem;
--text-2xl: 1.5rem;
--text-3xl: 1.875rem;
/* Spacing */
--space-1: 0.25rem;
--space-2: 0.5rem;
--space-3: 0.75rem;
--space-4: 1rem;
--space-6: 1.5rem;
--space-8: 2rem;
--space-12: 3rem;
/* Border Radius */
--radius-sm: 0.25rem;
--radius-md: 0.5rem;
--radius-lg: 0.75rem;
--radius-xl: 1rem;
--radius-full: 9999px;
/* Transitions */
--transition-fast: 150ms ease;
--transition-normal: 250ms ease;
/* Sidebar */
--sidebar-width: 280px;
}
h1:focus {
outline: none;
/* Dark Mode */
[data-theme="dark"] {
--bg-primary: #000000;
--bg-secondary: #1c1c1e;
--bg-tertiary: #2c2c2e;
--bg-elevated: #1c1c1e;
--text-primary: #f5f5f7;
--text-secondary: #a1a1a6;
--text-tertiary: #6e6e73;
--border-default: rgba(255, 255, 255, 0.1);
--border-strong: rgba(255, 255, 255, 0.2);
--glass-bg: rgba(28, 28, 30, 0.8);
--glass-border: rgba(255, 255, 255, 0.1);
--glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
a, .btn-link {
color: #0071c1;
/* ═══════════════════════════════════════════════════════════════════════════════
Base Styles
═══════════════════════════════════════════════════════════════════════════════ */
*,
*::before,
*::after {
box-sizing: border-box;
}
.btn-primary {
color: #fff;
background-color: #1b6ec2;
border-color: #1861ac;
html {
font-size: 16px;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
body {
font-family: var(--font-sans);
background: var(--bg-primary);
color: var(--text-primary);
margin: 0;
padding: 0;
line-height: 1.5;
transition: background-color var(--transition-normal), color var(--transition-normal);
}
/* ═══════════════════════════════════════════════════════════════════════════════
Layout
═══════════════════════════════════════════════════════════════════════════════ */
.page {
display: flex;
min-height: 100vh;
}
.sidebar {
width: var(--sidebar-width);
background: var(--bg-secondary);
border-right: 1px solid var(--border-default);
display: flex;
flex-direction: column;
}
main {
flex: 1;
display: flex;
flex-direction: column;
}
.top-row {
background: var(--bg-elevated);
border-bottom: 1px solid var(--border-default);
padding: var(--space-4);
display: flex;
justify-content: flex-end;
align-items: center;
gap: var(--space-4);
}
.content {
padding-top: 1.1rem;
flex: 1;
padding: var(--space-6);
overflow-y: auto;
}
.valid.modified:not([type=checkbox]) {
outline: 1px solid #26b050;
.container {
max-width: 1200px;
margin: 0 auto;
}
.invalid {
outline: 1px solid red;
/* ═══════════════════════════════════════════════════════════════════════════════
Navigation
═══════════════════════════════════════════════════════════════════════════════ */
.nav-brand {
padding: var(--space-6) var(--space-4);
font-size: var(--text-xl);
font-weight: 700;
background: var(--brand-gradient);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.validation-message {
color: red;
.nav-menu {
padding: var(--space-4);
}
#blazor-error-ui {
color-scheme: light only;
background: lightyellow;
bottom: 0;
box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
box-sizing: border-box;
display: none;
left: 0;
padding: 0.6rem 1.25rem 0.7rem 1.25rem;
position: fixed;
width: 100%;
z-index: 1000;
.nav-link {
display: flex;
align-items: center;
gap: var(--space-3);
padding: var(--space-3) var(--space-4);
color: var(--text-secondary);
text-decoration: none;
border-radius: var(--radius-lg);
transition: all var(--transition-fast);
}
#blazor-error-ui .dismiss {
cursor: pointer;
position: absolute;
right: 0.75rem;
top: 0.5rem;
}
.nav-link:hover {
background: var(--bg-tertiary);
color: var(--text-primary);
}
.blazor-error-boundary {
background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
padding: 1rem 1rem 1rem 3.7rem;
.nav-link.active {
background: var(--accent-primary);
color: white;
}
.blazor-error-boundary::after {
content: "An error has occurred."
}
/* ═══════════════════════════════════════════════════════════════════════════════
Glass Card
═══════════════════════════════════════════════════════════════════════════════ */
.glass-card {
background: var(--glass-bg);
backdrop-filter: blur(var(--glass-blur));
-webkit-backdrop-filter: blur(var(--glass-blur));
border: 1px solid var(--glass-border);
border-radius: var(--radius-xl);
padding: var(--space-6);
box-shadow: var(--glass-shadow);
margin-bottom: var(--space-6);
}
.loading-progress {
position: absolute;
.glass-card h2 {
margin: 0 0 var(--space-4);
font-size: var(--text-xl);
font-weight: 600;
}
/* ═══════════════════════════════════════════════════════════════════════════════
Forms
═══════════════════════════════════════════════════════════════════════════════ */
.form-group {
margin-bottom: var(--space-4);
}
.form-group label {
display: block;
width: 8rem;
height: 8rem;
inset: 20vh 0 auto 0;
margin: 0 auto 0 auto;
margin-bottom: var(--space-2);
font-size: var(--text-sm);
font-weight: 500;
color: var(--text-secondary);
}
.loading-progress circle {
fill: none;
stroke: #e0e0e0;
stroke-width: 0.6rem;
transform-origin: 50% 50%;
transform: rotate(-90deg);
}
.form-input {
width: 100%;
padding: var(--space-3) var(--space-4);
font-size: var(--text-base);
font-family: var(--font-sans);
background: var(--bg-primary);
border: 1px solid var(--border-default);
border-radius: var(--radius-md);
color: var(--text-primary);
transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.loading-progress circle:last-child {
stroke: #1b6ec2;
stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
transition: stroke-dasharray 0.05s ease-in-out;
}
.form-input:focus {
outline: none;
border-color: var(--accent-primary);
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}
.loading-progress-text {
position: absolute;
.form-input::placeholder {
color: var(--text-tertiary);
}
.form-input.invalid,
.form-input:invalid {
border-color: var(--accent-error);
}
.form-row {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: var(--space-4);
}
.form-hint {
display: block;
margin-top: var(--space-1);
font-size: var(--text-xs);
color: var(--text-tertiary);
}
.form-actions {
display: flex;
gap: var(--space-3);
margin-top: var(--space-6);
}
.checkbox-group {
display: flex;
align-items: center;
gap: var(--space-2);
}
.checkbox-group label {
margin: 0;
}
/* ═══════════════════════════════════════════════════════════════════════════════
Buttons
═══════════════════════════════════════════════════════════════════════════════ */
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: var(--space-2);
padding: var(--space-3) var(--space-6);
font-size: var(--text-base);
font-weight: 500;
font-family: var(--font-sans);
border: none;
border-radius: var(--radius-md);
cursor: pointer;
transition: all var(--transition-fast);
}
.btn:disabled {
opacity: 0.6;
cursor: not-allowed;
}
.btn-primary {
background: var(--brand-gradient);
color: white;
}
.btn-primary:hover:not(:disabled) {
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}
.btn-secondary {
background: var(--bg-tertiary);
color: var(--text-primary);
}
.btn-secondary:hover:not(:disabled) {
background: var(--bg-secondary);
}
.btn-full {
width: 100%;
}
/* ═══════════════════════════════════════════════════════════════════════════════
Validation
═══════════════════════════════════════════════════════════════════════════════ */
.validation-summary {
background: rgba(239, 68, 68, 0.1);
border: 1px solid var(--accent-error);
border-radius: var(--radius-md);
padding: var(--space-4);
margin-bottom: var(--space-4);
color: var(--accent-error);
}
.validation-summary ul {
margin: 0;
padding-left: var(--space-4);
}
.validation-message {
display: block;
margin-top: var(--space-1);
font-size: var(--text-xs);
color: var(--accent-error);
}
/* ═══════════════════════════════════════════════════════════════════════════════
Alerts
═══════════════════════════════════════════════════════════════════════════════ */
.alert {
padding: var(--space-4);
border-radius: var(--radius-md);
margin-top: var(--space-4);
}
.alert-success {
background: rgba(34, 197, 94, 0.1);
border: 1px solid var(--accent-success);
color: var(--accent-success);
}
.alert-error {
background: rgba(239, 68, 68, 0.1);
border: 1px solid var(--accent-error);
color: var(--accent-error);
}
/* ═══════════════════════════════════════════════════════════════════════════════
Product Grid
═══════════════════════════════════════════════════════════════════════════════ */
.product-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
gap: var(--space-4);
}
.product-card {
background: var(--bg-elevated);
border: 1px solid var(--border-default);
border-radius: var(--radius-lg);
padding: var(--space-4);
transition: all var(--transition-fast);
}
.product-card:hover {
transform: translateY(-2px);
box-shadow: var(--glass-shadow);
}
.product-card h3 {
margin: 0 0 var(--space-2);
font-size: var(--text-lg);
}
.product-card .description {
color: var(--text-secondary);
font-size: var(--text-sm);
margin-bottom: var(--space-3);
}
.product-details {
display: flex;
justify-content: space-between;
align-items: center;
}
.product-details .price {
font-weight: 600;
color: var(--accent-primary);
}
.product-details .quantity {
font-size: var(--text-sm);
color: var(--text-tertiary);
}
/* ═══════════════════════════════════════════════════════════════════════════════
Auth
═══════════════════════════════════════════════════════════════════════════════ */
.auth-container {
max-width: 400px;
margin: var(--space-12) auto;
}
.auth-tabs {
display: flex;
gap: var(--space-2);
margin-bottom: var(--space-4);
}
.tab-btn {
flex: 1;
padding: var(--space-3);
font-size: var(--text-base);
font-weight: 500;
background: var(--bg-tertiary);
border: none;
border-radius: var(--radius-md);
color: var(--text-secondary);
cursor: pointer;
transition: all var(--transition-fast);
}
.tab-btn.active {
background: var(--accent-primary);
color: white;
}
.auth-card .subtitle {
color: var(--text-secondary);
margin-bottom: var(--space-6);
}
/* ═══════════════════════════════════════════════════════════════════════════════
Page Title
═══════════════════════════════════════════════════════════════════════════════ */
.page-title {
font-size: var(--text-2xl);
font-weight: 700;
margin-bottom: var(--space-6);
background: var(--brand-gradient);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
/* ═══════════════════════════════════════════════════════════════════════════════
Theme Toggle
═══════════════════════════════════════════════════════════════════════════════ */
.theme-toggle {
padding: var(--space-2) var(--space-3);
background: var(--bg-tertiary);
border: 1px solid var(--border-default);
border-radius: var(--radius-full);
color: var(--text-primary);
cursor: pointer;
transition: all var(--transition-fast);
}
.theme-toggle:hover {
background: var(--bg-secondary);
}
/* ═══════════════════════════════════════════════════════════════════════════════
Loading & States
═══════════════════════════════════════════════════════════════════════════════ */
.loading {
text-align: center;
font-weight: bold;
inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
color: var(--text-secondary);
padding: var(--space-8);
}
.loading-progress-text:after {
content: var(--blazor-load-percentage-text, "Loading");
.empty-state {
text-align: center;
color: var(--text-tertiary);
padding: var(--space-8);
}
.spinner {
display: inline-block;
width: 1rem;
height: 1rem;
border: 2px solid currentColor;
border-right-color: transparent;
border-radius: 50%;
animation: spin 0.75s linear infinite;
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
/* ═══════════════════════════════════════════════════════════════════════════════
Responsive
═══════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
.sidebar {
position: fixed;
left: -100%;
top: 0;
bottom: 0;
z-index: 100;
transition: left var(--transition-normal);
}
code {
color: #c02d76;
}
.sidebar.open {
left: 0;
}
.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
color: var(--bs-secondary-color);
text-align: end;
}
.form-row {
grid-template-columns: 1fr;
}
.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
text-align: start;
.content {
padding: var(--space-4);
}
}

View File

@@ -4,31 +4,51 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>WebClientBase.Client</title>
<title>GoodGo Web Client Base</title>
<base href="/" />
<link rel="preload" id="webassembly" />
<link rel="stylesheet" href="lib/bootstrap/dist/css/bootstrap.min.css" />
<!-- EN: Google Fonts - Inter for modern typography -->
<!-- VI: Google Fonts - Inter cho typography hiện đại -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
<!-- EN: Design System CSS -->
<!-- VI: CSS Design System -->
<link rel="stylesheet" href="css/app.css" />
<link rel="icon" type="image/png" href="favicon.png" />
<link href="WebClientBase.Client.styles.css" rel="stylesheet" />
<script type="importmap"></script>
</head>
<body>
<div id="app">
<svg class="loading-progress">
<circle r="40%" cx="50%" cy="50%" />
<circle r="40%" cx="50%" cy="50%" />
</svg>
<div class="loading-progress-text"></div>
<!-- EN: Loading indicator -->
<!-- VI: Chỉ báo đang tải -->
<div style="display: flex; justify-content: center; align-items: center; height: 100vh; flex-direction: column; gap: 1rem;">
<svg class="loading-progress" width="80" height="80" viewBox="0 0 80 80">
<circle cx="40" cy="40" r="32" fill="none" stroke="#e5e5ea" stroke-width="4" />
<circle cx="40" cy="40" r="32" fill="none" stroke="#3b82f6" stroke-width="4"
stroke-dasharray="200" stroke-dashoffset="60"
style="animation: spin 1s linear infinite; transform-origin: center;">
</circle>
</svg>
<p style="color: #6e6e73; font-family: Inter, sans-serif;">Loading GoodGo... / Đang tải...</p>
</div>
<style>
@keyframes spin {
to { transform: rotate(360deg); }
}
</style>
</div>
<div id="blazor-error-ui">
An unhandled error has occurred.
<a href="." class="reload">Reload</a>
<span class="dismiss">🗙</span>
<div id="blazor-error-ui" style="display: none; position: fixed; bottom: 0; left: 0; right: 0; padding: 1rem; background: #ef4444; color: white; text-align: center;">
An unhandled error has occurred. / Đã xảy ra lỗi.
<a href="." class="reload" style="color: white; text-decoration: underline; margin-left: 1rem;">Reload / Tải lại</a>
<span class="dismiss" style="cursor: pointer; margin-left: 1rem;"></span>
</div>
<script src="_framework/blazor.webassembly#[.{fingerprint}].js"></script>
<script src="_framework/blazor.webassembly.js"></script>
</body>
</html>