remove indes and just use dashboard
This commit is contained in:
@@ -1,38 +0,0 @@
|
|||||||
package handler
|
|
||||||
|
|
||||||
import (
|
|
||||||
"net/http"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/LazyBachelor/LazyPM/internal/models"
|
|
||||||
"github.com/LazyBachelor/LazyPM/pkg/web/components"
|
|
||||||
"github.com/LazyBachelor/LazyPM/pkg/web/routes"
|
|
||||||
)
|
|
||||||
|
|
||||||
func IndexHandler(w http.ResponseWriter, r *http.Request) {
|
|
||||||
app := App(r)
|
|
||||||
hx := HTMX(r)
|
|
||||||
|
|
||||||
query := strings.TrimSpace(r.URL.Query().Get("q"))
|
|
||||||
filter := models.IssueFilter{Limit: 100}
|
|
||||||
issuesPtr, err := app.Issues.SearchIssues(r.Context(), query, filter)
|
|
||||||
if err != nil {
|
|
||||||
http.Error(w, "failed to retrieve issues", http.StatusInternalServerError)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
issues := models.IssuesPtrToIssues(issuesPtr)
|
|
||||||
|
|
||||||
props := routes.IndexProps{
|
|
||||||
IssueTable: components.IssueTableProps{
|
|
||||||
Issues: issues,
|
|
||||||
},
|
|
||||||
SearchQuery: query,
|
|
||||||
}
|
|
||||||
|
|
||||||
if hx.IsHxRequest() {
|
|
||||||
routes.IndexContent(props).Render(r.Context(), w)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
routes.Index(props).Render(r.Context(), w)
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
package routes
|
|
||||||
|
|
||||||
import "github.com/LazyBachelor/LazyPM/pkg/web/components"
|
|
||||||
|
|
||||||
type IndexProps struct {
|
|
||||||
IssueTable components.IssueTableProps
|
|
||||||
SearchQuery string
|
|
||||||
}
|
|
||||||
|
|
||||||
templ IndexContent(props IndexProps) {
|
|
||||||
<div class="flex flex-col justify-center items-center gap-6 m-5">
|
|
||||||
<h1 class="text-2xl text-primary">Create New Issue</h1>
|
|
||||||
@components.IssueForm(
|
|
||||||
components.IssueFormProps{
|
|
||||||
Action: "/issues",
|
|
||||||
Class: "mb-4",
|
|
||||||
Title: "",
|
|
||||||
Description: "",
|
|
||||||
Status: "open",
|
|
||||||
Priority: 0,
|
|
||||||
IssueType: "task",
|
|
||||||
})
|
|
||||||
@components.IssueTable(props.IssueTable)
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
templ Index(props IndexProps) {
|
|
||||||
@BaseLayout(BaseLayoutProps{SearchQuery: props.SearchQuery}) {
|
|
||||||
@IndexContent(props)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user