Compare commits

..

12 Commits

Author SHA1 Message Date
Andrey Antukh
59050a7bc6 📎 Backport frontend/package.json changes
Mainly for compatibility with the upcoming devenv changes
2024-11-04 16:16:28 +01:00
Andrey Antukh
3334fb0e99 🐛 Add migration to fix invalid pages 2024-11-04 15:34:09 +01:00
Andrey Antukh
24268bbf33 Merge pull request #5248 from penpot/palba-add-event-for-add-frame
 Add event for add-frame
2024-11-04 14:25:19 +01:00
Pablo Alba
cd3f8f0c43 Add event for add-frame 2024-11-04 12:56:34 +01:00
Andrey Antukh
d3a8954605 Merge pull request #5247 from penpot/alotor-fix-plugin-problem
🐛 Fix problem with plugins path positioning
2024-11-04 12:16:25 +01:00
alonso.torres
1cda61e230 🐛 Fix problem with plugins path positioning 2024-11-04 11:02:04 +01:00
Alejandro
aca3e3db4f Merge pull request #5237 from penpot/niwinz-hotfix-2
🐛 Fix incorrect thumbnail lookup on dashboard project view
2024-10-31 16:12:22 +01:00
Andrey Antukh
74f9166f3d Merge pull request #5238 from penpot/bameda-manage-build-docs-bundle
🎉 add command to build docs bundle
2024-10-30 23:15:22 +01:00
David Barragán Merino
977a2090fb 🎉 add command to build docs bundle 2024-10-30 19:17:04 +01:00
Andrey Antukh
14e6ea9393 Merge pull request #5236 from penpot/palba-testab-templates-link2
🎉 Add test A/B for add a link to the libraries page
2024-10-30 16:44:17 +01:00
Andrey Antukh
3eb35f0aa6 🐛 Fix incorrect thumbnail lookup on dashboard project view
That causes a repeated generation of thumbnails on each page
view instead of reusing already generated thumbnails.
2024-10-30 16:19:16 +01:00
Pablo Alba
92b7a35c58 🎉 Add test A/B for add a link to the libraries page 2024-10-30 16:13:05 +01:00
14 changed files with 122 additions and 23 deletions

View File

@@ -356,7 +356,7 @@
f.name,
f.revn,
f.is_shared,
ft.media_id
ft.media_id AS thumbnail_id
from file as f
left join file_thumbnail as ft on (ft.file_id = f.id
and ft.revn = f.revn
@@ -367,13 +367,7 @@
(defn get-project-files
[conn project-id]
(->> (db/exec! conn [sql:project-files project-id])
(mapv (fn [row]
(if-let [media-id (:media-id row)]
(-> row
(dissoc :media-id)
(assoc :thumbnail-uri (resolve-public-uri media-id)))
(dissoc row :media-id))))))
(db/exec! conn [sql:project-files project-id]))
(def schema:get-project-files
[:map {:title "get-project-files"}

View File

@@ -467,7 +467,7 @@
#?(:clj (validate-shapes! data result items))
result))))
;; DEPRECATED: remove before 2.3 release
;; DEPRECATED: remove after 2.3 release
(defmethod process-change :set-option
[data _]
data)

View File

@@ -6,4 +6,4 @@
(ns app.common.files.defaults)
(def version 56)
(def version 57)

View File

@@ -13,6 +13,7 @@
[app.common.files.defaults :as cfd]
[app.common.files.helpers :as cfh]
[app.common.geom.matrix :as gmt]
[app.common.geom.point :as gpt]
[app.common.geom.rect :as grc]
[app.common.geom.shapes :as gsh]
[app.common.geom.shapes.path :as gsp]
@@ -1102,6 +1103,33 @@
(update :pages-index update-vals update-container)
(update :components update-vals update-container))))
(defn migrate-up-57
[data]
(letfn [(fix-thread-positions [positions]
(reduce-kv (fn [result id {:keys [position] :as data}]
(let [data (cond
(gpt/point? position)
data
(and (map? position)
(gpt/valid-point-attrs? position))
(assoc data :position (gpt/point position))
:else
(assoc data :position (gpt/point 0 0)))]
(assoc result id data)))
positions
positions))
(update-page [page]
(d/update-when page :comment-thread-positions fix-thread-positions))]
(-> data
(update :pages (fn [pages] (into [] (remove nil?) pages)))
(update :pages-index dissoc nil)
(update :pages-index update-vals update-page))))
(def migrations
"A vector of all applicable migrations"
[{:id 2 :migrate-up migrate-up-2}
@@ -1149,4 +1177,6 @@
{:id 53 :migrate-up migrate-up-26}
{:id 54 :migrate-up migrate-up-54}
{:id 55 :migrate-up migrate-up-55}
{:id 56 :migrate-up migrate-up-56}])
{:id 56 :migrate-up migrate-up-56}
{:id 57 :migrate-up migrate-up-57}])

View File

@@ -56,6 +56,9 @@
[:x ::sm/safe-number]
[:y ::sm/safe-number]])
(def valid-point-attrs?
(sm/validator schema:point-attrs))
(def valid-point?
(sm/validator
[:and [:fn point?] schema:point-attrs]))

View File

@@ -38,6 +38,7 @@
"translations": "node ./scripts/translations.js",
"watch": "yarn run watch:app:assets",
"watch:app:assets": "node ./scripts/watch.js",
"watch:app": "clojure -M:dev:shadow-cljs watch main",
"watch:storybook": "concurrently \"clojure -M:dev:shadow-cljs watch storybook\" \"storybook dev -p 6006 --no-open\" \"yarn run watch:storybook:assets\"",
"watch:storybook:assets": "node ./scripts/watch-storybook.js"
},

View File

@@ -18,6 +18,7 @@
[app.common.types.shape-tree :as ctst]
[app.main.data.changes :as dch]
[app.main.data.comments :as dc]
[app.main.data.events :as ev]
[app.main.data.workspace.edition :as dwe]
[app.main.data.workspace.selection :as dws]
[app.main.data.workspace.state-helpers :as wsh]
@@ -129,7 +130,9 @@
(dwu/commit-undo-transaction undo-id))
(when (cfh/text-shape? shape)
(->> (rx/of (dwe/start-edition-mode (:id shape)))
(rx/observe-on :async)))))))))
(rx/observe-on :async)))
(when (cfh/frame-shape? shape)
(rx/of (ptk/event ::ev/event {::ev/name "add-frame"})))))))))
(defn move-shapes-into-frame
[frame-id shapes]

View File

@@ -14,6 +14,7 @@
[app.common.types.file :as ctf]
[app.common.types.typographies-list :as ctyl]
[app.common.uuid :as uuid]
[app.config :as cf]
[app.main.data.modal :as modal]
[app.main.data.users :as du]
[app.main.data.workspace.colors :as mdc]
@@ -293,7 +294,14 @@
[:*
[:span {:class (stl/css :empty-state-icon)}
library-icon]
(tr "workspace.libraries.no-shared-libraries-available")]
(tr "workspace.libraries.no-shared-libraries-available")
(when (cf/external-feature-flag "templates-01" "test")
[:div {:class (stl/css :templates-info)}
(tr "workspace.libraries.more-templates")
[:a {:target "_blank"
:class (stl/css :templates-info-link)
:href "https://penpot.app/libraries-templates"}
(tr "workspace.libraries.more-templates-link")]])]
:else
(tr "workspace.libraries.no-matches-for" search-term))]))]]))

View File

@@ -323,3 +323,13 @@
@include headlineSmallTypography;
padding: $s-0 $s-16;
}
.templates-info {
color: var(--color-accent-primary);
}
.templates-info-link {
color: var(--color-accent-primary);
text-decoration: underline;
font-weight: $fw400;
}

View File

@@ -952,7 +952,7 @@
;; Geometry properties
{:name "x"
:get #(-> % u/proxy->shape :x)
:get #(-> % u/proxy->shape :points grc/points->rect :x)
:set
(fn [self value]
(let [id (obj/get self "$id")]
@@ -967,7 +967,7 @@
(st/emit! (dw/update-position id {:x value})))))}
{:name "y"
:get #(-> % u/proxy->shape :y)
:get #(-> % u/proxy->shape :points grc/points->rect :y)
:set
(fn [self value]
(let [id (obj/get self "$id")]
@@ -991,9 +991,10 @@
{:name "parentX"
:get (fn [self]
(let [shape (u/proxy->shape self)
shape-x (-> shape :points grc/points->rect :x)
parent-id (:parent-id shape)
parent (u/locate-shape (obj/get self "$file") (obj/get self "$page") parent-id)]
(- (:x shape) (:x parent))))
(- shape-x (:x parent))))
:set
(fn [self value]
(cond
@@ -1013,10 +1014,11 @@
{:name "parentY"
:get (fn [self]
(let [shape (u/proxy->shape self)
shape-y (-> shape :points grc/points->rect :y)
parent-id (:parent-id shape)
parent (u/locate-shape (obj/get self "$file") (obj/get self "$page") parent-id)
parent-y (:y parent)]
(- (:y shape) parent-y)))
(- shape-y parent-y)))
:set
(fn [self value]
(cond
@@ -1036,10 +1038,11 @@
{:name "boardX"
:get (fn [self]
(let [shape (u/proxy->shape self)
shape-x (-> shape :points grc/points->rect :x)
frame-id (:parent-id shape)
frame (u/locate-shape (obj/get self "$file") (obj/get self "$page") frame-id)
frame-x (:x frame)]
(- (:x shape) frame-x)))
(- shape-x frame-x)))
:set
(fn [self value]
(cond
@@ -1059,10 +1062,11 @@
{:name "boardY"
:get (fn [self]
(let [shape (u/proxy->shape self)
shape-y (-> shape :points grc/points->rect :y)
frame-id (:parent-id shape)
frame (u/locate-shape (obj/get self "$file") (obj/get self "$page") frame-id)
frame-y (:y frame)]
(- (:y shape) frame-y)))
(- shape-y frame-y)))
:set
(fn [self value]
(cond
@@ -1080,10 +1084,10 @@
(st/emit! (dw/update-position id {:y (+ frame-y value)})))))}
{:name "width"
:get #(-> % u/proxy->shape :width)}
:get #(-> % u/proxy->shape :selrect :width)}
{:name "height"
:get #(-> % u/proxy->shape :height)}
:get #(-> % u/proxy->shape :selrect :height)}
{:name "bounds"
:get #(-> % u/proxy->shape :points grc/points->rect format/format-bounds)}

View File

@@ -4415,6 +4415,14 @@ msgstr "No matches found for “%s“"
msgid "workspace.libraries.no-shared-libraries-available"
msgstr "There are no Shared Libraries available"
#: src/app/main/ui/workspace/libraries.cljs:297
msgid "workspace.libraries.more-templates"
msgstr "You can look for "
#: src/app/main/ui/workspace/libraries.cljs:297
msgid "workspace.libraries.more-templates-link"
msgstr "more templates in here"
#: src/app/main/ui/workspace/libraries.cljs:260
msgid "workspace.libraries.search-shared-libraries"
msgstr "Search shared libraries"

View File

@@ -4397,6 +4397,14 @@ msgstr "No se encuentra “%s“"
msgid "workspace.libraries.no-shared-libraries-available"
msgstr "No hay bibliotecas compartidas disponibles"
#: src/app/main/ui/workspace/libraries.cljs:297
msgid "workspace.libraries.more-templates"
msgstr "Puedes buscar "
#: src/app/main/ui/workspace/libraries.cljs:297
msgid "workspace.libraries.more-templates-link"
msgstr "más plantillas aquí"
#: src/app/main/ui/workspace/libraries.cljs:260
msgid "workspace.libraries.search-shared-libraries"
msgstr "Buscar bibliotecas compartidas"

View File

@@ -177,13 +177,27 @@ function build-exporter-bundle {
rm -rf $bundle_dir;
mv ./exporter/target $bundle_dir;
echo $version > $bundle_dir/version.txt
put-license-file $bundle_dir;
echo ">> bundle exporter end";
}
function build-docs-bundle {
echo ">> bundle docs start";
mkdir -p ./bundles
local version=$(print-current-version);
local bundle_dir="./bundles/docs";
build "docs";
rm -rf $bundle_dir;
mv ./docs/_dist $bundle_dir;
echo $version > $bundle_dir/version.txt;
put-license-file $bundle_dir;
echo ">> bundle docs end";
}
function build-docker-images {
rsync -avr --delete ./bundles/frontend/ ./docker/images/bundle-frontend/;
rsync -avr --delete ./bundles/backend/ ./docker/images/bundle-backend/;
@@ -204,12 +218,24 @@ function usage {
echo "Options:"
echo "- pull-devenv Pulls docker development oriented image"
echo "- build-devenv Build docker development oriented image"
echo "- build-devenv-local Build a local docker development oriented image"
echo "- create-devenv Create the development oriented docker compose service."
echo "- start-devenv Start the development oriented docker compose service."
echo "- stop-devenv Stops the development oriented docker compose service."
echo "- drop-devenv Remove the development oriented docker compose containers, volumes and clean images."
echo "- run-devenv Attaches to the running devenv container and starts development environment"
echo "- run-devenv-shell Attaches to the running devenv container and starts a bash shell."
echo "- log-devenv Show logs of the running devenv docker compose service."
echo ""
echo "- build-bundle Build all bundles (frontend, backend and exporter)."
echo "- build-frontend-bundle Build frontend bundle"
echo "- build-backend-bundle Build backend bundle."
echo "- build-exporter-bundle Build exporter bundle."
echo "- build-docs-bundle Build docs bundle."
echo ""
echo "- build-docker-images Build all docker images (frontend, backend and exporter)."
echo ""
echo "- version Show penpot's version."
}
case $1 in
@@ -276,6 +302,10 @@ case $1 in
build-exporter-bundle;
;;
build-docs-bundle)
build-docs-bundle;
;;
build-docker-images)
build-docker-images
;;