# Pull Request Template ## Description This PR will hide Copilot launcher button on inbox view message screen. ## Type of change - [x] Bug fix (non-breaking change which fixes an issue) ## How Has This Been Tested? ### Screenshots **Before** <img width="1425" alt="image" src="https://github.com/user-attachments/assets/319a010c-d6e0-4ac0-b52f-7a4263e62e7f" /> **After** <img width="1442" alt="image" src="https://github.com/user-attachments/assets/73ed796e-97ab-4d34-bf65-43a439d7e66b" /> <img width="1442" alt="image" src="https://github.com/user-attachments/assets/98043441-7c8a-492a-abc3-330856d44c19" /> ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [ ] I have commented on my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules
64 lines
1.8 KiB
Vue
64 lines
1.8 KiB
Vue
<script setup>
|
|
import { computed } from 'vue';
|
|
import { useRoute } from 'vue-router';
|
|
import Button from 'dashboard/components-next/button/Button.vue';
|
|
import { useUISettings } from 'dashboard/composables/useUISettings';
|
|
import { useMapGetter } from 'dashboard/composables/store';
|
|
import { FEATURE_FLAGS } from 'dashboard/featureFlags';
|
|
const route = useRoute();
|
|
|
|
const { uiSettings, updateUISettings } = useUISettings();
|
|
|
|
const isConversationRoute = computed(() => {
|
|
const CONVERSATION_ROUTES = [
|
|
'inbox_conversation',
|
|
'conversation_through_inbox',
|
|
'conversations_through_label',
|
|
'team_conversations_through_label',
|
|
'conversations_through_folders',
|
|
'conversation_through_mentions',
|
|
'conversation_through_unattended',
|
|
'conversation_through_participating',
|
|
'inbox_view_conversation',
|
|
];
|
|
return CONVERSATION_ROUTES.includes(route.name);
|
|
});
|
|
|
|
const currentAccountId = useMapGetter('getCurrentAccountId');
|
|
const isFeatureEnabledonAccount = useMapGetter(
|
|
'accounts/isFeatureEnabledonAccount'
|
|
);
|
|
|
|
const showCopilotLauncher = computed(() => {
|
|
const isCaptainEnabled = isFeatureEnabledonAccount.value(
|
|
currentAccountId.value,
|
|
FEATURE_FLAGS.CAPTAIN
|
|
);
|
|
return (
|
|
isCaptainEnabled &&
|
|
!uiSettings.value.is_copilot_panel_open &&
|
|
!isConversationRoute.value
|
|
);
|
|
});
|
|
const toggleSidebar = () => {
|
|
updateUISettings({
|
|
is_copilot_panel_open: !uiSettings.value.is_copilot_panel_open,
|
|
is_contact_sidebar_open: false,
|
|
});
|
|
};
|
|
</script>
|
|
|
|
<template>
|
|
<div v-if="showCopilotLauncher" class="fixed bottom-4 right-4 z-50">
|
|
<div class="rounded-full bg-n-alpha-2 p-1">
|
|
<Button
|
|
icon="i-woot-captain"
|
|
class="!rounded-full !bg-n-solid-3 dark:!bg-n-alpha-2 !text-n-slate-12 text-xl"
|
|
lg
|
|
@click="toggleSidebar"
|
|
/>
|
|
</div>
|
|
</div>
|
|
<template v-else />
|
|
</template>
|