Skip to content

Landing page #354

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

Merged
merged 4 commits into from
Apr 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import Home from "@/components/home/home";
import LandingPage from "@/components/Landing";
// import Home from "@/components/home/home";

export default function page() {
return <Home />;
return <LandingPage />;
}
57 changes: 57 additions & 0 deletions src/components/Landing.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import Image from "next/image";
import Link from "next/link";
import { Button } from "@/components/ui/button";

export default function LandingPage() {
return (
<div className="flex min-h-screen flex-col">
{/* Hero Section */}
<section className="relative w-full h-[100vh]">
{/* Background Pattern */}
<div className="absolute inset-0 w-full h-full">
<Image
src="/logos/aibtcdev-pattern-1-1920px.png"
alt="AIBTC Background Pattern"
fill
priority
className="object-cover"
sizes="100vw"
/>
</div>

{/* Content overlay */}
<div className="absolute inset-0 flex flex-col items-center justify-center p-4 sm:p-6">
<div className="flex flex-col items-center space-y-8 sm:space-y-10 -mt-10 sm:-mt-20">
{/* Logo */}
<div className="w-full max-w-[280px] sm:max-w-[500px] md:max-w-[700px] lg:max-w-[800px] px-4">
<Image
src="/logos/aibtcdev-primary-logo-white-wide-1000px.png"
alt="AIBTC Logo"
width={1000}
height={250}
className="w-full h-auto"
priority
/>
</div>

{/* Button */}
<Link
href="https://www.addevent.com/event/UM20108233"
target="_blank"
rel="noopener noreferrer"
className="w-full max-w-[200px] sm:max-w-[250px] md:max-w-[300px]"
>
<Button
size="lg"
className="sm:text-lg font-bold px-6 py-2 h-auto sm:px-8 sm:py-3 w-full"
variant="primary"
>
RSVP THURSDAYS
</Button>
</Link>
</div>
</div>
</section>
</div>
);
}
69 changes: 37 additions & 32 deletions src/utils/supabase/middleware.ts
Original file line number Diff line number Diff line change
@@ -1,65 +1,69 @@
import { createServerClient } from "@supabase/ssr";
import { type NextRequest, NextResponse } from "next/server";
import { createServerClient } from "@supabase/ssr"
import { type NextRequest, NextResponse } from "next/server"

export const updateSession = async (request: NextRequest) => {
try {
// If the path is not the root path, redirect to root
if (request.nextUrl.pathname !== "/") {
return NextResponse.redirect(new URL("/", request.url))
}

// Create an unmodified response
let response = NextResponse.next({
request: {
headers: request.headers,
},
});
})

const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL;
const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL
const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY
if (!supabaseUrl || !supabaseAnonKey) {
throw new Error(
"middleware: missing supabase url or supabase anon key in env vars"
);
throw new Error("middleware: missing supabase url or supabase anon key in env vars")
}

const supabase = createServerClient(supabaseUrl, supabaseAnonKey, {
cookies: {
getAll() {
return request.cookies.getAll();
return request.cookies.getAll()
},
setAll(cookiesToSet) {
cookiesToSet.forEach(({ name, value }) =>
request.cookies.set(name, value)
);
cookiesToSet.forEach(({ name, value }) => request.cookies.set(name, value))
response = NextResponse.next({
request,
});
cookiesToSet.forEach(({ name, value, options }) =>
response.cookies.set(name, value, options)
);
})
cookiesToSet.forEach(({ name, value, options }) => response.cookies.set(name, value, options))
},
},
});
})

// Get the user
const {
data: { user },
error: userError,
} = await supabase.auth.getUser();
// const {
// data: { user },
// error: userError,
// } = await supabase.auth.getUser()

// Still call getUser() to refresh the session, but don't store the result
await supabase.auth.getUser()

// ORIGINAL ROUTE PROTECTION LOGIC (COMMENTED OUT)
/*
// If trying to access admin route
if (request.nextUrl.pathname.startsWith("/admin")) {
if (userError || !user) {
// If no user, redirect to login
return NextResponse.redirect(new URL("/daos", request.url));
return NextResponse.redirect(new URL("/", request.url))
}

// Check user role in profiles table
const { data: profileData, error: profileError } = await supabase
.from("profiles")
.select("role")
.eq("id", user.id)
.single();
.single()

if (profileError || !profileData || profileData.role !== "Admin") {
// If not admin, redirect to dashboard
return NextResponse.redirect(new URL("/chat", request.url));
return NextResponse.redirect(new URL("/chat", request.url))
}
}

Expand All @@ -74,25 +78,26 @@ export const updateSession = async (request: NextRequest) => {
// }

// Redirect root route to /daos
if (request.nextUrl.pathname === "/") {
return NextResponse.redirect(new URL("/daos", request.url));
}
// if (request.nextUrl.pathname === "/") {
// return NextResponse.redirect(new URL("/daos", request.url));
// }

if (request.nextUrl.pathname.startsWith("/profile") && (userError || !user)) {
return NextResponse.redirect(new URL("/", request.url))
}

if (request.nextUrl.pathname === "/" && !userError) {
return NextResponse.redirect(new URL("/daos", request.url));
return NextResponse.redirect(new URL("/daos", request.url))
}
*/

return response;
return response
} catch (error) {
console.error(error);
console.error(error)
return NextResponse.next({
request: {
headers: request.headers,
},
});
})
}
};
}