Skip to content

Commit 226d2ac

Browse files
robgrameCopilot
andcommitted
feat(web): show app version in sidebar footer
Adds a small monospace �<InformationalVersion> line beneath the user identity in MainLayout's sidebar footer. The full informational version (including git sha after '+') is exposed via the title attribute for hover inspection, while the displayed value is trimmed to the semver prefix to stay compact. The version is read once at component-class init from typeof(MainLayout).Assembly's AssemblyInformationalVersionAttribute, so it stays in sync with the centralized <Version> in Directory.Build.props without any extra DI plumbing. CSS: sidebar-footer becomes a flex column so user + version stack cleanly with a small gap; the user line gets ellipsis to handle long SamAccountNames. Build 0/0, tests 50/50. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 6e68eb8 commit 226d2ac

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

src/BitLockerKeyMonitor.Web/Components/Layout/MainLayout.razor

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@inherits LayoutComponentBase
2+
@using System.Reflection
23

34
<div class="app-container">
45
<nav class="sidebar">
@@ -33,9 +34,10 @@
3334
<div class="sidebar-footer">
3435
<Microsoft.AspNetCore.Components.Authorization.AuthorizeView>
3536
<Authorized>
36-
<small>👤 @context.User.Identity?.Name</small>
37+
<small class="sidebar-footer-user">👤 @context.User.Identity?.Name</small>
3738
</Authorized>
3839
</Microsoft.AspNetCore.Components.Authorization.AuthorizeView>
40+
<small class="sidebar-footer-version" title="@_versionFull">v@_versionDisplay</small>
3941
</div>
4042
</nav>
4143

@@ -52,3 +54,14 @@
5254
<a href="." class="reload">Reload</a>
5355
<span class="dismiss">🗙</span>
5456
</div>
57+
58+
@code {
59+
private static readonly string _versionFull =
60+
typeof(MainLayout).Assembly
61+
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion
62+
?? typeof(MainLayout).Assembly.GetName().Version?.ToString()
63+
?? "unknown";
64+
65+
private static readonly string _versionDisplay =
66+
_versionFull.Split('+', 2)[0];
67+
}

src/BitLockerKeyMonitor.Web/wwwroot/app.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ code { background: #f1f3f5; padding: 0.1rem 0.4rem; border-radius: 4px; font-siz
7272
a { color: #3498db; }
7373

7474
/* Sidebar footer */
75-
.sidebar-footer { position: absolute; bottom: 1rem; left: 1rem; right: 1rem; color: #888; font-size: 0.8rem; border-top: 1px solid #333; padding-top: 0.75rem; }
75+
.sidebar-footer { position: absolute; bottom: 1rem; left: 1rem; right: 1rem; color: #888; font-size: 0.8rem; border-top: 1px solid #333; padding-top: 0.75rem; display: flex; flex-direction: column; gap: 0.25rem; }
76+
.sidebar-footer-user { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
77+
.sidebar-footer-version { color: #6c757d; font-size: 0.72rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.02em; }
7678

7779
/* Worker status badge (top bar of every page) + details modal */
7880
.app-topbar {

0 commit comments

Comments
 (0)