Skip to content

Commit

Permalink
refact: Cleanup pre renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaeldelboni committed Oct 30, 2021
1 parent 17a4485 commit 7cde518
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 34 deletions.
5 changes: 1 addition & 4 deletions src/data.edn
Original file line number Diff line number Diff line change
Expand Up @@ -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"}}}
14 changes: 1 addition & 13 deletions src/stasis/resolvers.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -67,8 +57,7 @@
:post/name
:post/path
:post/description
:post/tags
:author/id]}
:post/tags]}
(-> :posts
database-fn
(get id)
Expand Down Expand Up @@ -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
Expand Down
20 changes: 9 additions & 11 deletions src/stasis/ui.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand All @@ -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)))
4 changes: 2 additions & 2 deletions src/stasis/ui/pages.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/stasis/ui/posts.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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}))
Expand All @@ -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
Expand All @@ -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)))
2 changes: 1 addition & 1 deletion src/stasis/ui/posts/pagination.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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)))

0 comments on commit 7cde518

Please sign in to comment.