Addet employee frontend and move header to a componet
This commit is contained in:
@@ -1,18 +1,9 @@
|
||||
@rendermode InteractiveServer
|
||||
@implements IDisposable
|
||||
@using System.Globalization
|
||||
@inject NavigationManager Nav
|
||||
@page "/"
|
||||
|
||||
<header class="top-nav">
|
||||
<div class="brand">Indstilinger</div>
|
||||
<Header/>
|
||||
|
||||
<time datetime="@_currentTime.ToString("O")">
|
||||
@_currentTime.ToString(
|
||||
"dddd d. MMMM yyyy · HH:mm",
|
||||
_danishCulture)
|
||||
</time>
|
||||
</header>
|
||||
|
||||
<div class="home-container">
|
||||
<FluentButton Class="menu-button" Size="ButtonSize.Large">
|
||||
@@ -27,32 +18,4 @@
|
||||
<FluentButton Class="menu-button" Size="ButtonSize.Large" onclick="@(() => Nav.NavigateTo("/settings"))">
|
||||
Indstillinger
|
||||
</FluentButton>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private readonly CultureInfo _danishCulture =
|
||||
CultureInfo.GetCultureInfo("da-DK");
|
||||
|
||||
private readonly Timer _timer;
|
||||
private DateTime _currentTime = DateTime.Now;
|
||||
|
||||
public Home()
|
||||
{
|
||||
_timer = new Timer(
|
||||
UpdateTime,
|
||||
null,
|
||||
TimeSpan.FromMinutes(1),
|
||||
TimeSpan.FromMinutes(1));
|
||||
}
|
||||
|
||||
private void UpdateTime(object? state)
|
||||
{
|
||||
_currentTime = DateTime.Now;
|
||||
_ = InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_timer.Dispose();
|
||||
}
|
||||
}
|
||||
</div>
|
||||
Reference in New Issue
Block a user