From 96461bc7b6687d27fede074862412cf4f1987a4e Mon Sep 17 00:00:00 2001 From: Stivenjs Date: Fri, 9 May 2025 20:40:52 -0500 Subject: [PATCH 1/4] refactor(FirstView): replace window.location with useRouter for navigation The `window.location.href` was replaced with `useRouter` from Next.js to handle navigation more efficiently and in line with Next.js best practices. This change improves the maintainability and consistency of the code. --- app/(main-layout)/landing/components/FirstView.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/(main-layout)/landing/components/FirstView.tsx b/app/(main-layout)/landing/components/FirstView.tsx index 1261a25d..9b3f57c8 100644 --- a/app/(main-layout)/landing/components/FirstView.tsx +++ b/app/(main-layout)/landing/components/FirstView.tsx @@ -1,4 +1,7 @@ +'use client' + import { Button } from '@/components/ui/button' +import { useRouter } from 'next/navigation' import { ArrowRight } from 'lucide-react' import { motion } from 'framer-motion' import Link from 'next/link' @@ -32,9 +35,10 @@ const slides = [ export function FirstView() { const swiperRef = useRef() const [activeIndex, setActiveIndex] = useState(0) + const router = useRouter() - const rediret = () => { - window.location.href = '/first-steps' + const redirect = () => { + router.push('/first-steps') } return ( @@ -93,7 +97,7 @@ export function FirstView() {