Added issues dashboard
This commit is contained in:
103
pkg/web/components/issue_detail_card.templ
Normal file
103
pkg/web/components/issue_detail_card.templ
Normal file
@@ -0,0 +1,103 @@
|
||||
package components
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/LazyBachelor/LazyPM/internal/models"
|
||||
)
|
||||
|
||||
type IssueDetailCardProps struct {
|
||||
Issue models.Issue
|
||||
DisplayOwner string
|
||||
DisplayAssignee string
|
||||
}
|
||||
|
||||
templ IssueDetailCard(props IssueDetailCardProps) {
|
||||
<div class="card bg-base-100 shadow-sm">
|
||||
<div class="card-body p-4">
|
||||
<span class="badge badge-ghost badge-sm font-mono">{ props.Issue.ID }</span>
|
||||
<h2 class="text-lg font-bold mt-2">{ props.Issue.Title }</h2>
|
||||
<div class="flex gap-2 flex-wrap">
|
||||
@StatusBadge(props.Issue.Status)
|
||||
@TypeBadge(props.Issue.IssueType)
|
||||
@PriorityBadge(props.Issue.Priority)
|
||||
</div>
|
||||
if props.Issue.Description != "" {
|
||||
<div class="mt-4">
|
||||
<h3 class="text-sm font-semibold opacity-70 mb-1">Description</h3>
|
||||
<p class="whitespace-pre-wrap text-sm">{ props.Issue.Description }</p>
|
||||
</div>
|
||||
}
|
||||
<div class="divider my-2"></div>
|
||||
<div class="grid grid-cols-2 gap-2 text-sm">
|
||||
<div class="bg-base-200 rounded-lg p-2">
|
||||
<span class="text-xs opacity-70 block">Created</span>
|
||||
<p>{ props.Issue.CreatedAt.Format("Jan 2, 2006") }</p>
|
||||
</div>
|
||||
<div class="bg-base-200 rounded-lg p-2">
|
||||
<span class="text-xs opacity-70 block">Updated</span>
|
||||
<p>{ props.Issue.UpdatedAt.Format("Jan 2, 2006") }</p>
|
||||
</div>
|
||||
<div class="bg-base-200 rounded-lg p-2">
|
||||
<span class="text-xs opacity-70 block">Created by</span>
|
||||
<p>{ props.DisplayOwner }</p>
|
||||
</div>
|
||||
<div class="bg-base-200 rounded-lg p-2">
|
||||
<span class="text-xs opacity-70 block">Assignee</span>
|
||||
<p>{ props.DisplayAssignee }</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
templ StatusBadge(status models.Status) {
|
||||
switch status {
|
||||
case "open":
|
||||
<span class="badge badge-info badge-sm">Open</span>
|
||||
case "in_progress":
|
||||
<span class="badge badge-warning badge-sm">In Progress</span>
|
||||
case "closed":
|
||||
<span class="badge badge-success badge-sm">Closed</span>
|
||||
case "blocked":
|
||||
<span class="badge badge-error badge-sm">Blocked</span>
|
||||
case "deferred":
|
||||
<span class="badge badge-ghost badge-sm">Deferred</span>
|
||||
default:
|
||||
<span class="badge badge-ghost badge-sm">{ string(status) }</span>
|
||||
}
|
||||
}
|
||||
|
||||
templ TypeBadge(issueType models.IssueType) {
|
||||
switch issueType {
|
||||
case "bug":
|
||||
<span class="badge badge-outline badge-error badge-sm">Bug</span>
|
||||
case "feature":
|
||||
<span class="badge badge-outline badge-success badge-sm">Feature</span>
|
||||
case "task":
|
||||
<span class="badge badge-outline badge-info badge-sm">Task</span>
|
||||
case "chore":
|
||||
<span class="badge badge-outline badge-warning badge-sm">Chore</span>
|
||||
case "epic":
|
||||
<span class="badge badge-outline badge-secondary badge-sm">Epic</span>
|
||||
default:
|
||||
<span class="badge badge-outline badge-sm">{ string(issueType) }</span>
|
||||
}
|
||||
}
|
||||
|
||||
templ PriorityBadge(priority int) {
|
||||
switch priority {
|
||||
case 0:
|
||||
<span class="badge badge-error badge-sm">Critical</span>
|
||||
case 1:
|
||||
<span class="badge badge-warning badge-sm">High</span>
|
||||
case 2:
|
||||
<span class="badge badge-info badge-sm">Medium</span>
|
||||
case 3:
|
||||
<span class="badge badge-ghost badge-sm">Low</span>
|
||||
case 4:
|
||||
<span class="badge badge-outline badge-sm">Minimal</span>
|
||||
default:
|
||||
<span class="badge badge-ghost badge-sm">{ fmt.Sprintf("P%d", priority) }</span>
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user