enhance: switching between class/property config and page properties

This commit is contained in:
Tienson Qin
2023-10-19 00:23:54 +08:00
parent 9b219474a2
commit 44ee2baf42
2 changed files with 35 additions and 29 deletions

View File

@@ -349,34 +349,39 @@
class-or-property? (or class? property?)
page-opts {:configure? true
:show-page-properties? @*show-page-properties?}]
[:div.p-4.flex.flex-col.gap-2 {:style {:min-width 700
:min-height 400}}
(cond
(not class-or-property?)
(when (and (not class?)
(not property?)
(not (property-handler/block-has-viewable-properties? page)))
(page-properties page page-opts))
@*show-page-properties?
(page-properties page page-opts)
:else
[:<>
(when class?
(configure page {}))
(when class?
[:div.flex.flex-col.justify-between.p-4 {:style {:min-width 700
:min-height 400}}
[:div.flex.flex-col.gap-2
(cond
(not class-or-property?)
(when (and (not class?)
(not property?)
(not (property-handler/block-has-viewable-properties? page)))
(page-properties page page-opts))
(when (and property? (not class?))
[:h1.title "Configure property"])
(when property?
(property/property-config page page (assoc opts
:inline-text component-block/inline-text)))])
@*show-page-properties?
(page-properties page page-opts)
:else
[:<>
(when class?
(configure page {}))
(when class?
(page-properties page page-opts))
(when (and property? (not class?))
[:h1.title "Configure property"])
(when property?
(property/property-config page page (assoc opts
:inline-text component-block/inline-text)))])]
(when (and class-or-property?
(not (property-handler/block-has-viewable-properties? page))
(not config/publishing?))
[:a.fade-link.ml-2 {:on-click #(swap! *show-page-properties? not)}
[:a.fade-link.flex.flex-row.items-center.gap-1.text-sm
{:on-click #(swap! *show-page-properties? not)}
(ui/icon (if @*show-page-properties?
"arrow-narrow-left"
"arrow-narrow-right"))
(if @*show-page-properties?
"Back"
"Edit page properties")])]))

View File

@@ -422,11 +422,12 @@
[:div.col-span-3
(if (and disabled? inline-text)
(inline-text {} :markdown (:description @*property-schema))
(ui/ls-textarea
{:on-change (fn [e]
(swap! *property-schema assoc :description (util/evalue e)))
:disabled disabled?
:value (:description @*property-schema)}))]]
[:div.mt-1
(ui/ls-textarea
{:on-change (fn [e]
(swap! *property-schema assoc :description (util/evalue e)))
:disabled disabled?
:value (:description @*property-schema)})])]]
[:div
(when-not disabled?
@@ -588,7 +589,7 @@
(property-handler/set-editing-new-property! edit-input-id)
(reset! *property-key nil)
(reset! *property-value nil))}
[:div.flex.flex-row.items-center {:style {:padding-left 1}}
[:div.flex.flex-row.items-center.py-1
(ui/icon "circle-plus" {:size 15})
[:div.ml-1.text-sm "Add property"]]]