Improve post view
Moves link below main post and adds date
This commit is contained in:
parent
566bc711be
commit
342462fd63
2 changed files with 47 additions and 18 deletions
|
|
@ -103,14 +103,34 @@
|
|||
list-style-type: none;
|
||||
}
|
||||
|
||||
ul.results li {
|
||||
ul.results li.result {
|
||||
padding: 36px 0;
|
||||
border-top: 2px dotted #dccb8b;
|
||||
}
|
||||
|
||||
.content p:last-child {
|
||||
.post .metadata {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
}
|
||||
|
||||
.post .metadata .post-info {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.post .metadata .mentions,
|
||||
.post .metadata .date {
|
||||
color: #777;
|
||||
}
|
||||
|
||||
.post .content p:last-child {
|
||||
margin-bottom: 0
|
||||
}
|
||||
|
||||
.post ul.controls {
|
||||
margin: 18px 0 0;
|
||||
padding: 0;
|
||||
list-style-type: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
|||
|
|
@ -294,6 +294,13 @@
|
|||
(defn user [{:keys [user]}]
|
||||
(:username user))
|
||||
|
||||
(defn- list-accounts [accounts]
|
||||
[:<>
|
||||
(->> (map-indexed (fn [idx account]
|
||||
^{:key idx} [user {:user account}]) accounts)
|
||||
(interleave (repeat ", "))
|
||||
(drop 1))])
|
||||
|
||||
(defn attachment [{:keys [attachment]}]
|
||||
(case (:type attachment)
|
||||
"image" [:img {:src (:preview_url attachment)
|
||||
|
|
@ -309,23 +316,25 @@
|
|||
|
||||
(defn post [{:keys [post]}]
|
||||
; TODO: handle (:sensitive post)
|
||||
[:article
|
||||
[:div.users
|
||||
[:article.post
|
||||
[:header.metadata
|
||||
[:section.users
|
||||
[user {:user (:account post)}]
|
||||
(when (seq (:mentions post))
|
||||
[:span.mentions
|
||||
{:style #js {:color "#777"}}
|
||||
" (mentioning " (->> (map-indexed (fn [idx account]
|
||||
^{:key idx} [user {:user account}])
|
||||
(:mentions post))
|
||||
(interleave (repeat ", "))
|
||||
(drop 1)) ")"])]
|
||||
[:div.url [:a {:href (:url post)} (:url post)]]
|
||||
[:div.content {:dangerouslySetInnerHTML (r/unsafe-html (:content post))}
|
||||
" (mentioning " [list-accounts (:mentions post)] ")"])]
|
||||
[:section.post-info
|
||||
[:time.date {:datetime (:created_at post)} (first (str/split (:created_at post) "T"))]]]
|
||||
[:section.content {:dangerouslySetInnerHTML (r/unsafe-html (:content post))}
|
||||
(when (seq (:media_attachments post))
|
||||
[:div.attachments (map-indexed (fn [idx item]
|
||||
[:section.attachments
|
||||
(map-indexed (fn [idx item]
|
||||
^{:key idx} [attachment {:attachment item}])
|
||||
(:media_attachments post))])]
|
||||
[:nav
|
||||
[:ul.controls
|
||||
[:li.control-element.url
|
||||
[:a {:href (:url post) :target "_blank"} "↗ Open original post"]]]]
|
||||
#_[debug post]])
|
||||
|
||||
(defn- refresh-displayed-posts!
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue