about summary refs log tree commit diff
path: root/BugMine.Web/Pages/Projects/NewProject.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/NewProject.razor
parentStart adding pages (diff)
downloadBugMine-68fe1a2284045908d92ef06c1c26cd937ded784e.tar.xz
Add basic project management
Diffstat (limited to 'BugMine.Web/Pages/Projects/NewProject.razor')
-rw-r--r--BugMine.Web/Pages/Projects/NewProject.razor36
1 files changed, 29 insertions, 7 deletions
diff --git a/BugMine.Web/Pages/Projects/NewProject.razor b/BugMine.Web/Pages/Projects/NewProject.razor
index 529813e..00b7b21 100644
--- a/BugMine.Web/Pages/Projects/NewProject.razor
+++ b/BugMine.Web/Pages/Projects/NewProject.razor
@@ -1,25 +1,47 @@
 @page "/Projects/New"
-@using LibMatrix.Responses
-@using BugMine.Web.Classes
 @using ArcaneLibs.Extensions
 <h3>New project</h3>
 
 <span>Project name: </span>
-<FancyTextBox bind-Value="@request.Name"></FancyTextBox>
+<FancyTextBox @bind-Value="@_request.Name"></FancyTextBox>
 <br/>
-<span>Shortname: </span>
-<FancyTextBox bind-Value="@request.RoomAliasName"></FancyTextBox>
+<span>Project repository: </span>
+<FancyTextBox @bind-Value="@_request.Repository"></FancyTextBox>
 <br/>
+@* <span>Room alias: </span> *@
+@* <FancyTextBox @bind-Value="@_request."></FancyTextBox> *@
+@* <br/> *@
 
 @if (Constants.Debug) {
     <span>Debug: </span>
     <pre>
-        @request.ToJson()
+        @_request.ToJson()
     </pre>
     <br/>
 }
 
+<LinkButton OnClick="@CreateProject">Create project</LinkButton>
+
 @code {
-    private CreateRoomRequest request = new CreateRoomRequest();
+
+    private BugMineClient? Client { get; set; }
+
+    private readonly ProjectInfo _request = new();
+
+    protected override async Task OnInitializedAsync() {
+        Client = await BugMineStorage.GetCurrentSessionOrNavigate();
+        if (Client == null) {
+            return;
+        }
+    }
+
+    private async Task CreateProject() {
+        if (Client == null) {
+            return;
+        }
+
+        var proj = await Client.CreateProject(_request);
+        NavigationManager.NavigateTo($"/Projects/{proj.ProjectSlug}/");
+    }
 
 }
\ No newline at end of file