Files
aliasvault/apps/server/AliasVault.Client/Main/Layout/Footer.razor
2025-07-16 11:28:28 +02:00

67 lines
2.2 KiB
Plaintext

@inject NavigationManager NavigationManager
@inject IStringLocalizerFactory LocalizerFactory
@using AliasVault.Shared.Core
@using Microsoft.Extensions.Localization
@implements IDisposable
<footer class="relative -z-10 lg:fixed bottom-0 left-0 right-0 dark:bg-gray-900 @(ShowBorder ? "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">
© 2024 <span>@AppInfo.ApplicationName v@(AppInfo.GetFullVersion())</span>. @Localizer["CopyrightText"]
</p>
<div class="hidden lg:block text-center text-gray-400 text-sm">@_randomQuote</div>
<ul class="flex flex-wrap items-center justify-center">
<li>
<a href="https://github.com/lanedirt/AliasVault" target="_blank" class="text-sm font-normal text-gray-500 hover:underline dark:text-gray-400">GitHub</a>
</li>
</ul>
</div>
</div>
</footer>
@code {
/// <summary>
/// Gets or sets a value indicating whether the footer should have a border.
/// </summary>
[Parameter]
public bool ShowBorder { get; set; } = true;
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();
}
}