package components import ( "fmt" "github.com/LazyBachelor/LazyPM/internal/models" ) type IssueDetailProps struct { Issue *models.Issue From string // "board" when navigating from board view; passed via hx-vals to child requests } templ IssueDetail(props IssueDetailProps) {

{ props.Issue.Title }

@StatusBadge(props.Issue.Status) @TypeBadge(props.Issue.IssueType) @PriorityBadge(props.Issue.Priority)
if props.Issue.Description != "" {

Description

{ props.Issue.Description }

}

Dependencies

Created

{ props.Issue.CreatedAt.Format("Jan 2, 2006") }

Updated

{ props.Issue.UpdatedAt.Format("Jan 2, 2006") }

Created by

{ props.Issue.CreatedBy }

if props.Issue.Assignee == "" { Unassigned (click to assign) } else { Assignee: { props.Issue.Assignee } }
} templ StatusBadge(status models.Status) { switch status { case "open": Open case "in_progress": In Progress case "closed": Closed case "blocked": Blocked case "deferred": Deferred default: { string(status) } } } templ TypeBadge(issueType models.IssueType) { switch issueType { case "bug": Bug case "feature": Feature case "task": Task case "chore": Chore case "epic": Epic default: { string(issueType) } } } templ PriorityBadge(priority int) { switch priority { case 0: Irrelevant case 1: Low case 2: Normal case 3: High case 4: Critical default: { fmt.Sprintf("P%d", priority) } } } templ StatusBadgeExpr(statusExpr string, fallbackStatus string) { ' + ((%s || %q).replace(/_/g, " ").replace(/\\b\\w/g, l => l.toUpperCase())) + ''`, statusExpr, fallbackStatus, statusExpr, fallbackStatus) }> } templ TypeBadgeExpr(typeExpr string, fallbackType string) { ' + ((%s || %q).charAt(0).toUpperCase() + (%s || %q).slice(1)) + ''`, typeExpr, fallbackType, typeExpr, fallbackType, typeExpr, fallbackType) }> } templ PriorityBadgeExpr(priorityExpr string, fallbackPriority int) { ' + (() => { const p = parseInt(%s || %d); switch(p) { case 0: return "Irrelevant"; case 1: return "Low"; case 2: return "Normal"; case 3: return "High"; case 4: return "Critical"; default: return "P" + p; } })() + ''`, priorityExpr, fallbackPriority, priorityExpr, fallbackPriority) }> }