about summary refs log tree commit diff
path: root/BugMine.Web/Pages/Projects/Index.razor
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2024-04-20 23:48:43 +0200
committerRory& <root@rory.gay>2024-04-20 23:48:43 +0200
commit68fe1a2284045908d92ef06c1c26cd937ded784e (patch)
tree71144f404f060888dcc5e4036e038abe857adc4e /BugMine.Web/Pages/Projects/Index.razor
parentStart adding pages (diff)
downloadBugMine-68fe1a2284045908d92ef06c1c26cd937ded784e.tar.xz
Add basic project management
Diffstat (limited to 'BugMine.Web/Pages/Projects/Index.razor')
-rw-r--r--BugMine.Web/Pages/Projects/Index.razor44
1 files changed, 37 insertions, 7 deletions
diff --git a/BugMine.Web/Pages/Projects/Index.razor b/BugMine.Web/Pages/Projects/Index.razor

index a24747c..eaf8dc1 100644 --- a/BugMine.Web/Pages/Projects/Index.razor +++ b/BugMine.Web/Pages/Projects/Index.razor
@@ -1,22 +1,52 @@ @page "/Projects" +@using LibMatrix.Homeservers <h3>Projects</h3> -@if (true) { +@if (Projects.Count == 0) { <p>There are no projects to display.</p> } +else { + <div class="projects"> + @foreach (var project in Projects) { + <div class="card project-card" @onclick="@(()=>Navigate(project))"> + @if (string.IsNullOrWhiteSpace(project.Info.ProjectIcon)) { + <img class="project-icon" src="/icon-512.png"> + } + else { + <img class="project-icon" src="/icon-512.png"> + } + <span class="project-name">@project.Info.Name</span> + </div> + @* <p>@project.Info.Name</p> *@ + } + </div> +} <p>Did not find the project board you are looking for?</p> <LinkButton href="/Projects/New">Create new board</LinkButton> @code { - private List<Project> projects = new List<Project>(); - - + private BugMineClient? Client { get; set; } + private List<BugMineProject> Projects { get; set; } = []; + private CancellationTokenSource? _cts = new(); protected override async Task OnInitializedAsync() { - + Client = await BugMineStorage.GetCurrentSessionOrNavigate(); + if (Client == null) { + return; + } + + await foreach (var project in Client.GetProjects()) { + Projects.Add(project); + StateHasChanged(); + // await Task.Delay(100); + } } - - private class Project { } + + private async Task Navigate(BugMineProject project) { + Console.WriteLine($"Navigating to {project.ProjectSlug}"); + NavigationManager.NavigateTo($"/Projects/{project.ProjectSlug}/"); + } + } \ No newline at end of file