chore: Update captain FAQ bulk action UI (#11780)

This commit is contained in:
Sivin Varghese
2025-06-24 16:33:42 +05:30
committed by GitHub
parent 9edfb1e902
commit 92c51a10de
3 changed files with 35 additions and 11 deletions

View File

@@ -123,7 +123,7 @@ const handleDocumentableClick = () => {
@mouseenter="emit('hover', true)" @mouseenter="emit('hover', true)"
@mouseleave="emit('hover', false)" @mouseleave="emit('hover', false)"
> >
<div v-show="selectable" class="absolute top-7 ltr:left-4 rtl:right-4"> <div v-show="selectable" class="absolute top-7 ltr:left-3 rtl:right-3">
<Checkbox v-model="modelValue" /> <Checkbox v-model="modelValue" />
</div> </div>
<div class="flex relative justify-between w-full gap-1"> <div class="flex relative justify-between w-full gap-1">

View File

@@ -537,6 +537,8 @@
"CONVERSATION": "Conversation #{id}" "CONVERSATION": "Conversation #{id}"
}, },
"SELECTED": "{count} selected", "SELECTED": "{count} selected",
"SELECT_ALL": "Select all ({count})",
"UNSELECT_ALL": "Unselect all ({count})",
"BULK_APPROVE_BUTTON": "Approve", "BULK_APPROVE_BUTTON": "Approve",
"BULK_DELETE_BUTTON": "Delete", "BULK_DELETE_BUTTON": "Delete",
"BULK_APPROVE": { "BULK_APPROVE": {

View File

@@ -157,6 +157,13 @@ const bulkCheckbox = computed({
}, },
}); });
const buildSelectedCountLabel = computed(() => {
const count = responses.value?.length || 0;
return bulkSelectionState.value.allSelected
? t('CAPTAIN.RESPONSES.UNSELECT_ALL', { count })
: t('CAPTAIN.RESPONSES.SELECT_ALL', { count });
});
const handleCardHover = (isHovered, id) => { const handleCardHover = (isHovered, id) => {
hoveredCard.value = isHovered ? id : null; hoveredCard.value = isHovered ? id : null;
}; };
@@ -270,7 +277,11 @@ onMounted(() => {
<template #controls> <template #controls>
<div <div
v-if="shouldShowDropdown" v-if="shouldShowDropdown"
class="mb-4 -mt-3 flex justify-between items-center" class="mb-4 -mt-3 flex justify-between items-center w-fit py-1"
:class="{
'ltr:pl-3 rtl:pr-3 ltr:pr-1 rtl:pl-1 rounded-lg outline outline-1 outline-n-weak bg-n-solid-3':
bulkSelectionState.hasSelected,
}"
> >
<div v-if="!bulkSelectionState.hasSelected" class="flex gap-3"> <div v-if="!bulkSelectionState.hasSelected" class="flex gap-3">
<OnClickOutside @trigger="isStatusFilterOpen = false"> <OnClickOutside @trigger="isStatusFilterOpen = false">
@@ -306,13 +317,18 @@ onMounted(() => {
> >
<div <div
v-if="bulkSelectionState.hasSelected" v-if="bulkSelectionState.hasSelected"
class="flex items-center gap-3 ltr:pl-4 rtl:pr-4" class="flex items-center gap-3"
> >
<div class="flex items-center gap-3">
<div class="flex items-center gap-1.5"> <div class="flex items-center gap-1.5">
<Checkbox <Checkbox
v-model="bulkCheckbox" v-model="bulkCheckbox"
:indeterminate="bulkSelectionState.isIndeterminate" :indeterminate="bulkSelectionState.isIndeterminate"
/> />
<span class="text-sm text-n-slate-12 font-medium tabular-nums">
{{ buildSelectedCountLabel }}
</span>
</div>
<span class="text-sm text-n-slate-10 tabular-nums"> <span class="text-sm text-n-slate-10 tabular-nums">
{{ {{
$t('CAPTAIN.RESPONSES.SELECTED', { $t('CAPTAIN.RESPONSES.SELECTED', {
@@ -322,17 +338,23 @@ onMounted(() => {
</span> </span>
</div> </div>
<div class="h-4 w-px bg-n-strong" /> <div class="h-4 w-px bg-n-strong" />
<div class="flex gap-2"> <div class="flex gap-3 items-center">
<Button <Button
:label="$t('CAPTAIN.RESPONSES.BULK_APPROVE_BUTTON')" :label="$t('CAPTAIN.RESPONSES.BULK_APPROVE_BUTTON')"
sm sm
slate ghost
icon="i-lucide-check"
class="!px-1.5"
@click="handleBulkApprove" @click="handleBulkApprove"
/> />
<div class="h-4 w-px bg-n-strong" />
<Button <Button
:label="$t('CAPTAIN.RESPONSES.BULK_DELETE_BUTTON')" :label="$t('CAPTAIN.RESPONSES.BULK_DELETE_BUTTON')"
sm sm
slate ruby
ghost
class="!px-1.5"
icon="i-lucide-trash"
@click="bulkDeleteDialog.dialogRef.open()" @click="bulkDeleteDialog.dialogRef.open()"
/> />
</div> </div>