From 4dda1c2c71b2687817ca3d393cb58263dfa2b78d Mon Sep 17 00:00:00 2001 From: pious2847 Date: Sun, 27 Apr 2025 21:01:52 +0000 Subject: [PATCH] Add wheel navigation and update header with back button --- app/creator/reader/page.tsx | 64 +++++++++++++++++++++++++++++++------ 1 file changed, 55 insertions(+), 9 deletions(-) diff --git a/app/creator/reader/page.tsx b/app/creator/reader/page.tsx index 89cc3de..7aa332f 100644 --- a/app/creator/reader/page.tsx +++ b/app/creator/reader/page.tsx @@ -1,10 +1,12 @@ "use client" -import { Setting2 } from 'iconsax-react'; +import { ArrowLeft2, Setting2 } from 'iconsax-react'; import Image from 'next/image'; import React, { useState, useEffect, useRef } from 'react'; import Link from 'next/link'; import HoverCards from '@/components/cards/HoverCards'; +import { Button } from '@/components/ui/button'; + interface Page { id: number; @@ -17,6 +19,45 @@ export default function Reader() { const [transitioning, setTransitioning] = useState(false); const videoRefs = useRef<(HTMLVideoElement | null)[]>([]); + // Add wheel event handler + const handleWheel = (event: WheelEvent) => { + if (transitioning) return; + + // Scroll down + if (event.deltaY > 0) { + handleNextPage(); + } + // Scroll up + else if (event.deltaY < 0) { + handlePreviousPage(); + } + }; + + // Add previous page handler + const handlePreviousPage = () => { + if (transitioning) return; + + setTransitioning(true); + + if (currentPageIndex > 0) { + setCurrentPageIndex(prev => prev - 1); + } else { + setCurrentPageIndex(pages.length - 1); + } + + setTimeout(() => { + setTransitioning(false); + }, 1000); + }; + + // Add useEffect for wheel event listener + useEffect(() => { + window.addEventListener('wheel', handleWheel); + return () => { + window.removeEventListener('wheel', handleWheel); + }; + }, [currentPageIndex, transitioning]); // Add dependencies + // Content structured to match your design const pages: Page[] = [ { @@ -59,8 +100,8 @@ export default function Reader() {

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.

@@ -109,12 +150,17 @@ export default function Reader() { {/* NavBar */}
{/* Logo */} - -
- Wodey - Wodey -
- + + +
+ + + + Wodey + Wodey +
{/* Brutal Logo - Center */}