Skip to content

Commit d229670

Browse files
committed
feat: add sparkle to nodes with ai_chat
1 parent 197423d commit d229670

File tree

1 file changed

+15
-11
lines changed
  • assets/js/workflow-diagram/nodes

1 file changed

+15
-11
lines changed

assets/js/workflow-diagram/nodes/Node.tsx

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Handle, type NodeProps } from 'reactflow';
44
import Shape from '../components/Shape';
55
import ErrorMessage from '../components/ErrorMessage';
66
import { nodeIconStyles, nodeLabelStyles } from '../styles';
7+
import { SparklesIcon } from '@heroicons/react/24/outline';
78

89
type NodeData = any;
910

@@ -23,6 +24,7 @@ type ErrorObject = {
2324

2425
type LabelProps = React.PropsWithChildren<{
2526
hasErrors?: boolean;
27+
hasAi?: boolean;
2628
}>;
2729

2830
function errorsMessage(errors: ErrorObject): string {
@@ -39,16 +41,19 @@ const hasErrors = (errors: ErrorObject | null | undefined): boolean => {
3941
return Object.values(errors).some(errorArray => errorArray.length > 0);
4042
};
4143

42-
const Label: React.FC<LabelProps> = ({ children, hasErrors = false }) => {
44+
const Label: React.FC<LabelProps> = ({ children, hasErrors = false, hasAi = false }) => {
4345
const textColorClass = hasErrors ? 'text-red-500' : '';
4446

4547
if (children && (children as any).length) {
4648
return (
47-
<p
48-
className={`line-clamp-2 align-left text-m max-w-[275px] text-ellipsis overflow-hidden ${textColorClass}`}
49-
>
50-
{children}
51-
</p>
49+
<div className='inline-flex'>
50+
<p
51+
className={`flex line-clamp-2 align-left text-m max-w-[275px] text-ellipsis overflow-hidden ${textColorClass}`}
52+
>
53+
{children}
54+
</p>
55+
{hasAi ? <SparklesIcon title='AI chat was used in this job' className='w-5 h-5 ml-1' color="#FF5722" /> : null}
56+
</div>
5257
);
5358
}
5459
return null;
@@ -225,7 +230,7 @@ const Node = ({
225230
/>
226231
)}
227232
<div className="flex flex-col flex-1 ml-2 mt-8">
228-
<Label hasErrors={hasErrors(errors)}>{label}</Label>
233+
<Label hasErrors={hasErrors(errors)} hasAi={!!data.has_ai_chat}>{label} </Label>
229234
<SubLabel>{sublabel}</SubLabel>
230235
{data.isActiveDropTarget &&
231236
typeof data.dropTargetError === 'string' && (
@@ -245,10 +250,9 @@ const Node = ({
245250
justifyContent: 'center',
246251
}}
247252
className={`flex flex-row items-center
248-
opacity-0 ${
249-
(!data.isActiveDropTarget && 'group-hover:opacity-100') ??
250-
''
251-
}
253+
opacity-0 ${(!data.isActiveDropTarget && 'group-hover:opacity-100') ??
254+
''
255+
}
252256
transition duration-150 ease-in-out`}
253257
>
254258
{toolbar()}

0 commit comments

Comments
 (0)