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(ux): response editor #1220

Merged
merged 8 commits into from
May 24, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
feat: add loading indicator
  • Loading branch information
ssiyad committed May 24, 2023
commit b69f28c2f64f84058c141fc5b8cf0e94d87e2e34
10 changes: 7 additions & 3 deletions desk/src/pages/desk/ticket/ConversationBox.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div ref="listElement" class="flex flex-col items-center overflow-scroll">
<div class="content flex flex-col gap-4">
<div v-if="isLoaded" class="content flex flex-col gap-4">
<div v-for="(c, i) in conversations" :key="c.name" class="mt-4">
<div v-if="isNewDay(i)">
<div class="flex items-center">
Expand Down Expand Up @@ -29,12 +29,16 @@
/>
</div>
</div>
<div v-else class="flex grow items-center justify-center">
<LoadingIndicator class="w-5 text-gray-900" />
</div>
</div>
</template>

<script setup lang="ts">
import { computed, onUnmounted, ref, watch } from "vue";
import { useScroll } from "@vueuse/core";
import { LoadingIndicator } from "frappe-ui";
import dayjs from "dayjs";
import { orderBy, unionBy } from "lodash";
import { socket } from "@/socket";
Expand All @@ -54,15 +58,15 @@ ticket.getCommunications
ticket.getComments.submit().then(() => (isCommentsLoaded.value = true));

const listElement = ref<HTMLElement | null>(null);
const { y: scrollY } = useScroll(listElement, { behavior: "smooth" });
const { y: scrollY } = useScroll(listElement);

const isCommunicationsLoaded = ref(false);
const isCommentsLoaded = ref(false);
const isLoaded = computed(
() => isCommunicationsLoaded.value && isCommentsLoaded.value
);

watch(isLoaded, (v) => {
watch(listElement, (v) => {
if (v) scrollToBottom();
});

Expand Down
3 changes: 1 addition & 2 deletions desk/src/pages/desk/ticket/TicketSingle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
<TopBar />
<div class="flex grow overflow-hidden">
<div class="flex grow flex-col">
<ConversationBox />
<div class="grow"></div>
<ConversationBox class="grow" />
<ResponseEditor />
</div>
<SideBar />
Expand Down