Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ChatView): center dragover on MessagesList only #14237

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 39 additions & 33 deletions src/components/ChatView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,24 @@
@dragleave.prevent="handleDragLeave"
@drop.prevent="handleDropFiles">
<GuestWelcomeWindow v-if="isGuestWithoutDisplayName" :token="token" />
<TransitionWrapper name="slide-up" mode="out-in">
<div v-show="isDraggingOver"
class="dragover">
<div class="drop-hint">
<div class="drop-hint__icon"
:class="{
'icon-upload' : !isGuest && !isReadOnly,
'icon-user' : isGuest,
'icon-error' : isReadOnly}" />
<h2 class="drop-hint__text">
{{ dropHintText }}
</h2>
</div>
</div>
</TransitionWrapper>
<MessagesList role="region"
:aria-label="t('spreed', 'Conversation messages')"
:token="token"
:is-chat-scrolled-to-bottom.sync="isChatScrolledToBottom"
:is-visible="isVisible" />
<div class="messages-list-dragover-wrapper">
<TransitionWrapper name="slide-up" mode="out-in">
<NcEmptyContent v-show="isDraggingOver"
:name="dropHintText"
class="dragover">
<template #icon>
<IconTrayArrowUp v-if="!isGuest && !isReadOnly" />
<IconAccount v-else-if="isGuest" />
<IconAlertOctagon v-else-if="isReadOnly" />
</template>
</NcEmptyContent>
</TransitionWrapper>
<MessagesList role="region"
:aria-label="t('spreed', 'Conversation messages')"
:token="token"
:is-chat-scrolled-to-bottom.sync="isChatScrolledToBottom"
:is-visible="isVisible" />
</div>

<div class="scroll-to-bottom">
<TransitionWrapper name="fade">
Expand All @@ -39,7 +37,7 @@
class="scroll-to-bottom__button"
@click="scrollToBottom">
<template #icon>
<ChevronDoubleDown :size="20" />
<IconChevronDoubleDown :size="20" />
</template>
</NcButton>
</TransitionWrapper>
Expand All @@ -57,11 +55,15 @@
</template>

<script>
import ChevronDoubleDown from 'vue-material-design-icons/ChevronDoubleDown.vue'
import IconAccount from 'vue-material-design-icons/Account.vue'
import IconAlertOctagon from 'vue-material-design-icons/AlertOctagon.vue'
import IconChevronDoubleDown from 'vue-material-design-icons/ChevronDoubleDown.vue'
import IconTrayArrowUp from 'vue-material-design-icons/TrayArrowUp.vue'

import { t } from '@nextcloud/l10n'

import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import NcEmptyContent from '@nextcloud/vue/dist/Components/NcEmptyContent.js'

import GuestWelcomeWindow from './GuestWelcomeWindow.vue'
import MessagesList from './MessagesList/MessagesList.vue'
Expand All @@ -80,12 +82,17 @@ export default {

components: {
NcButton,
ChevronDoubleDown,
NcEmptyContent,
MessagesList,
NewMessage,
NewMessageUploadEditor,
TransitionWrapper,
GuestWelcomeWindow,
// icons
IconAccount,
IconAlertOctagon,
IconChevronDoubleDown,
IconTrayArrowUp,
},

props: {
Expand Down Expand Up @@ -216,9 +223,17 @@ export default {
min-height: 0;
}

.messages-list-dragover-wrapper {
position: relative;
width: 100%;
height: 100%;
display: flex;
min-height: 0;
}

.dragover {
position: absolute;
inset: 10%;
inset: 5%;
background: var(--color-primary-element-light);
z-index: 11;
display: flex;
Expand All @@ -228,15 +243,6 @@ export default {
pointer-events: none;
}

.drop-hint {
margin: auto;
&__icon {
background-size: 48px;
height: 48px;
margin-bottom: 16px;
}
}

.scroll-to-bottom {
position: relative;
height: 0;
Expand Down
Loading