Skip to content

Commit 87fdcf3

Browse files
hemanandrclaude
andcommitted
fix: resolve heartbeat animation timing and priority issues in TrendBlocks
- Fix heartbeat animation not showing by adjusting animation state management - Reset showNewData after slide-in completes to allow heartbeat to resume - Improve animation priority logic (slide-left > slide-in > heartbeat) - Add proper initialization for first load without animation - Fine-tune heartbeat animation scale (0.95x to 1.1x) - Remove debug logging Ensures heartbeat animation properly shows on the latest status block after slide animations complete, creating clear visual feedback for the most recent monitoring data. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 1dfa97e commit 87fdcf3

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

thingconnect.pulse.client/src/components/status/TrendBlocks.tsx

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ const TrendBlocks = ({ data }: { data: SparklinePoint[] }) => {
3131
setShowNewData(true);
3232
setIsSliding(false);
3333
}, 500);
34+
35+
// Reset showNewData after slide-in animation completes
36+
setTimeout(() => {
37+
setShowNewData(false);
38+
}, 1000);
39+
} else if (latestTimestamp && !lastTimestampRef.current) {
40+
// First load - no animation needed
41+
setIsSliding(false);
42+
setShowNewData(false);
3443
}
3544

3645
lastTimestampRef.current = latestTimestamp;
@@ -41,9 +50,9 @@ const TrendBlocks = ({ data }: { data: SparklinePoint[] }) => {
4150
<style>
4251
{`
4352
@keyframes heartbeat {
44-
0% { transform: scale(0.9); }
45-
50% { transform: scale(1.10); }
46-
100% { transform: scale(0.9); }
53+
0% { transform: scale(0.95); }
54+
50% { transform: scale(1.1); }
55+
100% { transform: scale(0.95); }
4756
}
4857
@keyframes slideLeftGroup {
4958
0% { transform: translateX(0); }
@@ -70,6 +79,8 @@ const TrendBlocks = ({ data }: { data: SparklinePoint[] }) => {
7079
const isLastElement = idx === displayBlocks.length - 1 && point !== null;
7180
const isEmpty = point === null;
7281
const isNewElement = isLastElement && showNewData;
82+
const shouldHeartbeat = isLastElement && !isSliding;
83+
7384

7485
return (
7586
<Box
@@ -87,11 +98,11 @@ const TrendBlocks = ({ data }: { data: SparklinePoint[] }) => {
8798
: point.s === 'd' ? 'red.600' : 'green.600'
8899
}}
89100
className={
90-
isNewElement
91-
? 'slide-in-animation'
92-
: isSliding && !isEmpty
101+
isSliding && !isEmpty
93102
? 'slide-left-animation'
94-
: isLastElement && !isSliding && !showNewData
103+
: isNewElement
104+
? 'slide-in-animation'
105+
: shouldHeartbeat
95106
? 'heartbeat-animation'
96107
: undefined
97108
}

0 commit comments

Comments
 (0)