akkoma-fe/src/components/chat_message/chat_message.vue

101 lines
2.9 KiB
Vue
Raw Normal View History

2020-05-07 13:10:53 +00:00
<template>
<div
v-if="isMessage"
class="chat-message-wrapper"
:class="{ 'hovered-message-chain': hoveredMessageChain }"
@mouseover="onHover(true)"
@mouseleave="onHover(false)"
>
<div
class="chat-message"
:class="[{ 'outgoing': isCurrentUser, 'incoming': !isCurrentUser }]"
>
<div
v-if="!isCurrentUser"
class="avatar-wrapper"
>
<router-link
v-if="chatViewItem.isHead"
:to="userProfileLink"
>
<UserAvatar
:compact="true"
:better-shadow="betterShadow"
:user="author"
/>
</router-link>
</div>
<div class="chat-message-inner">
<div
class="status-body"
:style="{ 'min-width': message.attachment ? '80%' : '' }"
>
<div
class="media status"
2020-10-29 10:33:06 +00:00
:class="{ 'without-attachment': !hasAttachment, 'pending': chatViewItem.data.pending, 'error': chatViewItem.data.error }"
2020-05-07 13:10:53 +00:00
style="position: relative"
@mouseenter="hovered = true"
@mouseleave="hovered = false"
>
<div
class="chat-message-menu"
:class="{ 'visible': hovered || menuOpened }"
2020-05-07 13:10:53 +00:00
>
<Popover
trigger="click"
placement="top"
:bound-to-selector="isCurrentUser ? '' : '.scrollable-message-list'"
:bound-to="{ x: 'container' }"
:margin="popoverMarginStyle"
@show="menuOpened = true"
@close="menuOpened = false"
>
<div slot="content">
<div class="dropdown-menu">
<button
class="button-default dropdown-item dropdown-item-icon"
2020-05-07 13:10:53 +00:00
@click="deleteMessage"
>
2020-10-20 18:18:23 +00:00
<FAIcon icon="times" /> {{ $t("chats.delete") }}
2020-05-07 13:10:53 +00:00
</button>
</div>
</div>
<button
slot="trigger"
class="button-default menu-icon"
2020-05-07 13:10:53 +00:00
:title="$t('chats.more')"
>
<FAIcon icon="ellipsis-h" />
2020-05-07 13:10:53 +00:00
</button>
</Popover>
</div>
<StatusContent
:status="messageForStatusContent"
:full-content="true"
>
<span
slot="footer"
class="created-at"
>
{{ createdAt }}
</span>
</StatusContent>
</div>
</div>
</div>
</div>
</div>
<div
v-else
class="chat-message-date-separator"
>
<ChatMessageDate :date="chatViewItem.date" />
</div>
</template>
<script src="./chat_message.js" ></script>
<style lang="scss">
@import './chat_message.scss';
</style>