-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add landing transition and chat links #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,40 @@ | ||
| import Link from 'next/link'; | ||
| import { useEffect, useState } from 'react'; | ||
| import { useRouter } from 'next/navigation'; | ||
| import Spline from '@splinetool/react-spline/next'; | ||
| import { Button } from '@/components/ui/button'; | ||
|
|
||
| export default function Home() { | ||
| const [transitioning, setTransitioning] = useState(false); | ||
| const router = useRouter(); | ||
|
|
||
| const startTransition = () => { | ||
| if (transitioning) return; | ||
| setTransitioning(true); | ||
| setTimeout(() => { | ||
| router.push('/landing.html'); | ||
| }, 700); | ||
|
Comment on lines
+10
to
+15
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P1] Landing transition is blocked by auth middleware The new transition calls Useful? React with 👍 / 👎.
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @codex fix comments There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Summary
Testing
|
||
| }; | ||
|
|
||
| useEffect(() => { | ||
| const handleWheel = () => startTransition(); | ||
| window.addEventListener('wheel', handleWheel, { once: true }); | ||
| return () => window.removeEventListener('wheel', handleWheel); | ||
| }, [transitioning]); | ||
|
|
||
| return ( | ||
| <main className="relative h-screen w-screen"> | ||
| <main | ||
| className={`relative h-screen w-screen transition-opacity duration-700 ${ | ||
| transitioning ? 'opacity-0' : 'opacity-100' | ||
| }`} | ||
| onWheel={startTransition} | ||
| > | ||
| <Spline scene="https://prod.spline.design/DS0UgrDOifhNt9T6/scene.splinecode" /> | ||
| <div className="absolute bottom-8 left-1/2 -translate-x-1/2"> | ||
| <Button | ||
| asChild | ||
| onClick={startTransition} | ||
| className="bg-[hsl(246,82%,60%)] text-white hover:opacity-90" | ||
| > | ||
| <Link href="/login">cerch now</Link> | ||
| cerch now | ||
| </Button> | ||
| </div> | ||
| </main> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P0] Mark home page as client component
The updated home page uses
useState,useEffect, anduseRouter, which can only be used in Client Components. This file no longer renders through a<Link>and now depends on client‑side hooks, but it is missing the'use client'directive at the top of the module. Without that directive Next.js will throwuseRouter can only be used in Client Componentsand fail to compile or run tests. Add'use client';before the imports so the page can render.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@codex fix comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary
'use client'directive so client-side hooks likeuseRoutercan run during transitions app/page.tsxL1-L4/landing.htmlin the middleware’s public route list middleware.tsL35-L38Testing
pnpm format app/page.tsx middleware.tspnpm exec biome lint app/page.tsx middleware.tspnpm lint(Do not shadow the global "escape" property; Forbidden non-null assertion)pnpm test(This module cannot be imported from a Client Component module)View task →