From c111da4b9d1b9e02ffbcf0c8f42dfa899cc82efc Mon Sep 17 00:00:00 2001 From: Martin Klepsch Date: Wed, 21 Mar 2018 17:52:29 +0100 Subject: [PATCH] fix #368: dont show `Manage Payouts` if user hasnt issued bounties --- src/cljs/commiteth/core.cljs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/cljs/commiteth/core.cljs b/src/cljs/commiteth/core.cljs index 3e62083..62a27dd 100644 --- a/src/cljs/commiteth/core.cljs +++ b/src/cljs/commiteth/core.cljs @@ -74,19 +74,17 @@ (defn tabs [mobile?] (let [user (rf/subscribe [:user]) + owner-bounties (rf/subscribe [:owner-bounties]) current-page (rf/subscribe [:page])] - (fn [] - (let [tabs (apply conj [[:bounties (str (when-not @user "Open ") "Bounties")] - [:activity "Activity"]] - (when @user - [ - ;; NOTE(oskarth) Disabling this as repo management happens through GH app - #_[:repos "Repositories"] - [:manage-payouts (str (when-not mobile? "Manage ") "Payouts")] - (when (:status-team-member? @user) - [:usage-metrics "Usage metrics"])]))] + (fn tabs-render [] + (let [tabs [[:bounties (str (when-not @user "Open ") "Bounties")] + [:activity "Activity"] + (when (seq @owner-bounties) + [:manage-payouts (str (when-not mobile? "Manage ") "Payouts")]) + (when (:status-team-member? @user) + [:usage-metrics "Usage metrics"])]] (into [:div.ui.attached.tabular.menu.tiny] - (for [[page caption] tabs] + (for [[page caption] (remove nil? tabs)] (let [props {:class (str "ui item" (when (= @current-page page) " active")) :on-click #(commiteth.routes/nav! page)}]