diff options
Diffstat (limited to 'BugMine.Web/Pages')
-rw-r--r-- | BugMine.Web/Pages/Projects/Boards/Index.razor | 19 | ||||
-rw-r--r-- | BugMine.Web/Pages/Projects/Issues/NewIssue.razor | 13 | ||||
-rw-r--r-- | BugMine.Web/Pages/Projects/Issues/ViewIssue.razor | 24 | ||||
-rw-r--r-- | BugMine.Web/Pages/Projects/NewProject.razor | 4 | ||||
-rw-r--r-- | BugMine.Web/Pages/Projects/ViewProject.razor | 53 | ||||
-rw-r--r-- | BugMine.Web/Pages/Projects/ViewProject.razor.css | 8 |
6 files changed, 107 insertions, 14 deletions
diff --git a/BugMine.Web/Pages/Projects/Boards/Index.razor b/BugMine.Web/Pages/Projects/Boards/Index.razor new file mode 100644 index 0000000..c1953c8 --- /dev/null +++ b/BugMine.Web/Pages/Projects/Boards/Index.razor @@ -0,0 +1,19 @@ +@page "/Projects/{ProjectSlug}/Boards" +@using BugMine.Web.Components.ScopedContainers +<h3>Boards</h3> +<ProjectContainer ProjectSlug="@ProjectSlug" ProjectContext="@ProjectContext" Loaded="@OnProjectLoaded"> + <p>@ProjectContext.Project.Info.Name</p> +</ProjectContainer> + +@code { + + [Parameter] + public string ProjectSlug { get; set; } + + public ProjectContainer.ProjectContainerContext ProjectContext { get; set; } = new(); + + private async Task OnProjectLoaded() { + + } + +} \ No newline at end of file diff --git a/BugMine.Web/Pages/Projects/Issues/NewIssue.razor b/BugMine.Web/Pages/Projects/Issues/NewIssue.razor index 159e20d..118a00c 100644 --- a/BugMine.Web/Pages/Projects/Issues/NewIssue.razor +++ b/BugMine.Web/Pages/Projects/Issues/NewIssue.razor @@ -1,8 +1,17 @@ @page "/Projects/{ProjectSlug}/Issues/New" +@using ArcaneLibs.Extensions +@using BugMine.Sdk.Events.Timeline +@using BugMine.Web.Components.ScopedContainers <h3>New issue</h3> <ProjectContainer ProjectSlug="@ProjectSlug" ProjectContext="@ProjectContext"> - <h1>Hi from NewIssue!</h1> + <p>Title: <InputText @bind-Value="@IssueData.Name"/></p> + + @if (Constants.Debug) { + <p>Debug info:</p> + <p>Issue data:</p> + <pre>@IssueData.ToJson()</pre> + } </ProjectContainer> @code { @@ -11,5 +20,7 @@ public string ProjectSlug { get; set; } = null!; public ProjectContainer.ProjectContainerContext? ProjectContext { get; set; } = new(); + + public BugMineIssueData IssueData { get; set; } = new(); } \ No newline at end of file diff --git a/BugMine.Web/Pages/Projects/Issues/ViewIssue.razor b/BugMine.Web/Pages/Projects/Issues/ViewIssue.razor new file mode 100644 index 0000000..e33f74d --- /dev/null +++ b/BugMine.Web/Pages/Projects/Issues/ViewIssue.razor @@ -0,0 +1,24 @@ +@page "/Projects/{ProjectSlug}/Issues/{IssueId}" +@using ArcaneLibs.Extensions +@using BugMine.Sdk.Events.Timeline +@using BugMine.Web.Components.ScopedContainers +<h3>New issue</h3> + +<ProjectContainer ProjectSlug="@ProjectSlug" ProjectContext="@ProjectContext"> + <IssueContainer IssueId="@IssueId" IssueContext="@IssueContext"> + <p>meow</p> + </IssueContainer> +</ProjectContainer> + +@code { + + [Parameter] + public string ProjectSlug { get; set; } = null!; + + [Parameter] + public string IssueId { get; set; } = null!; + + public ProjectContainer.ProjectContainerContext? ProjectContext { get; set; } = new(); + public IssueContainer.IssueContainerContext? IssueContext { get; set; } = new(); + +} \ No newline at end of file diff --git a/BugMine.Web/Pages/Projects/NewProject.razor b/BugMine.Web/Pages/Projects/NewProject.razor index f8c7dfd..2a7c7da 100644 --- a/BugMine.Web/Pages/Projects/NewProject.razor +++ b/BugMine.Web/Pages/Projects/NewProject.razor @@ -1,6 +1,8 @@ @page "/Projects/New" @using ArcaneLibs.Extensions +@using BugMine.Sdk.Events.State @using LibMatrix +@inject ILogger<NewProject> Logger <h3>New project</h3> <span>Project name: </span> @@ -62,7 +64,7 @@ else { } catch (MatrixException e) { - + Logger.LogError(e, "Failed to create project"); } } diff --git a/BugMine.Web/Pages/Projects/ViewProject.razor b/BugMine.Web/Pages/Projects/ViewProject.razor index 91cc4d0..c1a2aa1 100644 --- a/BugMine.Web/Pages/Projects/ViewProject.razor +++ b/BugMine.Web/Pages/Projects/ViewProject.razor @@ -1,28 +1,36 @@ @page "/Projects/{ProjectSlug}/" -@using LibMatrix -@using BugMine.Web.Classes.Exceptions +@using System.Collections.Frozen +@using System.Reflection @using ArcaneLibs.Extensions +@using BugMine.Sdk.Events.Timeline +@using BugMine.Web.Pages.Projects.Issues +@using BugMine.Web.Components.ScopedContainers +@using LibMatrix <ProgressLog ></ProgressLog> <ProjectContainer ProjectSlug="@ProjectSlug" ProjectContext="@ProjectContext" Loaded="@OnProjectLoaded"> - <h1>Hi from ViewProject!</h1> - <h1>@ProjectContext!.Project!.Info.Name</h1> - - @if (Progress == "loading-issues") { + <h3>@ProjectContext!.Project!.Info.Name</h3> + <p>@Followers.Count followers - @Issues?.Count issues</p> + <LinkButton href="@(typeof(NewIssue).GetCustomAttributes<RouteAttribute>().First().Template.Replace("{ProjectSlug}", ProjectSlug))">New issue</LinkButton> + @if (Progress == Status.Loading) { <p>Loading issues, got @(Issues?.Count ?? 0) so far... <SimpleSpinner/></p> } @* <p>@Project.Description</p> *@ @if (Issues != null) { @foreach (var issue in Issues) { - <pre>@issue.Data.RawContent.ToJson()</pre> + var issueData = issue.Data.TypedContent as BugMineIssueData; + <div class="issue-card" @onclick="@(() => { NavigationManager.NavigateTo(GetIssueUrl(issue)); })"> + <div style="width: 1em; height: 1em; background-color: #00FF00; display: inline-block;"></div> @* Color based on tags... *@ + <p>@issueData.Name</p> + </div> } } </ProjectContainer> @code { - private string? _progress = "loading"; + private Status? _progress = Status.Loading; public ProjectContainer.ProjectContainerContext? ProjectContext { get; set; } = new(); @@ -30,8 +38,9 @@ public string ProjectSlug { get; set; } = null!; private List<BugMineIssue>? Issues { get; set; } + private FrozenSet<StateEventResponse> Followers { get; set; } = FrozenSet<StateEventResponse>.Empty; - private string? Progress { + private Status? Progress { get => _progress; set { _progress = value; @@ -40,14 +49,34 @@ } protected async Task OnProjectLoaded() { - Progress = "loading-issues"; - await foreach (var issue in ProjectContext.Project.GetIssues()) { + Progress = Status.Loading; + ProjectContext!.Project!.Room.GetMembersListAsync().ContinueWith(x => { + Followers = x.Result; + StateHasChanged(); + }); + await foreach (var issue in ProjectContext.Project.GetIssues(chunkLimit: 1000)) { Issues ??= new List<BugMineIssue>(); Issues.Add(issue); - StateHasChanged(); + // StateHasChanged(); + if (Issues.Count % 1000 == 0) { + StateHasChanged(); + Console.WriteLine($"Got issue {Issues.Count} {issue.Data.RawContent.ToJson()}"); + } } + Progress = Status.Done; + StateHasChanged(); } + private enum Status { + Loading, + Done + } + + private string GetIssueUrl(BugMineIssue issue) => + typeof(ViewIssue).GetCustomAttributes<RouteAttribute>().First().Template + .Replace("{ProjectSlug}", ProjectSlug) + .Replace("{IssueId}", issue.Data.EventId); + } \ No newline at end of file diff --git a/BugMine.Web/Pages/Projects/ViewProject.razor.css b/BugMine.Web/Pages/Projects/ViewProject.razor.css new file mode 100644 index 0000000..6f67e52 --- /dev/null +++ b/BugMine.Web/Pages/Projects/ViewProject.razor.css @@ -0,0 +1,8 @@ +.issue-card { + display: flex; + padding: 1rem; + border-radius: 0.5rem; + background-color: var(--bs-dark); + box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.5); + transition: background-color 1s, box-shadow 3s; +} \ No newline at end of file |