Show project count in dashboard

This commit is contained in:
Alejandro Gómez 2016-02-09 20:33:19 +01:00
parent 3a31abac5a
commit 7830c11a16
2 changed files with 11 additions and 6 deletions

View file

@ -2,6 +2,10 @@
(defonce +locales+ (defonce +locales+
{"ds.projects" "PROJECTS" {"ds.projects" "PROJECTS"
"ds.num-projects" ["No projects"
"%s project"
"%s projects"]
"ds.elements" "ELEMENTS" "ds.elements" "ELEMENTS"
"ds.icons" "ICONS" "ds.icons" "ICONS"
"ds.colors" "COLORS" "ds.colors" "COLORS"

View file

@ -3,6 +3,7 @@
[rum.core :as rum] [rum.core :as rum]
[cats.labs.lens :as l] [cats.labs.lens :as l]
[cuerdas.core :as str] [cuerdas.core :as str]
[uxbox.locales :as t :refer (tr)]
[uxbox.router :as r] [uxbox.router :as r]
[uxbox.rstore :as rs] [uxbox.rstore :as rs]
[uxbox.state :as s] [uxbox.state :as s]
@ -149,9 +150,9 @@
;; Menu ;; Menu
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; (def ^:static menu-l (def ^:static menu-l
;; (as-> (l/select-keys [:projects]) $ (as-> (l/select-keys [:projects-by-id]) $
;; (l/focus-atom $ s/state))) (l/focus-atom $ s/state)))
(rum/defc project-sort-selector < rum/reactive (rum/defc project-sort-selector < rum/reactive
[sort-order] [sort-order]
@ -166,12 +167,12 @@
(defn menu-render (defn menu-render
[] []
(let [state {:projects []} #_(rum/react menu-l) (let [projects (rum/react menu-l)
pcount (count (:projects state))] pcount (count (:projects-by-id projects))] ;; FIXME: redundant project-by-id key
(html (html
[:section#dashboard-bar.dashboard-bar [:section#dashboard-bar.dashboard-bar
[:div.dashboard-info [:div.dashboard-info
[:span.dashboard-projects pcount " projects"] [:span.dashboard-projects (tr "ds.num-projects" (t/c pcount))]
[:span "Sort by"]] [:span "Sort by"]]
[:div.dashboard-search [:div.dashboard-search
i/search]]))) i/search]])))