-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(replies): add message replies (#133)
* feat(replies): add reply component and replies under messages * feat(replies): reply logic * fix(replies): rebase and minors * fix(replies): minors * fix(replies): minors
- Loading branch information
Showing
25 changed files
with
426 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,4 +49,8 @@ | |
.command-desc { | ||
font-size: @mini-text-size; | ||
} | ||
|
||
&.has-reply { | ||
margin-bottom: 30px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<div v-if="$store.state.ui.replyChatbarContent.id" class="is-chatbar-reply"> | ||
<VueMarkdown :source="`${$t('conversation.reply_to')} **${$store.state.ui.replyChatbarContent.from}**: ${$store.state.ui.replyChatbarContent.payload}`" class="markdown" /> | ||
<div class="reply-close" @click="setReplyChatbarContent"> | ||
<font-awesome-icon :icon="['far', 'times-circle']" /> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
.is-chatbar-reply { | ||
min-height: 36px; | ||
max-height: 36px; | ||
display: flex; | ||
justify-content: space-between; | ||
width: calc(100% - 2rem); | ||
padding: 0.25rem 0.5rem; | ||
font-size: @text-size; | ||
font-family: @secondary-font; | ||
margin: 0 1rem; | ||
background-color: @light-gray; | ||
border-top-left-radius: @corner-rounding; | ||
border-top-right-radius: @corner-rounding; | ||
border: 1px solid transparent; | ||
align-items: center; | ||
|
||
strong { | ||
color: @bright-text; | ||
} | ||
|
||
.markdown { | ||
width: calc(100% - @small-icon-size - 0.25rem); | ||
p { | ||
font-size: @text-size; | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
overflow: hidden; | ||
} | ||
} | ||
|
||
.reply-close { | ||
cursor: pointer; | ||
display: flex; | ||
font-size: @small-icon-size; | ||
color: @text; | ||
} | ||
} | ||
|
||
@media only screen and (max-width: 768px) { | ||
.is-chatbar-reply { | ||
margin: 0 @light-spacing; | ||
width: calc(100% - @normal-spacing); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<template src="./Reply.html"></template> | ||
<script lang="ts"> | ||
import Vue from 'vue' | ||
import VueMarkdown from 'vue-markdown' | ||
export default Vue.extend({ | ||
components: { | ||
VueMarkdown, | ||
}, | ||
methods: { | ||
setReplyChatbarContent() { | ||
this.$store.commit('setReplyChatbarContent', { | ||
id: '', | ||
payload: '', | ||
from: '', | ||
}) | ||
}, | ||
}, | ||
}) | ||
</script> | ||
<style lang="less" src="./Reply.less"></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,28 @@ | ||
<div class="is-message" @contextmenu="contextMenu"> | ||
<VueMarkdown v-if="message.type === 'text'" :source="message.payload" class="markdown" /> | ||
<UiImage v-else-if="message.type === 'image'" :source="message.payload.url" alt="" /> | ||
<UiEmbedsVideoPlayer v-else-if="message.type === 'video'" :data="message.payload" /> | ||
<UiEmbedsAudioPlayer v-else-if="message.type === 'audio'" :data="message.payload" /> | ||
<UiEmbedsFile v-else-if="message.type === 'file'" :data="message.payload" /> | ||
<div @mouseenter="mouseOver" @mouseleave="mouseOver" :class="`message-container ${messageHover ? 'message-hover' : '' }`"> | ||
<div v-if="messageHover" class="reply-button"> | ||
<div class="reply-command" :data-tooltip="$t('global.glyphs')"> | ||
<font-awesome-icon | ||
:icon="['far', 'grin-tongue-wink']" | ||
:class="`control-icon emoji-icon ${$store.state.ui.showEnhancers ? 'primary' : ''}`" | ||
/> | ||
</div> | ||
<div class="reply-command" :data-tooltip="$t('global.reply')" @click="setReplyChatbarContent"> | ||
<font-awesome-icon :icon="['fas', 'reply']" :class="'control-icon'" /> | ||
</div> | ||
<div class="reply-command" :data-tooltip="$t('global.more')"> | ||
<font-awesome-icon :icon="['fas', 'ellipsis-h']" :class="'control-icon'" /> | ||
</div> | ||
</div> | ||
<VueMarkdown v-if="message.type === 'text'" :source="message.payload" class="markdown" /> | ||
<UiImage v-else-if="message.type === 'image'" :source="message.payload.url" alt="" /> | ||
<UiEmbedsVideoPlayer v-else-if="message.type === 'video'" :data="message.payload" /> | ||
<UiEmbedsAudioPlayer v-else-if="message.type === 'audio'" :data="message.payload" /> | ||
<UiEmbedsFile v-else-if="message.type === 'file'" :data="message.payload" /> | ||
</div> | ||
<div v-if="message.replies.length" class="reply-container"> | ||
<div v-if="!showReplies" class="reply-preview" @click="toggleReplies"> {{message.replies.length}} {{$tc('conversation.reply', message.replies.length)}} > </div> | ||
<TailoredMessagingMessageReply v-if="showReplies" v-for="reply in message.replies" :reply="reply" :key="reply.id"/> | ||
<div v-if="showReplies" @click="toggleReplies" class="reply-close"> Collapse < </div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<div class="is-reply"> | ||
<span v-on:click="showQuickProfile"> | ||
<UiCircle type="random" :seed="reply.from" :size="35" /> | ||
</span> | ||
<div class="reply-body"> | ||
<div class="reply-heading"> | ||
<span v-on:click="showQuickProfile"> | ||
<UiUsername :username="$mock.users.filter(u => u.address === reply.from)[0].name" | ||
:badge="$mock.users.filter(u => u.address === reply.from)[0].badge" /> | ||
</span> | ||
<TypographyText :text="$dayjs(reply.at).from()" /> | ||
</div> | ||
<div class="reply-content"> | ||
<VueMarkdown v-if="reply.type === 'text'" :source="reply.payload" class="markdown" /> | ||
<UiImage v-else-if="reply.type === 'image'" :source="reply.payload.url" alt="" /> | ||
<UiEmbedsVideoPlayer v-else-if="reply.type === 'video'" :data="reply.payload" /> | ||
<UiEmbedsAudioPlayer v-else-if="reply.type === 'audio'" :data="reply.payload" /> | ||
<UiEmbedsFile v-else-if="reply.type === 'file'" :data="reply.payload" /> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
.is-reply { | ||
padding: 0.25rem; | ||
display: flex; | ||
margin-bottom: 0.25rem; | ||
|
||
.circle { | ||
margin-top: 0.3rem; | ||
cursor: pointer; | ||
} | ||
|
||
.reply-body { | ||
margin-left: 0.75rem; | ||
width: 100%; | ||
|
||
.reply-heading { | ||
display: inline-flex; | ||
flex-direction: row; | ||
align-items: center; | ||
|
||
.is-text { | ||
margin-left: @light-spacing; | ||
font-size: @micro-text-size; | ||
color: @text-muted; | ||
display: flex; | ||
align-items: flex-end; | ||
height: 1.2rem; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.