diff --git a/src/app/components/dashboard/dashboard.ts b/src/app/components/dashboard/dashboard.ts
index 453e81f..ccd9b38 100644
--- a/src/app/components/dashboard/dashboard.ts
+++ b/src/app/components/dashboard/dashboard.ts
@@ -25,6 +25,41 @@ export class Dashboard implements OnInit {
});
}
+ editWorkspace(workspace: Workspace) {
+ const updatedName = window.prompt('Edit workspace name', workspace.name)?.trim();
+ if (!updatedName) {
+ return;
+ }
+
+ const updatedDescriptionInput = window.prompt('Edit workspace description', workspace.description ?? '');
+ if (updatedDescriptionInput === null) {
+ return;
+ }
+
+ const updatedDescription = updatedDescriptionInput.trim();
+
+ this.workspaceService.updateWorkspace(workspace.id, updatedName, updatedDescription).subscribe(updatedWorkspace => {
+ if (!updatedWorkspace) {
+ return;
+ }
+ this.workspaces = this.workspaces.map(ws => ws.id === updatedWorkspace.id ? updatedWorkspace : ws);
+ });
+ }
+
+ deleteWorkspace(workspace: Workspace) {
+ const confirmed = window.confirm(`Delete workspace "${workspace.name}"?`);
+ if (!confirmed) {
+ return;
+ }
+
+ this.workspaceService.deleteWorkspace(workspace.id).subscribe(deleted => {
+ if (!deleted) {
+ return;
+ }
+ this.workspaces = this.workspaces.filter(ws => ws.id !== workspace.id);
+ });
+ }
+
logout() {
this.authService.logout();
this.router.navigate(['/login']);
diff --git a/src/app/components/decision-form/decision-form.component.ts b/src/app/components/decision-form/decision-form.component.ts
index 70adcba..c48d6a2 100644
--- a/src/app/components/decision-form/decision-form.component.ts
+++ b/src/app/components/decision-form/decision-form.component.ts
@@ -17,6 +17,7 @@ export class DecisionFormComponent implements OnInit {
isEditMode = false;
decisionId: string | null = null;
isLoading = false;
+ workspaceId: string | null = null;
constructor(
private fb: FormBuilder,
@@ -32,13 +33,7 @@ export class DecisionFormComponent implements OnInit {
}
ngOnInit(): void {
- // Get workspaceId from parent
- this.route.parent?.paramMap.subscribe(params => {
- const workspaceId = params.get('id');
- if (workspaceId) {
- this.decisionForm.patchValue({ workspaceId });
- }
- });
+ this.workspaceId = this.getWorkspaceIdFromRoute();
// Get decisionId from current route
this.route.paramMap.subscribe(params => {
@@ -78,11 +73,23 @@ export class DecisionFormComponent implements OnInit {
this.router.navigate(['../../'], { relativeTo: this.route });
});
} else {
- // Include workspaceId from parent route if available
- const workspaceId = this.route.parent?.snapshot.paramMap.get('id');
- this.decisionService.createDecision({ ...formValue, workspaceId }).subscribe(() => {
+ if (!this.workspaceId) {
+ return;
+ }
+
+ this.decisionService.createDecision({ ...formValue, workspaceId: this.workspaceId }).subscribe(() => {
this.router.navigate(['../'], { relativeTo: this.route });
});
}
}
+
+ private getWorkspaceIdFromRoute(): string | null {
+ for (const route of this.route.pathFromRoot) {
+ const id = route.snapshot.paramMap.get('id');
+ if (id) {
+ return id;
+ }
+ }
+ return null;
+ }
}
diff --git a/src/app/components/decision-list/decision-list.component.ts b/src/app/components/decision-list/decision-list.component.ts
index 17b4681..13f6809 100644
--- a/src/app/components/decision-list/decision-list.component.ts
+++ b/src/app/components/decision-list/decision-list.component.ts
@@ -21,13 +21,10 @@ export class DecisionListComponent implements OnInit {
) { }
ngOnInit(): void {
- // Get workspaceId from the parent route (workspaces/:id)
- this.route.parent?.paramMap.subscribe(params => {
- const workspaceId = params.get('id');
- if (workspaceId) {
- this.decisions$ = this.decisionService.getDecisions(workspaceId);
- }
- });
+ const workspaceId = this.getWorkspaceIdFromRoute();
+ if (workspaceId) {
+ this.decisions$ = this.decisionService.getDecisions(workspaceId);
+ }
}
deleteDecision(id: string): void {
@@ -35,4 +32,14 @@ export class DecisionListComponent implements OnInit {
this.decisionService.deleteDecision(id);
}
}
+
+ private getWorkspaceIdFromRoute(): string | null {
+ for (const route of this.route.pathFromRoot) {
+ const id = route.snapshot.paramMap.get('id');
+ if (id) {
+ return id;
+ }
+ }
+ return null;
+ }
}
diff --git a/src/app/components/workspace/create-workspace.css b/src/app/components/workspace/create-workspace.css
index e8cdb50..4de2a73 100644
--- a/src/app/components/workspace/create-workspace.css
+++ b/src/app/components/workspace/create-workspace.css
@@ -28,10 +28,13 @@ label {
font-weight: 600;
}
-input {
+input,
+textarea {
padding: 10px 12px;
border: 1px solid #d0d7de;
border-radius: 6px;
+ font: inherit;
+ resize: vertical;
}
.actions {
diff --git a/src/app/components/workspace/create-workspace.html b/src/app/components/workspace/create-workspace.html
index a02bd2e..b7725db 100644
--- a/src/app/components/workspace/create-workspace.html
+++ b/src/app/components/workspace/create-workspace.html
@@ -14,6 +14,16 @@ Create Workspace
placeholder="e.g. Product Team"
/>
+
+
+