mirror of
https://github.com/penpot/penpot.git
synced 2025-05-30 16:16:11 +02:00
✨ Set an artboard as the file thumbnail
This commit is contained in:
parent
a588267fc2
commit
0a04a856da
11 changed files with 150 additions and 26 deletions
|
@ -38,12 +38,12 @@
|
|||
(def ^:const CACHE-NAME "penpot")
|
||||
(def ^:const CACHE-URL "https://penpot.app/cache/")
|
||||
|
||||
|
||||
(defn use-thumbnail-cache
|
||||
"Creates some hooks to handle the files thumbnails cache"
|
||||
[file]
|
||||
|
||||
(let [cache-url (str CACHE-URL (:id file) "/" (:revn file) ".svg")
|
||||
|
||||
get-thumbnail
|
||||
(mf/use-callback
|
||||
(mf/deps cache-url)
|
||||
|
@ -83,14 +83,12 @@
|
|||
(if (some? thumb-data)
|
||||
(rx/of thumb-data)
|
||||
(->> (wrk/ask! {:cmd :thumbnails/generate
|
||||
:file-id (:id file)
|
||||
:page-id (get-in file [:data :pages 0])})
|
||||
:file-id (:id file)})
|
||||
(rx/tap cache-thumbnail)))))
|
||||
|
||||
;; If we have a problem we delegate to the thumbnail generation
|
||||
(rx/catch #(wrk/ask! {:cmd :thumbnails/generate
|
||||
:file-id (:id file)
|
||||
:page-id (get-in file [:data :pages 0])})))))))
|
||||
:file-id (:id file)})))))))
|
||||
|
||||
(mf/defc grid-item-thumbnail
|
||||
{::mf/wrap [mf/memo]}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue