Skip to content

Commit

Permalink
⚡ Hiding assistant button for custom nodes, fixing banner border in d…
Browse files Browse the repository at this point in the history
…ark mode
  • Loading branch information
MiloradFilipovic committed Jul 29, 2024
1 parent 67e637c commit 4c24b73
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,3 @@ const onClick = () => {
margin-bottom: -1px; // center icon to align with text
}
</style>
../AskAssistantText/AssistantText.vue../AskAssistantIcon/AssistantIcon.vue
2 changes: 1 addition & 1 deletion packages/design-system/src/css/_tokens.dark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@
--color-notice-font: var(--prim-gray-0);

// Callout
--color-callout-info-border: var(--prim-gray-420);
--color-callout-info-border: var(--prim-gray-670);
--color-callout-info-background: var(--prim-gray-740);
--color-callout-info-font: var(--prim-gray-0);
--color-callout-success-border: var(--color-success);
Expand Down
8 changes: 7 additions & 1 deletion packages/editor-ui/src/components/Error/NodeErrorView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { useAssistantStore } from '@/stores/assistant.store';
import type { ChatRequest } from '@/types/assistant.types';
import InlineAskAssistantButton from 'n8n-design-system/components/InlineAskAssistantButton/InlineAskAssistantButton.vue';
import { useUIStore } from '@/stores/ui.store';
import { isCommunityPackageName } from '@/utils/nodeTypesUtils';
type Props = {
// TODO: .node can be undefined
Expand Down Expand Up @@ -110,6 +111,11 @@ const prepareRawMessages = computed(() => {
return returnData;
});
const isAskAssistantAvailable = computed(() => {
const isCustomNode = props.error.node?.type === undefined || isCommunityPackageName(props.error.node);

Check failure on line 115 in packages/editor-ui/src/components/Error/NodeErrorView.vue

View workflow job for this annotation

GitHub Actions / Lint / Lint

Replace `·` with `⏎↹↹`
return assistantStore.canShowAssistantButtons && !isCustomNode;
});
const assistantAlreadyAsked = computed(() => {
return assistantStore.isNodeErrorActive({
error: simplifyErrorForAssistant(props.error),
Expand Down Expand Up @@ -435,7 +441,7 @@ async function onAskAssistantClick() {
class="node-error-view__header-description"
v-html="getErrorDescription()"
></div>
<div v-if="assistantStore.canShowAssistantButtons" class="node-error-view__assistant-button">
<div v-if="isAskAssistantAvailable" class="node-error-view__assistant-button">
<InlineAskAssistantButton :asked="assistantAlreadyAsked" @click="onAskAssistantClick" />
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions packages/editor-ui/src/stores/assistant.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -468,5 +468,6 @@ export const useAssistantStore = defineStore(STORES.ASSISTANT, () => {
sendMessage,
applyCodeDiff,
undoCodeDiff,
resetAssistantChat,
};
});

0 comments on commit 4c24b73

Please sign in to comment.