Add expense from overview page #3

Merged
juancwu merged 3 commits from feat/add-expense-shortcut into main 2026-02-07 19:41:27 +00:00
2 changed files with 3 additions and 9 deletions
Showing only changes of commit ccd6eaf9ee - Show all commits

feat: redirect to expenses after add from overview

juancwu 2026-02-07 19:37:05 +00:00

View file

@ -566,14 +566,8 @@ func (h *SpaceHandler) CreateExpense(w http.ResponseWriter, r *http.Request) {
}
if r.URL.Query().Get("from") == "overview" {
ui.Render(w, r, toast.Toast(toast.Props{
Title: "Expense created",
Description: "Your transaction has been recorded.",
Variant: toast.VariantSuccess,
Icon: true,
Dismissible: true,
Duration: 5000,
}))
w.Header().Set("HX-Redirect", "/app/spaces/"+spaceID+"/expenses")
w.WriteHeader(http.StatusOK)
return
}

View file

@ -20,7 +20,7 @@ type AddExpenseFormProps struct {
Tags []*model.Tag
ListsWithItems []model.ListWithUncheckedItems
DialogID string // which dialog to close on success
FromOverview bool // if true, POSTs with ?from=overview for toast response
FromOverview bool // if true, POSTs with ?from=overview; server redirects to expenses page
}
func (p AddExpenseFormProps) formAttrs() templ.Attributes {