mirror of
https://github.com/styppo/hamstr.git
synced 2024-10-18 13:33:22 +00:00
Basic 'Replying to' in Posts
This commit is contained in:
parent
9d2bb8982a
commit
028e870f5f
@ -46,7 +46,7 @@ export default {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss" scoped>
|
||||||
@import 'assets/theme/colors.scss';
|
@import 'assets/theme/colors.scss';
|
||||||
|
|
||||||
a {
|
a {
|
||||||
|
@ -13,6 +13,9 @@
|
|||||||
<span>·</span>
|
<span>·</span>
|
||||||
<span class="created-at">{{ moment(post.createdAt).fromNow() }}</span>
|
<span class="created-at">{{ moment(post.createdAt).fromNow() }}</span>
|
||||||
</p>
|
</p>
|
||||||
|
<p v-if="post.inReplyTo" class="in-reply-to">
|
||||||
|
Replying to <a @click.stop="toEvent(post.inReplyTo)">{{ shorten(post.inReplyTo) }}</a>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="post-content-body">
|
<div class="post-content-body">
|
||||||
<p>
|
<p>
|
||||||
@ -84,11 +87,15 @@ function countRepliesRecursive(event) {
|
|||||||
|
|
||||||
function postFromEvents(events) {
|
function postFromEvents(events) {
|
||||||
const event = events[0]
|
const event = events[0]
|
||||||
|
if (event.interpolated.replyEvents.length) {
|
||||||
|
console.log(event.content, event.interpolated.replyEvents)
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
id: event.id,
|
id: event.id,
|
||||||
author: event.pubkey,
|
author: event.pubkey,
|
||||||
createdAt: event.created_at * 1000,
|
createdAt: event.created_at * 1000,
|
||||||
content: event.content,
|
content: event.content,
|
||||||
|
inReplyTo: event.interpolated.replyEvents[event.interpolated.replyEvents.length - 1],
|
||||||
images: [],
|
images: [],
|
||||||
stats: {
|
stats: {
|
||||||
comments: countRepliesRecursive(event),
|
comments: countRepliesRecursive(event),
|
||||||
@ -153,8 +160,22 @@ export default {
|
|||||||
margin-left: 12px;
|
margin-left: 12px;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
&-header {
|
&-header {
|
||||||
|
.in-reply-to {
|
||||||
|
color: $color-dark-gray;
|
||||||
|
a {
|
||||||
|
color: $color-blue;
|
||||||
|
&:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
p {
|
p {
|
||||||
margin: 0 0 8px;
|
&:first-child {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
&:last-child {
|
||||||
|
margin: 0 0 8px;
|
||||||
|
}
|
||||||
> span {
|
> span {
|
||||||
color: $color-dark-gray;
|
color: $color-dark-gray;
|
||||||
&:first-child {
|
&:first-child {
|
||||||
|
Loading…
Reference in New Issue
Block a user