From 2fa7b99966936eb464eaff9901f346c8535fce52 Mon Sep 17 00:00:00 2001 From: Nikitha Date: Wed, 15 Apr 2026 08:12:16 -0600 Subject: [PATCH] Chat Widget, changes in nav bar Auto Scroll chat and changes in Nav bar --- web/app/chat/page.js | 8 ++++- web/app/globals.css | 13 +++---- web/app/page.js | 38 ++++++++++++++++++++- web/components/FloatingChat.js | 16 +++++++-- web/components/Navigation.js | 4 +-- web/context/ChatWidgetContext.js | 58 ++++++++++++++++++++++---------- 6 files changed, 106 insertions(+), 31 deletions(-) diff --git a/web/app/chat/page.js b/web/app/chat/page.js index e54ea966..57692641 100644 --- a/web/app/chat/page.js +++ b/web/app/chat/page.js @@ -32,10 +32,16 @@ function ChatPage() { } }, [authLoading, user, router, conversationIdParam]); - useEffect(() => { + const prevMsgLengthRef = useRef(0); + +useEffect(() => { + if (messages.length > prevMsgLengthRef.current) { messagesEndRef.current?.scrollIntoView({ behavior: "smooth" }); + } + prevMsgLengthRef.current = messages.length; }, [messages]); + const fetchMessages = useCallback(async (convId) => { if (!token || !convId) return; try { diff --git a/web/app/globals.css b/web/app/globals.css index 2dbbe14a..33b7f646 100644 --- a/web/app/globals.css +++ b/web/app/globals.css @@ -36,7 +36,7 @@ body { padding: 0.5rem 2rem; display: flex; align-items: center; - flex-wrap: wrap; + justify-content: space-between; min-height: 70px; /* border-radius: 0px 0px 10px 10px; */ } @@ -71,17 +71,18 @@ body { .nav-link { color: #2f2f2f; text-decoration: none; - font-size: 1.1rem; - font-weight: 700; + font-size: 1.05rem; + font-weight: 600; padding: 0.5rem 1rem; - border-radius: 4px; - transition: all 0.3s ease; + border-radius: 6px; + transition: background-color 0.25s ease, color 0.25s ease; position: relative; } /* Alternative Hover Effect - Background */ .nav-link:hover { - background-color: rgba(255, 255, 255, 0.171); + background-color: rgba(255, 255, 255, 0.25); + } diff --git a/web/app/page.js b/web/app/page.js index 91f71946..0f277b1d 100644 --- a/web/app/page.js +++ b/web/app/page.js @@ -15,7 +15,7 @@ const navImages = [ {id: "nav-adopt", src: "/images/home/navimages/adopt.jpg", alt: "Adopt a Pet", link: "/adopt", title: "Adopt a Pet"}, {id: "nav-products", src: "/images/home/navimages/store.jpg", alt: "Online Store", link: "/products", title: "Online Store"}, {id: "nav-appointments", src: "/images/home/navimages/appointments.jpg", alt: "Appointments", link: "/appointments", title: "Appointments"}, - {id: "nav-about", src: "/images/home/navimages/about.jpg", alt: "About Us", link: "/about", title: "About Us"}, + ]; export default function Home() { @@ -76,6 +76,42 @@ export default function Home() { ))} + + {/* About Us Section */} +
+
+

About Leon's Pet Store

+

Pet care, adoption support, grooming, and everyday essentials in one place.

+
+
+ +
+
+

What We Do

+

+ Leon's Pet Store connects families with adoptable pets, helpful services, and quality products for day-to-day pet care. +

+
+ +
+

Our Focus

+
    +
  • Support responsible pet adoption
  • +
  • Provide grooming and care services
  • +
  • Offer reliable pet supplies and essentials
  • +
  • Create a friendly experience for customers and staff
  • +
+
+ +
+

Visit the Store

+

+ Browse adoptable pets, schedule appointments, shop products, or contact the team for help finding the right fit for a pet and household. +

+
+
+
+ ); } diff --git a/web/components/FloatingChat.js b/web/components/FloatingChat.js index 9db78e1a..4c6b45ab 100644 --- a/web/components/FloatingChat.js +++ b/web/components/FloatingChat.js @@ -21,10 +21,20 @@ export default function FloatingChat() { const [input, setInput] = useState(""); const messagesEndRef = useRef(null); + const prevAiLengthRef = useRef(0); +const prevLiveLengthRef = useRef(0); useEffect(() => { - if (isOpen) messagesEndRef.current?.scrollIntoView({ behavior: "smooth" }); - }, [aiMessages, liveMessages, isOpen]); + if (!isOpen) return; + const aiGrew = aiMessages.length > prevAiLengthRef.current; + const liveGrew = liveMessages.length > prevLiveLengthRef.current; + prevAiLengthRef.current = aiMessages.length; + prevLiveLengthRef.current = liveMessages.length; + if (aiGrew || liveGrew) { + messagesEndRef.current?.scrollIntoView({ behavior: "smooth" }); + } +}, [aiMessages, liveMessages, isOpen]); + useEffect(() => { if (view === "history" && token && isOpen) loadConversations(token); @@ -137,7 +147,7 @@ export default function FloatingChat() { )} {conversations.filter(c => c.status === "OPEN" && c.staffId).map((conv) => ( -