diff --git a/src/components/Footer.tsx b/src/components/Footer.tsx
index 28266195..77856e87 100644
--- a/src/components/Footer.tsx
+++ b/src/components/Footer.tsx
@@ -51,7 +51,7 @@ const Footer: React.FC = () => {
-
+
© {new Date().getFullYear()} GoBuild. All rights reserved.
diff --git a/src/components/HeroArchitectForm.tsx b/src/components/HeroArchitectForm.tsx
new file mode 100644
index 00000000..9f00e1a8
--- /dev/null
+++ b/src/components/HeroArchitectForm.tsx
@@ -0,0 +1,171 @@
+import React, { useState } from 'react';
+import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
+import { Calendar } from '@/components/ui/calendar';
+import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Textarea } from '@/components/ui/textarea';
+import { Calendar as CalendarIcon, Phone, MapPin } from 'lucide-react';
+import { format } from 'date-fns';
+import { useToast } from '@/hooks/use-toast';
+import { supabase } from '@/integrations/supabase/client';
+
+export function HeroArchitectForm() {
+ const [preferredDate, setPreferredDate] = useState();
+ const [dateOpen, setDateOpen] = useState(false);
+ const [name, setName] = useState('');
+ const [email, setEmail] = useState('');
+ const [phone, setPhone] = useState('');
+ const [projectType, setProjectType] = useState('');
+ const [location, setLocation] = useState('');
+ const [budget, setBudget] = useState('');
+ const [message, setMessage] = useState('');
+ const [isSubmitting, setIsSubmitting] = useState(false);
+ const { toast } = useToast();
+
+ const validate = () => {
+ if (!name.trim()) return 'Please enter your name';
+ if (!phone.trim() || phone.replace(/\D/g, '').length < 10) return 'Please enter a valid 10-digit phone number';
+ if (!projectType) return 'Please select a project type';
+ return null;
+ };
+
+ const handleSubmit = async () => {
+ const errorMsg = validate();
+ if (errorMsg) {
+ toast({ title: 'Error', description: errorMsg, variant: 'destructive' });
+ return;
+ }
+
+ if (isSubmitting) return;
+ setIsSubmitting(true);
+
+ try {
+ const payload: any = {
+ client_name: name.trim(),
+ phone: phone.trim(),
+ project_type: projectType,
+ preferred_date: preferredDate ? format(preferredDate, 'yyyy-MM-dd') : null,
+ location: location.trim() || null,
+ budget: budget ? Number(budget) : null,
+ message: message.trim() || null,
+ status: 'pending',
+ created_at: new Date().toISOString(),
+ };
+
+ const { error } = await supabase.from('ArchitectRequest').insert([payload]);
+
+ if (error) throw error;
+
+ toast({ title: 'Request sent', description: 'We will contact you soon.', });
+
+ // reset
+ setPreferredDate(undefined);
+ setName('');
+ setPhone('');
+ setProjectType('');
+ setLocation('');
+ setBudget('');
+ setMessage('');
+ } catch (err: any) {
+ console.error('Architect request error', err);
+ toast({ title: 'Error', description: err?.message || 'Failed to submit request', variant: 'destructive' });
+ } finally {
+ setIsSubmitting(false);
+ }
+ };
+
+ return (
+
+ );
+}
+
+export default HeroArchitectForm;
diff --git a/src/components/HeroForm.tsx b/src/components/HeroForm.tsx
index d2fd7b2c..2f78c828 100644
--- a/src/components/HeroForm.tsx
+++ b/src/components/HeroForm.tsx
@@ -28,40 +28,30 @@ const [isSubmitting, setIsSubmitting] = useState(false);
const locationList = [
'Katra, Jammu',
- 'Janipur, Jammu',
+ 'Jaanipur, Jammu',
+ 'High Court, Jammu',
'Satwari Chowk, Jammu',
'Gandhinagar, Jammu',
- 'Gangyal Industrial Area, Jammu',
+ 'Ganghiyal Industrial Area, Jammu',
'Bahu Plaza, Jammu',
- 'Residency Road, Jammu',
+ 'RaghuNath Nagar, Jammu',
+ 'Bus Stand, Jammu',
'Bari Brahmana, Jammu',
'Sainik Colony, Jammu',
- 'Trikuta Nagar, jammu',
- 'Bhagwati Nagar, jammu',
- 'Shastri Nagar, jammu',
- 'Rehari, jammu',
- 'Talab Tillo, jammu',
- 'Muthi, jammu',
- 'Channi Himmat, jammu',
];
const locationCoords: any = {
'katra, jammu': { lat: 32.9917, lng: 74.9319 },
- 'Janipur, jammu': { lat: 32.7496, lng: 74.8373 },
- 'satwari chowk, jammu': { lat: 32.6923199, lng: 74.8462223 },
- 'gandhinagar, jammu': { lat: 32.7043905, lng: 74.8518208 },
- 'gangyal industrial area, jammu': { lat: 32.6722807, lng: 74.866613 },
- 'bahu plaza, jammu': { lat: 32.7038042, lng: 74.8698721 },
- 'residency Road, jammu': { lat: 32.7293127, lng: 74.8654757 },
- 'bari brahmana, jammu': { lat: 32.636539, lng: 74.9038354 },
- 'sainik colony, jammu': { lat: 32.6738936, lng: 74.8723597 },
- 'trikuta nagar, jammu': { lat: 32.6927306, lng: 74.8565729 },
- 'bhagwati nagar, jammu': { lat: 32.7277661, lng: 74.826981 },
- 'shastri nagar, jammu': { lat: 32.6931782, lng: 74.8514339 },
- 'rehari, jammu': { lat: 32.7478515, lng: 74.8463835 },
- 'talab tillo, jammu': { lat: 32.724354, lng: 74.8406902 },
- 'muthi, jammu': { lat: 32.7585189, lng: 74.8114887 },
- 'channi himmat, jammu': { lat: 32.6934058, lng: 74.873381 },
+ 'jaanipur, jammu': { lat: 32.7496, lng: 74.8373 },
+ 'high court, jammu': { lat: 32.7294, lng: 74.8648 },
+ 'satwari chowk, jammu': { lat: 32.6887, lng: 74.8371 },
+ 'gandhinagar, jammu': { lat: 32.7266, lng: 74.8570 },
+ 'ganghiyal industrial area, jammu': { lat: 32.6749, lng: 74.8090 },
+ 'bahu plaza, jammu': { lat: 32.7150, lng: 74.8600 },
+ 'raghunath nagar, jammu': { lat: 32.7300, lng: 74.8605 },
+ 'bus stand, jammu': { lat: 32.7357, lng: 74.8733 },
+ 'bari brahmana, jammu': { lat: 32.6204, lng: 74.9072 },
+ 'sainik colony, jammu': { lat: 32.6927, lng: 74.8905 },
};
const handleLocationSelect = (value: string) => {
diff --git a/src/contexts/AuthContext.tsx b/src/contexts/AuthContext.tsx
index 71a62622..dcc74b64 100644
--- a/src/contexts/AuthContext.tsx
+++ b/src/contexts/AuthContext.tsx
@@ -45,56 +45,53 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children
}
};
- useEffect(() => {
- // Set up the auth state listener first
- const { data: { subscription } } = supabase.auth.onAuthStateChange(
- (event, currentSession) => {
- setSession(currentSession);
- setUser(currentSession?.user ?? null);
-
- setTimeout(async()=>{
- if (currentSession?.user) {
- // Fetch user role when user is signed in
- const role = await fetchUserRole(currentSession.user.id);
- setUserRole(role);
- } else {
- // Clear user role when user is signed out
- setUserRole(null);
- }
- // Handle events
- if (event === 'SIGNED_IN') {
- toast({
- title: "Welcome back!",
- description: "You have successfully signed in.",
- });
- } else if (event === 'SIGNED_OUT') {
- toast({
- title: "Signed out",
- description: "You have been signed out successfully.",
- });
- }
- },0);
- }
- );
-
- // Then check for existing session
- supabase.auth.getSession().then(async ({ data: { session: currentSession } }) => {
+useEffect(() => {
+ let lastUserId = null;
+ let lastEvent = null;
+
+ const fetchAndSetUserRole = async (userId) => {
+ if (!userId || userId === lastUserId) return;
+ lastUserId = userId;
+
+ const role = await fetchUserRole(userId);
+ setUserRole(role);
+ };
+
+ supabase.auth.getSession().then(async ({ data: { session: currentSession } }) => {
+ setSession(currentSession);
+ setUser(currentSession?.user ?? null);
+
+ if (currentSession?.user) {
+ await fetchAndSetUserRole(currentSession.user.id);
+ }
+
+ setLoading(false);
+ });
+
+ const { data: { subscription } } = supabase.auth.onAuthStateChange(
+ async (event, currentSession) => {
setSession(currentSession);
setUser(currentSession?.user ?? null);
-
+
+ if (event === lastEvent) return;
+ lastEvent = event;
+
if (currentSession?.user) {
- // Fetch user role for existing session
- const role = await fetchUserRole(currentSession.user.id);
- setUserRole(role);
+ await fetchAndSetUserRole(currentSession.user.id);
+ } else {
+ setUserRole(null);
}
-
- setLoading(false);
- });
- return () => {
- subscription.unsubscribe();
- };
- }, [navigate]);
+ if (event === 'SIGNED_IN') {
+ toast({ title: "Welcome back!", description: "You have successfully signed in." });
+ } else if (event === 'SIGNED_OUT') {
+ toast({ title: "Signed out", description: "You have been signed out successfully." });
+ }
+ }
+ );
+
+ return () => subscription.unsubscribe();
+}, [navigate]);
const signIn = async (email: string, password: string) => {
try {
diff --git a/src/locales/en.json b/src/locales/en.json
index a4dcccca..355baa33 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -69,7 +69,7 @@
"company": "Company",
"howItWorks": "How It Works",
"contact": "Contact",
- "address": "House No - 251\nNear Chaddha Classes, Rehari Colony\nJammu & Kashmir"
+ "address": "H/No- 251, Front of Chaddha Classes,Rehari Colony,Jammu, Jammu & Kashmir"
},
"howItWorks": {
"title": "How GoBuild Works",
diff --git a/src/pages/ContactUs.tsx b/src/pages/ContactUs.tsx
index 8b09b080..06f0a894 100644
--- a/src/pages/ContactUs.tsx
+++ b/src/pages/ContactUs.tsx
@@ -123,7 +123,7 @@ const ContactUs: React.FC = () => {
{t('contactUs.contactInfo.address')}
- House No - 251
Near Chaddha Classes, Rehari Colony
+ H/No- 251, Front of Chaddha Classes,Rehari Colony,
Jammu & Kashmir
diff --git a/src/pages/categories/Architects.tsx b/src/pages/categories/Architects.tsx
index d88ec0f8..77acaafd 100644
--- a/src/pages/categories/Architects.tsx
+++ b/src/pages/categories/Architects.tsx
@@ -5,7 +5,7 @@ import { useNavigate, useSearchParams } from "react-router-dom";
import Navbar from "@/components/Navbar";
import Footer from "@/components/Footer";
import { Loader2, CheckCircle2, Smile } from "lucide-react";
-import BmodelArchitect from "@/components/BmodelArchitect";
+import { HeroArchitectForm } from "@/components/HeroArchitectForm";
import ImageSlider from "@/components/ImageSlider";
const ArchitectsPage = () => {
@@ -397,8 +397,11 @@ const ArchitectsPage = () => {
)}
)}
-
- {/* Heading Added Below Cards Section */}
+
+ {/* Hero form for achitects */}
+
+
+ {/* ✅ Heading Added Below Cards Section */}