Skip to content

Commit 86c8672

Browse files
author
nehhhhha6
committed
update
1 parent 64d6c06 commit 86c8672

File tree

4 files changed

+247
-61
lines changed

4 files changed

+247
-61
lines changed

app/(root)/page.tsx

Lines changed: 91 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Image from "next/image";
44
import { Button } from "@/components/ui/button";
55
import InterviewCard from "@/components/InterviewCard";
66

7-
import { getCurrentUser } from "@/lib/actions/auth.action";
7+
import { getCurrentUser, signOut } from "@/lib/actions/auth.action";
88
import {
99
getInterviewsByUserId,
1010
getLatestInterviews,
@@ -22,72 +22,102 @@ async function Home() {
2222
const hasUpcomingInterviews = allInterview?.length! > 0;
2323

2424
return (
25-
<>
26-
<section className="card-cta">
27-
<div className="flex flex-col gap-6 max-w-lg">
28-
<h2>Get Interview-Ready with AI-Powered Practice & Feedback</h2>
29-
<p className="text-lg">
30-
Practice real interview questions & get instant feedback
31-
</p>
32-
33-
<Button asChild className="btn-primary max-sm:w-full">
34-
<Link href="/interview">Start an Interview</Link>
35-
</Button>
25+
<div className="min-h-screen bg-gradient-to-b from-background to-muted">
26+
{/* Updated Navbar with oval corners and better transparency */}
27+
<nav className="fixed top-4 left-4 right-4 z-50">
28+
<div className="max-w-7xl mx-auto">
29+
<div className="backdrop-blur-sm bg-background/40 border border-border/40 rounded-full px-6">
30+
<div className="flex items-center justify-between h-14">
31+
<div className="flex items-center gap-6">
32+
<span className="text-sm text-muted-foreground">
33+
Welcome back,{" "}
34+
<span className="font-medium text-foreground">
35+
{user?.name}
36+
</span>
37+
</span>
38+
<form action={signOut}>
39+
<Button
40+
variant="ghost"
41+
type="submit"
42+
className="hover:bg-destructive/10 hover:text-destructive rounded-full"
43+
>
44+
Sign Out
45+
</Button>
46+
</form>
47+
</div>
48+
</div>
49+
</div>
3650
</div>
51+
</nav>
3752

38-
<Image
39-
src="/robot.png"
40-
alt="robo-dude"
41-
width={400}
42-
height={400}
43-
className="max-sm:hidden"
44-
/>
45-
</section>
53+
{/* Adjust main content padding */}
54+
<main className="pt-24 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto">
55+
<section className="card-cta">
56+
<div className="flex flex-col gap-6 max-w-lg">
57+
<h2>Get Interview-Ready with AI-Powered Practice & Feedback</h2>
58+
<p className="text-lg">
59+
Practice real interview questions & get instant feedback
60+
</p>
4661

47-
<section className="flex flex-col gap-6 mt-8">
48-
<h2>Your Interviews</h2>
62+
<Button asChild className="btn-primary max-sm:w-full">
63+
<Link href="/interview">Start an Interview</Link>
64+
</Button>
65+
</div>
4966

50-
<div className="interviews-section">
51-
{hasPastInterviews ? (
52-
userInterviews?.map((interview) => (
53-
<InterviewCard
54-
key={interview.id}
55-
userId={user?.id}
56-
interviewId={interview.id}
57-
role={interview.role}
58-
type={interview.type}
59-
techstack={interview.techstack}
60-
createdAt={interview.createdAt}
61-
/>
62-
))
63-
) : (
64-
<p>You haven&apos;t taken any interviews yet</p>
65-
)}
66-
</div>
67-
</section>
67+
<Image
68+
src="/robot.png"
69+
alt="robo-dude"
70+
width={400}
71+
height={400}
72+
className="max-sm:hidden"
73+
/>
74+
</section>
6875

69-
<section className="flex flex-col gap-6 mt-8">
70-
<h2>Take Interviews</h2>
76+
<section className="flex flex-col gap-6 mt-8">
77+
<h2>Your Interviews</h2>
7178

72-
<div className="interviews-section">
73-
{hasUpcomingInterviews ? (
74-
allInterview?.map((interview) => (
75-
<InterviewCard
76-
key={interview.id}
77-
userId={user?.id}
78-
interviewId={interview.id}
79-
role={interview.role}
80-
type={interview.type}
81-
techstack={interview.techstack}
82-
createdAt={interview.createdAt}
83-
/>
84-
))
85-
) : (
86-
<p>There are no interviews available</p>
87-
)}
88-
</div>
89-
</section>
90-
</>
79+
<div className="interviews-section">
80+
{hasPastInterviews ? (
81+
userInterviews?.map((interview) => (
82+
<InterviewCard
83+
key={interview.id}
84+
userId={user?.id}
85+
interviewId={interview.id}
86+
role={interview.role}
87+
type={interview.type}
88+
techstack={interview.techstack}
89+
createdAt={interview.createdAt}
90+
/>
91+
))
92+
) : (
93+
<p>You haven&apos;t taken any interviews yet</p>
94+
)}
95+
</div>
96+
</section>
97+
98+
<section className="flex flex-col gap-6 mt-8">
99+
<h2>Take Interviews</h2>
100+
101+
<div className="interviews-section">
102+
{hasUpcomingInterviews ? (
103+
allInterview?.map((interview) => (
104+
<InterviewCard
105+
key={interview.id}
106+
userId={user?.id}
107+
interviewId={interview.id}
108+
role={interview.role}
109+
type={interview.type}
110+
techstack={interview.techstack}
111+
createdAt={interview.createdAt}
112+
/>
113+
))
114+
) : (
115+
<p>There are no interviews available</p>
116+
)}
117+
</div>
118+
</section>
119+
</main>
120+
</div>
91121
);
92122
}
93123

app/globals.css

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,50 @@
156156
li {
157157
@apply text-light-100;
158158
}
159+
:root {
160+
--background: 0 0% 100%;
161+
--foreground: 240 10% 3.9%;
162+
--card: 0 0% 100%;
163+
--card-foreground: 240 10% 3.9%;
164+
--popover: 0 0% 100%;
165+
--popover-foreground: 240 10% 3.9%;
166+
--primary: 240 5.9% 10%;
167+
--primary-foreground: 0 0% 98%;
168+
--secondary: 240 4.8% 95.9%;
169+
--secondary-foreground: 240 5.9% 10%;
170+
--muted: 240 4.8% 95.9%;
171+
--muted-foreground: 240 3.8% 46.1%;
172+
--accent: 240 4.8% 95.9%;
173+
--accent-foreground: 240 5.9% 10%;
174+
--destructive: 0 84.2% 60.2%;
175+
--destructive-foreground: 0 0% 98%;
176+
--border: 240 5.9% 90%;
177+
--input: 240 5.9% 90%;
178+
--ring: 240 5.9% 10%;
179+
--radius: 0.5rem;
180+
}
181+
182+
.dark {
183+
--background: 240 10% 3.9%;
184+
--foreground: 0 0% 98%;
185+
--card: 240 10% 3.9%;
186+
--card-foreground: 0 0% 98%;
187+
--popover: 240 10% 3.9%;
188+
--popover-foreground: 0 0% 98%;
189+
--primary: 0 0% 98%;
190+
--primary-foreground: 240 5.9% 10%;
191+
--secondary: 240 3.7% 15.9%;
192+
--secondary-foreground: 0 0% 98%;
193+
--muted: 240 3.7% 15.9%;
194+
--muted-foreground: 240 5% 64.9%;
195+
--accent: 240 3.7% 15.9%;
196+
--accent-foreground: 0 0% 98%;
197+
--destructive: 0 62.8% 30.6%;
198+
--destructive-foreground: 0 0% 98%;
199+
--border: 240 3.7% 15.9%;
200+
--input: 240 3.7% 15.9%;
201+
--ring: 240 4.9% 83.9%;
202+
}
159203
}
160204

161205
@layer components {

app/landing/page.tsx

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import Link from "next/link";
2+
import Image from "next/image";
3+
import { Button } from "@/components/ui/button";
4+
5+
export default function LandingPage() {
6+
return (
7+
<div className="min-h-screen bg-gradient-to-b from-background to-muted">
8+
{/* Landing Page Navbar */}
9+
<nav className="fixed top-4 left-4 right-4 z-50">
10+
<div className="max-w-7xl mx-auto">
11+
<div className="backdrop-blur-sm bg-background/40 border border-border/40 rounded-full px-6">
12+
<div className="flex items-center justify-between h-14">
13+
<Link href="/landing" className="flex items-center gap-3">
14+
<Image
15+
src="/logo.png"
16+
alt="PrepWise"
17+
width={32}
18+
height={32}
19+
className="rounded-full"
20+
/>
21+
<span className="font-semibold text-xl">PrepWise</span>
22+
</Link>
23+
24+
<div className="flex items-center gap-4">
25+
<Button
26+
variant="ghost"
27+
className="hover:bg-primary-200/10 rounded-full"
28+
asChild
29+
>
30+
<Link href="/sign-in">Login</Link>
31+
</Button>
32+
<Button
33+
className="bg-primary-200 text-dark-100 hover:bg-primary-200/80 rounded-full"
34+
asChild
35+
>
36+
<Link href="/sign-up">Sign Up</Link>
37+
</Button>
38+
</div>
39+
</div>
40+
</div>
41+
</div>
42+
</nav>
43+
44+
{/* Hero Section */}
45+
<main className="pt-32 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto">
46+
<div className="text-center">
47+
<h1 className="text-6xl font-bold tracking-tight">
48+
Practice Interviews with
49+
<span className="text-primary-200"> AI Assistant</span>
50+
</h1>
51+
<p className="mt-6 text-xl text-muted-foreground max-w-2xl mx-auto">
52+
Get ready for your next interview with our AI-powered mock
53+
interviews. Practice real scenarios and receive instant feedback.
54+
</p>
55+
<div className="mt-10 flex justify-center gap-4">
56+
<Button
57+
size="lg"
58+
className="bg-primary-200 text-dark-100 hover:bg-primary-200/80 rounded-full px-8"
59+
asChild
60+
>
61+
<Link href="/sign-up">Get Started Free</Link>
62+
</Button>
63+
</div>
64+
</div>
65+
66+
<Image
67+
src="/robot.png"
68+
alt="AI Interview Assistant"
69+
width={400}
70+
height={400}
71+
className="mx-auto mt-16"
72+
/>
73+
</main>
74+
</div>
75+
);
76+
}

middleware.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { NextResponse } from "next/server";
2+
import type { NextRequest } from "next/server";
3+
4+
export function middleware(request: NextRequest) {
5+
// Get the pathname
6+
const path = request.nextUrl.pathname;
7+
8+
// Check if user is logged in
9+
const sessionCookie = request.cookies.get("session")?.value;
10+
const isAuthenticated = !!sessionCookie;
11+
12+
// Public paths that don't require authentication
13+
const isPublicPath =
14+
path === "/landing" || path === "/sign-in" || path === "/sign-up";
15+
16+
// If user is not authenticated and trying to access a protected route
17+
if (!isAuthenticated && !isPublicPath && path !== "/") {
18+
return NextResponse.redirect(new URL("/landing", request.url));
19+
}
20+
21+
// If user is not authenticated and at root, redirect to landing
22+
if (!isAuthenticated && path === "/") {
23+
return NextResponse.redirect(new URL("/landing", request.url));
24+
}
25+
26+
// If user is authenticated and trying to access public routes
27+
if (isAuthenticated && isPublicPath) {
28+
return NextResponse.redirect(new URL("/", request.url));
29+
}
30+
31+
return NextResponse.next();
32+
}
33+
34+
export const config = {
35+
matcher: ["/((?!api|_next/static|_next/image|favicon.ico).*)"],
36+
};

0 commit comments

Comments
 (0)