diff --git a/src/app/globals.css b/src/app/globals.css index 3f44c43..b399b12 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -1,24 +1,38 @@ +@import url('https://fonts.googleapis.com/css2?family=Russo+One&display=swap'); @import "tailwindcss"; - -@custom-variant dark (&:is(.dark *)); +@custom-variant dark (&:where(.dark, .dark *)); @theme { +/* this is for the color when toggle_theme this is for the light theme*/ + --color-web3: rgba(63, 101, 226); + --color-uoa: rgba(255, 255, 255); + --color-hero-text: rgba(0, 0, 0); + --color-nav-text: rgba(0, 0, 0); + --color-nav-bg: rgba(255, 255, 255, 0.6); + --color-nav-text-hover: rgba(63, 101, 226); + --color-button: rgba(255, 255, 255.6); + --color-button-bor: var(--color-button-b); + --color-button-txt: rgba(63, 101, 226); + + --font-russo: + 'Russo One', sans-serif; + --font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; - - --color-background: oklch(1 0 0); /* Pure White */ - --color-foreground: oklch(0.15 0 0); /* Almost Black */ + + --color-background: oklch(1 0 0); + --color-foreground: oklch(0.15 0 0); --color-card: oklch(1 0 0); --color-card-foreground: oklch(0.15 0 0); --color-popover: oklch(1 0 0); --color-popover-foreground: oklch(0.15 0 0); - --color-primary: oklch(0.55 0.22 260); /* Vibrant, accessible blue */ + --color-primary: oklch(0.55 0.22 260); --color-primary-foreground: oklch(1 0 0); - --color-secondary: oklch(0.96 0 0); /* Light gray */ + --color-secondary: oklch(0.96 0 0); --color-secondary-foreground: oklch(0.15 0 0); --color-muted: oklch(0.95 0 0); --color-muted-foreground: oklch(0.45 0 0); @@ -54,9 +68,9 @@ scroll-behavior: smooth; } body { - @apply bg-background text-foreground font-sans antialiased; - margin: 0; + background-image: var(--background-theme); min-height: 100vh; + transition: background-image 0.3s ease; } ::selection { background-color: oklch(0.55 0.22 260 / 0.2); @@ -65,3 +79,33 @@ -webkit-user-drag: none; } } + +/* this is for the color when toggle_theme this is for the light theme*/ +:root { + --background-theme: linear-gradient(135deg, #c8dff5 0%, #ddd0e8 60%, #f8f4fc 100%); + --color-nav-bar-text: rgba(0, 0, 0); + --nav-bar-bg: rgba(255, 255, 255, 0.6); + --color-button-b: rgb(63, 101, 226); +} + +/* dark theme*/ +.dark { + --background-theme: radial-gradient(ellipse at top right, #b0c4d8 0%, #7b82b0 40%, #1a1a2e 100%); + --color-nav-bar-bg: rgba(64, 66, 70, 0.6); + --color-nav-text: rgba(255,255,255); + --color-nav-bar-text: rgba(255, 255, 255); + --color-nav-text-hover: rgba(163, 222, 244); + --color-web3: rgba(163, 222, 244); + --color-uoa: rgba(0,0,0); + --color-hero-text: rgba(255, 255, 255); + --color-button: rgba(63,101,226,0.6); + + --color-button-b: rgb(163, 222, 244); + + --color-nav-bg: rgba(64, 66, 70, 0.6); + --color-button-txt: rgba(63, 101, 226); +} + +.theme-transitioning * { + transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease !important; +} \ No newline at end of file diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 5e75b1f..2f88f65 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -3,6 +3,7 @@ import "./globals.css"; import { Navbar } from "@/components/navbar"; import { Footer } from "@/components/footer"; import { Web3Provider } from "@/components/web3-provider"; +import Script from "next/script"; export const metadata: Metadata = { title: "WEB3UOA - University of Auckland Web3 Club", @@ -17,9 +18,22 @@ export default function RootLayout({ return ( + {/*Prevent flash of wrong theme when reload page*/} + {children} @@ -28,4 +42,4 @@ export default function RootLayout({ ); -} +} \ No newline at end of file diff --git a/src/app/page.tsx b/src/app/page.tsx index afa8660..ec86893 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -13,7 +13,7 @@ export default function Home() { {/* ENS Subname Claim Section */}
{/* Abstract background blobs for styling */}
diff --git a/src/components/hero.tsx b/src/components/hero.tsx index 4cee764..e6ba882 100644 --- a/src/components/hero.tsx +++ b/src/components/hero.tsx @@ -3,25 +3,23 @@ import { Instagram, Linkedin, ArrowRight } from "lucide-react"; export function Hero() { return ( -
+
{/* Hero text (left side) */}
- - University of Auckland - -

- WEB3UOA +

+ WEB3 + UOA

-

- Educating the next generation of blockchain innovators. +

+ The next generation of blockchain innovators

- {/* Social Links */} -
+
+ {/* Logo element (right side) */}
diff --git a/src/components/navbar.tsx b/src/components/navbar.tsx index 5b63dd6..c73b2a7 100644 --- a/src/components/navbar.tsx +++ b/src/components/navbar.tsx @@ -1,45 +1,88 @@ "use client"; -import React, { useState } from "react"; +import { Sun, Moon } from 'lucide-react' +import React, { useState, useEffect } from "react"; import { Button } from "@/components/ui/button"; import { Menu, X } from "lucide-react"; -import { useWallet } from "@/hooks/use-wallet"; -import { WalletButton } from "@/components/wallet-button"; -import { usePathname } from "next/navigation"; +import { useAccount } from "wagmi"; +import { isAllowedAdminAddress } from "@/lib/admin-auth"; import Link from "next/link"; const navLinks = [ - { label: "About", href: "/#about" }, - { label: "Events", href: "/#events" }, - { label: "Partners", href: "/#partners" }, - { label: "Claim your Web3 ID!", href: "/#identity", isCTA: true }, + { label: "About", href: "/pages/about" }, + { label: "Events", href: "/pages/events" }, + { label: "Partners", href: "/pages/partners" }, + // { label: "Claim your Web3 ID!", href: "/pages/claim-id", isCTA: true }, + // { label: "About", href: "#about" }, + // { label: "Events", href: "#events" }, + // { label: "Partners", href: "#partners" }, + { label: "Search", href: "#search" }, // TODO: add search page + { label: "Join Us", href: "#join_us" }, // TODO: add Us + { label: "Connect Wallet", href: "/pages/claim-id" }, // TODO: add wallet connection + //{ label: "Claim your Web3 ID!", href: "#identity", isCTA: true } // not sure if need ]; export function Navbar() { const [mobileOpen, setMobileOpen] = useState(false); - const { isAdmin } = useWallet(); - const pathname = usePathname(); - const isHome = pathname === "/"; + const [theme, setTheme] = useState("light"); + const [mounted, setMounted] = useState(false); + const { address } = useAccount(); + + useEffect(() => { + setMounted(true); + }, []); + + // save theme preference to localStorage for persistence across sessions + // read saved preference (client only) + useEffect(() => { + const saved = localStorage.getItem("theme") as "light" | "dark" | null; + const preferred = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"; + setTheme(saved || preferred); + }, []); + + // 3. Apply theme + save it whenever it changes for the theme + useEffect(() => { + document.documentElement.classList.add('theme-transitioning'); + + if (theme === "dark") { + document.documentElement.classList.add("dark"); + } else { + document.documentElement.classList.remove("dark"); + } + + localStorage.setItem("theme", theme); // ← this saves it + + setTimeout(() => { + document.documentElement.classList.remove('theme-transitioning'); + }, 300); + }, [theme]); + + const isAdmin = mounted && isAllowedAdminAddress(address); return ( -