diff --git a/app/javascript/dashboard/i18n/locale/en/integrations.json b/app/javascript/dashboard/i18n/locale/en/integrations.json
index 4c05b0284..2bb03746a 100644
--- a/app/javascript/dashboard/i18n/locale/en/integrations.json
+++ b/app/javascript/dashboard/i18n/locale/en/integrations.json
@@ -447,7 +447,6 @@
}
},
"DRILLDOWN": {
- "CLOSE": "Close details",
"EMPTY": "No records found for this metric.",
"ERROR": "Could not load records. Please try again.",
"LOAD_MORE": "Load more",
diff --git a/app/javascript/dashboard/i18n/locale/en/report.json b/app/javascript/dashboard/i18n/locale/en/report.json
index 0171b9620..fa1c2e176 100644
--- a/app/javascript/dashboard/i18n/locale/en/report.json
+++ b/app/javascript/dashboard/i18n/locale/en/report.json
@@ -129,7 +129,6 @@
"ERROR": "Could not load records. Please try again.",
"ADMIN_ONLY": "Only administrators can drill down into report records.",
"LOAD_MORE": "Load more",
- "CLOSE": "Close details",
"PREVIOUS_BUCKET": "Previous bar",
"NEXT_BUCKET": "Next bar",
"UNKNOWN_CONTACT": "Unknown contact",
diff --git a/app/javascript/dashboard/routes/dashboard/captain/documents/Index.vue b/app/javascript/dashboard/routes/dashboard/captain/documents/Index.vue
index 9c1effd20..4fcebf8d6 100644
--- a/app/javascript/dashboard/routes/dashboard/captain/documents/Index.vue
+++ b/app/javascript/dashboard/routes/dashboard/captain/documents/Index.vue
@@ -54,11 +54,9 @@ const handleDelete = () => {
const showDocumentDetails = ref(false);
const showCreateDialog = ref(false);
const createDocumentDialog = ref(null);
-const documentDetailsDialog = ref(null);
const handleShowDocumentDetails = () => {
showDocumentDetails.value = true;
- nextTick(() => documentDetailsDialog.value.dialogRef.open());
};
const handleCreateDocument = () => {
showCreateDialog.value = true;
@@ -430,7 +428,6 @@ onUnmounted(() => {
diff --git a/app/javascript/dashboard/routes/dashboard/settings/automation/AutomationRuleForm.vue b/app/javascript/dashboard/routes/dashboard/settings/automation/AutomationRuleForm.vue
index 654c6e348..d7bf5c78e 100644
--- a/app/javascript/dashboard/routes/dashboard/settings/automation/AutomationRuleForm.vue
+++ b/app/javascript/dashboard/routes/dashboard/settings/automation/AutomationRuleForm.vue
@@ -291,7 +291,7 @@ defineExpose({ open, close });
-
+
-import { computed, nextTick, onBeforeUnmount, ref, watch } from 'vue';
+import { computed, ref, watch } from 'vue';
import { useEventListener } from '@vueuse/core';
import { useI18n } from 'vue-i18n';
import { formatTime } from '@chatwoot/utils';
import Button from 'dashboard/components-next/button/Button.vue';
import Spinner from 'dashboard/components-next/spinner/Spinner.vue';
-import TeleportWithDirection from 'dashboard/components-next/TeleportWithDirection.vue';
+import SidePanel from 'dashboard/components-next/side-panel/SidePanel.vue';
import { useReportDrilldown } from '../composables/useReportDrilldown';
import ReportDrilldownCard from './ReportDrilldownCard.vue';
@@ -29,8 +29,8 @@ const props = defineProps({
const emit = defineEmits(['close', 'navigate']);
+const panelRef = ref(null);
const { t } = useI18n();
-const drawerRef = ref(null);
const {
records,
meta,
@@ -44,10 +44,6 @@ const {
loadMore,
} = useReportDrilldown();
-let previousActiveElement = null;
-
-const isOpen = computed(() => props.open);
-
const title = computed(() => props.metricName || '');
const bucketValue = computed(() => {
@@ -100,37 +96,11 @@ const subtitle = computed(() =>
.join(' ⋅ ')
);
-const restoreFocus = () => {
- if (previousActiveElement?.isConnected) {
- previousActiveElement.focus();
- }
- previousActiveElement = null;
-};
-
-const closeDrawer = () => {
- close();
- emit('close');
- restoreFocus();
-};
-
const recordKey = record =>
`${record.record_type}-${record.message?.id || record.conversation?.id}-${
record.occurred_at
}`;
-const rememberActiveElement = () => {
- if (previousActiveElement) return;
-
- previousActiveElement =
- document.activeElement instanceof HTMLElement
- ? document.activeElement
- : null;
-};
-
-const focusDrawer = () => {
- nextTick(() => drawerRef.value?.focus());
-};
-
const fetchDrilldown = () => {
openDrilldown({
metric: props.metric,
@@ -152,13 +122,9 @@ const navigate = direction => {
};
const onKeydown = event => {
- if (!isOpen.value) return;
+ if (!props.open) return;
- if (event.key === 'Escape') {
- event.preventDefault();
- event.stopPropagation();
- closeDrawer();
- } else if (event.key === 'ArrowLeft') {
+ if (event.key === 'ArrowLeft') {
navigate(-1);
} else if (event.key === 'ArrowRight') {
navigate(1);
@@ -171,16 +137,14 @@ watch(
() => props.open,
isDrawerOpen => {
if (!isDrawerOpen) {
+ panelRef.value?.close();
close();
- restoreFocus();
return;
}
- rememberActiveElement();
+ panelRef.value?.open();
fetchDrilldown();
- focusDrawer();
- },
- { immediate: true }
+ }
);
watch(
@@ -189,127 +153,89 @@ watch(
if (props.open) fetchDrilldown();
}
);
-
-onBeforeUnmount(() => {
- restoreFocus();
-});
-
-
-
-