Skip to content

Commit 042e243

Browse files
committed
feat: improve inspection display logic in DFlowFunctionCard for better validation feedback
1 parent 71acf23 commit 042e243

File tree

1 file changed

+33
-29
lines changed

1 file changed

+33
-29
lines changed

src/components/d-flow/function/cards/DFlowFunctionCard.tsx

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import {
1212
IconDots,
1313
IconExclamationCircle,
1414
IconFileLambdaFilled,
15-
IconGripVertical, IconMessageExclamation,
15+
IconGripVertical,
16+
IconMessageExclamation,
1617
IconTrash
1718
} from "@tabler/icons-react";
1819
import Text from "../../../text/Text";
@@ -102,36 +103,39 @@ export const DFlowFunctionCard: React.FC<DFlowFunctionCardProps> = memo((props)
102103
position={functionData.isParameter ? Position.Right : Position.Top}
103104
/>
104105

105-
<div className={"function-card__inspection"}>
106-
<Flex style={{gap: "0.35rem"}}>
107-
{(validation?.filter(v => v.type === InspectionSeverity.ERROR)?.length ?? 0) > 0 ? (
108-
<Badge color={"error"}>
109-
<Flex align={"center"} style={{gap: "0.35rem"}}>
110-
<IconExclamationCircle size={12}/>
111-
{validation?.filter(v => v.type === InspectionSeverity.ERROR)?.length}
112-
</Flex>
113-
</Badge>
114-
) : null}
106+
{(validation?.length ?? 0) > 0 ? (
107+
<div className={"function-card__inspection"}>
108+
<Flex style={{gap: "0.35rem"}}>
109+
{(validation?.filter(v => v.type === InspectionSeverity.ERROR)?.length ?? 0) > 0 ? (
110+
<Badge color={"error"}>
111+
<Flex align={"center"} style={{gap: "0.35rem"}}>
112+
<IconExclamationCircle size={12}/>
113+
{validation?.filter(v => v.type === InspectionSeverity.ERROR)?.length}
114+
</Flex>
115+
</Badge>
116+
) : null}
115117

116-
{(validation?.filter(v => v.type === InspectionSeverity.WARNING)?.length ?? 0) > 0 ? (
117-
<Badge color={"warning"}>
118-
<Flex align={"center"} style={{gap: "0.35rem"}}>
119-
<IconAlertTriangle size={12}/>
120-
{validation?.filter(v => v.type === InspectionSeverity.WARNING)?.length}
121-
</Flex>
122-
</Badge>
123-
) : null}
118+
{(validation?.filter(v => v.type === InspectionSeverity.WARNING)?.length ?? 0) > 0 ? (
119+
<Badge color={"warning"}>
120+
<Flex align={"center"} style={{gap: "0.35rem"}}>
121+
<IconAlertTriangle size={12}/>
122+
{validation?.filter(v => v.type === InspectionSeverity.WARNING)?.length}
123+
</Flex>
124+
</Badge>
125+
) : null}
126+
127+
{(validation?.filter(v => v.type === InspectionSeverity.GRAMMAR)?.length ?? 0) > 0 ? (
128+
<Badge>
129+
<Flex align={"center"} style={{gap: "0.35rem"}}>
130+
<IconMessageExclamation size={12}/>
131+
{validation?.filter(v => v.type === InspectionSeverity.GRAMMAR)?.length}
132+
</Flex>
133+
</Badge>
134+
) : null}
135+
</Flex>
136+
</div>
137+
) : null}
124138

125-
{(validation?.filter(v => v.type === InspectionSeverity.GRAMMAR)?.length ?? 0) > 0 ? (
126-
<Badge>
127-
<Flex align={"center"} style={{gap: "0.35rem"}}>
128-
<IconMessageExclamation size={12}/>
129-
{validation?.filter(v => v.type === InspectionSeverity.GRAMMAR)?.length}
130-
</Flex>
131-
</Badge>
132-
) : null}
133-
</Flex>
134-
</div>
135139

136140
{/* Dynamische Parameter-Eingänge (rechts), nur wenn wirklich verbunden */}
137141
{functionData.parameters?.map((param: NodeParameterObject, index: number) => (

0 commit comments

Comments
 (0)