Browse Source

chore: add shortcuts to menu

Konstantinos Kaloutas 3 years ago
parent
commit
c8506fed20

+ 4 - 2
src/main/frontend/components/sidebar.cljs

@@ -26,6 +26,7 @@
             [frontend.handler.page :as page-handler]
             [frontend.handler.route :as route-handler]
             [frontend.handler.user :as user-handler]
+            [frontend.handler.whiteboard :as whiteboard-handler]
             [frontend.mixins :as mixins]
             [frontend.mobile.action-bar :as action-bar]
             [frontend.mobile.footer :as footer]
@@ -36,7 +37,6 @@
             [frontend.ui :as ui]
             [frontend.util :as util]
             [frontend.util.cursor :as cursor]
-            [frontend.components.whiteboard :as whiteboard]
             [goog.dom :as gdom]
             [goog.object :as gobj]
             [react-draggable]
@@ -239,6 +239,7 @@
    (->>
     [{:title (t :left-side-bar/new-page)
       :class "new-page-link"
+      :shortcut (ui/keyboard-shortcut-from-config :go/search)
       :options {:on-click #((close-sidebar-on-mobile!)
                             (state/pub-event! [:go/search]))}
       :icon (ui/type-icon {:name "new-page"
@@ -246,8 +247,9 @@
                            :extension? true})}
      {:title (t :left-side-bar/new-whiteboard)
       :class "new-whiteboard-link"
+      :shortcut (ui/keyboard-shortcut-from-config :editor/new-whiteboard)
       :options {:on-click #((close-sidebar-on-mobile!)
-                            (whiteboard/create-new-whiteboard!))}
+                            (whiteboard-handler/create-new-whiteboard!))}
       :icon (ui/type-icon {:name "new-whiteboard"
                            :class "highlight"
                            :extension? true})}])

+ 1 - 1
src/main/frontend/components/sidebar.css

@@ -281,7 +281,7 @@
       right: initial;
       bottom: calc(100% + 6px);
       left: 0;
-      width: 100%;
+      width: max-content;
 
       @screen sm {
         bottom: 0;

+ 2 - 2
src/main/frontend/ui.cljs

@@ -156,7 +156,7 @@
      [:.menu-links-wrapper
       (when links-header links-header)
 
-      (for [{:keys [options title icon key hr hover-detail item _as-link?]} (if (fn? links) (links) links)]
+      (for [{:keys [options title icon shortcut key hr hover-detail item _as-link?]} (if (fn? links) (links) links)]
         (let [new-options
               (merge options
                      (cond->
@@ -177,7 +177,7 @@
           (if hr
             [:hr.menu-separator {:key "dropdown-hr"}]
             (rum/with-key
-              (menu-link new-options child nil)
+              (menu-link new-options child shortcut)
               title))))
       (when links-footer links-footer)])
    opts))