From 826985bfb9e8fe1c81943743de16d94b05befda2 Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Mon, 24 Feb 2025 19:31:02 +0800 Subject: [PATCH] enhance: view time filters support 1 day and 3 days ago --- src/main/frontend/components/views.cljs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/frontend/components/views.cljs b/src/main/frontend/components/views.cljs index 8e69d226c8..7453c95416 100644 --- a/src/main/frontend/components/views.cljs +++ b/src/main/frontend/components/views.cljs @@ -655,7 +655,11 @@ (contains? #{:block/created-at :block/updated-at} (:db/ident property)))) (def timestamp-options - [{:value "1 week ago" + [{:value "1 day ago" + :label "1 day ago"} + {:value "3 days ago" + :label "3 days ago"} + {:value "1 week ago" :label "1 week ago"} {:value "1 month ago" :label "1 month ago"} @@ -673,6 +677,10 @@ (let [now (t/now) f t/minus] (case value + "1 day ago" + (tc/to-long (f now (t/days 1))) + "3 days ago" + (tc/to-long (f now (t/days 3))) "1 week ago" (tc/to-long (f now (t/weeks 1))) "1 month ago" @@ -696,7 +704,7 @@ {:label (:name column) :value column}) columns) option {:input-default-placeholder "Filter" - :input-opts {:class "!px-3 !py-1"} + :input-opts {:class "!px-2 !py-1"} :items items :extract-fn :label :extract-chosen-fn :value