diff --git a/app/homepage2/components/sidebar.tsx b/app/homepage2/components/sidebar.tsx index 60d1170..348d7bf 100644 --- a/app/homepage2/components/sidebar.tsx +++ b/app/homepage2/components/sidebar.tsx @@ -7,6 +7,7 @@ import { current } from "@reduxjs/toolkit" import { useEffect, useState } from "react" import { db } from "@/utils/firebase" import { collection, getDocs } from "firebase/firestore" +import Loader from "@/components/ui/Loader" interface SidebarProps extends React.HTMLAttributes { playlists: Playlist[], @@ -35,8 +36,11 @@ export function Sidebar({ className, playlists, selectChange, currentC }: Sideba return []; } } - const category = getCat(); - setSidebarCategory(category); + const category = getCat().then(categories => { + setSidebarCategory(categories); + }).catch(error => { + console.error('Error:', error); + }); }, []) //console.log("LS: ", selectChange); @@ -47,6 +51,7 @@ export function Sidebar({ className, playlists, selectChange, currentC }: Sideba

Discover

+
- +
+ )): +
+ } + + {/* - - - + */} +

diff --git a/app/homepage2/createEvent/page.tsx b/app/homepage2/createEvent/page.tsx index 037824f..cb0f9e8 100644 --- a/app/homepage2/createEvent/page.tsx +++ b/app/homepage2/createEvent/page.tsx @@ -151,7 +151,7 @@ const CreatEventPage = () => { const [previewImg, setPreviewImg] = useState(null); const [subCategoryy, setSubCategoryy] = useState(["SubCategory1", "SubCategory2", "SubCategory3"]); const [tempSubCategory, setTempSubCategory] = useState([]); - + const [selectCategory, setSelectCategory] = useState(); const [sponsors , setSponsors] = useState([]); const [sponsorInput , setSponsorInput] = useState(""); const [landmark, setLandmark] = useState(""); @@ -212,6 +212,30 @@ const CreatEventPage = () => { //extracting ends + useEffect(()=>{ + const getCat=async()=>{ + try { + const eventCategoriesRef = collection(db, 'meta-data', 'v1', 'event-categories'); + const snapshot = await getDocs(eventCategoriesRef); + + const eventCategories:any = []; + snapshot.forEach(doc => { + eventCategories.push({ id: doc.id, ...doc.data() }); + }); + + return eventCategories; + } catch (error) { + console.error('Error fetching event categories:', error); + return []; + } + } + const category = getCat().then(categories => { + setSelectCategory(categories); + }).catch(error => { + console.error('Error:', error); + }); + }, []) + //new fetchpost useEffect(() => { @@ -698,11 +722,17 @@ const CreatEventPage = () => { Categories - How To - Help - Mystery/Haunted/Ghost - Astrology/Remedies/Occult - GemStones/Rudraksha +
+ { + selectCategory? + selectCategory.map((categoryD:any, index:any)=>( +
+ {categoryD.id.split("|").join("/")} +
+ )): +
+ } +
Others