enhance(ux): show configure tag instead of create tag when exists

This commit is contained in:
Tienson Qin
2025-06-13 20:11:28 +08:00
parent 1d3e8a1703
commit 25bd22522b

View File

@@ -84,11 +84,21 @@
(when (and (not (string/blank? q))
(not (#{"config.edn" "custom.js" "custom.css"} q))
(not config/publishing?))
(let [class? (string/starts-with? q "#")]
(->> [{:text (if class? "Create tag" "Create page") :icon "new-page"
(let [class? (string/starts-with? q "#")
class-name (get-class-from-input q)
class (ldb/class? (db/get-case-page class-name))]
(->> [{:text (cond
class "Configure tag"
class? "Create tag"
:else "Create page")
:icon "new-page"
:icon-theme :gray
:info (if class?
(str "Create class called '" (get-class-from-input q) "'")
(let [class-name (get-class-from-input q)
class (db/get-case-page class-name)]
(if class
(str "Configure #" class-name)
(str "Create tag called '" class-name "'")))
(str "Create page called '" q "'"))
:source-create :page}]
(remove nil?)))))