feat[GenericNode]: Change GenericNode icon to generic icon
This commit is contained in:
parent
8101bbc21e
commit
5486e31d14
4 changed files with 19 additions and 13 deletions
|
|
@ -28,11 +28,13 @@ export default function GenericNode({
|
||||||
const { setErrorData } = useContext(alertContext);
|
const { setErrorData } = useContext(alertContext);
|
||||||
const showError = useRef(true);
|
const showError = useRef(true);
|
||||||
const { types, deleteNode } = useContext(typesContext);
|
const { types, deleteNode } = useContext(typesContext);
|
||||||
|
|
||||||
const { closePopUp, openPopUp } = useContext(PopUpContext);
|
const { closePopUp, openPopUp } = useContext(PopUpContext);
|
||||||
// any to avoid type conflict
|
// any to avoid type conflict
|
||||||
const Icon: any =
|
const Icon: any =
|
||||||
nodeIconsLucide[data.type] || nodeIconsLucide[types[data.type]];
|
nodeIconsLucide[data.type] || nodeIconsLucide[types[data.type]];
|
||||||
|
console.log({ data, Icon, types: data.type || types[data.type], color: nodeColors[types[data.type]] })
|
||||||
|
const name = nodeIconsLucide[data.type] ? data.type : types[data.type]
|
||||||
const [validationStatus, setValidationStatus] = useState(null);
|
const [validationStatus, setValidationStatus] = useState(null);
|
||||||
// State for outline color
|
// State for outline color
|
||||||
const { sseData, isBuilding } = useSSE();
|
const { sseData, isBuilding } = useSSE();
|
||||||
|
|
@ -86,12 +88,11 @@ export default function GenericNode({
|
||||||
>
|
>
|
||||||
<div className="generic-node-div-title">
|
<div className="generic-node-div-title">
|
||||||
<div className="generic-node-title-arrangement">
|
<div className="generic-node-title-arrangement">
|
||||||
<Icon
|
<IconComponent
|
||||||
strokeWidth={1.5}
|
name={name}
|
||||||
className="generic-node-icon"
|
style="generic-node-icon"
|
||||||
style={{
|
method="LUCIDE"
|
||||||
color: nodeColors[types[data.type]] ?? nodeColors.unknown,
|
iconColor={`${nodeColors[types[data.type]]}`}
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
<div className="generic-node-tooltip-div">
|
<div className="generic-node-tooltip-div">
|
||||||
<ShadTooltip content={data.node.display_name}>
|
<ShadTooltip content={data.node.display_name}>
|
||||||
|
|
|
||||||
|
|
@ -4,14 +4,16 @@ import { nodeIconsLucide, svgIcons } from "../../utils";
|
||||||
export function IconFromLucide({
|
export function IconFromLucide({
|
||||||
name,
|
name,
|
||||||
style,
|
style,
|
||||||
|
iconColor,
|
||||||
}: IconProps): JSX.Element {
|
}: IconProps): JSX.Element {
|
||||||
const TargetIcon = nodeIconsLucide[name] ?? nodeIconsLucide["unknown"];
|
const TargetIcon = nodeIconsLucide[name] ?? nodeIconsLucide["unknown"];
|
||||||
return <TargetIcon className={ style } />;
|
return <TargetIcon className={ style } style={{ color: iconColor }} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function IconFromSvg({
|
export function IconFromSvg({
|
||||||
name,
|
name,
|
||||||
style
|
style,
|
||||||
|
iconColor,
|
||||||
}: IconProps): JSX.Element {
|
}: IconProps): JSX.Element {
|
||||||
const TargetSvg = svgIcons[name] ?? nodeIconsLucide["unknown"];
|
const TargetSvg = svgIcons[name] ?? nodeIconsLucide["unknown"];
|
||||||
return <TargetSvg className={ style } />;
|
return <TargetSvg className={ style } />;
|
||||||
|
|
@ -21,12 +23,13 @@ export default function IconComponent({
|
||||||
method,
|
method,
|
||||||
name,
|
name,
|
||||||
style,
|
style,
|
||||||
|
iconColor,
|
||||||
}: IconComponentProps): JSX.Element {
|
}: IconComponentProps): JSX.Element {
|
||||||
switch (method) {
|
switch (method) {
|
||||||
case "SVG":
|
case "SVG":
|
||||||
return <IconFromSvg name={name} style={ style } />;
|
return <IconFromSvg name={name} style={ style } iconColor={ iconColor } />;
|
||||||
case "LUCIDE":
|
case "LUCIDE":
|
||||||
return <IconFromLucide name={name} style={ style } />;
|
return <IconFromLucide name={name} style={ style } iconColor={ iconColor } />;
|
||||||
default:
|
default:
|
||||||
console.error("IconComponent: invalid method");
|
console.error("IconComponent: invalid method");
|
||||||
return <IconFromLucide name={"unknown"} style={"unknown"} />;
|
return <IconFromLucide name={"unknown"} style={"unknown"} />;
|
||||||
|
|
|
||||||
|
|
@ -165,10 +165,12 @@ export interface IVarHighlightType {
|
||||||
export type IconProps = {
|
export type IconProps = {
|
||||||
name: string;
|
name: string;
|
||||||
style: string;
|
style: string;
|
||||||
|
iconColor?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type IconComponentProps = {
|
export type IconComponentProps = {
|
||||||
method: "SVG" | "LUCIDE";
|
method: "SVG" | "LUCIDE";
|
||||||
name: string;
|
name: string;
|
||||||
style: string;
|
style: string;
|
||||||
|
iconColor?: string;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ export enum TypeModal {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const svgIcons = {
|
export const svgIcons = {
|
||||||
Airbyte: SvgAirbyte,
|
/* Airbyte: SvgAirbyte,
|
||||||
Anthropic: SvgAnthropicBox,
|
Anthropic: SvgAnthropicBox,
|
||||||
Bing: SvgBing,
|
Bing: SvgBing,
|
||||||
Chroma: SvgChroma,
|
Chroma: SvgChroma,
|
||||||
|
|
@ -165,7 +165,7 @@ export const svgIcons = {
|
||||||
Weaviate: SvgWeaviate,
|
Weaviate: SvgWeaviate,
|
||||||
Wikipedia: SvgWikipedia,
|
Wikipedia: SvgWikipedia,
|
||||||
Wolfram: SvgWolfram,
|
Wolfram: SvgWolfram,
|
||||||
Word: SvgWord,
|
Word: SvgWord, */
|
||||||
};
|
};
|
||||||
|
|
||||||
export const textColors = {
|
export const textColors = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue