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;
|
list-style-type: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.results li {
|
ul.results li.result {
|
||||||
padding: 36px 0;
|
padding: 36px 0;
|
||||||
border-top: 2px dotted #dccb8b;
|
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
|
margin-bottom: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.post ul.controls {
|
||||||
|
margin: 18px 0 0;
|
||||||
|
padding: 0;
|
||||||
|
list-style-type: none;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
||||||
|
|
@ -294,6 +294,13 @@
|
||||||
(defn user [{:keys [user]}]
|
(defn user [{:keys [user]}]
|
||||||
(:username 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]}]
|
(defn attachment [{:keys [attachment]}]
|
||||||
(case (:type attachment)
|
(case (:type attachment)
|
||||||
"image" [:img {:src (:preview_url attachment)
|
"image" [:img {:src (:preview_url attachment)
|
||||||
|
|
@ -309,23 +316,25 @@
|
||||||
|
|
||||||
(defn post [{:keys [post]}]
|
(defn post [{:keys [post]}]
|
||||||
; TODO: handle (:sensitive post)
|
; TODO: handle (:sensitive post)
|
||||||
[:article
|
[:article.post
|
||||||
[:div.users
|
[:header.metadata
|
||||||
|
[:section.users
|
||||||
[user {:user (:account post)}]
|
[user {:user (:account post)}]
|
||||||
(when (seq (:mentions post))
|
(when (seq (:mentions post))
|
||||||
[:span.mentions
|
[:span.mentions
|
||||||
{:style #js {:color "#777"}}
|
" (mentioning " [list-accounts (:mentions post)] ")"])]
|
||||||
" (mentioning " (->> (map-indexed (fn [idx account]
|
[:section.post-info
|
||||||
^{:key idx} [user {:user account}])
|
[:time.date {:datetime (:created_at post)} (first (str/split (:created_at post) "T"))]]]
|
||||||
(:mentions post))
|
[:section.content {:dangerouslySetInnerHTML (r/unsafe-html (:content post))}
|
||||||
(interleave (repeat ", "))
|
|
||||||
(drop 1)) ")"])]
|
|
||||||
[:div.url [:a {:href (:url post)} (:url post)]]
|
|
||||||
[:div.content {:dangerouslySetInnerHTML (r/unsafe-html (:content post))}
|
|
||||||
(when (seq (:media_attachments 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}])
|
^{:key idx} [attachment {:attachment item}])
|
||||||
(:media_attachments post))])]
|
(:media_attachments post))])]
|
||||||
|
[:nav
|
||||||
|
[:ul.controls
|
||||||
|
[:li.control-element.url
|
||||||
|
[:a {:href (:url post) :target "_blank"} "↗ Open original post"]]]]
|
||||||
#_[debug post]])
|
#_[debug post]])
|
||||||
|
|
||||||
(defn- refresh-displayed-posts!
|
(defn- refresh-displayed-posts!
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue