[front/perf] show voteup and comment count

This commit is contained in:
SouthFox 2023-09-21 14:02:29 +08:00
parent 4c05a47117
commit 6f5c2987b3

View file

@ -71,10 +71,10 @@
get-more (fn [event params] get-more (fn [event params]
(.preventDefault event) (.preventDefault event)
(dispatch [:get-more params]) (dispatch [:get-more params])
(dispatch [:set-history {:id (get-in params [:request :id]) (dispatch [:set-history
:type :question {:id (get-in params [:request :id])
:query (get-in params [:request :query]) :type :question
}]))] :query (get-in params [:request :query])}]))]
(if (:question loading) (if (:question loading)
[:p "Loading..."] [:p "Loading..."]
[:div [:div
@ -91,11 +91,18 @@
(-> answer :author :name)]] (-> answer :author :name)]]
[:div [:div
{:dangerouslySetInnerHTML {:dangerouslySetInnerHTML
{:__html (:content answer)}}]])] {:__html (:content answer)}}]
(if end? [:div {:class "text-slate-500 my-2.5"}
[:p {:class "mt-5"} "answers end here."] [:p "发布于" (.toLocaleString (js/Date. (* (:created_time answer) 1000)) "zh-CN" {:timezone "UTC"})]
(if (:more loading) (when (not= (:created_time answer) (:updated_time answer))
[:p {:class "mt-5"} "loading more..."] [:p "编辑于" (.toLocaleString (js/Date. (* (:updated_time answer) 1000)) "zh-CN" {:timezone "UTC"})])]
[:div {:class "flex gap-4"}
[:span "🔼" (:voteup_count answer)]
[:span "🗨️️" (:comment_count answer)]]])]
(if (:more loading)
[:p {:class "mt-5"} "loading more..."]
(if end?
[:p {:class "mt-5"} "answers end here."]
[:div {:class "mt-5"} [:div {:class "mt-5"}
[:button [:button
{:type "button" {:type "button"