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