From 7cde518b462ad090948b390247a039fe43a5a651 Mon Sep 17 00:00:00 2001 From: Rafael Delboni Date: Sat, 30 Oct 2021 12:19:52 -0300 Subject: [PATCH] refact: Cleanup pre renaming --- src/data.edn | 5 +---- src/stasis/resolvers.cljs | 14 +------------- src/stasis/ui.cljs | 20 +++++++++----------- src/stasis/ui/pages.cljs | 4 ++-- src/stasis/ui/posts.cljs | 6 +++--- src/stasis/ui/posts/pagination.cljs | 2 +- 6 files changed, 17 insertions(+), 34 deletions(-) diff --git a/src/data.edn b/src/data.edn index a5dbde3..5cb02cd 100644 --- a/src/data.edn +++ b/src/data.edn @@ -4,7 +4,4 @@ :posts {"hello-world" {:post/name "Hello World", :post/description "Such hello, much world", :post/timestamp 1635101110744, :post/path "posts/hello-world.md", :post/tags #{"markdown" "first"}} "gfm-syntax" {:post/name "GFM Syntax", :post/description "All about Github Markdown Syntax", :post/timestamp 1635538866761, :post/path "posts/gfm-syntax.md", :post/tags #{"markdown"}}} - :tags {"markdown" {:tag/name "Markdown Stuff"}} - - :authors {1 {:author/name "Author Name" - :author/email "author@email.com"}}} + :tags {"markdown" {:tag/name "Markdown Stuff"}}} diff --git a/src/stasis/resolvers.cljs b/src/stasis/resolvers.cljs index bfc5cc1..5eff579 100644 --- a/src/stasis/resolvers.cljs +++ b/src/stasis/resolvers.cljs @@ -25,16 +25,6 @@ (get id) (logics/assoc-if-exists :page/id id))) -(pc/defresolver author-resolver [{:keys [database-fn]} {:author/keys [id]}] - {::pc/input #{:author/id} - ::pc/output [:author/id - :author/name - :author/email]} - (-> :authors - database-fn - (get id) - (logics/assoc-if-exists :author/id id))) - (pc/defresolver tag-resolver [{:keys [database-fn]} {:tag/keys [id]}] {::pc/input #{:tag/id} ::pc/output [:tag/id @@ -67,8 +57,7 @@ :post/name :post/path :post/description - :post/tags - :author/id]} + :post/tags]} (-> :posts database-fn (get id) @@ -110,7 +99,6 @@ (def resolvers [page-body-resolver post-body-resolver page-resolver - author-resolver tag-resolver list-posts-tag-resolver alias-list-posts-tag-id diff --git a/src/stasis/ui.cljs b/src/stasis/ui.cljs index 2745a77..d718feb 100644 --- a/src/stasis/ui.cljs +++ b/src/stasis/ui.cljs @@ -35,13 +35,10 @@ (defsc Footer [_this _] {} (dom/footer - (dom/section - (dom/div - (dom/hr) - (dom/span "© 2021 built using ") - (dom/a {:href "https://github.com/rafaeldelboni/stasis"} "stasis") - (dom/span "with ❤ by ") - (dom/a {:href "https://github.com/rafaeldelboni"} "@rafaeldelboni"))))) + (dom/div + (dom/hr) + (dom/span "© 2021 built using ") + (dom/a {:href "https://github.com/rafaeldelboni/stasis"} "stasis")))) (def footer (comp/factory Footer)) @@ -50,7 +47,8 @@ {:query [{:list-pages (comp/get-query ui.pages/ListPage)} {:root/router (comp/get-query TopRouter)}] :initial-state {:root/router {}}} - (dom/div :.container - (header {:list-pages list-pages}) - (ui-top-router router) - (footer))) + (dom/div + (header {:list-pages list-pages}) + (dom/section + (ui-top-router router)) + (footer))) diff --git a/src/stasis/ui/pages.cljs b/src/stasis/ui/pages.cljs index 60abc03..a9f3fba 100644 --- a/src/stasis/ui/pages.cljs +++ b/src/stasis/ui/pages.cljs @@ -21,9 +21,9 @@ :post-mutation-params {:target [:page/id id]}})))} (if body - (dom/section + (dom/div (markdown/render {:body body})) - (dom/section "loading"))) + (dom/div "loading"))) (defsc ListPage [_this {:page/keys [id name] :as props}] {:query [:page/id diff --git a/src/stasis/ui/posts.cljs b/src/stasis/ui/posts.cljs index 17cdbaf..723f651 100644 --- a/src/stasis/ui/posts.cljs +++ b/src/stasis/ui/posts.cljs @@ -35,7 +35,7 @@ :post-mutation-params {:target [:post/id id]}})))} (if body - (dom/section + (dom/div (dom/div :.inline (map link-tags tags)) (ui.markdown/render {:body body})) @@ -48,7 +48,7 @@ :post/description :ui/fetch-state] :ident [:posts/by-id :post/id]} - (dom/section + (dom/div (dom/a {:onClick #(routing/route-to! (dr/path-to Post id))} (dom/p :.inline (dom/span :.post-title @@ -71,6 +71,6 @@ {:post-mutation `dr/target-ready :post-mutation-params {:target [:list-posts-tag/id id]}})))} - (dom/section + (dom/div (dom/h5 (str "[" (:tag/name props) "]")) (mapv ui-list-post posts))) diff --git a/src/stasis/ui/posts/pagination.cljs b/src/stasis/ui/posts/pagination.cljs index be560cd..b62edf1 100644 --- a/src/stasis/ui/posts/pagination.cljs +++ b/src/stasis/ui/posts/pagination.cljs @@ -109,5 +109,5 @@ #(do (initialize {:app app}) (dr/target-ready! app [:component/id :list-posts]))))} - (dom/section + (dom/div (ui-large-list-posts list)))