Explorar o código

fix: optimize logic

Peng Xiao %!s(int64=2) %!d(string=hai) anos
pai
achega
6b1c703a06
Modificáronse 1 ficheiros con 11 adicións e 11 borrados
  1. 11 11
      src/main/frontend/components/header.cljs

+ 11 - 11
src/main/frontend/components/header.cljs

@@ -203,9 +203,16 @@
                              (util/scroll-to-top true))))
       :style           {:fontSize 50}}
      [:div.l.flex.drag-region
-      (when-not (mobile-util/native-platform?)
-        [left-menu
-         (when current-repo ;; this is for the Search button
+      [left-menu
+       (if (mobile-util/native-platform?)
+         ;; back button for mobile
+         (when-not (or (state/home?) custom-home-page? (state/whiteboard-dashboard?))
+           (ui/with-shortcut :go/backward "bottom"
+             [:button.it.navigation.nav-left.button.icon.opacity-70
+              {:title "Go back" :on-click #(js/window.history.back)}
+              (ui/icon "chevron-left" {:size 26})]))
+         ;; search button for non-mobile
+         (when current-repo
            (ui/with-shortcut :go/search "right"
              [:button.button.icon#search-button
               {:title "Search"
@@ -213,14 +220,7 @@
                                         (mobile-util/native-iphone?))
                                 (state/set-left-sidebar-open! false))
                               (state/pub-event! [:go/search]))}
-              (ui/icon "search" {:size ui/icon-size})]))])
-      (when (mobile-util/native-platform?)
-        [left-menu
-         (when-not (or (state/home?) custom-home-page? (state/whiteboard-dashboard?))
-           (ui/with-shortcut :go/backward "bottom"
-             [:button.it.navigation.nav-left.button.icon.opacity-70
-              {:title "Go back" :on-click #(js/window.history.back)}
-              (ui/icon "chevron-left" {:size 26})]))])]
+              (ui/icon "search" {:size ui/icon-size})])))]]
 
      [:div.r.flex.drag-region
       (when (and current-repo