1- <div class =" top-row ps-3 navbar navbar-dark" >
1+ @using ColorControl .Shared .Contracts
2+ @using ColorControl .Shared .Services ;
3+
4+ @rendermode InteractiveServer
5+
6+ @inject RpcUiClientService _rpcClientService
7+ @inject AppState AppState
8+ @inject NavigationManager _navigationManager ;
9+
10+ <div class =" top-row ps-3 navbar navbar-dark" >
211 <div class =" container-fluid" >
312 <a class =" navbar-brand" href =" " >ColorControl Web App</a >
413 </div >
918<div class =" nav-scrollable" onclick =" document.querySelector('.navbar-toggler').click()" >
1019 <nav class =" flex-column" >
1120 <div class =" nav-item px-3" >
12- <NavLink class =" nav-link" href =" " Match =" NavLinkMatch.All" >
21+ <NavLink class =" nav-link px-3 " href =" " Match =" NavLinkMatch.All" >
1322 <span class =" bi bi-house-door-fill-nav-menu" aria-hidden =" true" ></span > Home
1423 </NavLink >
1524 </div >
1625
26+ @if (modules != null )
27+ {
28+ @foreach ( var module in modules .Where (m => m .IsActive ))
29+ {
30+ <div class =" nav-item px-3" >
31+ <NavLink class =" nav-link px-3" href =" @module.Link" >
32+ <span class =" bi bi-plus-square-fill-nav-menu" aria-hidden =" true" ></span > @module.DisplayName
33+ </NavLink >
34+ </div >
35+ }
36+ }
37+
1738 <div class =" nav-item px-3" >
18- <NavLink class =" nav-link" href =" counter " >
19- <span class =" bi bi-plus-square-fill-nav-menu" aria-hidden =" true" ></span > Counter
39+ <NavLink class =" nav-link px-3 " href =" options " >
40+ <span class =" bi bi-plus-square-fill-nav-menu" aria-hidden =" true" ></span > Options
2041 </NavLink >
2142 </div >
2243
2344 <div class =" nav-item px-3" >
24- <NavLink class =" nav-link" href =" weather " >
25- <span class =" bi bi-list-nested -nav-menu" aria-hidden =" true" ></span > Weather
45+ <NavLink class =" nav-link px-3 " href =" logging " >
46+ <span class =" bi bi-list-logging -nav-menu" aria-hidden =" true" ></span > Logging
2647 </NavLink >
2748 </div >
2849
2950 <div class =" nav-item px-3" >
30- <NavLink class =" nav-link" href =" options " >
31- <span class =" bi bi-plus-square-fill- nav-menu" aria-hidden =" true" ></span > Options
51+ <NavLink class =" nav-link px-3 " href =" info " >
52+ <span class =" bi bi-list-logging- nav-menu" aria-hidden =" true" ></span > Info
3253 </NavLink >
3354 </div >
34-
3555 </nav >
3656</div >
3757
58+ @code {
59+ private Config ? config ;
60+ private List <ModuleDto >? modules ;
61+
62+ protected override async Task OnInitializedAsync ()
63+ {
64+ config = await _rpcClientService .CallAsync <Config >(" OptionsService" , " GetConfig" );
65+ modules = config ? .Modules ? .Select (m => new ModuleDto { DisplayName = m .DisplayName , IsActive = m .IsActive , Link = m .DisplayName .Split (' ' )[0 ] }).ToList ();
66+ }
67+ }
0 commit comments