mirror of
https://github.com/penpot/penpot.git
synced 2025-05-10 11:36:38 +02:00
🎉 Set files as shared libraries
This commit is contained in:
parent
69ae893bd0
commit
9fb821d6e0
19 changed files with 322 additions and 56 deletions
|
@ -1,11 +1,3 @@
|
|||
-- ALTER TABLE color_library
|
||||
-- DROP COLUMN team_id,
|
||||
-- DROP COLUMN name,
|
||||
-- ADD COLUMN file_id uuid NOT NULL REFERENCES file(id) ON DELETE CASCADE;
|
||||
--
|
||||
-- CREATE INDEX color_library__file_id__idx
|
||||
-- ON color_library(file_id);
|
||||
|
||||
TRUNCATE TABLE color;
|
||||
TRUNCATE TABLE color_library CASCADE;
|
||||
TRUNCATE TABLE image;
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
ALTER TABLE file
|
||||
ADD COLUMN is_shared BOOLEAN NOT NULL DEFAULT false;
|
||||
|
||||
UPDATE file
|
||||
SET is_shared = true
|
||||
WHERE project_id IN (SELECT id
|
||||
FROM project
|
||||
WHERE team_id = uuid_nil());
|
||||
|
|
@ -372,7 +372,8 @@
|
|||
(files/create-file conn {:id id
|
||||
:profile-id uuid/zero
|
||||
:project-id project-id
|
||||
:name name})
|
||||
:name name
|
||||
:shared? true})
|
||||
(files/create-page conn {:file-id id}))
|
||||
id))
|
||||
|
||||
|
|
|
@ -63,7 +63,11 @@
|
|||
|
||||
{:desc "Make libraries linked to a file"
|
||||
:name "0012-make-libraries-linked-to-a-file"
|
||||
:fn (mg/resource "migrations/0012-make-libraries-linked-to-a-file.sql")}]})
|
||||
:fn (mg/resource "migrations/0012-make-libraries-linked-to-a-file.sql")}
|
||||
|
||||
{:desc "Mark files shareable"
|
||||
:name "0013-mark-files-shareable"
|
||||
:fn (mg/resource "migrations/0013-mark-files-shareable.sql")}]})
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Entry point
|
||||
|
|
|
@ -63,9 +63,14 @@
|
|||
:can-edit true}))
|
||||
|
||||
(defn create-file
|
||||
[conn {:keys [id profile-id name project-id] :as params}]
|
||||
(let [id (or id (uuid/next))
|
||||
file (db/insert! conn :file {:id id :project-id project-id :name name})]
|
||||
[conn {:keys [id profile-id name project-id shared?] :as params}]
|
||||
(let [id (or id (uuid/next))
|
||||
shared? (or shared? false)
|
||||
file (db/insert! conn :file
|
||||
{:id id
|
||||
:project-id project-id
|
||||
:name name
|
||||
:is-shared shared?})]
|
||||
(->> (assoc params :file-id id)
|
||||
(create-file-profile conn))
|
||||
file))
|
||||
|
@ -101,6 +106,26 @@
|
|||
{:id id}))
|
||||
|
||||
|
||||
;; --- Mutation: Set File shared
|
||||
|
||||
(declare set-file-shared)
|
||||
|
||||
(s/def ::set-file-shared
|
||||
(s/keys :req-un [::profile-id ::id ::is-shared]))
|
||||
|
||||
(sm/defmutation ::set-file-shared
|
||||
[{:keys [id profile-id] :as params}]
|
||||
(db/with-atomic [conn db/pool]
|
||||
(files/check-edition-permissions! conn profile-id id)
|
||||
(set-file-shared conn params)))
|
||||
|
||||
(defn- set-file-shared
|
||||
[conn {:keys [id is-shared] :as params}]
|
||||
(db/update! conn :file
|
||||
{:is-shared is-shared}
|
||||
{:id id}))
|
||||
|
||||
|
||||
;; --- Mutation: Delete Project File
|
||||
|
||||
(declare mark-file-deleted)
|
||||
|
|
3
frontend/resources/images/icons/library.svg
Normal file
3
frontend/resources/images/icons/library.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 500 500">
|
||||
<path d="M453 125c0-4-1-7-3-11L402 14a25 25 0 00-23-14H123C93 0 47 20 47 75v350c0 55 46 75 76 75h305c6 0 13-3 18-7 4-5 7-11 7-18zM123 50h240l24 50H123c-11 0-25-5-25-25s14-25 25-25zm279 400H123c-11 0-25-5-25-25V150h152v150l51-25 51 25V150h50z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 317 B |
|
@ -269,8 +269,44 @@
|
|||
"es" : "La solución de código abierto para diseñar y prototipar"
|
||||
}
|
||||
},
|
||||
"dashboard.grid.add-shared" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/dashboard/grid.cljs:131", "src/uxbox/main/ui/workspace/header.cljs:147" ],
|
||||
"translations" : {
|
||||
"en" : "Add as Shared Library",
|
||||
"fr" : "",
|
||||
"ru" : "",
|
||||
"es" : "Añadir como Biblioteca Compartida"
|
||||
}
|
||||
},
|
||||
"dashboard.grid.add-shared-accept" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/dashboard/grid.cljs:70", "src/uxbox/main/ui/workspace/header.cljs:70" ],
|
||||
"translations" : {
|
||||
"en" : "Add as Shared Library",
|
||||
"fr" : "",
|
||||
"ru" : "",
|
||||
"es" : "Añadir como Biblioteca Compartida"
|
||||
}
|
||||
},
|
||||
"dashboard.grid.add-shared-hint" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/dashboard/grid.cljs:69", "src/uxbox/main/ui/workspace/header.cljs:69" ],
|
||||
"translations" : {
|
||||
"en" : "Once added as Shared Library, the assets of this file library will be available to be used among the rest of your files.",
|
||||
"fr" : "",
|
||||
"ru" : "",
|
||||
"es" : "Una vez añadido como Biblioteca Compartida, los recursos de este archivo estarán disponibles para ser usado por el resto de tus archivos."
|
||||
}
|
||||
},
|
||||
"dashboard.grid.add-shared-message" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/dashboard/grid.cljs:68", "src/uxbox/main/ui/workspace/header.cljs:68" ],
|
||||
"translations" : {
|
||||
"en" : "Add “%s” as Shared Library",
|
||||
"fr" : "",
|
||||
"ru" : "",
|
||||
"es" : "Añadir “%s” como Biblioteca Compartida"
|
||||
}
|
||||
},
|
||||
"dashboard.grid.delete" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/dashboard/project.cljs:62", "src/uxbox/main/ui/dashboard/grid.cljs:103" ],
|
||||
"used-in" : [ "src/uxbox/main/ui/dashboard/project.cljs:62", "src/uxbox/main/ui/dashboard/grid.cljs:128" ],
|
||||
"translations" : {
|
||||
"en" : "Delete",
|
||||
"fr" : "Supprimer",
|
||||
|
@ -279,7 +315,7 @@
|
|||
}
|
||||
},
|
||||
"dashboard.grid.empty-files" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/dashboard/grid.cljs:125" ],
|
||||
"used-in" : [ "src/uxbox/main/ui/dashboard/grid.cljs:153" ],
|
||||
"translations" : {
|
||||
"en" : "You still have no files here",
|
||||
"fr" : "Vous n'avez encore aucun fichier ici",
|
||||
|
@ -287,8 +323,44 @@
|
|||
"es" : "Todavía no hay ningún archivo aquí"
|
||||
}
|
||||
},
|
||||
"dashboard.grid.remove-shared" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/dashboard/grid.cljs:130", "src/uxbox/main/ui/workspace/header.cljs:145" ],
|
||||
"translations" : {
|
||||
"en" : "Remove as Shared Library",
|
||||
"fr" : "",
|
||||
"ru" : "",
|
||||
"es" : "Eliminar como Biblioteca Compartida"
|
||||
}
|
||||
},
|
||||
"dashboard.grid.remove-shared-accept" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/dashboard/grid.cljs:81", "src/uxbox/main/ui/workspace/header.cljs:79" ],
|
||||
"translations" : {
|
||||
"en" : "Remove as Shared Library",
|
||||
"fr" : "",
|
||||
"ru" : "",
|
||||
"es" : "Eliminar como Biblioteca Compartida"
|
||||
}
|
||||
},
|
||||
"dashboard.grid.remove-shared-hint" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/dashboard/grid.cljs:80", "src/uxbox/main/ui/workspace/header.cljs:78" ],
|
||||
"translations" : {
|
||||
"en" : "Once removed as Shared Library, the File Library of this file will stop being available to be used among the rest of your files.",
|
||||
"fr" : "",
|
||||
"ru" : "",
|
||||
"es" : "Una vez eliminado como Biblioteca Compartida, la Biblioteca de este archivo dejará de estar disponible para ser usada por el resto de tus archivos."
|
||||
}
|
||||
},
|
||||
"dashboard.grid.remove-shared-message" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/dashboard/grid.cljs:79", "src/uxbox/main/ui/workspace/header.cljs:77" ],
|
||||
"translations" : {
|
||||
"en" : "Remove “%s” as Shared Library",
|
||||
"fr" : "",
|
||||
"ru" : "",
|
||||
"es" : "Añadir “%s” como Biblioteca Compartida"
|
||||
}
|
||||
},
|
||||
"dashboard.grid.rename" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/dashboard/project.cljs:61", "src/uxbox/main/ui/dashboard/grid.cljs:102" ],
|
||||
"used-in" : [ "src/uxbox/main/ui/dashboard/project.cljs:61", "src/uxbox/main/ui/dashboard/grid.cljs:127" ],
|
||||
"translations" : {
|
||||
"en" : "Rename",
|
||||
"fr" : "Renommer",
|
||||
|
@ -540,7 +612,7 @@
|
|||
}
|
||||
},
|
||||
"ds.confirm-cancel" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/confirm.cljs:19" ],
|
||||
"used-in" : [ "src/uxbox/main/ui/confirm.cljs:20" ],
|
||||
"translations" : {
|
||||
"en" : "Cancel",
|
||||
"fr" : "Annuler",
|
||||
|
@ -549,7 +621,7 @@
|
|||
}
|
||||
},
|
||||
"ds.confirm-ok" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/confirm.cljs:20" ],
|
||||
"used-in" : [ "src/uxbox/main/ui/confirm.cljs:21" ],
|
||||
"translations" : {
|
||||
"en" : "Ok",
|
||||
"fr" : "Ok",
|
||||
|
@ -558,7 +630,7 @@
|
|||
}
|
||||
},
|
||||
"ds.confirm-title" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/confirm.cljs:18" ],
|
||||
"used-in" : [ "src/uxbox/main/ui/confirm.cljs:19" ],
|
||||
"translations" : {
|
||||
"en" : "Are you sure?",
|
||||
"fr" : "Êtes-vous sûr?",
|
||||
|
@ -585,7 +657,7 @@
|
|||
}
|
||||
},
|
||||
"ds.new-file" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/dashboard/grid.cljs:121", "src/uxbox/main/ui/dashboard/grid.cljs:127" ],
|
||||
"used-in" : [ "src/uxbox/main/ui/dashboard/grid.cljs:149", "src/uxbox/main/ui/dashboard/grid.cljs:155" ],
|
||||
"translations" : {
|
||||
"en" : "+ New File",
|
||||
"fr" : "+ Nouveau fichier",
|
||||
|
@ -657,7 +729,7 @@
|
|||
}
|
||||
},
|
||||
"errors.image-format-unsupported" : {
|
||||
"used-in" : [ "src/uxbox/main/data/workspace/persistence.cljs:390", "src/uxbox/main/data/users.cljs:177", "src/uxbox/main/data/images.cljs:376" ],
|
||||
"used-in" : [ "src/uxbox/main/data/workspace/persistence.cljs:406", "src/uxbox/main/data/users.cljs:177", "src/uxbox/main/data/images.cljs:376" ],
|
||||
"translations" : {
|
||||
"en" : "The image format is not supported (must be svg, jpg or png).",
|
||||
"fr" : "Le format d'image n'est pas supporté (doit être svg, jpg ou png).",
|
||||
|
@ -666,7 +738,7 @@
|
|||
}
|
||||
},
|
||||
"errors.image-too-large" : {
|
||||
"used-in" : [ "src/uxbox/main/data/workspace/persistence.cljs:388", "src/uxbox/main/data/users.cljs:175", "src/uxbox/main/data/images.cljs:374" ],
|
||||
"used-in" : [ "src/uxbox/main/data/workspace/persistence.cljs:404", "src/uxbox/main/data/users.cljs:175", "src/uxbox/main/data/images.cljs:374" ],
|
||||
"translations" : {
|
||||
"en" : "The image is too large to be inserted (must be under 5mb).",
|
||||
"fr" : "L'image est trop grande (doit être inférieure à 5 Mo).",
|
||||
|
@ -675,7 +747,7 @@
|
|||
}
|
||||
},
|
||||
"errors.image-type-mismatch" : {
|
||||
"used-in" : [ "src/uxbox/main/data/workspace/persistence.cljs:355", "src/uxbox/main/data/workspace/persistence.cljs:405", "src/uxbox/main/data/users.cljs:191", "src/uxbox/main/data/images.cljs:391" ],
|
||||
"used-in" : [ "src/uxbox/main/data/workspace/persistence.cljs:371", "src/uxbox/main/data/workspace/persistence.cljs:421", "src/uxbox/main/data/users.cljs:191", "src/uxbox/main/data/images.cljs:391" ],
|
||||
"translations" : {
|
||||
"en" : "Seems that the contents of the image does not match the file extension.",
|
||||
"fr" : "",
|
||||
|
@ -684,7 +756,7 @@
|
|||
}
|
||||
},
|
||||
"errors.image-type-not-allowed" : {
|
||||
"used-in" : [ "src/uxbox/main/data/workspace/persistence.cljs:352", "src/uxbox/main/data/workspace/persistence.cljs:402", "src/uxbox/main/data/users.cljs:188", "src/uxbox/main/data/images.cljs:388" ],
|
||||
"used-in" : [ "src/uxbox/main/data/workspace/persistence.cljs:368", "src/uxbox/main/data/workspace/persistence.cljs:418", "src/uxbox/main/data/users.cljs:188", "src/uxbox/main/data/images.cljs:388" ],
|
||||
"translations" : {
|
||||
"en" : "Seems that this is not a valid image.",
|
||||
"fr" : "",
|
||||
|
@ -729,7 +801,7 @@
|
|||
}
|
||||
},
|
||||
"errors.unexpected-error" : {
|
||||
"used-in" : [ "src/uxbox/main/data/workspace/persistence.cljs:358", "src/uxbox/main/data/workspace/persistence.cljs:408", "src/uxbox/main/data/users.cljs:194", "src/uxbox/main/data/images.cljs:394", "src/uxbox/main/ui/settings/change_email.cljs:51", "src/uxbox/main/ui/workspace/sidebar/options/exports.cljs:65", "src/uxbox/main/ui/auth/register.cljs:54" ],
|
||||
"used-in" : [ "src/uxbox/main/data/workspace/persistence.cljs:374", "src/uxbox/main/data/workspace/persistence.cljs:424", "src/uxbox/main/data/users.cljs:194", "src/uxbox/main/data/images.cljs:394", "src/uxbox/main/ui/settings/change_email.cljs:51", "src/uxbox/main/ui/workspace/sidebar/options/exports.cljs:65", "src/uxbox/main/ui/auth/register.cljs:54" ],
|
||||
"translations" : {
|
||||
"en" : "An unexpected error occurred.",
|
||||
"fr" : "Une erreur inattendue c'est produite",
|
||||
|
@ -756,7 +828,7 @@
|
|||
}
|
||||
},
|
||||
"header.sitemap" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/header.cljs:65" ],
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/header.cljs:85" ],
|
||||
"translations" : {
|
||||
"en" : "Sitemap",
|
||||
"fr" : null,
|
||||
|
@ -774,7 +846,7 @@
|
|||
}
|
||||
},
|
||||
"image.loading" : {
|
||||
"used-in" : [ "src/uxbox/main/data/workspace/persistence.cljs:366", "src/uxbox/main/data/workspace/persistence.cljs:417", "src/uxbox/main/data/users.cljs:201", "src/uxbox/main/data/images.cljs:403" ],
|
||||
"used-in" : [ "src/uxbox/main/data/workspace/persistence.cljs:382", "src/uxbox/main/data/workspace/persistence.cljs:433", "src/uxbox/main/data/users.cljs:201", "src/uxbox/main/data/images.cljs:403" ],
|
||||
"translations" : {
|
||||
"en" : "Loading image...",
|
||||
"fr" : "Chargement de l'image...",
|
||||
|
@ -1359,7 +1431,7 @@
|
|||
}
|
||||
},
|
||||
"workspace.assets.assets" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/sidebar/assets.cljs:325" ],
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/sidebar/assets.cljs:331" ],
|
||||
"translations" : {
|
||||
"en" : "Assets",
|
||||
"fr" : "",
|
||||
|
@ -1368,7 +1440,7 @@
|
|||
}
|
||||
},
|
||||
"workspace.assets.box-filter-all" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/sidebar/assets.cljs:342" ],
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/sidebar/assets.cljs:348" ],
|
||||
"translations" : {
|
||||
"en" : "All assets",
|
||||
"fr" : "",
|
||||
|
@ -1377,7 +1449,7 @@
|
|||
}
|
||||
},
|
||||
"workspace.assets.box-filter-colors" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/sidebar/assets.cljs:344" ],
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/sidebar/assets.cljs:350" ],
|
||||
"translations" : {
|
||||
"en" : "Colors",
|
||||
"fr" : "",
|
||||
|
@ -1386,7 +1458,7 @@
|
|||
}
|
||||
},
|
||||
"workspace.assets.box-filter-graphics" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/sidebar/assets.cljs:343" ],
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/sidebar/assets.cljs:349" ],
|
||||
"translations" : {
|
||||
"en" : "Graphics",
|
||||
"fr" : "",
|
||||
|
@ -1422,7 +1494,7 @@
|
|||
}
|
||||
},
|
||||
"workspace.assets.file-library" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/sidebar/assets.cljs:271" ],
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/sidebar/assets.cljs:272" ],
|
||||
"translations" : {
|
||||
"en" : "File library",
|
||||
"fr" : "",
|
||||
|
@ -1440,7 +1512,7 @@
|
|||
}
|
||||
},
|
||||
"workspace.assets.not-found" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/sidebar/assets.cljs:282" ],
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/sidebar/assets.cljs:287" ],
|
||||
"translations" : {
|
||||
"en" : "No assets found",
|
||||
"fr" : "",
|
||||
|
@ -1458,7 +1530,7 @@
|
|||
}
|
||||
},
|
||||
"workspace.assets.search" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/sidebar/assets.cljs:329" ],
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/sidebar/assets.cljs:335" ],
|
||||
"translations" : {
|
||||
"en" : "Search assets",
|
||||
"fr" : "",
|
||||
|
@ -1466,8 +1538,17 @@
|
|||
"es" : "Buscar recursos"
|
||||
}
|
||||
},
|
||||
"workspace.assets.shared" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/sidebar/assets.cljs:274" ],
|
||||
"translations" : {
|
||||
"en" : "SHARED",
|
||||
"fr" : "",
|
||||
"ru" : "",
|
||||
"es" : "COMPARTIDA"
|
||||
}
|
||||
},
|
||||
"workspace.header.menu.disable-dynamic-alignment" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/header.cljs:117" ],
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/header.cljs:139" ],
|
||||
"translations" : {
|
||||
"en" : "Disable dynamic alignment",
|
||||
"fr" : "Désactiver l'alignement dynamique",
|
||||
|
@ -1476,7 +1557,7 @@
|
|||
}
|
||||
},
|
||||
"workspace.header.menu.disable-snap-grid" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/header.cljs:89" ],
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/header.cljs:111" ],
|
||||
"translations" : {
|
||||
"en" : "Disable snap to grid",
|
||||
"fr" : "Désactiver l'alignement sur la grille",
|
||||
|
@ -1485,7 +1566,7 @@
|
|||
}
|
||||
},
|
||||
"workspace.header.menu.enable-dynamic-alignment" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/header.cljs:118" ],
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/header.cljs:140" ],
|
||||
"translations" : {
|
||||
"en" : "Enable dynamic aligment",
|
||||
"fr" : "Activer l'alignement dynamique",
|
||||
|
@ -1494,7 +1575,7 @@
|
|||
}
|
||||
},
|
||||
"workspace.header.menu.enable-snap-grid" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/header.cljs:90" ],
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/header.cljs:112" ],
|
||||
"translations" : {
|
||||
"en" : "Snap to grid",
|
||||
"fr" : "Aligner sur la grille",
|
||||
|
@ -1503,7 +1584,7 @@
|
|||
}
|
||||
},
|
||||
"workspace.header.menu.hide-grid" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/header.cljs:82" ],
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/header.cljs:104" ],
|
||||
"translations" : {
|
||||
"en" : "Hide grid",
|
||||
"fr" : "Masquer la grille",
|
||||
|
@ -1512,7 +1593,7 @@
|
|||
}
|
||||
},
|
||||
"workspace.header.menu.hide-layers" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/header.cljs:96" ],
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/header.cljs:118" ],
|
||||
"translations" : {
|
||||
"en" : "Hide layers",
|
||||
"fr" : "Masquer les couches",
|
||||
|
@ -1521,7 +1602,7 @@
|
|||
}
|
||||
},
|
||||
"workspace.header.menu.hide-libraries" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/header.cljs:110" ],
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/header.cljs:132" ],
|
||||
"translations" : {
|
||||
"en" : "Hide libraries",
|
||||
"fr" : "Masquer les librairies",
|
||||
|
@ -1530,7 +1611,7 @@
|
|||
}
|
||||
},
|
||||
"workspace.header.menu.hide-palette" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/header.cljs:103" ],
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/header.cljs:125" ],
|
||||
"translations" : {
|
||||
"en" : "Hide color palette",
|
||||
"fr" : "Masquer la palette de couleurs",
|
||||
|
@ -1539,7 +1620,7 @@
|
|||
}
|
||||
},
|
||||
"workspace.header.menu.hide-rules" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/header.cljs:75" ],
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/header.cljs:97" ],
|
||||
"translations" : {
|
||||
"en" : "Hide rules",
|
||||
"fr" : "Masquer les règles",
|
||||
|
@ -1548,7 +1629,7 @@
|
|||
}
|
||||
},
|
||||
"workspace.header.menu.show-grid" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/header.cljs:83" ],
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/header.cljs:105" ],
|
||||
"translations" : {
|
||||
"en" : "Show grid",
|
||||
"fr" : "Montrer la grille",
|
||||
|
@ -1557,7 +1638,7 @@
|
|||
}
|
||||
},
|
||||
"workspace.header.menu.show-layers" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/header.cljs:97" ],
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/header.cljs:119" ],
|
||||
"translations" : {
|
||||
"en" : "Show layers",
|
||||
"fr" : "Montrer les couches",
|
||||
|
@ -1566,7 +1647,7 @@
|
|||
}
|
||||
},
|
||||
"workspace.header.menu.show-libraries" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/header.cljs:111" ],
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/header.cljs:133" ],
|
||||
"translations" : {
|
||||
"en" : "Show libraries",
|
||||
"fr" : "Montrer les librairies",
|
||||
|
@ -1575,7 +1656,7 @@
|
|||
}
|
||||
},
|
||||
"workspace.header.menu.show-palette" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/header.cljs:104" ],
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/header.cljs:126" ],
|
||||
"translations" : {
|
||||
"en" : "Show color palette",
|
||||
"fr" : "Montrer la palette de couleurs",
|
||||
|
@ -1584,7 +1665,7 @@
|
|||
}
|
||||
},
|
||||
"workspace.header.menu.show-rules" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/header.cljs:76" ],
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/header.cljs:98" ],
|
||||
"translations" : {
|
||||
"en" : "Show rules",
|
||||
"fr" : "Montrer les règles",
|
||||
|
@ -1593,7 +1674,7 @@
|
|||
}
|
||||
},
|
||||
"workspace.header.viewer" : {
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/header.cljs:156" ],
|
||||
"used-in" : [ "src/uxbox/main/ui/workspace/header.cljs:184" ],
|
||||
"translations" : {
|
||||
"en" : "View mode (Ctrl + P)",
|
||||
"fr" : "Mode visualisation (Ctrl + P)",
|
||||
|
|
|
@ -156,6 +156,26 @@
|
|||
|
||||
}
|
||||
|
||||
.item-badge {
|
||||
background-color: $color-white;
|
||||
border: 1px solid $color-gray-20;
|
||||
border-radius: 4px;
|
||||
position: absolute;
|
||||
top: $x-small;
|
||||
right: $x-small;
|
||||
height: 32px;
|
||||
width: 32px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
svg {
|
||||
fill: $color-gray-30;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
&.add-file {
|
||||
border: 1px dashed $color-gray-20;
|
||||
justify-content: center;
|
||||
|
|
|
@ -124,6 +124,15 @@
|
|||
&:hover {
|
||||
background: $color-danger-dark;
|
||||
}
|
||||
|
||||
&.not-danger {
|
||||
background: $color-primary;
|
||||
color: $color-gray-60;
|
||||
}
|
||||
|
||||
&.not-danger:hover {
|
||||
background: $color-primary-dark;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -90,6 +90,15 @@ $width-settings-bar: 15rem;
|
|||
font-size: $fs13;
|
||||
}
|
||||
|
||||
span.tool-badge {
|
||||
border: 1px solid $color-primary;
|
||||
border-radius: 2px;
|
||||
font-size: $fs10;
|
||||
color: $color-primary;
|
||||
padding: 2px 4px;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.tool-window-icon {
|
||||
margin-right: $small;
|
||||
display: none;
|
||||
|
|
|
@ -55,6 +55,23 @@
|
|||
align-items: center;
|
||||
}
|
||||
|
||||
.shared-badge {
|
||||
margin-left: $x-small;
|
||||
border: 1px solid $color-gray-20;
|
||||
border-radius: 4px;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
svg {
|
||||
fill: $color-gray-20;
|
||||
height: 8px;
|
||||
width: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.users-section {
|
||||
display: flex;
|
||||
}
|
||||
|
|
|
@ -333,11 +333,25 @@
|
|||
|
||||
ptk/WatchEvent
|
||||
(watch [_ state stream]
|
||||
(let [local (:dashboard-local state)
|
||||
params {:id id :name name}]
|
||||
(let [params {:id id :name name}]
|
||||
(->> (rp/mutation :rename-file params)
|
||||
(rx/ignore))))))
|
||||
|
||||
;; --- Set File shared
|
||||
|
||||
(defn set-file-shared
|
||||
[id is-shared]
|
||||
{:pre [(uuid? id) (boolean? is-shared)]}
|
||||
(ptk/reify ::set-file-shared
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
(assoc-in state [:files id :is-shared] is-shared))
|
||||
|
||||
ptk/WatchEvent
|
||||
(watch [_ state stream]
|
||||
(let [params {:id id :is-shared is-shared}]
|
||||
(->> (rp/mutation :set-file-shared params)
|
||||
(rx/ignore))))))
|
||||
|
||||
;; --- Create File
|
||||
|
||||
|
|
|
@ -1436,6 +1436,7 @@
|
|||
|
||||
;; Persistence
|
||||
|
||||
(def set-file-shared dwp/set-file-shared)
|
||||
(def fetch-images dwp/fetch-images)
|
||||
(def add-image-from-url dwp/add-image-from-url)
|
||||
(def upload-image dwp/upload-image)
|
||||
|
|
|
@ -182,6 +182,22 @@
|
|||
:workspace-project project)
|
||||
(reduce assoc-page $$ pages))))))
|
||||
|
||||
;; --- Set File shared
|
||||
|
||||
(defn set-file-shared
|
||||
[id is-shared]
|
||||
{:pre [(uuid? id) (boolean? is-shared)]}
|
||||
(ptk/reify ::set-file-shared
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
(assoc-in state [:workspace-file :is-shared] is-shared))
|
||||
|
||||
ptk/WatchEvent
|
||||
(watch [_ state stream]
|
||||
(let [params {:id id :is-shared is-shared}]
|
||||
(->> (rp/mutation :set-file-shared params)
|
||||
(rx/ignore))))))
|
||||
|
||||
;; --- Fetch Pages
|
||||
|
||||
(declare page-fetched)
|
||||
|
|
|
@ -11,10 +11,11 @@
|
|||
[rumext.alpha :as mf]
|
||||
[uxbox.main.ui.modal :as modal]
|
||||
[uxbox.util.i18n :refer (tr)]
|
||||
[uxbox.util.data :refer [classnames]]
|
||||
[uxbox.util.dom :as dom]))
|
||||
|
||||
(mf/defc confirm-dialog
|
||||
[{:keys [message on-accept on-cancel hint cancel-text accept-text] :as ctx}]
|
||||
[{:keys [message on-accept on-cancel hint cancel-text accept-text not-danger?] :as ctx}]
|
||||
(let [message (or message (tr "ds.confirm-title"))
|
||||
cancel-text (or cancel-text (tr "ds.confirm-cancel"))
|
||||
accept-text (or accept-text (tr "ds.confirm-ok"))
|
||||
|
@ -45,5 +46,7 @@
|
|||
|
||||
[:input.dialog-accept-button
|
||||
{:type "button"
|
||||
:class (classnames :not-danger not-danger?)
|
||||
:value accept-text
|
||||
:on-click accept}]]]]]))
|
||||
|
||||
|
|
|
@ -60,6 +60,28 @@
|
|||
(dom/stop-propagation %)
|
||||
(modal/show! confirm-dialog {:on-accept delete-fn}))
|
||||
|
||||
add-shared-fn #(st/emit! nil (dsh/set-file-shared (:id file) true))
|
||||
on-add-shared
|
||||
#(do
|
||||
(dom/stop-propagation %)
|
||||
(modal/show! confirm-dialog
|
||||
{:message (t locale "dashboard.grid.add-shared-message" (:name file))
|
||||
:hint (t locale "dashboard.grid.add-shared-hint")
|
||||
:accept-text (t locale "dashboard.grid.add-shared-accept")
|
||||
:not-danger? true
|
||||
:on-accept add-shared-fn}))
|
||||
|
||||
remove-shared-fn #(st/emit! nil (dsh/set-file-shared (:id file) false))
|
||||
on-remove-shared
|
||||
#(do
|
||||
(dom/stop-propagation %)
|
||||
(modal/show! confirm-dialog
|
||||
{:message (t locale "dashboard.grid.remove-shared-message" (:name file))
|
||||
:hint (t locale "dashboard.grid.remove-shared-hint")
|
||||
:accept-text (t locale "dashboard.grid.remove-shared-accept")
|
||||
:not-danger? false
|
||||
:on-accept remove-shared-fn}))
|
||||
|
||||
on-blur #(let [name (-> % dom/get-target dom/get-value)]
|
||||
(st/emit! (dsh/rename-file (:id file) name))
|
||||
(swap! local assoc :edition false))
|
||||
|
@ -77,6 +99,9 @@
|
|||
[:div.grid-item.project-th {:on-click on-navigate}
|
||||
[:div.overlay]
|
||||
[:& grid-item-thumbnail {:file file}]
|
||||
(when (:is-shared file)
|
||||
[:div.item-badge
|
||||
i/library])
|
||||
[:div.item-info
|
||||
(if (:edition @local)
|
||||
[:input.element-name {:type "text"
|
||||
|
@ -100,7 +125,10 @@
|
|||
[:& context-menu {:on-close on-menu-close
|
||||
:show (:menu-open @local)
|
||||
:options [[(t locale "dashboard.grid.rename") on-edit]
|
||||
[(t locale "dashboard.grid.delete") on-delete]]}]]]))
|
||||
[(t locale "dashboard.grid.delete") on-delete]
|
||||
(if (:is-shared file)
|
||||
[(t locale "dashboard.grid.remove-shared") on-remove-shared]
|
||||
[(t locale "dashboard.grid.add-shared") on-add-shared])]}]]]))
|
||||
|
||||
;; --- Grid
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
(def interaction (icon-xref :interaction))
|
||||
(def layers (icon-xref :layers))
|
||||
(def letter-spacing (icon-xref :letter-spacing))
|
||||
(def library (icon-xref :library))
|
||||
(def line (icon-xref :line))
|
||||
(def line-height (icon-xref :line-height))
|
||||
(def loader (icon-xref :loader))
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
[uxbox.main.refs :as refs]
|
||||
[uxbox.main.store :as st]
|
||||
[uxbox.main.ui.components.dropdown :refer [dropdown]]
|
||||
[uxbox.main.ui.modal :as modal]
|
||||
[uxbox.main.ui.confirm :refer [confirm-dialog]]
|
||||
[uxbox.main.ui.workspace.presence :as presence]
|
||||
[uxbox.util.i18n :as i18n :refer [t]]
|
||||
[uxbox.util.data :refer [classnames]]
|
||||
|
@ -58,13 +60,33 @@
|
|||
(mf/defc menu
|
||||
[{:keys [layout project file] :as props}]
|
||||
(let [show-menu? (mf/use-state false)
|
||||
locale (i18n/use-locale)]
|
||||
locale (i18n/use-locale)
|
||||
|
||||
add-shared-fn #(st/emit! nil (dw/set-file-shared (:id file) true))
|
||||
on-add-shared
|
||||
#(modal/show! confirm-dialog
|
||||
{:message (t locale "dashboard.grid.add-shared-message" (:name file))
|
||||
:hint (t locale "dashboard.grid.add-shared-hint")
|
||||
:accept-text (t locale "dashboard.grid.add-shared-accept")
|
||||
:not-danger? true
|
||||
:on-accept add-shared-fn})
|
||||
|
||||
remove-shared-fn #(st/emit! nil (dw/set-file-shared (:id file) false))
|
||||
on-remove-shared
|
||||
#(modal/show! confirm-dialog
|
||||
{:message (t locale "dashboard.grid.remove-shared-message" (:name file))
|
||||
:hint (t locale "dashboard.grid.remove-shared-hint")
|
||||
:accept-text (t locale "dashboard.grid.remove-shared-accept")
|
||||
:not-danger? false
|
||||
:on-accept remove-shared-fn})]
|
||||
|
||||
[:div.menu-section
|
||||
[:div.btn-icon-dark.btn-small {:on-click #(reset! show-menu? true)} i/actions]
|
||||
[:div.project-tree {:alt (t locale "header.sitemap")}
|
||||
[:span.project-name (:name project) " /"]
|
||||
[:span (:name file)]]
|
||||
(when (:is-shared file)
|
||||
[:div.shared-badge i/library])
|
||||
|
||||
[:& dropdown {:show @show-menu?
|
||||
:on-close #(reset! show-menu? false)}
|
||||
|
@ -117,6 +139,12 @@
|
|||
(t locale "workspace.header.menu.disable-dynamic-alignment")
|
||||
(t locale "workspace.header.menu.enable-dynamic-alignment"))]
|
||||
[:span.shortcut "Ctrl+a"]]
|
||||
|
||||
(if (:is-shared file)
|
||||
[:li {:on-click on-remove-shared}
|
||||
[:span (t locale "dashboard.grid.remove-shared")]]
|
||||
[:li {:on-click on-add-shared}
|
||||
[:span (t locale "dashboard.grid.add-shared")]])
|
||||
]]]))
|
||||
|
||||
;; --- Header Component
|
||||
|
|
|
@ -255,6 +255,7 @@
|
|||
|
||||
(mf/defc library-toolbox
|
||||
[{:keys [library-id
|
||||
shared?
|
||||
images
|
||||
colors
|
||||
initial-open?
|
||||
|
@ -268,7 +269,9 @@
|
|||
{:class (classnames :open @open?)
|
||||
:on-click toggle-open}
|
||||
i/arrow-slide]
|
||||
[:span (tr "workspace.assets.file-library")]]
|
||||
[:span (tr "workspace.assets.file-library")]
|
||||
(when shared?
|
||||
[:span.tool-badge (tr "workspace.assets.shared")])]
|
||||
(when @open?
|
||||
(let [show-graphics (and (or (= box-filter :all) (= box-filter :graphics))
|
||||
(or (> (count images) 0) (str/empty? search-term)))
|
||||
|
@ -286,7 +289,8 @@
|
|||
(mf/defc assets-toolbox
|
||||
[]
|
||||
(let [team-id (-> refs/workspace-project mf/deref :team-id)
|
||||
file-id (-> refs/workspace-file mf/deref :id)
|
||||
file (mf/deref refs/workspace-file)
|
||||
file-id (:id file)
|
||||
file-images (mf/deref refs/workspace-images)
|
||||
file-colors (mf/deref refs/workspace-colors)
|
||||
|
||||
|
@ -347,6 +351,7 @@
|
|||
]]
|
||||
|
||||
[:& library-toolbox {:library-id file-id
|
||||
:shared? (:is-shared file)
|
||||
:images filtered-images
|
||||
:colors filtered-colors
|
||||
:initial-open? true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue