summaryrefslogtreecommitdiff
path: root/internal/handlers/widget.go
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-07-17 08:53:57 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-07-17 08:53:57 +0000
commit244d751412a0a1e3ede8bd91e114a4ef4e1a7eaa (patch)
tree7b86c6069b6446288fd4289d4d72a67f4ed60f81 /internal/handlers/widget.go
parent533e8ac3aa2d0a3a1bda50a984356c9fcc40076d (diff)
fix(widget): autofocus quick-add title field, redesign as blank edit form
Quick Add's text field never requested focus or triggered the keyboard, so tapping it opened a sheet with no visible way to type. Added a FocusRequester + delayed requestFocus()/keyboard show (ModalBottomSheet needs a beat to finish its enter animation before focus requests land). While in there, rebuilt the quick-add sheet to match the task edit popup instead of being a bare title field: due date, recurrence, project, and label chips, plus a description field, reusing the same dialogs the edit popup already uses. POST /api/widget/add now returns the created task's id so the client can chain the same project/labels/recurrence/due-date setter calls edit already relies on.
Diffstat (limited to 'internal/handlers/widget.go')
-rw-r--r--internal/handlers/widget.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/internal/handlers/widget.go b/internal/handlers/widget.go
index 5880314..a2a0837 100644
--- a/internal/handlers/widget.go
+++ b/internal/handlers/widget.go
@@ -430,7 +430,13 @@ func (h *Handler) HandleWidgetComplete(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
}
-// HandleWidgetAdd creates a new undated native task from the widget's quick-add sheet.
+type widgetAddResponse struct {
+ ID string `json:"id"`
+}
+
+// HandleWidgetAdd creates a new undated native task from the widget's quick-add
+// sheet and returns its id, so the client can follow up with the same
+// project/labels/recurrence/due-date setter calls the edit popup uses.
func (h *Handler) HandleWidgetAdd(w http.ResponseWriter, r *http.Request) {
var req widgetAddRequest
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
@@ -454,7 +460,8 @@ func (h *Handler) HandleWidgetAdd(w http.ResponseWriter, r *http.Request) {
return
}
- w.WriteHeader(http.StatusOK)
+ w.Header().Set("Content-Type", "application/json")
+ _ = json.NewEncoder(w).Encode(widgetAddResponse{ID: task.ID})
}
type recurrenceResponse struct {