Skip to content

Commit 404501d

Browse files
committed
fixed the ui bug
1 parent 9fb275b commit 404501d

File tree

4 files changed

+266
-76
lines changed

4 files changed

+266
-76
lines changed

src/app/dashboard/page.tsx

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"use client";
2-
import React, { useState, useEffect, useRef } from 'react';
2+
import React, { useState, useRef } from 'react';
33
import { Star, Clock, Filter } from 'lucide-react';
44
import { useRouter } from 'next/navigation';
55
import { NavbarDemo } from "@/components/nav";
@@ -69,7 +69,8 @@ const AcademicHub = () => {
6969
const [isLoading, setIsLoading] = useState(false);
7070
const [searchQuery, setSearchQuery] = useState("");
7171

72-
const allProjects = [
72+
// Core projects without duplicates
73+
const coreProjects = [
7374
{
7475
id: 1,
7576
title: "Assignment-Med",
@@ -126,6 +127,11 @@ const AcademicHub = () => {
126127
tagColor: "bg-green-500",
127128
tags: ["ai", "generator", "free", "instant"],
128129
},
130+
];
131+
132+
// Combine with mock projects (starting from id 5 to avoid duplicates)
133+
const allProjects = [
134+
...coreProjects,
129135
...MOCK_PROJECTS.map((project, index) => ({
130136
id: index + 5,
131137
title: project.title,
@@ -137,9 +143,10 @@ const AcademicHub = () => {
137143
price: project.price,
138144
originalPrice: project.price * 2,
139145
tag: project.badge || "Available",
140-
tagColor: project.badge === "Best Seller" ? "bg-amber-500" :
141-
project.badge === "New" ? "bg-emerald-500" :
142-
project.badge === "Popular" ? "bg-blue-500" : "bg-gray-500",
146+
tagColor:
147+
project.badge === "Best Seller" ? "bg-amber-500" :
148+
project.badge === "New" ? "bg-emerald-500" :
149+
project.badge === "Popular" ? "bg-blue-500" : "bg-gray-500",
143150
tags: project.tags,
144151
}))
145152
];
@@ -171,8 +178,11 @@ const AcademicHub = () => {
171178
<div className={isLoading ? "opacity-0" : "opacity-100 transition-opacity duration-500"}>
172179
<NavbarDemo searchQuery={searchQuery} setSearchQuery={setSearchQuery} />
173180

174-
<section className="relative py-20 px-4 sm:px-6 lg:px-8 overflow-hidden">
175-
<div className="absolute inset-0 bg-gradient-to-r from-blue-600/20 to-purple-600/20 backdrop-blur-3xl"></div>
181+
{/* Hero Section with Gradient Background extending from top */}
182+
<section className="relative py-20 px-4 sm:px-6 lg:px-8 overflow-hidden pt-32">
183+
{/* Gradient Background - extends to cover navbar area */}
184+
<div className="absolute inset-0 -top-20 bg-gradient-to-r from-blue-600/20 to-purple-600/20 backdrop-blur-3xl"></div>
185+
176186
<div className="relative max-w-4xl mx-auto text-center">
177187
<h1 className="text-4xl sm:text-5xl lg:text-6xl font-bold mb-6">
178188
Premium Academic{" "}

src/app/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export default function HomePage() {
119119
>
120120
<Image
121121
src="/homepage.png"
122-
src="/hero-image.png"
122+
// src="/hero-image.png"
123123
alt="hero"
124124
height={720}
125125
width={1400}

src/components/nav.tsx

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
} from "@/components/ui/resizable-navbar";
1313
import { useState, useEffect } from "react";
1414
import { GitHubStarsButton } from '@/components/animate-ui/buttons/github-stars';
15-
import { useRouter } from "next/navigation";
15+
import { useRouter, usePathname } from "next/navigation";
1616
import { supabase } from "@/lib/supabaseclient";
1717
import type { User } from '@supabase/supabase-js';
1818
import Link from "next/link";
@@ -47,6 +47,13 @@ export function NavbarDemo({ searchQuery = "", setSearchQuery }: NavbarDemoProps
4747
const [showMobileSearch, setShowMobileSearch] = useState(false);
4848
const [user, setUser] = useState<User | null>(null);
4949
const router = useRouter();
50+
const pathname = usePathname();
51+
52+
// Only show navbar if NOT on homepage or landing page
53+
const shouldShowNavbar = pathname !== '/' && pathname !== '/home';
54+
55+
// Only show search on dashboard page
56+
const showSearch = pathname === '/dashboard' && setSearchQuery;
5057

5158
useEffect(() => {
5259
if (!supabase) return;
@@ -72,6 +79,11 @@ export function NavbarDemo({ searchQuery = "", setSearchQuery }: NavbarDemoProps
7279
}
7380
};
7481

82+
// Don't render navbar on homepage
83+
if (!shouldShowNavbar) {
84+
return null;
85+
}
86+
7587
return (
7688
<div className="relative w-full">
7789
<Navbar>
@@ -82,26 +94,26 @@ export function NavbarDemo({ searchQuery = "", setSearchQuery }: NavbarDemoProps
8294
<NavItems items={navItems} />
8395
</div>
8496

85-
{/* Desktop Search Bar */}
86-
{setSearchQuery && (
97+
{/* Desktop Search - Only on Dashboard */}
98+
{showSearch && (
8799
<div className="hidden md:flex items-center mr-4">
88100
<div className="relative">
89101
<input
90102
type="text"
91103
placeholder="Search projects..."
92104
value={searchQuery}
93105
onChange={(e) => setSearchQuery(e.target.value)}
94-
className="w-64 px-4 py-2 pl-10 bg-white/10 backdrop-blur-sm border border-white/20
95-
rounded-full text-white placeholder-white/50
96-
focus:outline-none focus:border-blue-400 focus:ring-2
97-
focus:ring-blue-400/50 transition-all"
106+
className="w-64 px-4 py-2 pl-10 bg-white/5 backdrop-blur-md border border-white/10
107+
rounded-full text-white placeholder-white/40
108+
focus:outline-none focus:border-white/30 focus:bg-white/5
109+
transition-all duration-200"
98110
/>
99-
<Search className="absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-white/50" />
111+
<Search className="absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-white/40" />
100112
{searchQuery && (
101113
<button
102114
onClick={clearSearch}
103115
className="absolute right-3 top-1/2 -translate-y-1/2
104-
text-white/50 hover:text-white transition-colors"
116+
text-white/40 hover:text-white transition-colors"
105117
aria-label="Clear search"
106118
>
107119
<X className="w-4 h-4" />
@@ -126,8 +138,8 @@ export function NavbarDemo({ searchQuery = "", setSearchQuery }: NavbarDemoProps
126138
<MobileNavHeader>
127139
<NavbarLogo />
128140
<div className="flex items-center gap-2">
129-
{/* Mobile Search Toggle */}
130-
{setSearchQuery && (
141+
{/* Mobile Search Toggle - Only on Dashboard */}
142+
{showSearch && (
131143
<button
132144
onClick={() => setShowMobileSearch(!showMobileSearch)}
133145
className="text-white/90 hover:text-white transition-colors md:hidden"
@@ -143,26 +155,26 @@ export function NavbarDemo({ searchQuery = "", setSearchQuery }: NavbarDemoProps
143155
</div>
144156
</MobileNavHeader>
145157

146-
{/* Mobile Search Bar (appears below header when toggled) */}
147-
{showMobileSearch && setSearchQuery && (
158+
{/* Mobile Search Bar */}
159+
{showMobileSearch && showSearch && (
148160
<div className="px-4 py-3 border-t border-white/10 md:hidden">
149161
<div className="relative">
150162
<input
151163
type="text"
152164
placeholder="Search projects..."
153165
value={searchQuery}
154166
onChange={(e) => setSearchQuery(e.target.value)}
155-
className="w-full px-4 py-3 pl-10 bg-white/10 backdrop-blur-sm border border-white/20
156-
rounded-full text-white placeholder-white/50
157-
focus:outline-none focus:border-blue-400 focus:ring-2
158-
focus:ring-blue-400/50 transition-all"
167+
className="w-full px-4 py-3 pl-10 bg-white/5 backdrop-blur-sm border border-white/10
168+
rounded-lg text-white placeholder-white/40
169+
focus:outline-none focus:border-white/30 focus:bg-white/5
170+
transition-all"
159171
/>
160-
<Search className="absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-white/50" />
172+
<Search className="absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-white/40" />
161173
{searchQuery && (
162174
<button
163175
onClick={clearSearch}
164176
className="absolute right-3 top-1/2 -translate-y-1/2
165-
text-white/50 hover:text-white transition-colors"
177+
text-white/40 hover:text-white transition-colors"
166178
aria-label="Clear search"
167179
>
168180
<X className="w-5 h-5" />

0 commit comments

Comments
 (0)