개선: 배포 검증과 관리자 UX 안정화
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
@page "/admin/dashboard"
|
||||
@using TaxBaik.Application.Services
|
||||
@inject InquiryService InquiryService
|
||||
@inject BlogService BlogService
|
||||
@inject AdminDashboardService DashboardService
|
||||
|
||||
<PageTitle>대시보드</PageTitle>
|
||||
|
||||
@@ -11,28 +10,28 @@
|
||||
<MudItem xs="12" sm="6" md="3">
|
||||
<MudPaper Class="pa-4" Elevation="1">
|
||||
<MudText Typo="Typo.subtitle2">이번달 문의</MudText>
|
||||
<MudText Typo="Typo.h4">@thisMonthInquiries</MudText>
|
||||
<MudText Typo="Typo.h4">@summary.ThisMonthInquiries</MudText>
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
|
||||
<MudItem xs="12" sm="6" md="3">
|
||||
<MudPaper Class="pa-4" Elevation="1">
|
||||
<MudText Typo="Typo.subtitle2">신규 문의</MudText>
|
||||
<MudText Typo="Typo.h4">@newInquiries</MudText>
|
||||
<MudText Typo="Typo.h4">@summary.NewInquiries</MudText>
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
|
||||
<MudItem xs="12" sm="6" md="3">
|
||||
<MudPaper Class="pa-4" Elevation="1">
|
||||
<MudText Typo="Typo.subtitle2">전체 포스트</MudText>
|
||||
<MudText Typo="Typo.h4">@totalPosts</MudText>
|
||||
<MudText Typo="Typo.h4">@summary.TotalPosts</MudText>
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
|
||||
<MudItem xs="12" sm="6" md="3">
|
||||
<MudPaper Class="pa-4" Elevation="1">
|
||||
<MudText Typo="Typo.subtitle2">발행된 포스트</MudText>
|
||||
<MudText Typo="Typo.h4">@publishedPosts</MudText>
|
||||
<MudText Typo="Typo.h4">@summary.PublishedPosts</MudText>
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
@@ -50,7 +49,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var inquiry in recentInquiries)
|
||||
@foreach (var inquiry in summary.RecentInquiries)
|
||||
{
|
||||
<tr>
|
||||
<td>@inquiry.Name</td>
|
||||
@@ -70,22 +69,10 @@
|
||||
</MudPaper>
|
||||
|
||||
@code {
|
||||
private int thisMonthInquiries = 0;
|
||||
private int newInquiries = 0;
|
||||
private int totalPosts = 0;
|
||||
private int publishedPosts = 0;
|
||||
private List<Domain.Entities.Inquiry> recentInquiries = [];
|
||||
private AdminDashboardSummary summary = new(0, 0, 0, 0, []);
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
var (inquiries, _) = await InquiryService.GetPagedAsync(1, 100);
|
||||
recentInquiries = inquiries.OrderByDescending(x => x.CreatedAt).Take(5).ToList();
|
||||
|
||||
var now = DateTime.UtcNow;
|
||||
thisMonthInquiries = inquiries.Count(x => x.CreatedAt.Year == now.Year && x.CreatedAt.Month == now.Month);
|
||||
newInquiries = inquiries.Count(x => x.Status == "new");
|
||||
var stats = await BlogService.GetStatsAsync();
|
||||
totalPosts = stats.TotalPosts;
|
||||
publishedPosts = stats.PublishedPosts;
|
||||
summary = await DashboardService.GetSummaryAsync();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user