Skip to content

Commit 5d4ce32

Browse files
committed
Made a proper Ui for the Architect page
1 parent 8fcf479 commit 5d4ce32

1 file changed

Lines changed: 96 additions & 56 deletions

File tree

src/pages/categories/Architects.tsx

Lines changed: 96 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useAuth } from "@/contexts/AuthContext";
44
import { useNavigate } from "react-router-dom";
55
import Navbar from "@/components/Navbar";
66
import Footer from "@/components/Footer";
7-
import { Loader2 } from "lucide-react";
7+
import { Loader2, CheckCircle2, Smile } from "lucide-react";
88

99
const ArchitectsPage = () => {
1010
const { user } = useAuth();
@@ -21,7 +21,6 @@ const ArchitectsPage = () => {
2121
});
2222
const [message, setMessage] = useState("");
2323

24-
// Fetch architects
2524
const fetchArchitects = async () => {
2625
setLoading(true);
2726
const { data, error } = await supabase.from("architects").select("*");
@@ -34,12 +33,12 @@ const ArchitectsPage = () => {
3433
fetchArchitects();
3534
}, []);
3635

37-
// Handle form input
38-
const handleChange = (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {
36+
const handleChange = (
37+
e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>
38+
) => {
3939
setFormData({ ...formData, [e.target.name]: e.target.value });
4040
};
4141

42-
// Register architect
4342
const handleRegister = async (e: React.FormEvent) => {
4443
e.preventDefault();
4544
if (!user) {
@@ -56,17 +55,15 @@ const ArchitectsPage = () => {
5655
setLoading(true);
5756
setMessage("");
5857

59-
const { error } = await supabase
60-
.from("architects")
61-
.insert([
62-
{
63-
name,
64-
specialization,
65-
description,
66-
image_url,
67-
user_id: user.id, // must match your Supabase table column exactly
68-
},
69-
]);
58+
const { error } = await supabase.from("architects").insert([
59+
{
60+
name,
61+
specialization,
62+
description,
63+
image_url,
64+
user_id: user.id,
65+
},
66+
]);
7067

7168
setLoading(false);
7269

@@ -75,13 +72,17 @@ const ArchitectsPage = () => {
7572
setMessage(`Failed to register: ${error.message}`);
7673
} else {
7774
setMessage("Successfully registered as architect!");
78-
setFormData({ name: "", specialization: "", description: "", image_url: "" });
75+
setFormData({
76+
name: "",
77+
specialization: "",
78+
description: "",
79+
image_url: "",
80+
});
7981
setShowForm(false);
8082
fetchArchitects();
8183
}
8284
};
8385

84-
// Filtered architects
8586
const filteredArchitects = architects.filter(
8687
(arch) =>
8788
arch.name?.toLowerCase().includes(search.toLowerCase()) ||
@@ -92,35 +93,83 @@ const ArchitectsPage = () => {
9293
<div className="bg-white min-h-screen font-sans">
9394
<Navbar />
9495

95-
<section className="max-w-6xl mx-auto px-4 md:px-0 pt-12 sm:pt-20 flex flex-col md:flex-row items-center justify-between gap-10">
96-
<div className="md:w-1/2">
97-
<h1 className="text-4xl sm:text-5xl font-extrabold mb-6">
98-
Find <span className="text-purple-600">Top Architects</span> for Your Project
96+
{/* Hero Section (Professional Look) */}
97+
<section className="max-w-7xl mx-auto px-6 py-24 grid grid-cols-1 md:grid-cols-2 gap-10 items-center">
98+
{/* Left content */}
99+
<div>
100+
<h1 className="text-4xl md:text-5xl font-extrabold leading-tight mb-4">
101+
Hire <span className="text-blue-600">Skilled</span> Architect <br /> in{" "}
102+
<span className="text-blue-600">Minutes</span>
99103
</h1>
104+
<p className="text-gray-600 text-lg mb-6">
105+
Connect with expert architects to design your dream spaces — from modern homes to smart offices, all with precision and creativity
106+
</p>
107+
108+
<div className="relative w-full max-w-md mb-6">
109+
<input
110+
type="text"
111+
placeholder="Search services"
112+
className="w-full py-3 px-5 rounded-lg border border-gray-300 focus:ring-2 focus:ring-blue-500 outline-none"
113+
value={search}
114+
onChange={(e) => setSearch(e.target.value)}
115+
/>
116+
<button className="absolute right-2 top-1/2 -translate-y-1/2 bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700">
117+
Search →
118+
</button>
119+
</div>
120+
121+
<div className="flex flex-wrap gap-3 text-sm text-gray-700 mb-4">
122+
<span>Popular Services:</span>
123+
<span className="px-3 py-1 bg-gray-100 rounded-full">Aashiana Architect</span>
124+
<span className="px-3 py-1 bg-gray-100 rounded-full">Aviral Design Studio</span>
125+
</div>
100126

101127
{user && (
102128
<button
103129
onClick={() => setShowForm(!showForm)}
104-
className="bg-purple-600 text-white px-5 py-2 rounded-lg font-semibold hover:bg-purple-700 transition"
130+
className="bg-blue-600 text-white px-6 py-2 rounded-lg font-semibold hover:bg-blue-700 transition"
105131
>
106132
{showForm ? "Cancel" : "Register as Architect"}
107133
</button>
108134
)}
109135
</div>
110136

111-
<div className="md:w-1/2 flex justify-center hidden md:flex">
112-
<img
113-
src="https://thearchitectsdiary.com/wp-content/uploads/2019/12/architect-construction-plans.jpg"
114-
alt="Architectural planning"
115-
className="rounded-2xl shadow-xl object-cover w-full h-[300px] sm:h-[340px] md:max-w-[420px]"
116-
/>
137+
{/* Right Video */}
138+
<div className="relative">
139+
<div className="rounded-2xl overflow-hidden shadow-xl border border-gray-200">
140+
<iframe
141+
width="100%"
142+
height="320"
143+
src="https://www.youtube.com/embed/5aJjXXQPqpM"
144+
title="Customer Review"
145+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
146+
allowFullScreen
147+
className="w-full rounded-2xl"
148+
></iframe>
149+
</div>
150+
151+
{/* Floating Popups */}
152+
<div className="absolute top-4 right-4 bg-white shadow-lg rounded-xl px-4 py-2 flex items-center gap-2">
153+
<CheckCircle2 className="text-green-500 w-5 h-5" />
154+
<div className="text-sm">
155+
<p className="font-semibold text-gray-800">Verified Experts</p>
156+
<p className="text-gray-500 text-xs">Background Checked</p>
157+
</div>
158+
</div>
159+
160+
<div className="absolute bottom-4 left-4 bg-white shadow-lg rounded-xl px-4 py-2 flex items-center gap-2">
161+
<Smile className="text-blue-500 w-5 h-5" />
162+
<div className="text-sm">
163+
<p className="font-semibold text-gray-800">Happy Customers</p>
164+
</div>
165+
</div>
117166
</div>
118167
</section>
119168

120-
{/* Registration Form */}
169+
{/* Architect Registration Form */}
121170
{showForm && (
122171
<section className="max-w-4xl mx-auto mt-10 bg-gray-50 p-6 rounded-2xl shadow-md border border-gray-200">
123-
<h2 className="text-2xl font-bold mb-4 text-center text-purple-700">
172+
<h2 className="text-2xl font-bold mb-4 text-center text-blue-700">
124173
Register as an Architect
125174
</h2>
126175

@@ -131,7 +180,7 @@ const ArchitectsPage = () => {
131180
placeholder="Full Name"
132181
value={formData.name}
133182
onChange={handleChange}
134-
className="p-3 rounded-lg border border-gray-300 focus:ring-2 focus:ring-purple-600 focus:outline-none"
183+
className="p-3 rounded-lg border border-gray-300 focus:ring-2 focus:ring-blue-600 focus:outline-none"
135184
required
136185
/>
137186
<input
@@ -140,15 +189,15 @@ const ArchitectsPage = () => {
140189
placeholder="Specialization (e.g. Interior Design)"
141190
value={formData.specialization}
142191
onChange={handleChange}
143-
className="p-3 rounded-lg border border-gray-300 focus:ring-2 focus:ring-purple-600 focus:outline-none"
192+
className="p-3 rounded-lg border border-gray-300 focus:ring-2 focus:ring-blue-600 focus:outline-none"
144193
required
145194
/>
146195
<textarea
147196
name="description"
148197
placeholder="Short Description about your work"
149198
value={formData.description}
150199
onChange={handleChange}
151-
className="p-3 rounded-lg border border-gray-300 focus:ring-2 focus:ring-purple-600 focus:outline-none"
200+
className="p-3 rounded-lg border border-gray-300 focus:ring-2 focus:ring-blue-600 focus:outline-none"
152201
rows={4}
153202
required
154203
/>
@@ -158,12 +207,12 @@ const ArchitectsPage = () => {
158207
placeholder="Image URL (optional)"
159208
value={formData.image_url}
160209
onChange={handleChange}
161-
className="p-3 rounded-lg border border-gray-300 focus:ring-2 focus:ring-purple-600 focus:outline-none"
210+
className="p-3 rounded-lg border border-gray-300 focus:ring-2 focus:ring-blue-600 focus:outline-none"
162211
/>
163212

164213
<button
165214
type="submit"
166-
className="bg-purple-600 text-white px-6 py-3 rounded-lg font-semibold hover:bg-purple-700 transition"
215+
className="bg-blue-600 text-white px-6 py-3 rounded-lg font-semibold hover:bg-blue-700 transition"
167216
>
168217
Register
169218
</button>
@@ -181,22 +230,11 @@ const ArchitectsPage = () => {
181230
</section>
182231
)}
183232

184-
{/* Search Bar */}
185-
<section className="max-w-6xl mx-auto px-4 md:px-0 mt-8">
186-
<input
187-
type="text"
188-
placeholder="Search architects by name or specialization"
189-
className="w-full sm:w-1/2 px-4 py-3 rounded-lg border border-gray-300 focus:ring-2 focus:ring-purple-600 focus:outline-none mb-6"
190-
value={search}
191-
onChange={(e) => setSearch(e.target.value)}
192-
/>
193-
</section>
194-
195233
{/* Architects Grid */}
196-
<section className="max-w-6xl mx-auto px-4 md:px-0 mt-4 mb-20">
234+
<section className="max-w-6xl mx-auto px-4 md:px-0 mt-12 mb-20">
197235
{loading ? (
198236
<div className="flex justify-center items-center h-40">
199-
<Loader2 className="animate-spin w-8 h-8 text-purple-600" />
237+
<Loader2 className="animate-spin w-8 h-8 text-blue-600" />
200238
</div>
201239
) : filteredArchitects.length === 0 ? (
202240
<p className="text-center text-gray-500">No architects found.</p>
@@ -222,17 +260,19 @@ const ArchitectsPage = () => {
222260
{arch.specialization || "Specialization not specified"}
223261
</p>
224262
<p className="text-gray-700 mb-5 text-sm line-clamp-3">
225-
{arch.description || "Expert in architectural design and planning."}
263+
{arch.description ||
264+
"Expert in architectural design and planning."}
226265
</p>
227266
</div>
228267

229-
{/* View Details Button */}
230268
<button
231-
onClick={() => navigate(`/categories/architect-detail/${arch.id}`)}
232-
className="mt-auto bg-purple-600 text-white px-4 py-2 rounded-lg hover:bg-purple-700 transition"
233-
>
234-
View Details
235-
</button>
269+
onClick={() =>
270+
navigate(`/categories/architect-detail/${arch.id}`)
271+
}
272+
className="mt-auto bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 transition"
273+
>
274+
View Details
275+
</button>
236276
</div>
237277
</div>
238278
))}

0 commit comments

Comments
 (0)