mirror of
https://github.com/status-im/open-bounty.git
synced 2025-02-18 12:26:41 +00:00
some filtering and sorting fixes
This commit is contained in:
parent
34db7df1fc
commit
a3e42fe61f
@ -84,7 +84,7 @@
|
|||||||
(let [new-min (min current-min (max default-min new-max))]
|
(let [new-min (min current-min (max default-min new-max))]
|
||||||
(on-change-fn new-min new-max)))]
|
(on-change-fn new-min new-max)))]
|
||||||
[:div
|
[:div
|
||||||
"$0 - $1000+"
|
(::ui-model/bounty-filter.type.header filter-type-def)
|
||||||
[bounties-filter-tooltip-value-input-view "Min" tooltip-open? (merge common-range-opts
|
[bounties-filter-tooltip-value-input-view "Min" tooltip-open? (merge common-range-opts
|
||||||
{:current-val current-min
|
{:current-val current-min
|
||||||
:on-change-val on-min-change-fn})]
|
:on-change-val on-min-change-fn})]
|
||||||
|
@ -465,11 +465,11 @@
|
|||||||
::set-open-bounties-sorting-type
|
::set-open-bounties-sorting-type
|
||||||
(fn [db [_ sorting-type]]
|
(fn [db [_ sorting-type]]
|
||||||
(merge db {::db/open-bounties-sorting-type sorting-type
|
(merge db {::db/open-bounties-sorting-type sorting-type
|
||||||
:bounty-page-number 1})))
|
:page-number 1})))
|
||||||
|
|
||||||
(reg-event-db
|
(reg-event-db
|
||||||
::set-open-bounty-filter-type
|
::set-open-bounty-filter-type
|
||||||
(fn [db [_ filter-type filter-value]]
|
(fn [db [_ filter-type filter-value]]
|
||||||
(-> db
|
(-> db
|
||||||
(assoc-in [::db/open-bounties-filters filter-type] filter-value)
|
(assoc-in [::db/open-bounties-filters filter-type] filter-value)
|
||||||
(assoc :bounty-page-number 1))))
|
(assoc :page-number 1))))
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
(:require [re-frame.core :refer [reg-sub]]
|
(:require [re-frame.core :refer [reg-sub]]
|
||||||
[commiteth.db :as db]
|
[commiteth.db :as db]
|
||||||
[commiteth.ui-model :as ui-model]
|
[commiteth.ui-model :as ui-model]
|
||||||
[commiteth.common :refer [items-per-page]]))
|
[commiteth.common :refer [items-per-page]]
|
||||||
|
[clojure.string :as string]))
|
||||||
|
|
||||||
(reg-sub
|
(reg-sub
|
||||||
:db
|
:db
|
||||||
@ -139,6 +140,12 @@
|
|||||||
(map :repo-owner)
|
(map :repo-owner)
|
||||||
set)))
|
set)))
|
||||||
|
|
||||||
|
(reg-sub
|
||||||
|
::open-bounties-owners-sorted
|
||||||
|
:<- [::open-bounties-owners]
|
||||||
|
(fn [owners _]
|
||||||
|
(sort-by string/lower-case owners)))
|
||||||
|
|
||||||
(reg-sub
|
(reg-sub
|
||||||
::open-bounties-currencies
|
::open-bounties-currencies
|
||||||
:<- [:open-bounties]
|
:<- [:open-bounties]
|
||||||
|
@ -63,7 +63,7 @@
|
|||||||
(let [created-at-date (-> created-at-inst inst-ms t-coerce/from-long)]
|
(let [created-at-date (-> created-at-inst inst-ms t-coerce/from-long)]
|
||||||
(t/within? filter-value-interval created-at-date)))))
|
(t/within? filter-value-interval created-at-date)))))
|
||||||
|
|
||||||
(def bounty-filter-type-claims-options-def {::bounty-filter-type-claims-option|no-claims "With no claims"})
|
(def bounty-filter-type-claims-options-def {::bounty-filter-type-claims-option|no-claims "Not claimed yet"})
|
||||||
|
|
||||||
(def bounty-filter-type-claims-options (keys bounty-filter-type-claims-options-def))
|
(def bounty-filter-type-claims-options (keys bounty-filter-type-claims-options-def))
|
||||||
|
|
||||||
@ -75,7 +75,8 @@
|
|||||||
{::bounty-filter-type.name "Value"
|
{::bounty-filter-type.name "Value"
|
||||||
::bounty-filter-type.category ::bounty-filter-type-category|range
|
::bounty-filter-type.category ::bounty-filter-type-category|range
|
||||||
::bounty-filter-type.min-val 0
|
::bounty-filter-type.min-val 0
|
||||||
::bounty-filter-type.max-val 1000
|
::bounty-filter-type.max-val 10000
|
||||||
|
::bounty-filter.type.header "$0 - $10000+"
|
||||||
::bounty-filter-type.predicate (fn [filter-value bounty]
|
::bounty-filter-type.predicate (fn [filter-value bounty]
|
||||||
(let [min-val (first filter-value)
|
(let [min-val (first filter-value)
|
||||||
max-val (second filter-value)]
|
max-val (second filter-value)]
|
||||||
@ -101,7 +102,7 @@
|
|||||||
::bounty-filter-type|owner
|
::bounty-filter-type|owner
|
||||||
{::bounty-filter-type.name "Owner"
|
{::bounty-filter-type.name "Owner"
|
||||||
::bounty-filter-type.category ::bounty-filter-type-category|multiple-dynamic-options
|
::bounty-filter-type.category ::bounty-filter-type-category|multiple-dynamic-options
|
||||||
::bounty-filter-type.re-frame-subs-key-for-options :commiteth.subscriptions/open-bounties-owners
|
::bounty-filter-type.re-frame-subs-key-for-options :commiteth.subscriptions/open-bounties-owners-sorted
|
||||||
::bounty-filter-type.predicate (fn [filter-value bounty]
|
::bounty-filter-type.predicate (fn [filter-value bounty]
|
||||||
(->> filter-value
|
(->> filter-value
|
||||||
(some #{(:repo-owner bounty)})
|
(some #{(:repo-owner bounty)})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user