From f78f843f7cfe1eab409925da2678d97f8eb95ea3 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 13 Nov 2024 19:17:06 +0100 Subject: [PATCH] :sparkles: Use .penpot extension for binfile-v3 export format --- frontend/src/app/main/data/exports/files.cljs | 4 +-- .../src/app/main/ui/dashboard/file_menu.cljs | 8 ++--- frontend/src/app/main/ui/exports/files.cljs | 9 +++-- frontend/translations/en.po | 35 ++++++++++--------- 4 files changed, 31 insertions(+), 25 deletions(-) diff --git a/frontend/src/app/main/data/exports/files.cljs b/frontend/src/app/main/data/exports/files.cljs index 534ab209d..439dcaa97 100644 --- a/frontend/src/app/main/data/exports/files.cljs +++ b/frontend/src/app/main/data/exports/files.cljs @@ -31,14 +31,14 @@ [:project-id ::sm/uuid] [:is-shared ::sm/boolean]]]) -(def check-export-files! +(def check-export-files (sm/check-fn schema:export-files)) (defn export-files [files format] (dm/assert! "expected valid files param" - (check-export-files! files)) + (check-export-files files)) (dm/assert! "expected valid format" diff --git a/frontend/src/app/main/ui/dashboard/file_menu.cljs b/frontend/src/app/main/ui/dashboard/file_menu.cljs index e7dbd3b6e..9a0926110 100644 --- a/frontend/src/app/main/ui/dashboard/file_menu.cljs +++ b/frontend/src/app/main/ui/dashboard/file_menu.cljs @@ -261,8 +261,8 @@ :handler on-export-binary-files}) (when (contains? cf/flags :export-file-v3) - {:name (tr "dashboard.export-binary-multi-v3" file-count) - :id "file-binary-export-multi-v3" + {:name (tr "dashboard.export-binary-multi" file-count) + :id "file-binary-export-multi" :handler on-export-binary-files-v3}) (when-not (contains? cf/flags :export-file-v3) @@ -320,8 +320,8 @@ :handler on-export-binary-files}) (when (contains? cf/flags :export-file-v3) - {:name (tr "dashboard.download-binary-file-v3") - :id "download-binary-file-v3" + {:name (tr "dashboard.download-binary-file") + :id "download-binary-file" :handler on-export-binary-files-v3}) (when-not (contains? cf/flags :export-file-v3) diff --git a/frontend/src/app/main/ui/exports/files.cljs b/frontend/src/app/main/ui/exports/files.cljs index bbc954a57..58eb81779 100644 --- a/frontend/src/app/main/ui/exports/files.cljs +++ b/frontend/src/app/main/ui/exports/files.cljs @@ -10,6 +10,7 @@ (:require [app.common.data :as d] [app.common.data.macros :as dm] + [app.config :as cf] [app.main.data.exports.files :as fexp] [app.main.data.modal :as modal] [app.main.store :as st] @@ -106,9 +107,13 @@ (swap! state* update :files mark-file-error (:file-id msg)) (= :finish (:type msg)) - (do + (let [mtype (if (contains? cf/flags :export-file-v3) + "application/penpot" + (:mtype msg)) + fname (:filename msg) + uri (:uri msg)] (swap! state* update :files mark-file-success (:file-id msg)) - (dom/trigger-download-uri (:filename msg) (:mtype msg) (:uri msg))))))))) + (dom/trigger-download-uri fname mtype uri)))))))) on-cancel (mf/use-fn diff --git a/frontend/translations/en.po b/frontend/translations/en.po index 3a492e673..6cf08e682 100644 --- a/frontend/translations/en.po +++ b/frontend/translations/en.po @@ -416,11 +416,11 @@ msgstr "Your Penpot" msgid "dashboard.delete-team" msgstr "Delete team" -#: src/app/main/ui/dashboard/file_menu.cljs:318, src/app/main/ui/workspace/main_menu.cljs:602 +#: src/app/main/ui/dashboard/file_menu.cljs:318, src/app/main/ui/dashboard/file_menu.cljs:323, src/app/main/ui/workspace/main_menu.cljs:602 msgid "dashboard.download-binary-file" msgstr "Download Penpot file (.penpot)" -#: src/app/main/ui/dashboard/file_menu.cljs:323, src/app/main/ui/workspace/main_menu.cljs:611 +#: src/app/main/ui/workspace/main_menu.cljs:611 msgid "dashboard.download-binary-file-v3" msgstr "Download (.zip)" @@ -476,11 +476,12 @@ msgstr "Libraries added to the project will appear here." msgid "dashboard.empty-placeholder-libraries-title" msgstr "No libraries yet." -#: src/app/main/ui/dashboard/file_menu.cljs:259 +#: src/app/main/ui/dashboard/file_menu.cljs:259, src/app/main/ui/dashboard/file_menu.cljs:264 msgid "dashboard.export-binary-multi" msgstr "Download %s Penpot files (.penpot)" #: src/app/main/ui/dashboard/file_menu.cljs:264 +#, unused msgid "dashboard.export-binary-multi-v3" msgstr "Download %s Penpot files (.zip) (BETA)" @@ -526,47 +527,47 @@ msgstr "Export selection" msgid "dashboard.export-standard-multi" msgstr "Download %s standard files (.svg + .json)" -#: src/app/main/ui/exports/files.cljs:152 +#: src/app/main/ui/exports/files.cljs:157 msgid "dashboard.export.detail" msgstr "* Might include components, graphics, colors and/or typographies." -#: src/app/main/ui/exports/files.cljs:151 +#: src/app/main/ui/exports/files.cljs:156 msgid "dashboard.export.explain" msgstr "" "One or more files that you want to export are using shared libraries. What " "do you want to do with their assets*?" -#: src/app/main/ui/exports/files.cljs:160 +#: src/app/main/ui/exports/files.cljs:165 msgid "dashboard.export.options.all.message" msgstr "" "files with shared libraries will be included in the export, maintaining " "their linkage." -#: src/app/main/ui/exports/files.cljs:161 +#: src/app/main/ui/exports/files.cljs:166 msgid "dashboard.export.options.all.title" msgstr "Export shared libraries" -#: src/app/main/ui/exports/files.cljs:162 +#: src/app/main/ui/exports/files.cljs:167 msgid "dashboard.export.options.detach.message" msgstr "" "Shared libraries will not be included in the export and no assets will be " "added to the library. " -#: src/app/main/ui/exports/files.cljs:163 +#: src/app/main/ui/exports/files.cljs:168 msgid "dashboard.export.options.detach.title" msgstr "Treat shared library assets as basic objects" -#: src/app/main/ui/exports/files.cljs:164 +#: src/app/main/ui/exports/files.cljs:169 msgid "dashboard.export.options.merge.message" msgstr "" "Your file will be exported with all external assets merged into the file " "library." -#: src/app/main/ui/exports/files.cljs:165 +#: src/app/main/ui/exports/files.cljs:170 msgid "dashboard.export.options.merge.title" msgstr "Include shared library assets in file libraries" -#: src/app/main/ui/exports/files.cljs:143 +#: src/app/main/ui/exports/files.cljs:148 msgid "dashboard.export.title" msgstr "Export files" @@ -1016,7 +1017,7 @@ msgstr "The fonts %s could not be loaded" msgid "errors.cannot-upload" msgstr "Cannot upload the media file." -#: src/app/main/data/workspace.cljs:1665 +#: src/app/main/data/workspace.cljs:1672 msgid "errors.clipboard-not-implemented" msgstr "Your browser cannot do this operation" @@ -1601,7 +1602,7 @@ msgstr "" msgid "labels.bad-gateway.main-message" msgstr "Bad Gateway" -#: src/app/main/data/common.cljs:131, src/app/main/ui/dashboard/change_owner.cljs:68, src/app/main/ui/dashboard/import.cljs:489, src/app/main/ui/dashboard/team.cljs:906, src/app/main/ui/delete_shared.cljs:35, src/app/main/ui/exports/assets.cljs:168, src/app/main/ui/exports/files.cljs:187, src/app/main/ui/settings/access_tokens.cljs:177, src/app/main/ui/viewer/share_link.cljs:205, src/app/main/ui/workspace/sidebar/assets/groups.cljs:145, src/app/main/ui/workspace/tokens/form.cljs:429, src/app/main/ui/workspace/tokens/modals/themes.cljs:203 +#: src/app/main/data/common.cljs:131, src/app/main/ui/dashboard/change_owner.cljs:68, src/app/main/ui/dashboard/import.cljs:489, src/app/main/ui/dashboard/team.cljs:906, src/app/main/ui/delete_shared.cljs:35, src/app/main/ui/exports/assets.cljs:168, src/app/main/ui/exports/files.cljs:192, src/app/main/ui/settings/access_tokens.cljs:177, src/app/main/ui/viewer/share_link.cljs:205, src/app/main/ui/workspace/sidebar/assets/groups.cljs:145, src/app/main/ui/workspace/tokens/form.cljs:429, src/app/main/ui/workspace/tokens/modals/themes.cljs:203 msgid "labels.cancel" msgstr "Cancel" @@ -1609,7 +1610,7 @@ msgstr "Cancel" msgid "labels.canva" msgstr "Canva" -#: src/app/main/ui/dashboard/projects.cljs:96, src/app/main/ui/exports/files.cljs:205, src/app/main/ui/settings/access_tokens.cljs:172, src/app/main/ui/viewer/login.cljs:71, src/app/main/ui/viewer/share_link.cljs:176, src/app/main/ui/workspace/comments.cljs:129, src/app/main/ui/workspace/libraries.cljs:538, src/app/main/ui/workspace/sidebar/debug.cljs:40, src/app/main/ui/workspace/sidebar/layers.cljs:299, src/app/main/ui/workspace/tokens/modals/themes.cljs:366, src/app/main/ui/workspace/tokens/modals.cljs:56 +#: src/app/main/ui/dashboard/projects.cljs:96, src/app/main/ui/exports/files.cljs:210, src/app/main/ui/settings/access_tokens.cljs:172, src/app/main/ui/viewer/login.cljs:71, src/app/main/ui/viewer/share_link.cljs:176, src/app/main/ui/workspace/comments.cljs:129, src/app/main/ui/workspace/libraries.cljs:538, src/app/main/ui/workspace/sidebar/debug.cljs:40, src/app/main/ui/workspace/sidebar/layers.cljs:299, src/app/main/ui/workspace/tokens/modals/themes.cljs:366, src/app/main/ui/workspace/tokens/modals.cljs:56 msgid "labels.close" msgstr "Close" @@ -1629,7 +1630,7 @@ msgstr "Community" msgid "labels.confirm-password" msgstr "Confirm password" -#: src/app/main/ui/dashboard/import.cljs:495, src/app/main/ui/exports/files.cljs:192, src/app/main/ui/onboarding/newsletter.cljs:101 +#: src/app/main/ui/dashboard/import.cljs:495, src/app/main/ui/exports/files.cljs:197, src/app/main/ui/onboarding/newsletter.cljs:101 msgid "labels.continue" msgstr "Continue" @@ -1823,7 +1824,7 @@ msgstr "Language" msgid "labels.libraries-and-templates" msgstr "Libraries & Templates" -#: src/app/main/ui/auth/verify_token.cljs:97, src/app/main/ui/dashboard/grid.cljs:104, src/app/main/ui/dashboard/grid.cljs:124, src/app/main/ui/dashboard/import.cljs:253, src/app/main/ui/dashboard/placeholder.cljs:52, src/app/main/ui/ds/product/loader.cljs:52, src/app/main/ui/exports/files.cljs:61, src/app/main/ui/viewer.cljs:637, src/app/main/ui/workspace.cljs:129 +#: src/app/main/ui/auth/verify_token.cljs:97, src/app/main/ui/dashboard/grid.cljs:104, src/app/main/ui/dashboard/grid.cljs:124, src/app/main/ui/dashboard/import.cljs:253, src/app/main/ui/dashboard/placeholder.cljs:52, src/app/main/ui/ds/product/loader.cljs:52, src/app/main/ui/exports/files.cljs:62, src/app/main/ui/viewer.cljs:637, src/app/main/ui/workspace.cljs:129 msgid "labels.loading" msgstr "Loading…"