{imageUrl ? (
+ // eslint-disable-next-line @next/next/no-img-element

(null)
- const calculateNewTime = (clientX: number) => {
- if (!scrubBarRef.current) return 0
- const rect = scrubBarRef.current.getBoundingClientRect()
- const position = Math.max(
- 0,
- Math.min(1, (clientX - rect.left) / rect.width)
- )
- return duration * position
- }
+ const calculateNewTime = useCallback(
+ (clientX: number) => {
+ if (!scrubBarRef.current) return 0
+ const rect = scrubBarRef.current.getBoundingClientRect()
+ const position = Math.max(
+ 0,
+ Math.min(1, (clientX - rect.left) / rect.width)
+ )
+ return duration * position
+ },
+ [duration]
+ )
const handleMouseDown = (e: React.MouseEvent
) => {
setIsDragging(true)
@@ -91,11 +94,14 @@ const PlayerWidget = ({
onSeek(newTime)
}
- const handleMouseMove = (e: MouseEvent) => {
- if (!isDragging) return
- const newTime = calculateNewTime(e.clientX)
- onSeek(newTime)
- }
+ const handleMouseMove = useCallback(
+ (e: MouseEvent) => {
+ if (!isDragging) return
+ const newTime = calculateNewTime(e.clientX)
+ onSeek(newTime)
+ },
+ [isDragging, calculateNewTime, onSeek]
+ )
const handleMouseUp = () => {
setIsDragging(false)
@@ -110,7 +116,7 @@ const PlayerWidget = ({
document.removeEventListener("mousemove", handleMouseMove)
document.removeEventListener("mouseup", handleMouseUp)
}
- }, [isDragging])
+ }, [handleMouseMove, isDragging])
useEffect(() => {
const handleClickOutside = (event: MouseEvent) => {
diff --git a/src/components/ListenToPlayer/index.tsx b/src/components/ListenToPlayer/index.tsx
index ac8a941243c..cb5c5e14fc1 100644
--- a/src/components/ListenToPlayer/index.tsx
+++ b/src/components/ListenToPlayer/index.tsx
@@ -86,12 +86,14 @@ const ListenToPlayer = ({ slug }: { slug: string }) => {
}
audioPlayer.unload()
}
+ // eslint-disable-next-line react-hooks/exhaustive-deps
}, [currentTrackIndex])
useEffect(() => {
if (sound && autoplay && isPlaying) {
sound.play()
}
+ // eslint-disable-next-line react-hooks/exhaustive-deps
}, [sound])
useEffect(() => {
diff --git a/src/components/ProductTable/index.tsx b/src/components/ProductTable/index.tsx
index 76a5f3f2568..d2d2e412e62 100644
--- a/src/components/ProductTable/index.tsx
+++ b/src/components/ProductTable/index.tsx
@@ -94,6 +94,7 @@ const ProductTable = ({
// TODO: Fix this, removed to avoid infinite re-renders
// router.replace(pathname, undefined, { shallow: true })
}
+ // eslint-disable-next-line react-hooks/exhaustive-deps
}, [router.query])
// Update or remove preset filters
diff --git a/src/components/Quiz/QuizWidget/useQuizWidget.tsx b/src/components/Quiz/QuizWidget/useQuizWidget.tsx
index 3a07b09c452..77384ed2cc8 100644
--- a/src/components/Quiz/QuizWidget/useQuizWidget.tsx
+++ b/src/components/Quiz/QuizWidget/useQuizWidget.tsx
@@ -64,6 +64,7 @@ export const useQuizWidget = ({
setQuizData(quiz)
}
+ // eslint-disable-next-line react-hooks/exhaustive-deps
useEffect(initialize, [quizKey])
const currentQuestionIndex = userQuizProgress.length
diff --git a/src/components/StablecoinsTable.tsx b/src/components/StablecoinsTable.tsx
index 1e9973ecc8c..9a578a9e62e 100644
--- a/src/components/StablecoinsTable.tsx
+++ b/src/components/StablecoinsTable.tsx
@@ -1,3 +1,5 @@
+import { cn } from "@/lib/utils/cn"
+
import { ButtonLink } from "./ui/buttons/Button"
import { Flex } from "./ui/flex"
import {
@@ -8,6 +10,7 @@ import {
TableHeader,
TableRow,
} from "./ui/table"
+import { Image } from "./Image"
import { useRtlFlip } from "@/hooks/useRtlFlip"
import { useTranslation } from "@/hooks/useTranslation"
@@ -31,7 +34,7 @@ const StablecoinsTable = ({
content,
hasError,
}: StablecoinsTableProps) => {
- const { flipForRtl } = useRtlFlip()
+ const { twFlipForRtl } = useRtlFlip()
const { t } = useTranslation("page-stablecoins")
const stablecoinsType = {
@@ -51,9 +54,7 @@ const StablecoinsTable = ({
{content && content[0]?.url && (
-
- ↗
-
+ ↗
)}
@@ -71,7 +72,7 @@ const StablecoinsTable = ({
- {image &&
}
+ {image && }
<>{name}>
diff --git a/src/components/Translatathon/CountdownBanner.tsx b/src/components/Translatathon/CountdownBanner.tsx
index b772a988b46..3666672ccb7 100644
--- a/src/components/Translatathon/CountdownBanner.tsx
+++ b/src/components/Translatathon/CountdownBanner.tsx
@@ -1,12 +1,18 @@
-import { useEffect, useState } from "react"
+import { useEffect, useMemo, useState } from "react"
import BannerNotification from "@/components/Banners/BannerNotification"
export const CountdownBanner = () => {
const [countdown, setCountdown] = useState("")
- const translatathonStartDate = new Date("August 9, 2024 12:00:00 UTC")
- const translatathonEndDate = new Date("August 18, 2024 12:00:00 UTC")
+ const translatathonStartDate = useMemo(
+ () => new Date("August 9, 2024 12:00:00 UTC"),
+ []
+ )
+ const translatathonEndDate = useMemo(
+ () => new Date("August 18, 2024 12:00:00 UTC"),
+ []
+ )
const calculateCountdown = (targetDate: Date) => {
const currentTime = new Date()
@@ -36,7 +42,7 @@ export const CountdownBanner = () => {
return () => {
clearInterval(interval)
}
- }, [])
+ }, [translatathonEndDate, translatathonStartDate])
return new Date() < translatathonStartDate ? (
<>
diff --git a/src/components/icons/listen-to/expand.tsx b/src/components/icons/listen-to/expand.tsx
index ac062c4f093..a67546b3bde 100644
--- a/src/components/icons/listen-to/expand.tsx
+++ b/src/components/icons/listen-to/expand.tsx
@@ -6,14 +6,14 @@ export const ExpandIcon = createIconBase({
children: (
diff --git a/src/components/icons/staking/BedrockGlyphIcon.tsx b/src/components/icons/staking/BedrockGlyphIcon.tsx
index 05942232469..58d53358dd4 100644
--- a/src/components/icons/staking/BedrockGlyphIcon.tsx
+++ b/src/components/icons/staking/BedrockGlyphIcon.tsx
@@ -9,8 +9,8 @@ export const BedrockGlyphIcon = createIconBase({
...commonIconDefaultAttrs,
children: (
),
diff --git a/src/components/icons/staking/EthpoolGlyphIcon.tsx b/src/components/icons/staking/EthpoolGlyphIcon.tsx
index 1264f7b44a0..aa2bc204ffc 100644
--- a/src/components/icons/staking/EthpoolGlyphIcon.tsx
+++ b/src/components/icons/staking/EthpoolGlyphIcon.tsx
@@ -6,8 +6,8 @@ export const EthpoolGlyphIcon = createIconBase({
className: "size-[1em]",
children: (
diff --git a/src/components/ui/Link.tsx b/src/components/ui/Link.tsx
index 8242a18fd6c..e99df1ea7c7 100644
--- a/src/components/ui/Link.tsx
+++ b/src/components/ui/Link.tsx
@@ -56,7 +56,7 @@ export const BaseLink = forwardRef(function Link(
const { twFlipForRtl } = useRtlFlip()
if (!href) {
- console.warn("Link component is missing href prop")
+ console.warn(`Link component missing href prop, pathname: ${pathname}`)
return
}
diff --git a/src/lib/utils/data/dataLoader.ts b/src/lib/utils/data/dataLoader.ts
index 4a0a882e2a3..10101394a58 100644
--- a/src/lib/utils/data/dataLoader.ts
+++ b/src/lib/utils/data/dataLoader.ts
@@ -2,6 +2,7 @@ import { cacheAsyncFn } from "./cacheAsyncFn"
import { loadMockData } from "./loadMockData"
const USE_MOCK_DATA = process.env.USE_MOCK_DATA === "true"
+if (USE_MOCK_DATA) console.warn("Using mock data")
type DataLoaderFunction = () => Promise
@@ -28,7 +29,6 @@ export function dataLoader(
},
cacheTimeout?: number
): () => Promise {
- if (USE_MOCK_DATA) console.warn("Using mock data")
const cachedLoaders = loaders.map(([key, loader]) => {
const cachedLoader = cacheAsyncFn(key, loader, {
cacheTimeout,