Skip to content

Commit 147bed6

Browse files
committed
Add Home module with dashboard navigation
Introduces a new 'Home' module that serves as a central dashboard, providing dynamic navigation tiles for other program modules. Tiles include custom descriptions for key modules and are styled for an improved user experience. Also includes a VS Code launch configuration for simplified local server development.
1 parent f8d40cb commit 147bed6

4 files changed

Lines changed: 115 additions & 0 deletions

File tree

.claude/launch.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"version": "0.0.1",
3+
"configurations": [
4+
{
5+
"name": "server",
6+
"runtimeExecutable": "dotnet",
7+
"runtimeArgs": ["run", "--project", "Server/OpenEug.TenTrees.Server.csproj", "--launch-profile", "http", "--urls", "http://localhost:5000;http://localhost:5001"],
8+
"port": 5000
9+
}
10+
]
11+
}

Client/Modules/Home/Index.razor

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
@page "/Home"
2+
3+
@namespace OpenEug.TenTrees.Module.Home
4+
@inherits ModuleBase
5+
6+
@if (_tiles.Any())
7+
{
8+
<div class="row row-cols-1 row-cols-sm-2 row-cols-lg-3 g-3 py-2">
9+
@foreach (var tile in _tiles)
10+
{
11+
<div class="col">
12+
<a href="@NavigateUrl(tile.Path)" class="card h-100 text-decoration-none text-reset home-tile">
13+
<div class="card-body">
14+
<h5 class="card-title">
15+
@if (!string.IsNullOrEmpty(tile.Icon))
16+
{
17+
<span class="@tile.Icon me-2" aria-hidden="true"></span>
18+
}
19+
@tile.Name
20+
</h5>
21+
@if (!string.IsNullOrEmpty(tile.Description))
22+
{
23+
<p class="card-text text-muted mb-0">@tile.Description</p>
24+
}
25+
</div>
26+
</a>
27+
</div>
28+
}
29+
</div>
30+
}
31+
else
32+
{
33+
<p role="status"><em>Loading...</em></p>
34+
}
35+
36+
@code {
37+
private List<Tile> _tiles = new();
38+
39+
private class Tile
40+
{
41+
public string Name { get; set; }
42+
public string Description { get; set; }
43+
public string Path { get; set; }
44+
public string Icon { get; set; }
45+
}
46+
47+
// brief descriptions sourced from each module's ModuleInfo.cs - Page has no description field of its own
48+
private static readonly Dictionary<string, string> _descriptions = new(StringComparer.OrdinalIgnoreCase)
49+
{
50+
["Grower"] = "Grower management for 10 Trees program - track active status and program exits",
51+
["Assessment"] = "Garden Assessment and Tree Monitoring",
52+
["Cohort"] = "Cohort Management",
53+
["Training"] = "Permaculture training class management and attendance tracking for tree eligibility",
54+
["Classes"] = "Permaculture training class management and attendance tracking for tree eligibility",
55+
["Village"] = "Village Management",
56+
["TreeType"] = "Tree Type Management",
57+
["Mentor"] = "Mentor user management - create, edit, activate/deactivate mentors and assign growers",
58+
["Enrollment"] = "Grower Enrollment Submission",
59+
};
60+
61+
protected override void OnParametersSet()
62+
{
63+
_tiles = PageState.Pages
64+
.Where(p => p.IsNavigation && p.ParentId == null && p.PageId != PageState.Page.PageId)
65+
.OrderBy(p => p.Order)
66+
.Select(p => new Tile
67+
{
68+
Name = p.Name,
69+
Path = p.Path,
70+
Icon = p.Icon,
71+
Description = _descriptions.TryGetValue(p.Name, out var description) ? description : string.Empty
72+
})
73+
.ToList();
74+
}
75+
}

Client/Modules/Home/ModuleInfo.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using Oqtane.Models;
2+
using Oqtane.Modules;
3+
4+
namespace OpenEug.TenTrees.Module.Home
5+
{
6+
public class ModuleInfo : IModule
7+
{
8+
public ModuleDefinition ModuleDefinition => new ModuleDefinition
9+
{
10+
Name = "Home",
11+
Description = "Home page dashboard with navigation tiles for each program module",
12+
Version = "1.0.0",
13+
ServerManagerType = "",
14+
ReleaseVersions = "1.0.0",
15+
Dependencies = "",
16+
PackageName = "OpenEug.TenTrees.Module.Home"
17+
};
18+
}
19+
}

Server/wwwroot/Themes/OpenEug.TenTrees.Theme.TenTreesTheme/Theme.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,16 @@ div.app-moduleactions a.dropdown-toggle, div.app-moduleactions div.dropdown-menu
9090
mix-blend-mode: difference;
9191
}
9292

93+
.home-tile {
94+
transition: box-shadow 0.15s ease-in-out, transform 0.15s ease-in-out;
95+
}
96+
97+
.home-tile:hover,
98+
.home-tile:focus {
99+
box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
100+
transform: translateY(-2px);
101+
}
102+
93103
@media (max-width: 767.98px) {
94104

95105
.app-menu {

0 commit comments

Comments
 (0)