Skip to content

Commit

Permalink
Merge pull request #59 from evgongora/feat/multiple-pages
Browse files Browse the repository at this point in the history
feat: multiple changes
  • Loading branch information
evgongora authored Jan 21, 2025
2 parents e52c618 + a4d75f4 commit 755bd5a
Show file tree
Hide file tree
Showing 13 changed files with 331 additions and 26 deletions.
2 changes: 1 addition & 1 deletion frontend/src/app/(home)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { AchievementButton } from "@/components/ui/AchievementButton"

export default function Home() {
return (
<div className="flex min-h-screen flex-col items-center p-4 md:p-6 mt-6 md:mt-14 overflow-x-hidden">
<div className="flex flex-col items-center p-4 md:p-6 mt-6 md:mt-14 overflow-x-hidden">
<div className="w-full max-w-7xl px-4">
<div className="mb-6 md:mb-8 text-center">
<h1 className="text-3xl md:text-4xl font-bold font-spaceGrotesk mb-2">
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/achievements/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default function AchievementsPage() {
]

return (
<div className="flex min-h-screen flex-col items-center p-4 md:p-6 mt-16 md:mt-14">
<div className="flex flex-col items-center p-4 md:p-6 mt-16 md:mt-14">
<div className="w-full max-w-7xl px-4">
<div className="mb-6 md:mb-8">
<h1 className="text-3xl md:text-4xl font-bold font-spaceGrotesk mb-2">
Expand Down
61 changes: 55 additions & 6 deletions frontend/src/app/api/auth/[...nextauth]/route.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
import NextAuth, { NextAuthOptions } from "next-auth";
import NextAuth, { NextAuthOptions, DefaultSession } from "next-auth";
import GoogleProvider from "next-auth/providers/google";

// Extend next-auth types
declare module "next-auth" {
interface Session {
user: {
isWorldcoinVerified: boolean;
} & DefaultSession["user"]
}
interface User {
isWorldcoinVerified: boolean;
}
}

declare module "next-auth/jwt" {
interface JWT {
isWorldcoinVerified: boolean;
}
}

if (!process.env.NEXTAUTH_SECRET) {
throw new Error('NEXTAUTH_SECRET must be set');
Expand All @@ -9,10 +28,15 @@ if (!process.env.WLD_CLIENT_ID) {
if (!process.env.WLD_CLIENT_SECRET) {
throw new Error('WLD_CLIENT_SECRET must be set');
}
if (!process.env.GOOGLE_CLIENT_ID) {
throw new Error('GOOGLE_CLIENT_ID must be set');
}
if (!process.env.GOOGLE_CLIENT_SECRET) {
throw new Error('GOOGLE_CLIENT_SECRET must be set');
}

const authOptions: NextAuthOptions = {
secret: process.env.NEXTAUTH_SECRET,

providers: [
{
id: "worldcoin",
Expand All @@ -28,16 +52,41 @@ const authOptions: NextAuthOptions = {
return {
id: profile.sub,
name: profile.sub,
verificationLevel:
profile["https://id.worldcoin.org/v1"].verification_level,
verificationLevel: profile["https://id.worldcoin.org/v1"].verification_level,
isWorldcoinVerified: true
};
},
},
GoogleProvider({
clientId: process.env.GOOGLE_CLIENT_ID!,
clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
profile(profile) {
return {
id: profile.sub,
name: profile.name,
email: profile.email,
image: profile.picture,
isWorldcoinVerified: false
};
}
}),
],
callbacks: {
async signIn({ user }) {
return true;
async session({ session, token }) {
return {
...session,
user: {
...session.user,
isWorldcoinVerified: token.isWorldcoinVerified
}
};
},
async jwt({ token, user }) {
if (user) {
token.isWorldcoinVerified = user.isWorldcoinVerified;
}
return token;
}
},
debug: process.env.NODE_ENV === "development",
};
Expand Down
16 changes: 6 additions & 10 deletions frontend/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import "@/app/globals.css";
import { Metadata } from "next";
import { Space_Grotesk } from "next/font/google";
import dynamic from "next/dynamic";
import MiniKitProvider from "@/providers/MiniKitProvider";
import NextAuthProvider from "@/providers/next-auth-provider";
import MobileBottomNav from "@/components/BottomNav";
import "./globals.css";
import LayoutContent from "@/components/LayoutContent";

const spaceGrotesk = Space_Grotesk({
subsets: ['latin'],
Expand All @@ -24,24 +24,20 @@ export const metadata: Metadata = {
description: "Example application using MiniKit with Next.js",
};

export default async function RootLayout({
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en" suppressHydrationWarning>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body className={`${spaceGrotesk.variable} min-h-screen bg-neutral-bg text-foreground antialiased overflow-x-hidden`}>
<body className={`${spaceGrotesk.variable} bg-neutral-bg text-foreground antialiased`}>
<NextAuthProvider>
<ErudaProvider>
<MiniKitProvider>
<main className="min-h-screen w-full pb-16">
<LayoutContent>
{children}
</main>
<MobileBottomNav />
</LayoutContent>
</MiniKitProvider>
</ErudaProvider>
</NextAuthProvider>
Expand Down
104 changes: 104 additions & 0 deletions frontend/src/app/register/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
"use client";

import { Input } from "@/components/ui/input";
import { FilledButton } from "@/components/ui/FilledButton";
import { useState } from "react";

export default function Register() {
const [formData, setFormData] = useState({
name: "",
lastName: "",
email: "",
age: "",
subscription: false
});

const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();
console.log(formData);
};

return (
<div className="flex flex-col items-center">
<div className="relative w-screen h-[354px] -mt-4">
<div className="w-screen absolute top-0 bg-white rounded-b-[65px] shadow-[inset_-5px_-5px_25px_0px_rgba(134,152,183,1.00),inset_5px_5px_25px_0px_rgba(248,248,246,1.00)]" />
<div className="w-screen h-full px-[34px] pt-[104px] pb-[70px] absolute top-0 bg-[#2c5154] rounded-b-[65px] shadow-[21px_38px_64.69999694824219px_3px_rgba(0,0,0,0.25)] overflow-hidden">
<div className="max-w-md mx-auto">
<h1 className="text-white text-[50px] font-medium font-spaceGrotesk leading-[50px]">
Let&apos;s get to know a little bit about you...
</h1>
</div>
</div>
</div>

<div className="w-full max-w-md p-4 mt-4">
<p className="text-center text-[#232931] text-base font-normal mb-8">
Please fill up the following spaces to begin.
</p>

<form onSubmit={handleSubmit} className="space-y-6">
<div className="space-y-2">
<label className="text-[#232931] text-base">Name</label>
<Input
type="text"
value={formData.name}
onChange={(e) => setFormData({ ...formData, name: e.target.value })}
className="h-[30px] bg-[#d9d9d9] rounded-[20px] border-0"
/>
</div>

<div className="space-y-2">
<label className="text-[#232931] text-base">Last Name</label>
<Input
type="text"
value={formData.lastName}
onChange={(e) => setFormData({ ...formData, lastName: e.target.value })}
className="h-[30px] bg-[#d9d9d9] rounded-[20px] border-0"
/>
</div>

<div className="space-y-2">
<label className="text-[#232931] text-base">Email</label>
<Input
type="email"
value={formData.email}
onChange={(e) => setFormData({ ...formData, email: e.target.value })}
className="h-[30px] bg-[#d9d9d9] rounded-[20px] border-0"
/>
</div>

<div className="space-y-2">
<label className="text-[#232931] text-base">Age</label>
<Input
type="number"
value={formData.age}
onChange={(e) => setFormData({ ...formData, age: e.target.value })}
className="h-[30px] bg-[#d9d9d9] rounded-[20px] border-0"
/>
</div>

<div className="flex items-center gap-3">
<input
type="checkbox"
checked={formData.subscription}
onChange={(e) => setFormData({ ...formData, subscription: e.target.checked })}
className="w-5 h-5 rounded-full bg-[#d9d9d9]"
/>
<label className="text-[#232931] text-base">
I would like to receive updates and insights.
</label>
</div>

<FilledButton
variant="default"
size="sm"
className="w-[109px] h-9 bg-[#e36c59] mx-auto"
type="submit"
>
Enter
</FilledButton>
</form>
</div>
</div>
);
}
2 changes: 1 addition & 1 deletion frontend/src/app/results/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default function ResultsPage() {
]

return (
<div className="flex min-h-screen flex-col items-center">
<div className="flex flex-col items-center">
<div className="w-full bg-brand-tertiary rounded-b-[50px] shadow-lg pb-8 sm:pb-14 mb-6 sm:mb-8">
<div className="w-full max-w-2xl mx-auto px-4 pt-16 sm:pt-20">
<h1 className="text-center text-white text-3xl sm:text-4xl md:text-5xl font-bold font-spaceGrotesk leading-tight sm:leading-[50px] mb-3 sm:mb-4">
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/settings/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function SettingsPage() {
]

return (
<div className="flex min-h-screen flex-col items-center p-4 md:p-6 mt-16 md:mt-14">
<div className="flex flex-col items-center p-4 md:p-6 mt-16 md:mt-14">
<div className="w-full max-w-2xl px-4">
<div className="mb-6 md:mb-8">
<h1 className="text-3xl md:text-4xl font-bold font-spaceGrotesk mb-2">
Expand Down
22 changes: 17 additions & 5 deletions frontend/src/app/sign-in/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
import { signIn } from "next-auth/react";
import { FilledButton } from "@/components/ui/FilledButton";
import { Wallet } from "lucide-react";
import { OutlinedButton } from "@/components/ui/OutlinedButton";
import { Chrome } from "lucide-react";

export default function SignIn() {
return (
<div className="flex min-h-screen flex-col items-center">
<div className="flex flex-col items-center">
<div className="relative w-screen h-[510px] -mt-4">
<div className="w-screen absolute top-0 bg-white rounded-b-[65px] shadow-[inset_-5px_-5px_25px_0px_rgba(134,152,183,1.00),inset_5px_5px_25px_0px_rgba(248,248,246,1.00)]" />
<div className="w-screen h-full px-[34px] pt-[125px] pb-[70px] absolute top-0 bg-[#2c5154] rounded-b-[65px] shadow-[21px_38px_64.69999694824219px_3px_rgba(0,0,0,0.25)] overflow-hidden">
Expand All @@ -21,18 +23,28 @@ export default function SignIn() {
</div>
</div>

<div className="w-full max-w-md space-y-8 text-center mt-auto p-4">
<div className="w-full max-w-md space-y-4 text-center mt-auto p-4">
<FilledButton
variant="default"
size="sm"
icon={Wallet}
className="w-28 h-8 text-md transform transition-all duration-300 hover:scale-105 mx-auto"
className="w-full max-w-[200px] h-10 text-base transform transition-all duration-300 hover:scale-105 mx-auto"
onClick={() => signIn("worldcoin", { callbackUrl: "/" })}
>
Sign in
World ID
</FilledButton>

<p className="text-sm text-muted-foreground pb-6">
<OutlinedButton
variant="default"
size="sm"
icon={Chrome}
className="w-full max-w-[200px] h-10 text-base transform transition-all duration-300 hover:scale-105 mx-auto"
onClick={() => signIn("google", { callbackUrl: "/" })}
>
Google sign in
</OutlinedButton>

<p className="text-sm text-muted-foreground pb-6 mt-4">
By signing in, you agree to our Terms of Service and Privacy Policy
</p>
</div>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/tests/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function TestsPage() {
}

return (
<div className="flex min-h-screen flex-col items-center p-4 md:p-6 mt-16 md:mt-14">
<div className="flex flex-col items-center p-4 md:p-6 mt-16 md:mt-14">
<div className="w-full max-w-7xl px-4">
<div className="mb-6 md:mb-8">
<h1 className="text-3xl md:text-4xl font-bold font-spaceGrotesk mb-4">
Expand Down
38 changes: 38 additions & 0 deletions frontend/src/app/welcome/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"use client";

import { useSearchParams, useRouter } from "next/navigation";
import { FilledButton } from "@/components/ui/FilledButton";

export default function Welcome() {
const searchParams = useSearchParams();
const router = useRouter();
const name = searchParams.get("name") || "User";

return (
<div className="flex flex-col items-center">
<div className="relative w-screen min-h-screen bg-[#2c5154]">
<div className="w-full max-w-md mx-auto px-[34px] pt-[162px]">
<h1 className="text-white text-[45px] font-medium font-spaceGrotesk leading-[50px] mb-8">
Welcome {name}!
</h1>
<p className="text-white text-[45px] font-medium font-spaceGrotesk leading-[50px]">
Your journey toward understanding your true self begins here.
<br /><br />
Let&apos;s unlock your potential together!
</p>
</div>

<div className="fixed bottom-12 right-8">
<FilledButton
variant="default"
size="sm"
className="w-[132px] h-9 bg-[#e36c59] text-[#eeeeee] text-base font-bold"
onClick={() => router.push("/")}
>
Get Started
</FilledButton>
</div>
</div>
</div>
);
}
Loading

0 comments on commit 755bd5a

Please sign in to comment.