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

101 lines
2.9 KiB
Vue
Raw Normal View History

2020-05-07 13:10:53 +00:00
<template>
<div class="chat-view">
<div class="chat-view-inner">
<div
ref="inner"
class="panel-default panel chat-view-body"
>
<div
ref="header"
2022-04-20 17:43:10 +00:00
class="panel-heading -sticky chat-view-heading"
2020-05-07 13:10:53 +00:00
>
2022-04-12 14:17:52 +00:00
<button
class="button-unstyled go-back-button"
2020-05-07 13:10:53 +00:00
@click="goBack"
>
2020-10-20 21:31:16 +00:00
<FAIcon
size="lg"
icon="chevron-left"
/>
2022-04-12 14:17:52 +00:00
</button>
2020-05-07 13:10:53 +00:00
<div class="title text-center">
<ChatTitle
:user="recipient"
:with-avatar="true"
/>
</div>
</div>
2022-03-17 06:35:19 +00:00
<div
class="message-list"
2022-03-17 06:35:19 +00:00
:style="{ height: scrollableContainerHeight }"
>
<template v-if="!errorLoadingChat">
<ChatMessage
v-for="chatViewItem in chatViewItems"
:key="chatViewItem.id"
:author="recipient"
:chat-view-item="chatViewItem"
:hovered-message-chain="chatViewItem.messageChainId === hoveredMessageChainId"
@hover="onMessageHover"
/>
</template>
2020-05-07 13:10:53 +00:00
<div
2022-03-17 06:35:19 +00:00
v-else
class="chat-loading-error"
2020-05-07 13:10:53 +00:00
>
2022-03-17 06:35:19 +00:00
<div class="alert error">
{{ $t('chats.error_loading_chat') }}
2020-05-07 13:10:53 +00:00
</div>
</div>
2022-03-17 06:35:19 +00:00
</div>
<div
ref="footer"
class="panel-body footer"
>
2020-05-07 13:10:53 +00:00
<div
2022-03-17 06:35:19 +00:00
class="jump-to-bottom-button"
:class="{ 'visible': jumpToBottomButtonVisible }"
@click="scrollDown({ behavior: 'smooth' })"
2020-05-07 13:10:53 +00:00
>
2022-03-17 06:35:19 +00:00
<span>
<FAIcon icon="chevron-down" />
<div
v-if="newMessageCount"
class="badge badge-notification unread-chat-count unread-message-count"
>
{{ newMessageCount }}
</div>
</span>
2020-05-07 13:10:53 +00:00
</div>
2022-03-17 06:35:19 +00:00
<PostStatusForm
:disable-subject="true"
:disable-scope-selector="true"
:disable-notice="true"
:disable-lock-warning="true"
:disable-polls="true"
:disable-sensitivity-checkbox="true"
:disable-submit="errorLoadingChat || !currentChat"
:disable-preview="true"
:optimistic-posting="true"
:post-handler="sendMessage"
:submit-on-enter="!mobileLayout"
:preserve-focus="!mobileLayout"
:auto-focus="!mobileLayout"
:placeholder="formPlaceholder"
:file-limit="1"
max-height="160"
emoji-picker-placement="top"
@resize="handleResize"
/>
</div>
2020-05-07 13:10:53 +00:00
</div>
</div>
</div>
</template>
<script src="./chat.js"></script>
<style lang="scss">
@import '../../_variables.scss';
@import './chat.scss';
</style>