From 27dadca343969fcf02f9d9bc1b30b2e5f9775027 Mon Sep 17 00:00:00 2001 From: SouthFox Date: Wed, 20 Sep 2023 11:04:58 +0800 Subject: [PATCH] [front/chore] format some code --- src/main/frontend/views.cljs | 44 +++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/src/main/frontend/views.cljs b/src/main/frontend/views.cljs index c399467..b77b3e6 100644 --- a/src/main/frontend/views.cljs +++ b/src/main/frontend/views.cljs @@ -23,14 +23,14 @@ [:p "questions"] (button 432539930 :question "question") (button 437735833 :question "question") - (button 535225379 :question "question") - ]) + (button 535225379 :question "question")]) (defn about-page [] [:div - [:h2 "About"] [:ul - [:li [:a {:href "https://git.southfox.me/southfox/liberty-hu"} "Source code"]]]]) + [:li + [:a + {:href "https://git.southfox.me/southfox/liberty-hu"} "Source code"]]]]) (defn item-page [] (let [loading @(subscribe [:loading]) @@ -58,32 +58,35 @@ [:h1 {:class "text-2xl"} (-> post :question :title)] [:div {:class "space-y-5"} - (for [ans (:answers post)] - ^{:key ans} - [:div {:class "p-3 bg-white shadow rounded-lg"} + (for [answer (:answers post)] + ^{:key answer} + [:div {:class "p-3 bg-white shadow"} [:div {:class "flex items-center mb-3"} [:img {:class "h-10 rounded" - :src (-> ans :author :avatar_url)}] + :src (-> answer :author :avatar_url)}] [:a {:class "text-lg ml-3"} - (-> ans :author :name)]] + (-> answer :author :name)]] [:div {:dangerouslySetInnerHTML - {:__html (:content ans)}}]])] + {:__html (:content answer)}}]])] (if end? [:p {:class "mt-5"} "answers end here."] (if (:more loading) [:p {:class "mt-5"} "loading more..."] [:div {:class "mt-5"} - [:button {:type "button" - :href (-> post :paging :next) - :class "btn btn-blue" - :on-click #(get-more % - {:request {:path "hq" - :id (-> post :paging :question_id) - :query {:cursor (-> post :paging :cursor) - :session_id (-> post :paging :session_id)}} - :db-path [:post :answers] - :loading-type :comment})} + [:button + {:type "button" + :href (-> post :paging :next) + :class "btn btn-blue" + :on-click #(get-more + % + {:request + {:path "hq" + :id (-> post :paging :question_id) + :query {:cursor (-> post :paging :cursor) + :session_id (-> post :paging :session_id)}} + :db-path [:post :answers] + :loading-type :comment})} "Load More"]]))]))) (defn nav [{:keys [current-route]}] @@ -94,7 +97,6 @@ [:li [:a {:href (rfe/href :about)} (active :about) "About"]]])) - (defn current-page [] (let [current-route @(subscribe [:current-route])] [:div {:class "container p-2 mx-auto"}