feat(ui): promote Excel export to a top-level destination
- Add an /export hub page that hosts the existing (date-range, not event-specific) ExportDialog, so export is no longer reachable only by opening an event detail. - Add an Export entry under the System nav section.
This commit is contained in:
@@ -53,6 +53,10 @@
|
||||
</NavLink>
|
||||
|
||||
<div class="m-nav__group" style="margin-top: var(--m-space-5);">@L["Nav.Section.System"]</div>
|
||||
<NavLink class="m-nav__link" href="export">
|
||||
<MudIcon Icon="@Icons.Material.Outlined.FileDownload" Size="Size.Small" />
|
||||
<span>@L["Nav.Export"]</span>
|
||||
</NavLink>
|
||||
<NavLink class="m-nav__link" href="settings">
|
||||
<MudIcon Icon="@Icons.Material.Outlined.Tune" Size="Size.Small" />
|
||||
<span>@L["Nav.Settings"]</span>
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
@*
|
||||
ExportHub — a top-level home for the Excel export so it is no longer gated
|
||||
behind opening a single event's detail page. Hosts the shared ExportDialog
|
||||
(date range + kind) which is not event-specific.
|
||||
*@
|
||||
|
||||
@page "/export"
|
||||
@inject IStringLocalizer<SharedResource> L
|
||||
@inject IDialogService Dialog
|
||||
@inject ISnackbar Snackbar
|
||||
|
||||
<PageTitle>@L["App.Title"] · @L["Export.Title"]</PageTitle>
|
||||
|
||||
<section class="m-shell">
|
||||
<header class="m-rise m-rise-1" style="display: grid; gap: var(--m-space-3); max-width: 880px;">
|
||||
<span class="m-kicker">@L["Export.Kicker"]</span>
|
||||
<h1 class="m-display" style="font-size: clamp(2rem, 4vw, 3rem);">@L["Export.Title"]</h1>
|
||||
<p style="color: var(--m-c-ink-soft); max-width: 60ch;">@L["Export.Hub.Lede"]</p>
|
||||
</header>
|
||||
|
||||
<hr class="m-rule--double" />
|
||||
|
||||
<div class="m-rise m-rise-2" style="display: grid; gap: var(--m-space-3);">
|
||||
<div>
|
||||
<button type="button" class="m-chip" @onclick="OpenExportDialog" data-test="export-hub-open">
|
||||
@L["Export.Hub.Action"] →
|
||||
</button>
|
||||
</div>
|
||||
<span class="m-mono" style="font-size: 0.75rem; color: var(--m-c-ink-soft); letter-spacing: 0.08em;">
|
||||
@L["Export.Hub.FilenameHint"]
|
||||
</span>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@code {
|
||||
private async Task OpenExportDialog()
|
||||
{
|
||||
var parameters = new DialogParameters
|
||||
{
|
||||
["InitialFrom"] = MoscowTime.Now.Date.AddDays(-7),
|
||||
["InitialTo"] = MoscowTime.Now.Date,
|
||||
};
|
||||
|
||||
var options = new DialogOptions
|
||||
{
|
||||
CloseOnEscapeKey = true,
|
||||
FullWidth = true,
|
||||
MaxWidth = MaxWidth.Small,
|
||||
};
|
||||
|
||||
var reference = await Dialog.ShowAsync<ExportDialog>(L["Export.Title"], parameters, options);
|
||||
var result = await reference.Result;
|
||||
if (result is { Canceled: false, Data: string path })
|
||||
{
|
||||
Snackbar.Add(string.Format(CultureInfo.CurrentCulture, L["Export.Success"].Value, path), Severity.Success);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user