-
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.
fix(replies): change avatar color to correct one (#2878)
- Loading branch information
1 parent
e8c7d6a
commit 6c1deac
Showing
7 changed files
with
193 additions
and
132 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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<div class="reply-container"> | ||
<div class="is-reply"> | ||
<span @click="(event) => $emit('click', event)"> | ||
<UiCircle | ||
:type="src ? 'image' :'random'" | ||
:seed="address" | ||
:size="35" | ||
:source="src" | ||
/> | ||
</span> | ||
<div class="reply-body"> | ||
<div class="reply-heading"> | ||
<span @click="(event) => $emit('click', event)"> | ||
<!-- TODO: update badges //AP-397 --> | ||
<UiUserName :username="username" :badge="''" /> | ||
</span> | ||
<TypographyText :text="timestamp" /> | ||
</div> | ||
<div class="reply-content"> | ||
<MessageMarkdown | ||
v-if="reply.replyType === 'text'" | ||
:text="markdownToHtml(reply.payload)" | ||
class="markdown" | ||
data-cy="reply-message" | ||
/> | ||
<UiChatImage | ||
v-else-if="reply.replyType === 'image'" | ||
:source="reply.payload.url" | ||
alt="" | ||
/> | ||
<UiChatEmbedsVideoPlayer | ||
v-else-if="reply.replyType === 'video'" | ||
:data="reply.payload" | ||
/> | ||
<UiChatEmbedsAudioPlayer | ||
v-else-if="reply.replyType === 'audio'" | ||
:data="reply.payload" | ||
/> | ||
<UiChatEmbedsFile | ||
v-else-if="reply.replyType === 'file'" | ||
:data="reply.payload" | ||
/> | ||
<MessageActions | ||
:emojiReaction="(event) => $emit('emoji-reaction', event, reply.id)" | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
<MessageReactions :message="message" :group="group" :reply="reply" /> | ||
</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,47 @@ | ||
.reply-container { | ||
.emoji-reactions { | ||
margin-top: 0; | ||
margin-left: 3rem; | ||
position: relative; | ||
} | ||
.is-reply { | ||
.circle { | ||
margin-top: 0.3rem; | ||
cursor: pointer; | ||
} | ||
|
||
.reply-body { | ||
.reply-heading { | ||
display: inline-flex; | ||
flex-direction: row; | ||
align-items: center; | ||
|
||
.is-text { | ||
margin-left: @light-spacing; | ||
font-size: @micro-text-size; | ||
&:extend(.font-muted); | ||
display: flex; | ||
align-items: flex-end; | ||
height: 1.2rem; | ||
} | ||
} | ||
|
||
.reply-content { | ||
position: relative; | ||
} | ||
margin-left: 0.75rem; | ||
&:extend(.full-width); | ||
} | ||
&:extend(.full-width); | ||
padding: 0.5rem; | ||
display: flex; | ||
margin-bottom: 0.25rem; | ||
} | ||
display: flex; | ||
flex-direction: column; | ||
&:hover { | ||
.message-actions { | ||
display: flex; | ||
} | ||
} | ||
} |
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,76 @@ | ||
<template src="./Item.html"></template> | ||
<script lang="ts"> | ||
import Vue, { PropType } from 'vue' | ||
import { mapState } from 'vuex' | ||
import { UIMessage, Group } from '~/types/messaging' | ||
import { | ||
getUsernameFromState, | ||
convertTimestampToDate, | ||
getAddressFromState, | ||
} from '~/utilities/Messaging' | ||
export default Vue.extend({ | ||
props: { | ||
message: { | ||
type: Object as PropType<UIMessage>, | ||
default: () => ({ | ||
id: '0', | ||
at: 1620515543000, | ||
type: 'text', | ||
payload: 'Invalid Message', | ||
}), | ||
}, | ||
group: { | ||
type: Object as PropType<Group>, | ||
default: () => {}, | ||
}, | ||
reply: { | ||
type: Object, | ||
default: () => {}, | ||
}, | ||
markdownToHtml: { | ||
type: Function, | ||
default: () => {}, | ||
}, | ||
}, | ||
computed: { | ||
...mapState(['ui', 'friends', 'accounts']), | ||
address() { | ||
if (!this.reply.from) { | ||
return '' | ||
} | ||
return getAddressFromState(this.reply.from, this.$store.state) | ||
}, | ||
username() { | ||
if (!this.reply.from) { | ||
return '' | ||
} | ||
return getUsernameFromState(this.reply.from, this.$store.state) | ||
}, | ||
timestamp() { | ||
if (!this.reply.at) { | ||
return '' | ||
} | ||
return convertTimestampToDate(this.$t('friends.details'), this.reply.at) | ||
}, | ||
src(): string { | ||
// To check if the sender is you we just compare the from field | ||
// with your textile public key | ||
if (this.reply.from === this.$TextileManager?.getIdentityPublicKey()) { | ||
const myHash = this.accounts.details?.profilePicture | ||
return myHash ? `${this.$Config.textile.browser}/ipfs/${myHash}` : '' | ||
} | ||
// Try to find the friend you are talking to | ||
const friend = this.$Hounddog.findFriend(this.reply.from, this.friends) | ||
if (friend?.profilePicture) { | ||
return `${this.$Config.textile.browser}/ipfs/${friend?.profilePicture}` | ||
} | ||
return '' | ||
}, | ||
}, | ||
}) | ||
</script> | ||
<style lang="less" src="./Item.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