diff --git a/src/app/issues/issue-detail/issue-detail.css b/src/app/issues/issue-detail/issue-detail.css
index d28d426..ea570c7 100644
--- a/src/app/issues/issue-detail/issue-detail.css
+++ b/src/app/issues/issue-detail/issue-detail.css
@@ -180,3 +180,4 @@
.markdown-body > *:last-child {
margin-bottom: 0;
}
+
diff --git a/src/app/issues/issue-detail/issue-detail.html b/src/app/issues/issue-detail/issue-detail.html
index b10ecc7..674ea4f 100644
--- a/src/app/issues/issue-detail/issue-detail.html
+++ b/src/app/issues/issue-detail/issue-detail.html
@@ -247,6 +247,11 @@
}
+
+@if (!isNewIssueRoute) {
+
+}
+
@if (isNewIssueRoute) {
diff --git a/src/app/issues/issue-detail/issue-detail.ts b/src/app/issues/issue-detail/issue-detail.ts
index 2810d30..b4dded0 100644
--- a/src/app/issues/issue-detail/issue-detail.ts
+++ b/src/app/issues/issue-detail/issue-detail.ts
@@ -5,10 +5,11 @@ import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
import { ActivatedRoute, Router } from '@angular/router';
import { marked } from 'marked';
import { IssueEntity, IssuesStore } from '../issues.store';
+import { IssueComments } from '../issue-comments/issue-comments';
@Component({
selector: 'app-issue-detail',
- imports: [FormsModule],
+ imports: [FormsModule, IssueComments],
templateUrl: './issue-detail.html',
styleUrl: './issue-detail.css',
})
@@ -16,7 +17,7 @@ export class IssueDetail {
private readonly route = inject(ActivatedRoute);
private readonly router = inject(Router);
private readonly issuesStore = inject(IssuesStore);
- private readonly sanitizer = inject(DomSanitizer);
+ protected readonly sanitizer = inject(DomSanitizer);
protected readonly isNewIssueRoute = this.route.snapshot.routeConfig?.path === 'issues/new';
protected issue: IssueEntity = this.buildIssue();
@@ -158,6 +159,7 @@ export class IssueDetail {
description: '',
estimatedTime: null,
dependsOnIds: [],
+ comments: [],
priority: 'Moyenne',
status: 'draft',
progress: 0,
@@ -196,6 +198,7 @@ export class IssueDetail {
return this.sanitizer.bypassSecurityTrustHtml(html);
}
+
protected get typeBadgeClass(): string {
return this.getBadgeClass(this.issueTypeValue);
}
@@ -266,40 +269,24 @@ export class IssueDetail {
const resolvedId = Number(idParam ?? draftId ?? 0);
const safeId = Number.isNaN(resolvedId) ? 0 : resolvedId;
- if (isNewIssueRoute) {
- return {
- id: safeId,
- type: 'Story',
- assignee: '',
- epic: '',
- name: '',
- dueDate: '',
- description: '',
- estimatedTime: null,
- dependsOnIds: [],
- priority: 'Moyenne',
- status: 'draft',
- progress: 0,
- };
- }
+ const blank: IssueEntity = {
+ id: safeId,
+ type: 'Story',
+ assignee: '',
+ epic: '',
+ name: '',
+ dueDate: '',
+ description: '',
+ estimatedTime: null,
+ dependsOnIds: [],
+ comments: [],
+ priority: 'Moyenne',
+ status: 'draft',
+ progress: 0,
+ };
- const existingIssue = this.issuesStore.getById(safeId);
+ if (isNewIssueRoute) return blank;
- return (
- existingIssue ?? {
- id: safeId,
- type: 'Story',
- assignee: '',
- epic: '',
- name: '',
- dueDate: '',
- description: '',
- estimatedTime: null,
- dependsOnIds: [],
- priority: 'Moyenne',
- status: 'draft',
- progress: 0,
- }
- );
+ return this.issuesStore.getById(safeId) ?? blank;
}
}
diff --git a/src/app/issues/issues.store.ts b/src/app/issues/issues.store.ts
index 05d4ead..908c3df 100644
--- a/src/app/issues/issues.store.ts
+++ b/src/app/issues/issues.store.ts
@@ -6,6 +6,13 @@ export type IssueStatus = 'draft' | 'todo' | 'done' | 'in-progress';
export type IssuePriority = 'Basse' | 'Moyenne' | 'Haute';
export type IssueType = 'Epic' | 'Bug' | 'Study' | 'Story' | 'Task' | 'Technical Story';
+export type IssueComment = {
+ id: number;
+ text: string;
+ createdAt: string;
+ updatedAt: string | null;
+};
+
export type IssueEntity = {
id: number;
type: IssueType;
@@ -16,6 +23,7 @@ export type IssueEntity = {
description: string;
estimatedTime: number | null;
dependsOnIds: number[];
+ comments: IssueComment[];
priority: IssuePriority;
status: IssueStatus;
progress: number;
@@ -32,6 +40,7 @@ const DEFAULT_ISSUES: IssueEntity[] = [
description: 'Corriger le comportement du menu sur petits ecrans.',
estimatedTime: 8,
dependsOnIds: [],
+ comments: [],
priority: 'Haute',
status: 'in-progress',
progress: 35,
@@ -46,6 +55,7 @@ const DEFAULT_ISSUES: IssueEntity[] = [
description: 'Fiabiliser les regles de validation du formulaire projet.',
estimatedTime: 16,
dependsOnIds: [],
+ comments: [],
priority: 'Moyenne',
status: 'todo',
progress: 20,
@@ -60,6 +70,7 @@ const DEFAULT_ISSUES: IssueEntity[] = [
description: 'Mettre a jour le wording d accueil selon la charte produit.',
estimatedTime: 4,
dependsOnIds: [],
+ comments: [],
priority: 'Basse',
status: 'done',
progress: 100,
@@ -135,6 +146,7 @@ export class IssuesStore {
type: issue.type ?? 'Story',
estimatedTime: issue.estimatedTime ?? null,
dependsOnIds: normalizedDependencies,
+ comments: Array.isArray(issue.comments) ? issue.comments : [],
} as IssueEntity;
}