package routes
import (
"github.com/LazyBachelor/LazyPM/internal/models"
"github.com/LazyBachelor/LazyPM/pkg/web/components"
)
type IssueDetailProps struct {
Issue *models.Issue
Comments []*models.Comment
From string // "board" when navigating from board view
}
type IssueDetailModalProps struct {
Issue *models.Issue
Comments []*models.Comment
From string
}
templ IssueDetailContent(props IssueDetailProps) {
{{
backURL := "/"
editURL := "/issues/" + props.Issue.ID + "/edit"
if props.From == "board" {
backURL = "/?board=true"
editURL += "?from=board"
}
}}
@components.IssueDetail(components.IssueDetailProps{Issue: props.Issue, From: props.From})
@components.CommentSection(components.CommentSectionProps{
IssueID: props.Issue.ID,
Comments: props.Comments,
})
}
templ IssueDetail(props IssueDetailProps) {
@BaseLayout() {
@IssueDetailContent(props)
}
}
templ IssueDetailModalContent(props IssueDetailModalProps) {
@components.IssueDetail(components.IssueDetailProps{Issue: props.Issue, From: props.From})
@components.CommentSection(components.CommentSectionProps{
IssueID: props.Issue.ID,
Comments: props.Comments,
})
}