From d61deb2639b7400a04ff55adb860d21dab6cf342 Mon Sep 17 00:00:00 2001 From: RunDevelopment Date: Sat, 2 Dec 2023 13:57:11 +0100 Subject: [PATCH] Add open delay to status tooltips --- .../components/node/NodeFooter/Timer.tsx | 1 + .../node/NodeFooter/ValidityIndicator.tsx | 107 ++++++++---------- 2 files changed, 46 insertions(+), 62 deletions(-) diff --git a/src/renderer/components/node/NodeFooter/Timer.tsx b/src/renderer/components/node/NodeFooter/Timer.tsx index 78563e107..f66f19ec7 100644 --- a/src/renderer/components/node/NodeFooter/Timer.tsx +++ b/src/renderer/components/node/NodeFooter/Timer.tsx @@ -63,6 +63,7 @@ export const Timer = memo(({ time }: TimerProps) => { closeOnClick={false} gutter={24} label={`Execution took approximately ${joinEnglish(longParts)}.`} + openDelay={150} px={2} textAlign="center" > diff --git a/src/renderer/components/node/NodeFooter/ValidityIndicator.tsx b/src/renderer/components/node/NodeFooter/ValidityIndicator.tsx index 513110a12..46fcae184 100644 --- a/src/renderer/components/node/NodeFooter/ValidityIndicator.tsx +++ b/src/renderer/components/node/NodeFooter/ValidityIndicator.tsx @@ -15,80 +15,63 @@ interface ValidityIndicatorProps { export const ValidityIndicator = memo(({ validity, animated }: ValidityIndicatorProps) => { const { paused } = useContext(ExecutionStatusContext); - // eslint-disable-next-line no-nested-ternary - return animated ? ( - paused ? ( - -
-
- -
-
-
- ) : ( - -
- -
-
- ) - ) : ( - - {validity.isValid ? 'Node valid' : validity.reason} - - } - px={2} - textAlign="center" - > -
+ let icon; + let text; + if (animated) { + if (paused) { + text = 'This node is currently paused'; + icon = (
+ ); + } else { + text = 'This node is currently running...'; + icon = ; + } + } else { + text = validity.isValid ? 'Node valid' : validity.reason; + icon = ( +
+
+ ); + } + + return ( + {text}} + openDelay={150} + px={2} + textAlign="center" + > +
{icon}
); });