Files
aliasvault/src/AliasVault.Client/Main/Layout/Footer.razor
2024-08-09 13:51:02 +02:00

58 lines
1.9 KiB
Plaintext

@inject NavigationManager NavigationManager
@implements IDisposable
<footer class="md:flex md:items-center md:justify-between px-4 2xl:px-0 py-6 md:py-10">
<p class="text-sm text-center text-gray-500 mb-4 md:mb-0">
© 2024 AliasVault. All rights reserved.
</p>
<ul class="flex flex-wrap items-center justify-center">
<li>
<a href="#" class="mr-4 text-sm font-normal text-gray-500 hover:underline md:mr-6 dark:text-gray-400">Terms and conditions</a>
</li>
<li>
<a href="#" class="mr-4 text-sm font-normal text-gray-500 hover:underline md:mr-6 dark:text-gray-400">License</a>
</li>
<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>
</footer>
<div class="text-center text-gray-400 text-sm pt-4 pb-2">@RandomQuote</div>
@code {
private static readonly string[] Quotes =
[
"Tip: Use the g+c (go create) keyboard shortcut to quickly create a new identity.",
"Tip: Use the g+f (go find) keyboard shortcut to focus the search field.",
"Tip: Use the g+h (go home) keyboard shortcut to go to the homepage.",
];
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();
}
}