From ce2b3b10da480b23b307ba22173562c1172bde12 Mon Sep 17 00:00:00 2001 From: ankitaniket Date: Tue, 5 Mar 2024 18:54:32 +0530 Subject: [PATCH 1/6] Issue: Update QuotesPage.tsx Quote.tsx QuotesNavigator.tsx --- .../[[...locale]]/QuotesPage.tsx | 2 +- src/components/Quotes/Quote.tsx | 2 +- src/components/Quotes/QuotesNavigator.tsx | 32 +++++++++++++++++-- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/src/app/bhagavad-gita-quotes/[[...locale]]/QuotesPage.tsx b/src/app/bhagavad-gita-quotes/[[...locale]]/QuotesPage.tsx index c4461e0..44a7656 100644 --- a/src/app/bhagavad-gita-quotes/[[...locale]]/QuotesPage.tsx +++ b/src/app/bhagavad-gita-quotes/[[...locale]]/QuotesPage.tsx @@ -18,7 +18,7 @@ export default function QuotesPage(props: LocaleAndTranslations) { return (
-
+
-
+

{ quoteIndex < quoteCount - 1 && setQuote(quoteIndex + 1); }; @@ -25,12 +28,35 @@ export default function QuotesNavigator({ quoteIndex > 0 && setQuote(quoteIndex - 1); }; + useEffect(() => { + let timeoutId: NodeJS.Timeout; + + const handleScroll = () => { + setIsScrolling(true); + clearTimeout(timeoutId); + + // Set a timeout of 3 seconds to reset isScrolling after 3 seconds of no scrolling + timeoutId = setTimeout(() => { + setIsScrolling(false); + }, 1500); + }; + + window.addEventListener("scroll", handleScroll); + + return () => { + window.removeEventListener("scroll", handleScroll); + clearTimeout(timeoutId); + }; + }, []); + return ( <> {previousQuote >= 1 && ( @@ -38,7 +64,9 @@ export default function QuotesNavigator({ {nextQuote <= quoteCount && ( From f6b00cb11f76064103652ad54d2ec875400afc64 Mon Sep 17 00:00:00 2001 From: ankitaniket Date: Tue, 5 Mar 2024 21:56:45 +0530 Subject: [PATCH 2/6] chore: Update setTimeout to 3000 --- src/components/Quotes/QuotesNavigator.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/components/Quotes/QuotesNavigator.tsx b/src/components/Quotes/QuotesNavigator.tsx index 2f09cab..5635fbe 100644 --- a/src/components/Quotes/QuotesNavigator.tsx +++ b/src/components/Quotes/QuotesNavigator.tsx @@ -34,11 +34,9 @@ export default function QuotesNavigator({ const handleScroll = () => { setIsScrolling(true); clearTimeout(timeoutId); - - // Set a timeout of 3 seconds to reset isScrolling after 3 seconds of no scrolling timeoutId = setTimeout(() => { setIsScrolling(false); - }, 1500); + }, 3000); }; window.addEventListener("scroll", handleScroll); From 1944577672d3b4343ee11b31a5df0962eada710e Mon Sep 17 00:00:00 2001 From: ankitaniket Date: Tue, 26 Mar 2024 00:24:07 +0530 Subject: [PATCH 3/6] Chore: Fixed UI issues and improved alignment. --- src/app/bhagavad-gita-quotes/[[...locale]]/QuotesPage.tsx | 4 ++-- src/components/Quotes/QuotesNavigator.tsx | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/bhagavad-gita-quotes/[[...locale]]/QuotesPage.tsx b/src/app/bhagavad-gita-quotes/[[...locale]]/QuotesPage.tsx index 44a7656..532a197 100644 --- a/src/app/bhagavad-gita-quotes/[[...locale]]/QuotesPage.tsx +++ b/src/app/bhagavad-gita-quotes/[[...locale]]/QuotesPage.tsx @@ -16,9 +16,9 @@ export default function QuotesPage(props: LocaleAndTranslations) { const [quoteIndex, setQuoteIndex] = useState(0); return ( -
+
-
+
= 1 && ( @@ -63,7 +40,6 @@ export default function QuotesNavigator({