reformat bounty-filter-types-def

This commit is contained in:
pablodip 2018-01-31 12:01:24 +01:00
parent fa5bdef66a
commit 65cea5d521
2 changed files with 44 additions and 37 deletions

View File

@ -108,7 +108,7 @@
(defmethod bounties-filter-tooltip-view ::ui-model/bounty-filter-type-category|multiple-dynamic-options
[filter-type filter-type-def current-filter-value tooltip-open?]
(let [options (rf/subscribe [(::ui-model/bounty-filter-type.re-frame-subscription-key-for-options filter-type-def)])]
(let [options (rf/subscribe [(::ui-model/bounty-filter-type.re-frame-subs-key-for-options filter-type-def)])]
[:div.open-bounties-filter-list
(for [option @options]
(let [active? (boolean (and current-filter-value (current-filter-value option)))]

View File

@ -45,7 +45,8 @@
(def bounty-filter-type-date-options (keys bounty-filter-type-date-options-def))
(def bounty-filter-types-def
{::bounty-filter-type|value {::bounty-filter-type.name "Value"
{::bounty-filter-type|value
{::bounty-filter-type.name "Value"
::bounty-filter-type.category ::bounty-filter-type-category|range
::bounty-filter-type.min-val 0
::bounty-filter-type.max-val 1000
@ -53,15 +54,19 @@
(let [min-val (first filter-value)
max-val (second filter-value)]
(<= min-val (:value-usd bounty) max-val)))}
::bounty-filter-type|currency {::bounty-filter-type.name "Currency"
::bounty-filter-type|currency
{::bounty-filter-type.name "Currency"
::bounty-filter-type.category ::bounty-filter-type-category|multiple-dynamic-options
::bounty-filter-type.re-frame-subscription-key-for-options :commiteth.subscriptions/open-bounties-currencies
::bounty-filter-type.re-frame-subs-key-for-options :commiteth.subscriptions/open-bounties-currencies
::bounty-filter-type.predicate (fn [filter-value bounty]
(and (or (not-any? #{"ETH"} filter-value)
(< 0 (:balance-eth bounty)))
(set/subset? (->> filter-value (remove #{"ETH"}) set)
(-> bounty :tokens keys set))))}
::bounty-filter-type|date {::bounty-filter-type.name "Date"
::bounty-filter-type|date
{::bounty-filter-type.name "Date"
::bounty-filter-type.category ::bounty-filter-type-category|single-static-option
::bounty-filter-type.options bounty-filter-type-date-options-def
::bounty-filter-type.pre-predicate-value-processor (fn [filter-value]
@ -74,9 +79,11 @@
(when-let [created-at-inst (:created-at bounty)]
(let [created-at-date (-> created-at-inst inst-ms t-coerce/from-long)]
(t/within? filter-value-interval created-at-date))))}
::bounty-filter-type|owner {::bounty-filter-type.name "Owner"
::bounty-filter-type|owner
{::bounty-filter-type.name "Owner"
::bounty-filter-type.category ::bounty-filter-type-category|multiple-dynamic-options
::bounty-filter-type.re-frame-subscription-key-for-options :commiteth.subscriptions/open-bounties-owners
::bounty-filter-type.re-frame-subs-key-for-options :commiteth.subscriptions/open-bounties-owners
::bounty-filter-type.predicate (fn [filter-value bounty]
(->> filter-value
(some #{(:repo-owner bounty)})