Files
aliasvault/apps/server/AliasVault.Client/Main/Layout/Footer.razor

56 lines
1.8 KiB
Plaintext

@inject NavigationManager NavigationManager
@inject IStringLocalizerFactory LocalizerFactory
@using AliasVault.Shared.Core
@using Microsoft.Extensions.Localization
@implements IDisposable
<footer class="fixed -z-10 bottom-0 left-0 right-0 dark:bg-gray-900 border-t border-gray-200 dark:border-gray-700">
<div class="container mx-auto px-4 py-4">
<div class="flex flex-col lg:flex-row justify-between items-center">
<p class="text-sm text-center text-gray-500 mb-4 lg:mb-0">
© @(DateTime.Now.Year) <span>@AppInfo.ApplicationName v@(AppInfo.GetFullVersion())</span>. @Localizer["CopyrightText"]
</p>
<div class="hidden lg:block text-center text-gray-400 text-sm">@_randomQuote</div>
</div>
</div>
</footer>
@code {
private IStringLocalizer Localizer => LocalizerFactory.Create("Layout.Footer", "AliasVault.Client");
private string[] Quotes =>
[
Localizer["TipCreateShortcut"],
Localizer["TipFindShortcut"],
Localizer["TipHomeShortcut"],
Localizer["TipLockShortcut"],
];
private string _randomQuote = string.Empty;
/// <inheritdoc />
public void Dispose()
{
NavigationManager.LocationChanged -= RefreshQuote;
}
/// <inheritdoc />
protected override void OnAfterRender(bool firstRender)
{
if (firstRender)
{
_randomQuote = Quotes[Random.Shared.Next(Quotes.Length)];
NavigationManager.LocationChanged += RefreshQuote;
}
}
/// <summary>
/// Shows a new random quote.
/// </summary>
private void RefreshQuote(object? sender, LocationChangedEventArgs e)
{
_randomQuote = Quotes[Random.Shared.Next(Quotes.Length)];
StateHasChanged();
}
}