0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-12 07:41:43 -05:00

Merge pull request #5359 from penpot/alotor-fixes-2

🐛 Fix problem with scroll in history versions
This commit is contained in:
Andrey Antukh 2024-11-25 11:23:47 +01:00 committed by GitHub
commit 9506606e15
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 60 additions and 11 deletions

View file

@ -24,6 +24,7 @@
[app.main.data.workspace.libraries :as dwl] [app.main.data.workspace.libraries :as dwl]
[app.main.data.workspace.shortcuts :as sc] [app.main.data.workspace.shortcuts :as sc]
[app.main.data.workspace.undo :as dwu] [app.main.data.workspace.undo :as dwu]
[app.main.data.workspace.versions :as dwv]
[app.main.features :as features] [app.main.features :as features]
[app.main.refs :as refs] [app.main.refs :as refs]
[app.main.store :as st] [app.main.store :as st]
@ -537,6 +538,19 @@
(when (kbd/enter? event) (when (kbd/enter? event)
(on-show-version-history event)))) (on-show-version-history event))))
on-pin-version
(mf/use-fn
(mf/deps file-id)
(fn [_]
(st/emit! (dwv/create-version file-id))))
on-pin-version-key-down
(mf/use-fn
(mf/deps on-pin-version)
(fn [event]
(when (kbd/enter? event)
(on-pin-version event))))
on-export-shapes on-export-shapes
(mf/use-fn #(st/emit! (de/show-workspace-export-dialog {:origin "workspace:menu"}))) (mf/use-fn #(st/emit! (de/show-workspace-export-dialog {:origin "workspace:menu"})))
@ -599,6 +613,15 @@
[:span {:class (stl/css :item-name)} [:span {:class (stl/css :item-name)}
(tr "dashboard.add-shared")]])) (tr "dashboard.add-shared")]]))
[:div {:class (stl/css :separator)}]
[:> dropdown-menu-item* {:class (stl/css :submenu-item)
:on-click on-pin-version
:on-key-down on-pin-version-key-down
:id "file-menu-show-version-history"}
[:span {:class (stl/css :item-name)}
(tr "dashboard.create-version-menu")]]
[:> dropdown-menu-item* {:class (stl/css :submenu-item) [:> dropdown-menu-item* {:class (stl/css :submenu-item)
:on-click on-show-version-history :on-click on-show-version-history
:on-key-down on-show-version-history-key-down :on-key-down on-show-version-history-key-down
@ -606,6 +629,8 @@
[:span {:class (stl/css :item-name)} [:span {:class (stl/css :item-name)}
(tr "dashboard.show-version-history")]] (tr "dashboard.show-version-history")]]
[:div {:class (stl/css :separator)}]
[:> dropdown-menu-item* {:class (stl/css :submenu-item) [:> dropdown-menu-item* {:class (stl/css :submenu-item)
:on-click on-export-shapes :on-click on-export-shapes
:on-key-down on-export-shapes-key-down :on-key-down on-export-shapes-key-down

View file

@ -43,9 +43,12 @@
} }
.separator { .separator {
margin-top: $s-8; border-top: $s-1 solid var(--color-background-quaternary);
height: $s-4; height: $s-4;
border-top: $s-1 solid var(--color-background-secondary); left: calc(-1 * $s-4);
margin-top: $s-8;
position: relative;
width: calc(100% + $s-8);
} }
.shortcut { .shortcut {

View file

@ -237,15 +237,11 @@
[:& comments-sidebar] [:& comments-sidebar]
(true? is-history?) (true? is-history?)
[:> tab-switcher* {:tabs #js [#js {:label "History" :id "history" :content versions-tab} [:> tab-switcher*
#js {:label "Actions" :id "actions" :content history-tab}] {:tabs #js [#js {:label (tr "workspace.versions.tab.history") :id "history" :content versions-tab}
#js {:label (tr "workspace.versions.tab.actions") :id "actions" :content history-tab}]
:default-selected "history" :default-selected "history"
;;:selected (name section) :class (stl/css :left-sidebar-tabs)}]
;;:on-change-tab on-tab-change
:class (stl/css :left-sidebar-tabs)
;;:action-button-position "start"
;;:action-button (mf/html [:& collapse-button {:on-click handle-collapse}])
}]
:else :else
[:> options-toolbox props])]]])) [:> options-toolbox props])]]]))

View file

@ -113,4 +113,5 @@ $width-settings-bar-max: $s-500;
.versions-tab { .versions-tab {
width: 100%; width: 100%;
overflow: hidden; overflow: hidden;
height: calc(100vh - $s-88);
} }

View file

@ -8,6 +8,10 @@
.version-toolbox { .version-toolbox {
padding: $s-8; padding: $s-8;
height: 100%;
display: grid;
overflow: hidden;
grid-template-rows: auto auto 1fr;
} }
.versions-entry-empty { .versions-entry-empty {
@ -49,6 +53,8 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: $s-6; gap: $s-6;
overflow: auto;
margin: 0;
} }
.version-entry { .version-entry {

View file

@ -400,6 +400,9 @@ msgstr "Add as Shared Library"
msgid "dashboard.show-version-history" msgid "dashboard.show-version-history"
msgstr "Version history" msgstr "Version history"
msgid "dashboard.create-version-menu"
msgstr "Pin this version"
#: src/app/main/ui/settings/profile.cljs:72 #: src/app/main/ui/settings/profile.cljs:72
msgid "dashboard.change-email" msgid "dashboard.change-email"
msgstr "Change email" msgstr "Change email"
@ -6565,3 +6568,9 @@ msgstr "Open version menu"
#, unused #, unused
msgid "workspace.viewport.click-to-close-path" msgid "workspace.viewport.click-to-close-path"
msgstr "Click to close the path" msgstr "Click to close the path"
msgid "workspace.versions.tab.history"
msgstr "History"
msgid "workspace.versions.tab.actions"
msgstr "Actions"

View file

@ -402,6 +402,9 @@ msgstr "Añadir como Biblioteca Compartida"
msgid "dashboard.show-version-history" msgid "dashboard.show-version-history"
msgstr "Histórico de versiones" msgstr "Histórico de versiones"
msgid "dashboard.create-version-menu"
msgstr "Guardar esta versión"
#: src/app/main/ui/settings/profile.cljs:72 #: src/app/main/ui/settings/profile.cljs:72
msgid "dashboard.change-email" msgid "dashboard.change-email"
msgstr "Cambiar correo" msgstr "Cambiar correo"
@ -6560,3 +6563,9 @@ msgstr "Abrir menu de versiones"
#, unused #, unused
msgid "workspace.viewport.click-to-close-path" msgid "workspace.viewport.click-to-close-path"
msgstr "Pulsar para cerrar la ruta" msgstr "Pulsar para cerrar la ruta"
msgid "workspace.versions.tab.history"
msgstr "Histórico"
msgid "workspace.versions.tab.actions"
msgstr "Acciones"