62 lines
2.1 KiB
Text
62 lines
2.1 KiB
Text
|
@using Blazored.LocalStorage;
|
||
|
@inject ILocalStorageService localStorage;
|
||
|
@inject SettingsService settings;
|
||
|
@implements IDisposable
|
||
|
|
||
|
<Router AppAssembly="@typeof(App).Assembly">
|
||
|
<Found Context="routeData">
|
||
|
<ErrorBoundary>
|
||
|
<ChildContent>
|
||
|
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
|
||
|
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
|
||
|
</ChildContent>
|
||
|
<ErrorContent>
|
||
|
<PageTitle>An error occurred</PageTitle>
|
||
|
<LayoutView Layout="@typeof(DefaultLayout)">
|
||
|
<FluentBodyContent>
|
||
|
<h1>An error occurred</h1>
|
||
|
<p>
|
||
|
If you're able to, contact a developer to get the issue fixed.
|
||
|
You can also reload the page to try again.
|
||
|
</p>
|
||
|
</FluentBodyContent>
|
||
|
</LayoutView>
|
||
|
</ErrorContent>
|
||
|
</ErrorBoundary>
|
||
|
</Found>
|
||
|
<NotFound>
|
||
|
<PageTitle>Not found</PageTitle>
|
||
|
<LayoutView Layout="@typeof(DefaultLayout)">
|
||
|
<FluentBodyContent>
|
||
|
<h1>Page Not Found</h1>
|
||
|
<FluentAnchor Href="/" Appearance="Appearance.Hypertext">Head back home?</FluentAnchor>
|
||
|
</FluentBodyContent>
|
||
|
</LayoutView>
|
||
|
</NotFound>
|
||
|
</Router>
|
||
|
|
||
|
<FluentDesignTheme Mode="@settings.Settings.ThemeMode" OfficeColor="@settings.Settings.AccentColor" StorageName="theme" />
|
||
|
<FluentToastProvider />
|
||
|
<FluentDialogProvider />
|
||
|
<FluentTooltipProvider />
|
||
|
<FluentMessageBarProvider />
|
||
|
<FluentMenuProvider />
|
||
|
|
||
|
@code {
|
||
|
protected override async Task OnInitializedAsync() {
|
||
|
var settingsStr = await localStorage.GetItemAsync<string>("settings");
|
||
|
if (settingsStr != null) {
|
||
|
settings.Deserialize(settingsStr);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
protected override void OnInitialized()
|
||
|
{
|
||
|
settings.OnSettingsChanged += StateHasChanged;
|
||
|
}
|
||
|
|
||
|
public void Dispose()
|
||
|
{
|
||
|
settings.OnSettingsChanged -= StateHasChanged;
|
||
|
}
|
||
|
}
|