diff --git a/src/cljs/commiteth/core.cljs b/src/cljs/commiteth/core.cljs index e669215..1cca72e 100644 --- a/src/cljs/commiteth/core.cljs +++ b/src/cljs/commiteth/core.cljs @@ -4,8 +4,6 @@ [secretary.core :as secretary] [goog.events :as events] [goog.history.EventType :as HistoryEventType] - [markdown.core :refer [md->html]] - [ajax.core :refer [GET POST]] [commiteth.ajax :refer [load-interceptors!]] [commiteth.handlers] [commiteth.subscriptions] @@ -171,6 +169,8 @@ (defonce active-user (r/atom nil)) + +;; TODO: update-tokens is unnecessarily getting dispatched on every timer tick (defn load-user [] (if-let [login js/user] (if (= login @active-user) diff --git a/src/cljs/commiteth/repos.cljs b/src/cljs/commiteth/repos.cljs index 0051c95..75ac6fb 100644 --- a/src/cljs/commiteth/repos.cljs +++ b/src/cljs/commiteth/repos.cljs @@ -1,5 +1,6 @@ (ns commiteth.repos (:require [re-frame.core :as rf] + [reagent.core :as r] [commiteth.svg :as svg])) @@ -40,19 +41,36 @@ group)]) +(defn show-forks-checkbox [show-atom] + [:div.ui.container + [:div.ui.checkbox.commiteth-toggle + [:input (merge {:type :checkbox + :on-change #(swap! show-atom not)} + (when @show-atom + {:checked :checked}))] + [:label "Show forks"]]]) + + (defn repos-list [] (let [repos (rf/subscribe [:repos]) - user (rf/subscribe [:user])] + user (rf/subscribe [:user]) + show-atom (r/atom false)] (fn [] (let [repo-groups (sort-by identity (fn [a _] (= a (:login @user))) - (keys @repos))] - (into [:div] + (keys @repos)) + filter-fn (if @show-atom + identity + (fn [repo] + (not (:fork repo))))] + (into [:div + [show-forks-checkbox show-atom]] (for [[group group-repos] (map (fn [group] [group (get @repos group)]) repo-groups)] [:div.repo-group-title [repo-group-title group (:login @user)] (into [:div.ui.cards] - (map repo-card group-repos))])))))) + (map repo-card + (filter filter-fn group-repos)))])))))) (defn repos-page-token-ok [] (println "repos-token-ok") diff --git a/src/less/style.less b/src/less/style.less index 624067d..018ced8 100644 --- a/src/less/style.less +++ b/src/less/style.less @@ -304,6 +304,11 @@ padding-left: .5em; } +.commiteth-toggle { + padding-bottom: .5em; +} + + .flash-message { &.success { background-color: #61deb0;