Open task views in a sheet over the left pane

This commit is contained in:
Ian Gulliver
2026-10-21 17:00:07 -07:00
parent ccb08ab6ec
commit 193401021a
22 changed files with 698 additions and 546 deletions
+10 -9
View File
@@ -167,25 +167,26 @@ func (s *Store) TakeLeadWakes(ctx context.Context, taskID string) ([]string, err
func (s *Store) GetFocus(ctx context.Context, login string) (api.Focus, error) {
f := api.Focus{}
raw := ""
err := s.db.QueryRowContext(ctx, `SELECT focus FROM users WHERE login = ?`, login).Scan(&raw)
var task, project sql.NullString
err := s.db.QueryRowContext(ctx, `SELECT focus_task_id, focus_project_id FROM users WHERE login = ?`, login).Scan(&task, &project)
if errors.Is(err, sql.ErrNoRows) {
return f, ErrNotFound
}
if err != nil {
return f, err
}
err = json.Unmarshal([]byte(raw), &f)
return f, err
if task.Valid {
f.TaskId = &task.String
}
if project.Valid {
f.ProjectId = &project.String
}
return f, nil
}
func (s *Store) SetFocus(ctx context.Context, login string, f api.Focus, actor string) error {
raw, err := json.Marshal(f)
if err != nil {
return err
}
return s.write(ctx, func(tx *sql.Tx, emit emitFunc) error {
_, err := tx.ExecContext(ctx, `UPDATE users SET focus = ? WHERE login = ?`, string(raw), login)
_, err := tx.ExecContext(ctx, `UPDATE users SET focus_task_id = ?, focus_project_id = ? WHERE login = ?`, f.TaskId, f.ProjectId, login)
if err != nil {
return err
}
@@ -0,0 +1,4 @@
ALTER TABLE users ADD COLUMN focus_task_id TEXT;
ALTER TABLE users ADD COLUMN focus_project_id TEXT;
UPDATE users SET focus_task_id = json_extract(focus, '$.task_id'), focus_project_id = json_extract(focus, '$.project_id');
ALTER TABLE users DROP COLUMN focus;