remove unsigned transactions before they are implemented
This commit is contained in:
parent
5e31fcdacc
commit
d6966e2d34
|
@ -24,11 +24,6 @@
|
||||||
(fn [transactions]
|
(fn [transactions]
|
||||||
(group-by :type (vals transactions))))
|
(group-by :type (vals transactions))))
|
||||||
|
|
||||||
(reg-sub :wallet.transactions/unsigned-transactions
|
|
||||||
:<- [:wallet.transactions/grouped-transactions]
|
|
||||||
(fn [transactions]
|
|
||||||
(:unsigned transactions)))
|
|
||||||
|
|
||||||
(reg-sub :wallet.transactions/postponed-transactions-list
|
(reg-sub :wallet.transactions/postponed-transactions-list
|
||||||
:<- [:wallet.transactions/grouped-transactions]
|
:<- [:wallet.transactions/grouped-transactions]
|
||||||
(fn [{:keys [postponed]}]
|
(fn [{:keys [postponed]}]
|
||||||
|
|
|
@ -29,21 +29,22 @@
|
||||||
;; TODO(yenda) implement
|
;; TODO(yenda) implement
|
||||||
(utils/show-popup "TODO" "Delete Transaction"))
|
(utils/show-popup "TODO" "Delete Transaction"))
|
||||||
|
|
||||||
(defn unsigned-action [unsigned-transactions]
|
(defn unsigned-action []
|
||||||
[toolbar/text-action {:disabled? (zero? (count unsigned-transactions)) :handler #(re-frame/dispatch [:navigate-to-modal :wallet-transactions-sign-all])}
|
;; TODO subscribe to unsigned-transactions-count or pass it as parameter ?
|
||||||
|
[toolbar/text-action {:disabled? (zero? 0 #_(count unsigned-transactions)) :handler #(re-frame/dispatch [:navigate-to-modal :wallet-transactions-sign-all])}
|
||||||
(i18n/label :t/transactions-sign-all)])
|
(i18n/label :t/transactions-sign-all)])
|
||||||
|
|
||||||
(def history-action
|
(def history-action
|
||||||
{:icon :icons/filter
|
{:icon :icons/filter
|
||||||
:handler #(utils/show-popup "TODO" "Not implemented") #_(re-frame/dispatch [:navigate-to-modal :wallet-transactions-sign-all])})
|
:handler #(utils/show-popup "TODO" "Not implemented") #_(re-frame/dispatch [:navigate-to-modal :wallet-transactions-sign-all])})
|
||||||
|
|
||||||
(defn toolbar-view [view-id unsigned-transactions]
|
(defn toolbar-view [view-id]
|
||||||
[toolbar/toolbar2 {:flat? true}
|
[toolbar/toolbar2 {:flat? true}
|
||||||
toolbar/default-nav-back
|
toolbar/default-nav-back
|
||||||
[toolbar/content-title (i18n/label :t/transactions)]
|
[toolbar/content-title (i18n/label :t/transactions)]
|
||||||
(case @view-id
|
(case @view-id
|
||||||
:wallet-transactions-unsigned
|
:wallet-transactions-unsigned
|
||||||
[unsigned-action unsigned-transactions]
|
[unsigned-action]
|
||||||
|
|
||||||
:wallet-transactions-history
|
:wallet-transactions-history
|
||||||
[toolbar/actions
|
[toolbar/actions
|
||||||
|
@ -101,22 +102,24 @@
|
||||||
:on-refresh #(re-frame/dispatch [:update-transactions])
|
:on-refresh #(re-frame/dispatch [:update-transactions])
|
||||||
:refreshing transactions-loading?}]]))
|
:refreshing transactions-loading?}]]))
|
||||||
|
|
||||||
(defview unsigned-list [transactions]
|
(defview unsigned-list []
|
||||||
[]
|
[]
|
||||||
|
(let [transactions nil] ;; TODO replace by letsubs later
|
||||||
[react/scroll-view {:style styles/flex}
|
[react/scroll-view {:style styles/flex}
|
||||||
[list/flat-list {:data transactions
|
[list/flat-list {:data transactions
|
||||||
:render-fn render-transaction
|
:render-fn render-transaction
|
||||||
:empty-component (empty-text (i18n/label :t/transactions-unsigned-empty))}]])
|
:empty-component (empty-text (i18n/label :t/transactions-unsigned-empty))}]]))
|
||||||
|
|
||||||
(defn- unsigned-transactions-title [transactions]
|
(defn- unsigned-transactions-title []
|
||||||
(let [count (count transactions)]
|
;; TODO subscribe to unsigned-transactions-count or pass it as parameter ?
|
||||||
|
(let [count 0 #_(count transactions)]
|
||||||
(str (i18n/label :t/transactions-unsigned)
|
(str (i18n/label :t/transactions-unsigned)
|
||||||
(if (pos? count) (str " " count)))))
|
(if (pos? count) (str " " count)))))
|
||||||
|
|
||||||
(defn- tab-list [unsigned-transactions]
|
(defn- tab-list []
|
||||||
[{:view-id :wallet-transactions-unsigned
|
[{:view-id :wallet-transactions-unsigned
|
||||||
:title (unsigned-transactions-title unsigned-transactions)
|
:title (unsigned-transactions-title)
|
||||||
:screen [unsigned-list unsigned-transactions]}
|
:screen [unsigned-list]}
|
||||||
{:view-id :wallet-transactions-history
|
{:view-id :wallet-transactions-history
|
||||||
:title (i18n/label :t/transactions-history)
|
:title (i18n/label :t/transactions-history)
|
||||||
:screen [history-list]}])
|
:screen [history-list]}])
|
||||||
|
@ -192,13 +195,12 @@
|
||||||
;; TODO(yenda) must reflect selected wallet
|
;; TODO(yenda) must reflect selected wallet
|
||||||
|
|
||||||
(defview transactions []
|
(defview transactions []
|
||||||
[unsigned-transactions [:wallet.transactions/unsigned-transactions]]
|
(let [tabs (tab-list)
|
||||||
(let [tabs (tab-list unsigned-transactions)
|
|
||||||
default-view (get-in tabs [0 :view-id])
|
default-view (get-in tabs [0 :view-id])
|
||||||
view-id (reagent/atom default-view)]
|
view-id (reagent/atom default-view)]
|
||||||
[react/view {:style styles/flex}
|
[react/view {:style styles/flex}
|
||||||
[status-bar/status-bar]
|
[status-bar/status-bar]
|
||||||
[toolbar-view view-id unsigned-transactions]
|
[toolbar-view view-id]
|
||||||
[main-section view-id tabs]]))
|
[main-section view-id tabs]]))
|
||||||
|
|
||||||
(defn transaction-details-header [{:keys [value date type]}]
|
(defn transaction-details-header [{:keys [value date type]}]
|
||||||
|
|
Loading…
Reference in New Issue