Skip to content

Commit 2abb2e1

Browse files
aerodevalmergify[bot]
authored andcommitted
Merge pull request #2969 from aerodeval/fix/-fix-ui-inconsistency
refactor: fix UI inconsistency all over Helpdesk (cherry picked from commit 15b246e) # Conflicts: # desk/src/components/Settings/Telephony/Telephony.vue # desk/src/components/layouts/layoutSettings.ts # desk/src/components/view-controls/QuickFilters.vue # desk/src/pages/dashboard/Dashboard.vue # desk/src/pages/ticket/TicketAgent.vue # desk/src/pages/ticket/Tickets.vue # package.json
1 parent 873712c commit 2abb2e1

File tree

110 files changed

+4789
-1644
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+4789
-1644
lines changed

desk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@
4343
"cheerio": "1.0.0-rc.12",
4444
"prosemirror-model": "1.25.4"
4545
}
46-
}
46+
}

desk/src/App.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ useFavicon(favicon);
2626
onMounted(() => {
2727
window.addEventListener("online", () => {
2828
toast.create({
29-
message: __("You are now online"),
29+
message: __("You are now online."),
3030
icon: h(Wifi, { class: "text-white" }),
3131
});
3232
});
3333
3434
window.addEventListener("offline", () => {
3535
toast.create({
36-
message: __("You are now offline"),
36+
message: __("You are now offline."),
3737
icon: h(WifiOff, { class: "text-white" }),
3838
});
3939
});

desk/src/components/CommentBox.vue

Lines changed: 57 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
<span class="font-medium text-gray-800">
1212
{{ commenter }}
1313
</span>
14-
<span> added a</span>
14+
<span> {{ __(" added a") }}</span>
1515
<span class="max-w-xs truncate font-medium text-gray-800">
16-
comment
16+
{{ __(" comment") }}
1717
</span>
1818
</p>
1919
</div>
@@ -26,19 +26,8 @@
2626
<div v-if="authStore.userId === commentedBy && !editable">
2727
<Dropdown
2828
:placement="'right'"
29-
:options="[
30-
{
31-
label: 'Edit',
32-
onClick: () => handleEditMode(),
33-
icon: 'edit-2',
34-
condition: () => !isTicketMergedComment,
35-
},
36-
{
37-
label: 'Delete',
38-
onClick: () => (showDialog = true),
39-
icon: 'trash-2',
40-
},
41-
]"
29+
:options="dropdownOptions"
30+
@click="isConfirmingDelete = false"
4231
>
4332
<Button
4433
icon="more-horizontal"
@@ -147,6 +136,7 @@
147136
? 'bg-blue-100 text-blue-700 hover:bg-blue-200'
148137
: 'bg-surface-gray-3 text-ink-gray-6 hover:bg-surface-gray-4'
149138
"
139+
v-if="reaction.count !== 0"
150140
@click="handleReaction(reaction.emoji)"
151141
>
152142
<span>{{ reaction.emoji }}</span>
@@ -157,21 +147,6 @@
157147
</div>
158148
</div>
159149
</div>
160-
<Dialog
161-
v-model="showDialog"
162-
:options="{
163-
title: 'Delete Comment',
164-
message: 'Are you sure you want to confirm this action?',
165-
actions: [
166-
{ label: 'Cancel', onClick: () => (showDialog = false) },
167-
{
168-
label: 'Delete',
169-
onClick: () => deleteComment.submit(),
170-
variant: 'solid',
171-
},
172-
],
173-
}"
174-
/>
175150
</template>
176151

177152
<script setup lang="ts">
@@ -183,6 +158,7 @@ import { useConfigStore } from "@/stores/config";
183158
import { updateRes as updateComment } from "@/stores/knowledgeBase";
184159
import { useUserStore } from "@/stores/user";
185160
import { CommentActivity } from "@/types";
161+
import { ConfirmDelete } from "@/utils";
186162
import { useDevice } from "@/composables";
187163
import { useScreenSize } from "@/composables/screen";
188164
import {
@@ -195,7 +171,6 @@ import {
195171
} from "@/utils";
196172
import {
197173
Avatar,
198-
Dialog,
199174
Dropdown,
200175
Popover,
201176
TextEditor,
@@ -204,6 +179,7 @@ import {
204179
toast,
205180
} from "frappe-ui";
206181
import { PropType, computed, onMounted, ref } from "vue";
182+
import { __ } from "@/translation";
207183
208184
const authStore = useAuthStore();
209185
const props = defineProps({
@@ -228,12 +204,26 @@ const agentStore = useAgentStore();
228204
const userMentions = computed(() => agentStore.dropdown ?? []);
229205
230206
const emit = defineEmits(["update"]);
231-
const showDialog = ref(false);
207+
const isConfirmingDelete = ref(false);
232208
const editable = ref(false);
233209
const _content = ref(content);
234210
235211
const emojiList = ["👍", "👎", "❤️", "🎉", "👀", ""];
236212
213+
const dropdownOptions = computed(() => [
214+
{
215+
label: "Edit",
216+
onClick: () => handleEditMode(),
217+
icon: "edit-2",
218+
condition: () => !isTicketMergedComment.value,
219+
},
220+
...ConfirmDelete({
221+
onConfirmDelete: () => deleteComment.submit(),
222+
isConfirmingDelete,
223+
}),
224+
]);
225+
// editor.commands.focus('end')
226+
237227
const reactions = ref<
238228
Array<{
239229
emoji: string;
@@ -263,6 +253,37 @@ const toggleReaction = createResource({
263253
});
264254
265255
function handleReaction(emoji: string) {
256+
const previousReaction = reactions.value.find(
257+
(r) => r.current_user_reacted && r.emoji !== emoji
258+
);
259+
if (previousReaction) {
260+
previousReaction.count = Math.max(0, previousReaction.count - 1);
261+
previousReaction.current_user_reacted = false;
262+
}
263+
264+
const existingReaction = reactions.value.find((r) => r.emoji === emoji);
265+
if (existingReaction) {
266+
if (existingReaction.current_user_reacted) {
267+
existingReaction.count = Math.max(0, existingReaction.count - 1);
268+
existingReaction.current_user_reacted = false;
269+
} else {
270+
existingReaction.count += 1;
271+
existingReaction.current_user_reacted = true;
272+
}
273+
} else {
274+
reactions.value.push({
275+
emoji,
276+
count: 1,
277+
current_user_reacted: true,
278+
users: [
279+
{
280+
user: authStore.userId,
281+
full_name: getUser(authStore.userId).full_name,
282+
},
283+
],
284+
});
285+
}
286+
266287
toggleReaction.submit(emoji);
267288
}
268289
@@ -274,7 +295,7 @@ const commentBoxState = ref(content);
274295
function handleEditMode() {
275296
editable.value = true;
276297
commentBoxState.value = _content.value;
277-
editorRef.value.editor.chain().focus("start");
298+
editorRef.value?.editor.chain().focus("end").run();
278299
}
279300
280301
function handleDiscard() {
@@ -290,8 +311,7 @@ const deleteComment = createResource({
290311
}),
291312
onSuccess() {
292313
emit("update");
293-
showDialog.value = false;
294-
toast.success("Comment deleted");
314+
toast.success(__("Comment deleted sucessfully."));
295315
},
296316
});
297317
@@ -301,7 +321,7 @@ function handleSaveComment() {
301321
return;
302322
}
303323
if (isContentEmpty(_content.value)) {
304-
toast.error("Comment cannot be empty");
324+
toast.error(__("Comment cannot be empty."));
305325
return;
306326
}
307327
@@ -317,7 +337,7 @@ function handleSaveComment() {
317337
editable.value = false;
318338
lastSavedContent.value = _content.value;
319339
emit("update");
320-
toast.success("Comment updated");
340+
toast.success(__("Comment updated successfully."));
321341
},
322342
}
323343
);

desk/src/components/CommunicationArea.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
class="flex gap-1.5 flex-1"
3535
@keydown.ctrl.enter.capture.stop="submitEmail"
3636
@keydown.meta.enter.capture.stop="submitEmail"
37+
@keydown.esc.capture.stop="showEmailBox = false"
3738
>
3839
<EmailEditor
3940
ref="emailEditorRef"
@@ -64,6 +65,7 @@
6465
v-show="showCommentBox"
6566
@keydown.ctrl.enter.capture.stop="submitComment"
6667
@keydown.meta.enter.capture.stop="submitComment"
68+
@keydown.esc.capture.stop="showCommentBox = false"
6769
>
6870
<CommentTextEditor
6971
ref="commentTextEditorRef"
@@ -222,7 +224,7 @@ onClickOutside(
222224
}
223225
},
224226
{
225-
ignore: [".tippy-box", ".tippy-content"],
227+
ignore: [".tippy-box", ".tippy-content", ".PopoverContent"],
226228
}
227229
);
228230
@@ -234,7 +236,7 @@ onClickOutside(
234236
}
235237
},
236238
{
237-
ignore: [".tippy-box", ".tippy-content"],
239+
ignore: [".tippy-box", ".tippy-content", ".PopoverContent"],
238240
}
239241
);
240242
</script>

desk/src/components/DiscardButton.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ function handleDiscard() {
3434
},
3535
actions: [
3636
{
37-
label: "Confirm",
37+
label: "Delete",
38+
theme: "red",
39+
iconLeft: "trash-2",
3840
variant: "solid",
3941
onClick(close: Function) {
4042
emit("discard");

desk/src/components/EmailEditor.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,8 @@ const { onUserType, cleanup } = useTyping(props.ticketId);
269269
270270
const attachments = ref([]);
271271
const isUploading = ref(false);
272+
const contentEmpty = computed(() => isContentEmpty(newEmail.value));
273+
272274
const isDisabled = computed(() => {
273275
return (
274276
(isContentEmpty(newEmail.value) && isContentEmpty(quotedContent.value)) ||

desk/src/components/EmptyState.vue

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,44 @@
11
<template>
2-
<div class="flex h-full items-center justify-center">
2+
<div class="flex h-full items-center justify-center w-[stretch]">
33
<div
4-
class="flex flex-col items-center gap-3 text-xl font-medium text-ink-gray-4"
4+
class="flex flex-col items-center gap-3 text-xl font-medium text-ink-gray-4 w-9/12 md:w-4/12"
55
>
66
<!-- Icon -->
77
<component v-if="icon" :is="icon" class="h-10 w-10" />
88
<!-- title -->
9-
<span>{{ title }}</span>
10-
<!-- Button which emits Empty State Action -->
11-
<Button label="Create" @click="emit('emptyStateAction')" variant="subtle">
12-
<template #prefix><FeatherIcon name="plus" class="h-4" /></template>
13-
</Button>
9+
<div class="flex flex-col items-center justify-center">
10+
<span class="text-lg font-medium text-ink-gray-8">{{ __(title) }}</span>
11+
<span
12+
v-if="descriptionText"
13+
class="text-center text-p-base text-ink-gray-6 mt-1"
14+
>
15+
{{ __(descriptionText) }}
16+
</span>
17+
</div>
1418
</div>
1519
</div>
1620
</template>
1721

1822
<script setup lang="ts">
19-
import { VNode } from "vue";
23+
import { VNode, computed } from "vue";
2024
interface Props {
2125
title: string;
2226
icon?: VNode | string;
27+
description?: string;
2328
}
2429
25-
withDefaults(defineProps<Props>(), {
30+
const props = withDefaults(defineProps<Props>(), {
2631
title: "No Data Found",
2732
icon: "",
2833
});
2934
30-
const emit = defineEmits(["emptyStateAction"]);
35+
const descriptionText = computed(() =>
36+
props.description !== undefined && props.description !== ""
37+
? props.description
38+
: `Create new ${props.title
39+
.split(" ")[1]
40+
.toLocaleLowerCase()} using the Create button.`
41+
);
3142
</script>
3243

3344
<style lang="scss" scoped></style>

desk/src/components/LayoutHeader.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Teleport to="#app-header" v-if="showHeader">
33
<slot>
44
<header class="flex h-10.5 items-center justify-between mx-4 md:mr-0">
5-
<div class="flex items-center gap-2 max-w-[50%]">
5+
<div class="flex items-center gap-2 max-w-[70%] md:max-w-[50%]">
66
<slot name="left-header" />
77
</div>
88
<div class="flex items-center gap-2">

0 commit comments

Comments
 (0)