mirror of
https://github.com/penpot/penpot.git
synced 2025-06-14 21:51:37 +02:00
💄 Minor cosmetic changes on recent files component.
This commit is contained in:
parent
383431ec6d
commit
dca8971f06
1 changed files with 32 additions and 25 deletions
|
@ -42,36 +42,43 @@
|
||||||
|
|
||||||
;; --- Component: Drafts Page
|
;; --- Component: Drafts Page
|
||||||
|
|
||||||
|
(mf/defc recent-project
|
||||||
|
[{:keys [project files first? locale] :as props}]
|
||||||
|
(let [project-id (:id project)]
|
||||||
|
[:div.recent-files-row
|
||||||
|
{:class-name (when first? "first")}
|
||||||
|
[:div.recent-files-row-title
|
||||||
|
[:h2.recent-files-row-title-name (:name project)]
|
||||||
|
[:span.recent-files-row-title-info (str (:file-count project) " files")]
|
||||||
|
(when files
|
||||||
|
(let [time (-> (first files)
|
||||||
|
(:modified-at)
|
||||||
|
(dt/timeago {:locale locale}))]
|
||||||
|
[:span.recent-files-row-title-info (str ", " time)]))]
|
||||||
|
[:& grid {:id (:id project)
|
||||||
|
:files (or files [])
|
||||||
|
:hide-new? true}]]))
|
||||||
|
|
||||||
|
|
||||||
(mf/defc recent-files-page
|
(mf/defc recent-files-page
|
||||||
[{:keys [section team-id] :as props}]
|
[{:keys [section team-id] :as props}]
|
||||||
(mf/use-effect
|
(mf/use-effect
|
||||||
{:fn #(st/emit! (dsh/initialize-team team-id))
|
{:fn #(st/emit! (dsh/initialize-recent team-id))
|
||||||
:deps (mf/deps team-id)})
|
:deps (mf/deps team-id)})
|
||||||
(let [projects (mf/deref projects-ref)
|
(let [projects (->> (mf/deref projects-ref)
|
||||||
|
(vals)
|
||||||
|
(filter #(pos? (:file-count %)))
|
||||||
|
(sort-by :modified-at)
|
||||||
|
(reverse))
|
||||||
|
|
||||||
recent-files (mf/deref recent-files-ref)
|
recent-files (mf/deref recent-files-ref)
|
||||||
locale (i18n/use-locale)]
|
locale (i18n/use-locale)]
|
||||||
(if projects
|
(when (and projects recent-files)
|
||||||
[:section.recent-files-page
|
[:section.recent-files-page
|
||||||
(for [project (vals projects)]
|
(for [project projects]
|
||||||
[:div.recent-files-row
|
[:& recent-project {:project project
|
||||||
{:key (:id project)
|
:locale locale
|
||||||
:class-name (when (= project (first (vals projects))) "first")}
|
:key (:id project)
|
||||||
[:div.recent-files-row-title
|
:files (get recent-files (:id project))
|
||||||
[:h2.recent-files-row-title-name (:name project)]
|
:first? (= project (first projects))}])])))
|
||||||
[:span.recent-files-row-title-info (str (:file-count project) " files")]
|
|
||||||
(when (and recent-files (recent-files (:id project)))
|
|
||||||
(let [time (-> (project :id)
|
|
||||||
(recent-files)
|
|
||||||
(first)
|
|
||||||
:modified-at
|
|
||||||
(dt/timeago {:locale locale}))]
|
|
||||||
[:span.recent-files-row-title-info (str ", " time)]))]
|
|
||||||
[:& grid {:id (:id project)
|
|
||||||
:files (or
|
|
||||||
(and recent-files (recent-files (:id project)))
|
|
||||||
[])
|
|
||||||
:hide-new? true}]])]
|
|
||||||
[:section
|
|
||||||
[:p "empty"]])
|
|
||||||
))
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue