From 35114a3e0f4b69ed25ba761486ed535a0eccc1e7 Mon Sep 17 00:00:00 2001 From: Robin Olsen Date: Thu, 19 Mar 2026 21:12:28 +0100 Subject: [PATCH] make web submit when action done by user --- Task Details.txt | 12 ++++++++++++ go.mod | 2 +- pkg/web/components/modal.templ | 8 +++++++- pkg/web/components/modal_templ.go | 12 ++++++------ pkg/web/components/status.templ | 6 +++--- pkg/web/components/status_templ.go | 17 +++++++++++++++-- pkg/web/handler/task.go | 8 ++++++-- pkg/web/routes/layout.templ | 2 +- pkg/web/routes/layout_templ.go | 2 +- 9 files changed, 52 insertions(+), 17 deletions(-) create mode 100644 Task Details.txt diff --git a/Task Details.txt b/Task Details.txt new file mode 100644 index 0000000..c3e26ee --- /dev/null +++ b/Task Details.txt @@ -0,0 +1,12 @@ +You are tasked with backlog refinement. + +The product backlog has become cluttered with old and unclear issues. You need to groom the backlog: + +1. Go to the backlog. +2. Find two issues that got the same name or describe the same problem. +3. Open one of these issues. +4. Select "Close issue" +5. Choose "Duplicate issue" as closing reason. +6. Save/close issue. + +Focus on making the backlog a reliable source of upcoming work. \ No newline at end of file diff --git a/go.mod b/go.mod index 823223e..e5a75b7 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,7 @@ require ( github.com/go-git/go-git/v6 v6.0.0-20260317113930-fb0d09929504 github.com/joho/godotenv v1.5.1 github.com/muesli/reflow v0.3.0 + github.com/spf13/pflag v1.0.10 github.com/steveyegge/beads v0.49.6 go.mongodb.org/mongo-driver/v2 v2.5.0 ) @@ -97,7 +98,6 @@ require ( github.com/sergi/go-diff v1.4.0 // indirect github.com/spf13/afero v1.15.0 // indirect github.com/spf13/cast v1.10.0 // indirect - github.com/spf13/pflag v1.0.10 // indirect github.com/spf13/viper v1.21.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/tetratelabs/wazero v1.11.0 // indirect diff --git a/pkg/web/components/modal.templ b/pkg/web/components/modal.templ index 454cbab..a7e862b 100644 --- a/pkg/web/components/modal.templ +++ b/pkg/web/components/modal.templ @@ -46,7 +46,13 @@ templ Modal(props ModalProps) { } templ ModalContainer() { - + } type ConfirmModalProps struct { diff --git a/pkg/web/components/modal_templ.go b/pkg/web/components/modal_templ.go index 70939c0..4dc498e 100644 --- a/pkg/web/components/modal_templ.go +++ b/pkg/web/components/modal_templ.go @@ -143,7 +143,7 @@ func ModalContainer() templ.Component { templ_7745c5c3_Var7 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -189,7 +189,7 @@ func ConfirmModal(props ConfirmModalProps) templ.Component { var templ_7745c5c3_Var9 string templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(props.Title) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/web/components/modal.templ`, Line: 76, Col: 73} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/web/components/modal.templ`, Line: 82, Col: 73} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) if templ_7745c5c3_Err != nil { @@ -202,7 +202,7 @@ func ConfirmModal(props ConfirmModalProps) templ.Component { var templ_7745c5c3_Var10 string templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(props.Message) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/web/components/modal.templ`, Line: 80, Col: 52} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/web/components/modal.templ`, Line: 86, Col: 52} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10)) if templ_7745c5c3_Err != nil { @@ -216,7 +216,7 @@ func ConfirmModal(props ConfirmModalProps) templ.Component { var templ_7745c5c3_Var11 string templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(props.CancelText) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/web/components/modal.templ`, Line: 89, Col: 25} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/web/components/modal.templ`, Line: 95, Col: 25} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11)) if templ_7745c5c3_Err != nil { @@ -257,7 +257,7 @@ func ConfirmModal(props ConfirmModalProps) templ.Component { var templ_7745c5c3_Var14 string templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(props.ConfirmAction) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/web/components/modal.templ`, Line: 97, Col: 37} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/web/components/modal.templ`, Line: 103, Col: 37} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14)) if templ_7745c5c3_Err != nil { @@ -271,7 +271,7 @@ func ConfirmModal(props ConfirmModalProps) templ.Component { var templ_7745c5c3_Var15 string templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(props.ConfirmText) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/web/components/modal.templ`, Line: 102, Col: 26} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/web/components/modal.templ`, Line: 108, Col: 26} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15)) if templ_7745c5c3_Err != nil { diff --git a/pkg/web/components/status.templ b/pkg/web/components/status.templ index ad255c0..0555f98 100644 --- a/pkg/web/components/status.templ +++ b/pkg/web/components/status.templ @@ -1,7 +1,7 @@ package components -templ Status() { -
- +templ Status(msg string) { +
+
} diff --git a/pkg/web/components/status_templ.go b/pkg/web/components/status_templ.go index 41694c7..f46932f 100644 --- a/pkg/web/components/status_templ.go +++ b/pkg/web/components/status_templ.go @@ -8,7 +8,7 @@ package components import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" -func Status() templ.Component { +func Status(msg string) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { @@ -29,7 +29,20 @@ func Status() templ.Component { templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/pkg/web/handler/task.go b/pkg/web/handler/task.go index e5e79da..36c3c1a 100644 --- a/pkg/web/handler/task.go +++ b/pkg/web/handler/task.go @@ -30,11 +30,15 @@ func HandleTaskStatus(w http.ResponseWriter, r *http.Request) { hx := HTMX(r) if hx.IsHxRequest() { - hx.WriteString(` + if taskFeedback.Success { + w.Header().Set("HX-Trigger", "task-status-success") + w.WriteHeader(http.StatusOK) + } else { + hx.WriteString(`
`) - + } return } diff --git a/pkg/web/routes/layout.templ b/pkg/web/routes/layout.templ index caa7a8d..7b464a2 100644 --- a/pkg/web/routes/layout.templ +++ b/pkg/web/routes/layout.templ @@ -30,7 +30,7 @@ var baseLayout = components.LayoutProps{ }, Header: components.HeaderProps{ Title: "LazyPM", - NavbarEnd: components.Status(), + NavbarEnd: components.Status(""), }, Modal: components.ModalContainer(), } diff --git a/pkg/web/routes/layout_templ.go b/pkg/web/routes/layout_templ.go index a47058e..e3d833a 100644 --- a/pkg/web/routes/layout_templ.go +++ b/pkg/web/routes/layout_templ.go @@ -38,7 +38,7 @@ var baseLayout = components.LayoutProps{ }, Header: components.HeaderProps{ Title: "LazyPM", - NavbarEnd: components.Status(), + NavbarEnd: components.Status(""), }, Modal: components.ModalContainer(), }