~pepe/neil

87cbed5ccce29e186fa2a4ec4c8da5e6392224ff — Josef Pospíšil a month ago 7dd0bf8
Add list of pinned tasks
M neil/appraisers.janet => neil/appraisers.janet +5 -1
@@ 1,4 1,4 @@
(use manisha)
(use manisha bearimy)

(def epoch? number?)



@@ 6,6 6,10 @@
  [state]
  (fn _state= [i] (= (i :state) state)))

(defn future-pinned [i]
  (if-let [p (i :pin)]
    (:after? (make-calendar p) (now))))

(def active? (state= "active"))

(def states

M neil/watch/projects.janet => neil/watch/projects.janet +4 -1
@@ 87,7 87,10 @@
    (default state sstate)
    (match (protect (load brush i))
      [true (project (project :client))]
      (let [filtr (if (= state "all") identity (state= state))
      (let [filtr (if (= state "all")
                    identity (if (= state "pinned")
                               future-pinned
                               (state= state)))
            tasks (or (project-tasks-with-filter project filtr)
                      [])
            running (running-task brush)

M neil/watch/tasks.janet => neil/watch/tasks.janet +5 -1
@@ 114,7 114,11 @@
(defn list [{:params {:state state}}]
  (define-brush)
  (def alll (= state "all"))
  (def f (if alll identity (state= state)))
  (def f (if alll
           identity
           (if (= state "pinned")
             future-pinned
             (state= state))))
  (def [tasks running] [(tasks-with-filter brush f) (running-task brush)])
  (def name
    (. (if alll "all " "last ")

M templates/tasks/list.temple => templates/tasks/list.temple +1 -1
@@ 9,7 9,7 @@ $}
      {% (when-let [a (args :path)] %}
        <hstack spacing="l">
          <span>filter </span>
          {% (loop [s :in ["all" "active" "completed" "canceled"]] %}
          {% (loop [s :in ["all" "pinned" "active" "completed" "canceled"]] %}
            <a hx-get="{{ (. a s) }}" hx-target="#tasks" hx-swap="outerHTML">{{ s }}</a>
          {% ) %}
        </hstack>