From 6fb762f96cfe21b90c0ee88fdd3b6a571294238d Mon Sep 17 00:00:00 2001 From: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Date: Wed, 23 Jul 2025 13:56:17 +0530 Subject: [PATCH] chore: Migrate to next Switch component (#12005) --- .../DropdownPrimitives.story.vue | 4 +- .../sidebar/SidebarProfileMenuStatus.vue | 24 +++--- .../components-next/switch/Switch.vue | 4 +- .../dashboard/components/ui/Switch.vue | 83 ------------------- .../settings/automation/AutomationRuleRow.vue | 23 +++-- .../inbox/PreChatForm/PreChatFields.vue | 7 +- .../profile/NotificationPreferences.vue | 10 +-- .../reports/components/FilterSelector.vue | 9 +- .../reports/components/ReportFilters.vue | 13 ++- .../routes/dashboard/settings/sla/SlaForm.vue | 4 +- app/javascript/entrypoints/dashboard.js | 2 - app/javascript/v3/components/Form/Switch.vue | 36 -------- 12 files changed, 54 insertions(+), 165 deletions(-) delete mode 100644 app/javascript/dashboard/components/ui/Switch.vue delete mode 100644 app/javascript/v3/components/Form/Switch.vue diff --git a/app/javascript/dashboard/components-next/dropdown-menu/DropdownPrimitives.story.vue b/app/javascript/dashboard/components-next/dropdown-menu/DropdownPrimitives.story.vue index a174b1eea..397f45d93 100644 --- a/app/javascript/dashboard/components-next/dropdown-menu/DropdownPrimitives.story.vue +++ b/app/javascript/dashboard/components-next/dropdown-menu/DropdownPrimitives.story.vue @@ -6,7 +6,7 @@ import DropdownBody from './base/DropdownBody.vue'; import DropdownSection from './base/DropdownSection.vue'; import DropdownItem from './base/DropdownItem.vue'; import DropdownSeparator from './base/DropdownSeparator.vue'; -import WootSwitch from 'components/ui/Switch.vue'; +import ToggleSwitch from 'dashboard/components-next/switch/Switch.vue'; const currentUserAutoOffline = ref(false); @@ -61,7 +61,7 @@ const menuItems = ref([ {{ $t('SIDEBAR.SET_AUTO_OFFLINE.TEXT') }}
- +
diff --git a/app/javascript/dashboard/components-next/sidebar/SidebarProfileMenuStatus.vue b/app/javascript/dashboard/components-next/sidebar/SidebarProfileMenuStatus.vue index fef196162..41e64dee1 100644 --- a/app/javascript/dashboard/components-next/sidebar/SidebarProfileMenuStatus.vue +++ b/app/javascript/dashboard/components-next/sidebar/SidebarProfileMenuStatus.vue @@ -14,6 +14,7 @@ import { } from 'next/dropdown-menu/base'; import Icon from 'next/icon/Icon.vue'; import Button from 'next/button/Button.vue'; +import ToggleSwitch from 'dashboard/components-next/switch/Switch.vue'; const { t } = useI18n(); const store = useStore(); @@ -48,6 +49,16 @@ const activeStatus = computed(() => { return availabilityStatuses.value.find(status => status.active); }); +const autoOfflineToggle = computed({ + get: () => currentUserAutoOffline.value, + set: autoOffline => { + store.dispatch('updateAutoOffline', { + accountId: currentAccountId.value, + autoOffline, + }); + }, +}); + function changeAvailabilityStatus(availability) { if (isImpersonating.value) { useAlert(t('PROFILE_SETTINGS.FORM.AVAILABILITY.IMPERSONATING_ERROR')); @@ -62,13 +73,6 @@ function changeAvailabilityStatus(availability) { useAlert(t('PROFILE_SETTINGS.FORM.AVAILABILITY.SET_AVAILABILITY_ERROR')); } } - -function updateAutoOffline(autoOffline) { - store.dispatch('updateAutoOffline', { - accountId: currentAccountId.value, - autoOffline, - }); -}