mirror of
https://github.com/penpot/penpot.git
synced 2025-01-24 07:29:08 -05:00
🎉 Add workspace menu integration.
This commit is contained in:
parent
b210e84dd3
commit
aebea8ed5f
2 changed files with 59 additions and 9 deletions
|
@ -804,6 +804,17 @@
|
|||
"fr" : "MOT DE PASSE"
|
||||
}
|
||||
},
|
||||
"workspace.header.menu.hide-rules": "Hide rules",
|
||||
"workspace.header.menu.show-rules": "Show rules",
|
||||
"workspace.header.menu.hide-grid": "Hide grid",
|
||||
"workspace.header.menu.show-grid": "Show grid",
|
||||
"workspace.header.menu.hide-layers": "Hide layers",
|
||||
"workspace.header.menu.show-layers": "Show layers",
|
||||
"workspace.header.menu.hide-palette": "Hide color palette",
|
||||
"workspace.header.menu.show-palette": "Show color palette",
|
||||
"workspace.header.menu.hide-libraries": "Hide libraries",
|
||||
"workspace.header.menu.show-libraries": "Show libraries",
|
||||
|
||||
"settings.password.change-password" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/settings/password.cljs:64" ],
|
||||
"translations" : {
|
||||
|
|
|
@ -60,6 +60,53 @@
|
|||
[:& user-widget {:user (get-in users [:by-id id])
|
||||
:key id}])]))
|
||||
|
||||
(mf/defc menu
|
||||
[{:keys [layout] :as props}]
|
||||
(let [show-menu? (mf/use-state false)
|
||||
locale (i18n/use-locale)]
|
||||
|
||||
[:*
|
||||
[:div.menu-btn {:on-click #(reset! show-menu? true)} i/actions]
|
||||
|
||||
[:& dropdown {:show @show-menu?
|
||||
:on-close #(reset! show-menu? false)}
|
||||
[:ul.workspace-menu
|
||||
[:li {:on-click #(st/emit! (dw/toggle-layout-flag :rules))}
|
||||
[:span i/ruler]
|
||||
[:span
|
||||
(if (contains? layout :rules)
|
||||
(t locale "workspace.header.menu.hide-rules")
|
||||
(t locale "workspace.header.menu.show-rules"))]]
|
||||
|
||||
[:li {:on-click #(st/emit! (dw/toggle-layout-flag :grid))}
|
||||
[:span i/grid]
|
||||
[:span
|
||||
(if (contains? layout :grid)
|
||||
(t locale "workspace.header.menu.hide-grid")
|
||||
(t locale "workspace.header.menu.show-grid"))]]
|
||||
|
||||
[:li {:on-click #(st/emit! (dw/toggle-layout-flag :layers))}
|
||||
[:span i/layers]
|
||||
[:span
|
||||
(if (contains? layout :layers)
|
||||
(t locale "workspace.header.menu.hide-layers")
|
||||
(t locale "workspace.header.menu.show-layers"))]]
|
||||
|
||||
[:li {:on-click #(st/emit! (dw/toggle-layout-flag :colorpalette))}
|
||||
[:span i/palette]
|
||||
[:span
|
||||
(if (contains? layout :colorpalette)
|
||||
(t locale "workspace.header.menu.hide-palette")
|
||||
(t locale "workspace.header.menu.show-palette"))]]
|
||||
|
||||
[:li {:on-click #(st/emit! (dw/toggle-layout-flag :libraries))}
|
||||
[:span i/icon-set]
|
||||
[:span
|
||||
(if (contains? layout :libraries)
|
||||
(t locale "workspace.header.menu.hide-libraries")
|
||||
(t locale "workspace.header.menu.show-libraries"))]]
|
||||
]]]))
|
||||
|
||||
;; --- Header Component
|
||||
|
||||
(mf/defc header
|
||||
|
@ -69,8 +116,6 @@
|
|||
on-redo (constantly nil)
|
||||
locale (i18n/use-locale)
|
||||
|
||||
show-menu? (mf/use-state false)
|
||||
|
||||
on-image #(modal/show! import-image-modal {})
|
||||
;;on-download #(udl/open! :download)
|
||||
selected-drawtool (mf/deref refs/selected-drawing-tool)
|
||||
|
@ -83,14 +128,8 @@
|
|||
[:a {:on-click #(st/emit! (rt/nav :dashboard-team {:team-id "self"}))}
|
||||
i/logo-icon]]
|
||||
|
||||
[:div.menu-btn {:on-click #(reset! show-menu? true)} i/actions]
|
||||
|
||||
[:& dropdown {:show @show-menu?
|
||||
:on-close #(reset! show-menu? false)}
|
||||
[:ul.workspace-menu
|
||||
[:li i/user [:span (t locale "dashboard.header.profile-menu.profile")]]
|
||||
[:li i/lock [:span (t locale "dashboard.header.profile-menu.password")]]
|
||||
[:li i/exit [:span (t locale "dashboard.header.profile-menu.logout")]]]]
|
||||
[:& menu {:layout layout}]
|
||||
|
||||
[:div.project-tree-btn
|
||||
{:alt (tr "header.sitemap")
|
||||
|
|
Loading…
Add table
Reference in a new issue