Skip to content

Commit

Permalink
⚡ Only show assistant button if feature is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
MiloradFilipovic committed Aug 2, 2024
1 parent 59d2af5 commit 21ba59d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 6 additions & 1 deletion packages/editor-ui/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<AskAssistantChat />
<Modals />
<Telemetry />
<AskAssistantFloatingButton />
<AskAssistantFloatingButton v-if="showAssistantButton" />
</div>
</div>
</template>
Expand Down Expand Up @@ -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',
Expand All @@ -82,6 +83,7 @@ export default defineComponent({
},
computed: {
...mapStores(
useAssistantStore,
useNodeTypesStore,
useRootStore,
useSettingsStore,
Expand All @@ -98,6 +100,9 @@ export default defineComponent({
isDemoMode(): boolean {
return this.$route.name === VIEWS.DEMO;
},
showAssistantButton(): boolean {
return this.assistantStore.canShowAssistantButtons;
},
},
data() {
return {
Expand Down
3 changes: 1 addition & 2 deletions packages/editor-ui/src/stores/assistant.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export const useAssistantStore = defineStore(STORES.ASSISTANT, () => {
() =>
isExperimentEnabled.value &&
settings.isAiAssistantEnabled &&
route.name &&
ENABLED_VIEWS.includes(route.name as VIEWS),
);

Expand All @@ -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),
);

Expand Down

0 comments on commit 21ba59d

Please sign in to comment.