From d661e969d95be6ad3ede0286a518b12da8071a25 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Yusuf=20=C4=B0pek?=
Date: Sat, 11 Oct 2025 19:37:05 +0300
Subject: [PATCH] fix: prevent pulse animation on initial load and hide N/A
messages in chat/overlay
---
client/app/dashboard/page.tsx | 26 ++++++++++++++++++++------
client/app/globals.css | 6 ++++--
client/app/overlay/page.tsx | 6 +++---
3 files changed, 27 insertions(+), 11 deletions(-)
diff --git a/client/app/dashboard/page.tsx b/client/app/dashboard/page.tsx
index 4a8c716..e3ee168 100644
--- a/client/app/dashboard/page.tsx
+++ b/client/app/dashboard/page.tsx
@@ -49,6 +49,7 @@ export default function DashboardPage() {
const [memberPulse, setMemberPulse] = useState(false);
const prevSuperChatCountRef = useRef(0);
const prevMemberCountRef = useRef(0);
+ const hasInitializedRef = useRef(false);
const handleSelect = useCallback(
async (message: ChatMessage) => {
@@ -113,13 +114,24 @@ export default function DashboardPage() {
const newMembers = useMemo(() => messages.filter(m => m.membershipGift || m.membershipGiftPurchase), [messages]);
const regularMessages = useMemo(() => messages.filter(m => !m.superChat && !m.membershipGift && !m.membershipGiftPurchase), [messages]);
+ // Initialize counts on first load without triggering pulse
+ useEffect(() => {
+ if (!hasInitializedRef.current && messages.length > 0) {
+ prevSuperChatCountRef.current = superChats.length;
+ prevMemberCountRef.current = newMembers.length;
+ hasInitializedRef.current = true;
+ }
+ }, [messages.length, superChats.length, newMembers.length]);
+
// Detect new superchats and trigger pulse
useEffect(() => {
+ if (!hasInitializedRef.current) return;
+
const prevCount = prevSuperChatCountRef.current;
const currentCount = superChats.length;
- // Trigger pulse if count increased (but not on initial mount when both are 0)
- if (currentCount > prevCount && !(prevCount === 0 && currentCount === 0)) {
+ // Trigger pulse if count increased
+ if (currentCount > prevCount) {
setSuperChatPulse(true);
const timer = setTimeout(() => setSuperChatPulse(false), 10000);
prevSuperChatCountRef.current = currentCount;
@@ -131,11 +143,13 @@ export default function DashboardPage() {
// Detect new members and trigger pulse
useEffect(() => {
+ if (!hasInitializedRef.current) return;
+
const prevCount = prevMemberCountRef.current;
const currentCount = newMembers.length;
- // Trigger pulse if count increased (but not on initial mount when both are 0)
- if (currentCount > prevCount && !(prevCount === 0 && currentCount === 0)) {
+ // Trigger pulse if count increased
+ if (currentCount > prevCount) {
setMemberPulse(true);
const timer = setTimeout(() => setMemberPulse(false), 10000);
prevMemberCountRef.current = currentCount;
@@ -613,7 +627,7 @@ function ChatItem({ message, isSelected, onSelect, onLinkClick }: ChatItemProps)
)
)}
- ) : message.text && (
+ ) : message.text && message.text !== 'N/A' && (
@@ -652,7 +666,7 @@ function MemberItem({ message, isSelected, onSelect, onLinkClick }: ChatItemProp
)
)}
- ) : message.text && (
+ ) : message.text && message.text !== 'N/A' && (
diff --git a/client/app/globals.css b/client/app/globals.css
index e92b3b0..676ff40 100644
--- a/client/app/globals.css
+++ b/client/app/globals.css
@@ -629,7 +629,7 @@ main {
background: #1f1f1f;
border: 1px solid #2a2a2a;
text-align: left;
- transition: all 150ms ease;
+ transition: all 250ms ease-out;
cursor: pointer;
flex-shrink: 0;
width: 100%;
@@ -647,6 +647,7 @@ main {
background: rgba(59, 130, 246, 0.15);
border-color: rgba(59, 130, 246, 0.5);
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
+ filter: brightness(0.85);
}
.chatItem__header {
@@ -781,7 +782,7 @@ main {
background: #1f1f1f;
border: 1px solid #2a2a2a;
text-align: left;
- transition: all 150ms ease;
+ transition: all 250ms ease-out;
cursor: pointer;
flex-shrink: 0;
}
@@ -796,6 +797,7 @@ main {
background: rgba(16, 185, 129, 0.15);
border-color: rgba(16, 185, 129, 0.5);
box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
+ filter: brightness(0.85);
}
.memberItem__header {
diff --git a/client/app/overlay/page.tsx b/client/app/overlay/page.tsx
index 9db5c1c..edc2310 100644
--- a/client/app/overlay/page.tsx
+++ b/client/app/overlay/page.tsx
@@ -89,7 +89,7 @@ export default function OverlayPage() {
)
)}
- ) : message.text && (
+ ) : message.text && message.text !== 'N/A' && (
{message.text}
)}
>
@@ -119,7 +119,7 @@ export default function OverlayPage() {
)
)}
- ) : message.text && (
+ ) : message.text && message.text !== 'N/A' && (
{message.text}
)}
>
@@ -156,7 +156,7 @@ export default function OverlayPage() {
)
)}
- ) : message.text && (
+ ) : message.text && message.text !== 'N/A' && (
{message.text}
)}
>