From 21ba59d5325e093dc475681f941f2bed8087fa75 Mon Sep 17 00:00:00 2001 From: Milorad Filipovic Date: Fri, 2 Aug 2024 16:52:56 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=20Only=20show=20assistant=20button=20?= =?UTF-8?q?if=20feature=20is=20enabled?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/editor-ui/src/App.vue | 7 ++++++- packages/editor-ui/src/stores/assistant.store.ts | 3 +-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/editor-ui/src/App.vue b/packages/editor-ui/src/App.vue index c35a5950c0ebd..307d46d3dd0cd 100644 --- a/packages/editor-ui/src/App.vue +++ b/packages/editor-ui/src/App.vue @@ -29,7 +29,7 @@ - + @@ -61,6 +61,7 @@ import { useUsageStore } from '@/stores/usage.store'; import { useUsersStore } from '@/stores/users.store'; import { useHistoryHelper } from '@/composables/useHistoryHelper'; import { useRoute } from 'vue-router'; +import { useAssistantStore } from './stores/assistant.store'; export default defineComponent({ name: 'App', @@ -82,6 +83,7 @@ export default defineComponent({ }, computed: { ...mapStores( + useAssistantStore, useNodeTypesStore, useRootStore, useSettingsStore, @@ -98,6 +100,9 @@ export default defineComponent({ isDemoMode(): boolean { return this.$route.name === VIEWS.DEMO; }, + showAssistantButton(): boolean { + return this.assistantStore.canShowAssistantButtons; + }, }, data() { return { diff --git a/packages/editor-ui/src/stores/assistant.store.ts b/packages/editor-ui/src/stores/assistant.store.ts index e6c368fd24d1f..cd09d7d81f6ed 100644 --- a/packages/editor-ui/src/stores/assistant.store.ts +++ b/packages/editor-ui/src/stores/assistant.store.ts @@ -66,7 +66,6 @@ export const useAssistantStore = defineStore(STORES.ASSISTANT, () => { () => isExperimentEnabled.value && settings.isAiAssistantEnabled && - route.name && ENABLED_VIEWS.includes(route.name as VIEWS), ); @@ -85,8 +84,8 @@ export const useAssistantStore = defineStore(STORES.ASSISTANT, () => { const canShowAssistantButtons = computed( () => + isExperimentEnabled.value && settings.isAiAssistantEnabled && - route.name && EDITABLE_CANVAS_VIEWS.includes(route.name as VIEWS), );