mirror of
https://github.com/penpot/penpot.git
synced 2025-06-07 02:41:38 +02:00
🌐 Translate several dashboards
This commit is contained in:
parent
edbab7f8d5
commit
e06bc2cc95
14 changed files with 193 additions and 102 deletions
|
@ -9,6 +9,7 @@
|
|||
(:require [uxbox.main.data.lightbox :as udl]
|
||||
[uxbox.builtins.icons :as i]
|
||||
[rumext.core :as mx :include-macros true]
|
||||
[uxbox.util.i18n :refer (tr)]
|
||||
[uxbox.util.dom :as dom]
|
||||
[uxbox.main.ui.lightbox :as lbx]))
|
||||
|
||||
|
@ -24,17 +25,17 @@
|
|||
(when on-cancel
|
||||
(on-cancel (dissoc ctx :on-accept :on-cancel))))]
|
||||
[:div.lightbox-body.confirm-dialog
|
||||
[:h3 "Are you sure?"]
|
||||
[:h3 (tr "ds.confirm-title")]
|
||||
(if hint
|
||||
[:span hint])
|
||||
[:div.row-flex
|
||||
[:input.btn-success.btn-small
|
||||
{:type "button"
|
||||
:value "Ok"
|
||||
:value (tr "ds.confirm-ok")
|
||||
:on-click accept}]
|
||||
[:input.btn-delete.btn-small
|
||||
{:type "button"
|
||||
:value "Cancel"
|
||||
:value (tr "ds.confirm-cancel")
|
||||
:on-click cancel}]]
|
||||
[:a.close {:href "#"
|
||||
:on-click #(do (dom/prevent-default %)
|
||||
|
|
|
@ -137,7 +137,7 @@
|
|||
[:ul.library-elements {}
|
||||
(when own?
|
||||
[:li {}
|
||||
[:a.btn-primary {:on-click #(st/emit! (dc/create-collection))} "+ New library"]])
|
||||
[:a.btn-primary {:on-click #(st/emit! (dc/create-collection))} (tr "ds.colors-collection.new")]])
|
||||
(mx/doseq [{:keys [id] :as coll} colls]
|
||||
(let [selected? (= (:id coll) selected)]
|
||||
(-> (nav-item coll selected?)
|
||||
|
@ -161,10 +161,10 @@
|
|||
[:ul.library-tabs {}
|
||||
[:li {:class-name (when (= type :own) "current")
|
||||
:on-click (partial select-tab :own)}
|
||||
"YOUR COLORS"]
|
||||
(tr "ds.your-colors-title")]
|
||||
[:li {:class-name (when (= type :builtin) "current")
|
||||
:on-click (partial select-tab :builtin)}
|
||||
"COLORS STORE"]]
|
||||
(tr "ds.store-colors-title")]]
|
||||
(nav-section type id colls)]]))
|
||||
|
||||
;; --- Grid
|
||||
|
@ -172,7 +172,7 @@
|
|||
(mx/defc grid-form
|
||||
[coll-id]
|
||||
[:div.grid-item.small-item.add-project {:on-click #(udl/open! :color-form {:coll coll-id})}
|
||||
[:span {} "+ New color"]])
|
||||
[:span {} (tr "ds.color-new")]])
|
||||
|
||||
(mx/defc grid-options-tooltip
|
||||
{:mixins [mx/reactive mx/static]}
|
||||
|
@ -225,22 +225,22 @@
|
|||
;; if editable
|
||||
[:div.multiselect-nav {}
|
||||
[:span.move-item.tooltip.tooltip-top
|
||||
{:on-click on-toggle-copy :alt "Copy"}
|
||||
{:on-click on-toggle-copy :alt (tr "ds.multiselect-bar.copy")}
|
||||
(when (:show-copy-tooltip @local)
|
||||
(grid-options-tooltip :selected id
|
||||
:title "Copy to library"
|
||||
:title (tr "ds.multiselect-bar.copy-to-library")
|
||||
:on-select on-copy))
|
||||
|
||||
i/copy]
|
||||
[:span.move-item.tooltip.tooltip-top
|
||||
{:on-click on-toggle-move :alt "Move"}
|
||||
{:on-click on-toggle-move :alt (tr "ds.multiselect-bar.move")}
|
||||
(when (:show-move-tooltip @local)
|
||||
(grid-options-tooltip :selected id
|
||||
:title "Move to library"
|
||||
:title (tr "ds.multiselect-bar.move-to-library")
|
||||
:on-select on-move))
|
||||
i/move]
|
||||
[:span.delete.tooltip.tooltip-top
|
||||
{:alt "Delete"
|
||||
{:alt (tr "ds.multiselect-bar.delete")
|
||||
:on-click on-delete}
|
||||
i/trash]]
|
||||
|
||||
|
@ -250,7 +250,7 @@
|
|||
{:on-click on-toggle-copy}
|
||||
(when (:show-copy-tooltip @local)
|
||||
(grid-options-tooltip :selected id
|
||||
:title "Copy to library"
|
||||
:title (tr "ds.multiselect-bar.copy-to-library")
|
||||
:on-select on-copy))
|
||||
i/organize]])]))
|
||||
|
||||
|
@ -342,14 +342,14 @@
|
|||
(on-close [event]
|
||||
(udl/close!))]
|
||||
[:div.lightbox-body {}
|
||||
[:h3 {} "New color"]
|
||||
[:h3 {} (tr "ds.color-lightbox.title")]
|
||||
[:form {}
|
||||
[:div.row-flex.center {}
|
||||
(colorpicker
|
||||
:value (or (:hex @local) color "#00ccff")
|
||||
:on-change #(swap! local assoc :hex %))]
|
||||
|
||||
[:input#project-btn.btn-primary {:value "+ Add color"
|
||||
[:input#project-btn.btn-primary {:value (tr "ds.color-lightbox.add")
|
||||
:on-click on-submit
|
||||
:type "button"}]]
|
||||
[:a.close {:on-click on-close} i/close]]))
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
;; --- Helpers & Constants
|
||||
|
||||
(def +ordering-options+
|
||||
{:name "ds.project-ordering.by-name"
|
||||
:created "ds.project-ordering.by-creation-date"})
|
||||
{:name "ds.ordering.by-name"
|
||||
:created "ds.ordering.by-creation-date"})
|
||||
|
||||
(defn- sort-icons-by
|
||||
[ordering icons]
|
||||
|
@ -181,7 +181,7 @@
|
|||
[:li {}
|
||||
[:a.btn-primary
|
||||
{:on-click #(st/emit! (di/create-collection))}
|
||||
"+ New collection"]])
|
||||
(tr "ds.icons-collection.new")]])
|
||||
(when own?
|
||||
(nav-item nil (nil? selected)))
|
||||
(mx/doseq [coll colls]
|
||||
|
@ -206,10 +206,10 @@
|
|||
[:ul.library-tabs {}
|
||||
[:li {:class-name (when own? "current")
|
||||
:on-click (partial select-tab :own)}
|
||||
"YOUR ICONS"]
|
||||
(tr "ds.your-icons-title")]
|
||||
[:li {:class-name (when builtin? "current")
|
||||
:on-click (partial select-tab :builtin)}
|
||||
"ICONS STORE"]]
|
||||
(tr "ds.store-icons-title")]]
|
||||
|
||||
(nav-section type id colls)]])))
|
||||
|
||||
|
@ -224,7 +224,7 @@
|
|||
(let [files (dom/get-event-files event)]
|
||||
(st/emit! (di/create-icons coll-id files))))]
|
||||
[:div.grid-item.small-item.add-project {:on-click forward-click}
|
||||
[:span {} "+ New icon"]
|
||||
[:span {} (tr "ds.icon.new")]
|
||||
[:input.upload-image-input
|
||||
{:style {:display "none"}
|
||||
:multiple true
|
||||
|
@ -288,26 +288,26 @@
|
|||
(if editable?
|
||||
[:div.multiselect-nav {}
|
||||
[:span.move-item.tooltip.tooltip-top
|
||||
{:on-click on-toggle-copy :alt "Copy"}
|
||||
{:on-click on-toggle-copy :alt (tr "ds.multiselect-bar.copy")}
|
||||
(when (:show-copy-tooltip @local)
|
||||
(grid-options-tooltip :selected id
|
||||
:title "Copy to library"
|
||||
:title (tr "ds.multiselect-bar.copy-to-library")
|
||||
:on-select on-copy))
|
||||
i/copy]
|
||||
[:span.move-item.tooltip.tooltip-top
|
||||
{:on-click on-toggle-move :alt "Move"}
|
||||
{:on-click on-toggle-move :alt (tr "ds.multiselect-bar.move")}
|
||||
(when (:show-move-tooltip @local)
|
||||
(grid-options-tooltip :selected id
|
||||
:title "Move to library"
|
||||
:title (tr "ds.multiselect-bar.move-to-library")
|
||||
:on-select on-move))
|
||||
i/move]
|
||||
(when (= 1 (count selected))
|
||||
[:span.move-item.tooltip.tooltip-top
|
||||
{:alt "Rename"
|
||||
{:alt (tr "ds.multiselect-bar.rename")
|
||||
:on-click on-rename}
|
||||
i/pencil])
|
||||
[:span.delete.tooltip.tooltip-top
|
||||
{:alt "Delete"
|
||||
{:alt (tr "ds.multiselect-bar.delete")
|
||||
:on-click on-delete}
|
||||
i/trash]]
|
||||
[:div.multiselect-nav
|
||||
|
@ -315,7 +315,7 @@
|
|||
{:on-click on-toggle-copy}
|
||||
(when (:show-copy-tooltip @local)
|
||||
(grid-options-tooltip :selected id
|
||||
:title "Copy to library"
|
||||
:title (tr "ds.multiselect-bar.copy-to-library")
|
||||
:on-select on-copy))
|
||||
i/organize]])])))
|
||||
|
||||
|
@ -364,7 +364,7 @@
|
|||
:default-value (:name icon)}]
|
||||
[:h3 {:on-double-click on-edit}
|
||||
(:name icon)])
|
||||
(str "Uploaded at " (dt/format created-at "L"))]]))
|
||||
(str (tr "ds.uploaded-at" (dt/format created-at "L")))]]))
|
||||
|
||||
(mx/defc grid
|
||||
{:mixins [mx/static mx/reactive]}
|
||||
|
@ -421,7 +421,7 @@
|
|||
|
||||
;; Sorting
|
||||
[:div {}
|
||||
[:span {} (tr "ds.project-ordering")]
|
||||
[:span {} (tr "ds.ordering")]
|
||||
[:select.input-select
|
||||
{:on-change on-ordering-change
|
||||
:value (pr-str ordering)}
|
||||
|
@ -435,7 +435,7 @@
|
|||
:type "text"
|
||||
:on-change on-term-change
|
||||
:auto-focus true
|
||||
:placeholder (tr "ds.project-search.placeholder")
|
||||
:placeholder (tr "ds.search.placeholder")
|
||||
:value (or filtering "")}]
|
||||
[:div.clear-search {:on-click on-clear} i/close]]]])))
|
||||
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
;; --- Helpers & Constants
|
||||
|
||||
(def +ordering-options+
|
||||
{:name "ds.project-ordering.by-name"
|
||||
:created "ds.project-ordering.by-creation-date"})
|
||||
{:name "ds.ordering.by-name"
|
||||
:created "ds.ordering.by-creation-date"})
|
||||
|
||||
(defn- sort-images-by
|
||||
[ordering images]
|
||||
|
@ -176,7 +176,7 @@
|
|||
[:li {}
|
||||
[:a.btn-primary
|
||||
{:on-click #(st/emit! (di/create-collection))}
|
||||
"+ New library"]])
|
||||
(tr "ds.images-collection.new")]])
|
||||
(when own?
|
||||
(nav-item nil (nil? selected)))
|
||||
(mx/doseq [coll collections]
|
||||
|
@ -205,10 +205,10 @@
|
|||
[:ul.library-tabs {}
|
||||
[:li {:class-name (when own? "current")
|
||||
:on-click (partial select-tab :own)}
|
||||
"YOUR IMAGES"]
|
||||
(tr "ds.your-images-title")]
|
||||
[:li {:class-name (when builtin? "current")
|
||||
:on-click (partial select-tab :builtin)}
|
||||
"IMAGES STORE"]]
|
||||
(tr "ds.store-images-title")]]
|
||||
|
||||
(nav-section type id colls)]])))
|
||||
|
||||
|
@ -227,7 +227,7 @@
|
|||
[:div.grid-item.add-project {:on-click forward-click}
|
||||
(if uploading?
|
||||
[:div {} ^:inline i/loader-pencil]
|
||||
[:span {} "+ New image"])
|
||||
[:span {} (tr "ds.image-new")])
|
||||
[:input.upload-image-input
|
||||
{:style {:display "none"}
|
||||
:multiple true
|
||||
|
@ -290,26 +290,26 @@
|
|||
;; If editable
|
||||
[:div.multiselect-nav {}
|
||||
[:span.move-item.tooltip.tooltip-top
|
||||
{:on-click on-toggle-copy :alt "Copy"}
|
||||
{:on-click on-toggle-copy :alt (tr "ds.multiselect-bar.copy")}
|
||||
(when (:show-copy-tooltip @local)
|
||||
(grid-options-tooltip :selected id
|
||||
:title "Copy to library"
|
||||
:title (tr "ds.multiselect-bar.copy-to-library")
|
||||
:on-select on-copy))
|
||||
^:inline i/copy]
|
||||
[:span.move-item.tooltip.tooltip-top
|
||||
{:on-click on-toggle-move :alt "Move"}
|
||||
{:on-click on-toggle-move :alt (tr "ds.multiselect-bar.move")}
|
||||
(when (:show-move-tooltip @local)
|
||||
(grid-options-tooltip :selected id
|
||||
:title "Move to library"
|
||||
:title (tr "ds.multiselect-bar.move-to-library")
|
||||
:on-select on-move))
|
||||
^:inline i/move]
|
||||
(when (= 1 (count selected))
|
||||
[:span.move-item.tooltip.tooltip-top
|
||||
{:alt "Rename"
|
||||
{:alt (tr "ds.multiselect-bar.rename")
|
||||
:on-click on-rename}
|
||||
^:inline i/pencil])
|
||||
[:span.delete.tooltip.tooltip-top
|
||||
{:alt "Delete"
|
||||
{:alt (tr "ds.multiselect-bar.delete")
|
||||
:on-click on-delete}
|
||||
^:inline i/trash]]
|
||||
|
||||
|
@ -319,7 +319,7 @@
|
|||
{:on-click on-toggle-copy}
|
||||
(when (:show-copy-tooltip @local)
|
||||
(grid-options-tooltip :selected id
|
||||
:title "Copy to library"
|
||||
:title (tr "ds.multiselect-bar.copy-to-library")
|
||||
:on-select on-copy))
|
||||
^:inline i/organize]])]))
|
||||
|
||||
|
@ -358,7 +358,7 @@
|
|||
:on-click on-edit
|
||||
:default-value (:name image)}]
|
||||
[:h3 {:on-double-click on-edit} (:name image)])
|
||||
[:span.date {} (str "Uploaded at " (dt/format created-at "L"))]]]))
|
||||
[:span.date {} (str (tr "ds.uploaded-at" (dt/format created-at "L")))]]]))
|
||||
|
||||
(mx/defc grid
|
||||
{:mixins [mx/static mx/reactive]}
|
||||
|
@ -417,7 +417,7 @@
|
|||
|
||||
;; Sorting
|
||||
[:div {}
|
||||
[:span {} (tr "ds.project-ordering")]
|
||||
[:span {} (tr "ds.ordering")]
|
||||
[:select.input-select {:on-change on-ordering-change
|
||||
:value (pr-str ordering)}
|
||||
(mx/doseq [[key value] (seq +ordering-options+)]
|
||||
|
@ -430,7 +430,7 @@
|
|||
:type "text"
|
||||
:on-change on-term-change
|
||||
:auto-focus true
|
||||
:placeholder (tr "ds.project-search.placeholder")
|
||||
:placeholder (tr "ds.search.placeholder")
|
||||
:value (or filtering "")}]
|
||||
[:div.clear-search {:on-click on-clear} i/close]]]])))
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
;; --- Helpers & Constants
|
||||
|
||||
(def +ordering-options+
|
||||
{:name "ds.project-ordering.by-name"
|
||||
:created "ds.project-ordering.by-creation-date"})
|
||||
{:name "ds.ordering.by-name"
|
||||
:created "ds.ordering.by-creation-date"})
|
||||
|
||||
;; --- Refs
|
||||
|
||||
|
@ -97,7 +97,7 @@
|
|||
|
||||
;; Sorting
|
||||
[:div {}
|
||||
[:span {} (tr "ds.project-ordering")]
|
||||
[:span {} (tr "ds.ordering")]
|
||||
[:select.input-select
|
||||
{:on-change on-ordering-change
|
||||
:value (pr-str ordering)}
|
||||
|
@ -111,7 +111,7 @@
|
|||
:type "text"
|
||||
:on-change on-term-change
|
||||
:auto-focus true
|
||||
:placeholder (tr "ds.project-search.placeholder")
|
||||
:placeholder (tr "ds.search.placeholder")
|
||||
:value (or filtering "")}]
|
||||
[:div.clear-search {:on-click on-clear} i/close]]]])))
|
||||
|
||||
|
@ -216,12 +216,12 @@
|
|||
(dom/prevent-default e)
|
||||
(udl/open! :create-project))]
|
||||
[:section.dashboard-grid {}
|
||||
[:h2 {} "Your projects"]
|
||||
[:h2 {} (tr "ds.project-title")]
|
||||
[:div.dashboard-grid-content {}
|
||||
[:div.dashboard-grid-row {}
|
||||
[:div.grid-item.add-project
|
||||
{:on-click on-click}
|
||||
[:span {} "+ New project"]]
|
||||
[:span {} (tr "ds.project-new")]]
|
||||
(mx/doseq [item projects]
|
||||
(-> (grid-item item)
|
||||
(mx/with-key (:id item))))]]])))
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
[potok.core :as ptk]
|
||||
[uxbox.builtins.icons :as i]
|
||||
[rumext.core :as mx :include-macros true]
|
||||
[uxbox.util.i18n :refer [tr]]
|
||||
[uxbox.util.dom :as dom]
|
||||
[uxbox.main.ui.settings.header :refer (header)]))
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
(on-error [{:keys [code] :as payload}]
|
||||
(case code
|
||||
:uxbox.services.users/old-password-not-match
|
||||
(st/emit! (assoc-error :password-old "Wrong old password"))
|
||||
(st/emit! (assoc-error :password-old (tr "settings.wrong-old-password")))
|
||||
|
||||
:else
|
||||
(throw (ex-info "unexpected" {:error payload}))))
|
||||
|
@ -62,34 +62,34 @@
|
|||
:on-success on-success
|
||||
:on-error on-error)))]
|
||||
[:form.password-form
|
||||
[:span.user-settings-label "Change password"]
|
||||
[:span.user-settings-label (tr "settings.change-password")]
|
||||
[:input.input-text
|
||||
{:type "password"
|
||||
:class (fm/error-class errors :password-old)
|
||||
:value (:password-old data "")
|
||||
:on-change (partial on-change :password-old)
|
||||
:placeholder "Old password"}]
|
||||
:placeholder (tr "settings.old-password")}]
|
||||
(fm/input-error errors :password-old)
|
||||
[:input.input-text
|
||||
{:type "password"
|
||||
:class (fm/error-class errors :password-1)
|
||||
:value (:password-1 data "")
|
||||
:on-change (partial on-change :password-1)
|
||||
:placeholder "New password"}]
|
||||
:placeholder (tr "settings.new-password")}]
|
||||
(fm/input-error errors :password-1)
|
||||
[:input.input-text
|
||||
{:type "password"
|
||||
:class (fm/error-class errors :password-2)
|
||||
:value (:password-2 data "")
|
||||
:on-change (partial on-change :password-2)
|
||||
:placeholder "Confirm password"}]
|
||||
:placeholder (tr "settings.confirm-password")}]
|
||||
(fm/input-error errors :password-2)
|
||||
[:input.btn-primary
|
||||
{:type "button"
|
||||
:class (when-not valid? "btn-disabled")
|
||||
:disabled (not valid?)
|
||||
:on-click on-submit
|
||||
:value "Update settings"}]])))
|
||||
:value (tr "settings.update-settings")}]])))
|
||||
|
||||
;; --- Password Page
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
[uxbox.main.ui.settings.header :refer [header]]
|
||||
[uxbox.main.ui.messages :refer [messages-widget]]
|
||||
[uxbox.main.data.users :as udu]
|
||||
[uxbox.util.i18n :refer [tr]]
|
||||
[uxbox.util.forms :as fm]
|
||||
[uxbox.util.router :as r]
|
||||
[rumext.core :as mx :include-macros true]
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
[uxbox.main.data.lightbox :as udl]
|
||||
[uxbox.builtins.icons :as i]
|
||||
[uxbox.main.ui.navigation :as nav]
|
||||
[uxbox.util.i18n :refer (tr)]
|
||||
[uxbox.util.router :as rt]
|
||||
[rumext.core :as mx :include-macros true]))
|
||||
|
||||
|
@ -24,16 +25,16 @@
|
|||
[:ul.dropdown {:class (when-not open? "hide")}
|
||||
[:li {:on-click #(st/emit! (rt/navigate :settings/profile))}
|
||||
i/user
|
||||
[:span "Profile"]]
|
||||
[:span (tr "ds.user.profile")]]
|
||||
[:li {:on-click #(st/emit! (rt/navigate :settings/password))}
|
||||
i/lock
|
||||
[:span "Password"]]
|
||||
[:span (tr "ds.user.password")]]
|
||||
[:li {:on-click #(st/emit! (rt/navigate :settings/notifications))}
|
||||
i/mail
|
||||
[:span "Notifications"]]
|
||||
[:span (tr "ds.user.notifications")]]
|
||||
[:li {:on-click #(st/emit! (da/logout))}
|
||||
i/exit
|
||||
[:span "Exit"]]])
|
||||
[:span (tr "ds.user.exit")]]])
|
||||
|
||||
;; --- User Widget
|
||||
|
||||
|
@ -49,7 +50,8 @@
|
|||
photo (if (str/empty? (:photo profile ""))
|
||||
"/images/avatar.jpg"
|
||||
(:photo profile))]
|
||||
[:div.user-zone {:on-mouse-enter #(swap! local assoc :open true)
|
||||
[:div.user-zone {:on-click #(st/emit! (rt/navigate :settings/profile))
|
||||
:on-mouse-enter #(swap! local assoc :open true)
|
||||
:on-mouse-leave #(swap! local assoc :open false)}
|
||||
[:span (:fullname profile)]
|
||||
[:img {:src photo}]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue