Browse Source

feat(chrome-native-fs): show all graphs when user is not logged in

Tienson Qin 5 years ago
parent
commit
ddb8053f9b
2 changed files with 12 additions and 9 deletions
  1. 3 2
      src/main/frontend/components/header.cljs
  2. 9 7
      src/main/frontend/components/repo.cljs

+ 3 - 2
src/main/frontend/components/header.cljs

@@ -58,7 +58,7 @@
          {:title (t :graph)
           :options {:href (rfe/href :graph)}
           :icon svg/graph-sm})
-       (when logged?
+       (when (or logged? (nfs/supported?))
          {:title (t :all-graphs)
           :options {:href (rfe/href :repos)}
           :icon svg/repos-sm})
@@ -114,7 +114,8 @@
 (rum/defc header
   [{:keys [open-fn current-repo white? logged? page? route-match me default-home new-block-mode]}]
   (let [local-repo? (= current-repo config/local-repo)
-        repos (state/sub [:me :repos])]
+        repos (->> (state/sub [:me :repos])
+                   (remove #(= (:url %) config/local-repo)))]
     (rum/with-context [[t] i18n/*tongue-context*]
       [:div.cp__header#head
        (left-menu-button {:on-click (fn []

+ 9 - 7
src/main/frontend/components/repo.cljs

@@ -24,7 +24,8 @@
 
 (rum/defc repos < rum/reactive
   []
-  (let [{:keys [repos]} (state/sub :me)
+  (let [repos (->> (state/sub [:me :repos])
+                   (remove #(= (:url %) config/local-repo)))
         repos (util/distinct-by :url repos)]
     (rum/with-context [[t] i18n/*tongue-context*]
       (if (seq repos)
@@ -33,13 +34,14 @@
 
          [:div.pl-1.content
           [:div.flex.flex-row.my-4
+           (when (state/logged?)
+             [:div.mr-8
+              (ui/button
+               "Add another git repo"
+               :href (rfe/href :repo-add))])
            (ui/button
-            "Add another git repo"
-            :href (rfe/href :repo-add))
-           [:div.ml-8
-            (ui/button
-             (t :open-a-directory)
-             :on-click nfs-handler/ls-dir-files)]]
+            (t :open-a-directory)
+            :on-click nfs-handler/ls-dir-files)]
 
           (for [{:keys [id url] :as repo} repos]
             (let [local? (config/local-db? url)]