From c8144b9d36f605c86e6e25a2e860f38e51dc1db2 Mon Sep 17 00:00:00 2001 From: Yussif Yahuza Date: Mon, 28 Apr 2025 00:15:07 +0000 Subject: [PATCH] Refactor imports and optimize component code for better performance and readability --- app/creator/reader/page.tsx | 22 +++++++++---------- .../artists/_components/Artist_Content.tsx | 1 - .../artists/_components/Quick_Actions.tsx | 2 +- components/Recent_Creation.tsx | 1 - components/cards/HoverCards.tsx | 1 - components/common/SideBar.tsx | 2 +- components/custom/Best_Seller.tsx | 2 +- components/custom/Frame.tsx | 2 +- components/custom/New_Release.tsx | 2 +- 9 files changed, 16 insertions(+), 19 deletions(-) diff --git a/app/creator/reader/page.tsx b/app/creator/reader/page.tsx index 7aa332f..1797d0e 100644 --- a/app/creator/reader/page.tsx +++ b/app/creator/reader/page.tsx @@ -2,7 +2,7 @@ import { ArrowLeft2, Setting2 } from 'iconsax-react'; import Image from 'next/image'; -import React, { useState, useEffect, useRef } from 'react'; +import React, { useState, useEffect, useRef, useCallback } from 'react'; import Link from 'next/link'; import HoverCards from '@/components/cards/HoverCards'; import { Button } from '@/components/ui/button'; @@ -20,7 +20,7 @@ export default function Reader() { const videoRefs = useRef<(HTMLVideoElement | null)[]>([]); // Add wheel event handler - const handleWheel = (event: WheelEvent) => { + const handleWheel = useCallback((event: WheelEvent) => { if (transitioning) return; // Scroll down @@ -31,7 +31,7 @@ export default function Reader() { else if (event.deltaY < 0) { handlePreviousPage(); } - }; + }, []); // Add previous page handler const handlePreviousPage = () => { @@ -56,7 +56,7 @@ export default function Reader() { return () => { window.removeEventListener('wheel', handleWheel); }; - }, [currentPageIndex, transitioning]); // Add dependencies + }, [currentPageIndex, transitioning, handleWheel]); // Add dependencies // Content structured to match your design const pages: Page[] = [ @@ -81,10 +81,10 @@ export default function Reader() { <>

BRUTAL

-

"Wade Harper! What is up, old friend! It's been too long, man!" exclaims HANDSOME TWIN #1.

-

HANDSOME TWIN #2, more anxious and pushy, quickly interjects, "So do you have it for us?"

+

"Wade Harper! What is up, old friend! It's been too long, man!" exclaims HANDSOME TWIN #1.

+

HANDSOME TWIN #2, more anxious and pushy, quickly interjects, "So do you have it for us?"

Wade reaches into his breast pocket.

-

"Yes, I do."

+

"Yes, I do."

Wade considers the in his hand and fiddles with the device. The twins smile widely with delight.

@@ -97,13 +97,13 @@ export default function Reader() { <>

BRUTAL

-

Man, yes! Didn't I tell you not to question this man! I knew he was going to come through for us!" Handsome Twin #1 gloats.

-

Handsome Twin #2 sighs in satisfaction. " " he says, his tense demeanor turning to relief.

+

"Man, yes! Didn't I tell you not to question this man! I knew he was going to come through for us!" Handsome Twin #1 gloats.

+

Handsome Twin #2 sighs in satisfaction. "," he says, his tense demeanor turning to relief.

Wade hands the device to Handsome Twin #2.

-

"You will find all of the credentials you need on the drive. The shipment will arrive at the "You will find all of the credentials you need on the drive. The shipment will arrive at the tomorrow night," Wade explains.

+ But this man seemed untouched by such conventions, and that stood out to the pastor..." link='' /> tomorrow night,” Wade explains.

) diff --git a/app/marketplace/artists/_components/Artist_Content.tsx b/app/marketplace/artists/_components/Artist_Content.tsx index 29cdc24..a45e91a 100644 --- a/app/marketplace/artists/_components/Artist_Content.tsx +++ b/app/marketplace/artists/_components/Artist_Content.tsx @@ -1,4 +1,3 @@ -import { Input } from '@/components/ui/input'; import { Heart } from 'lucide-react'; import Image from 'next/image'; import { Checkbox } from '@/components/ui/checkbox'; diff --git a/app/marketplace/artists/_components/Quick_Actions.tsx b/app/marketplace/artists/_components/Quick_Actions.tsx index 94253ee..9d5e34b 100644 --- a/app/marketplace/artists/_components/Quick_Actions.tsx +++ b/app/marketplace/artists/_components/Quick_Actions.tsx @@ -39,7 +39,7 @@ export default function QuickActions() {
{/* Top linear gradient image bar */}
- Gradient Bar + Gradient Bar
- {books.map((book, idx) => ( + {books.map((book) => (
- {books.map((book, idx) => ( + {books.map((book) => (