created meeting/event list
This commit is contained in:
parent
f3dab8b288
commit
3f517220bd
5 changed files with 75 additions and 8 deletions
|
@ -2,7 +2,7 @@
|
||||||
import { Input } from '@/components/ui/input'
|
import { Input } from '@/components/ui/input'
|
||||||
import { ChevronLeft } from 'lucide-react'
|
import { ChevronLeft } from 'lucide-react'
|
||||||
import React, { useEffect, useState } from 'react'
|
import React, { useEffect, useState } from 'react'
|
||||||
import {DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger,} from "@/components/ui/dropdown-menu"
|
import {DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger,} from "@/components/ui/dropdown-menu"
|
||||||
import LocationOption from '@/app/_utils/LocationOption'
|
import LocationOption from '@/app/_utils/LocationOption'
|
||||||
import Image from 'next/image'
|
import Image from 'next/image'
|
||||||
import { Button } from '@/components/ui/button'
|
import { Button } from '@/components/ui/button'
|
||||||
|
@ -38,11 +38,11 @@ const MeetingForm = ({setFormEvent}) => {
|
||||||
locationMeeting: locationMeeting,
|
locationMeeting: locationMeeting,
|
||||||
urlMeeting: urlMeeting,
|
urlMeeting: urlMeeting,
|
||||||
themeColor: themeColor,
|
themeColor: themeColor,
|
||||||
businessId: doc(db, 'Business', user?.email)
|
businessId: doc(db, 'Business', user?.email),
|
||||||
}).then(res => {
|
createdBy: user?.email
|
||||||
toast('New event/meeting is created')
|
|
||||||
router.replace('/dashboard/meeting')
|
|
||||||
})
|
})
|
||||||
|
toast('New event/meeting is created');
|
||||||
|
router.replace('/dashboard/meeting');
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { LogoutLink, useKindeBrowserClient } from '@kinde-oss/kinde-auth-nextjs'
|
||||||
import { BsThreeDotsVertical } from "react-icons/bs";
|
import { BsThreeDotsVertical } from "react-icons/bs";
|
||||||
import Image from 'next/image';
|
import Image from 'next/image';
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {DropdownMenu, ropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger,} from "@/components/ui/dropdown-menu"
|
import {DropdownMenu, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger,} from "@/components/ui/dropdown-menu"
|
||||||
import { DropdownMenuContent } from '@radix-ui/react-dropdown-menu';
|
import { DropdownMenuContent } from '@radix-ui/react-dropdown-menu';
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ const DashboardHeader = () => {
|
||||||
<Image src={user?.picture} alt='user-img' width={30} height={30} className='rounded-full'/>
|
<Image src={user?.picture} alt='user-img' width={30} height={30} className='rounded-full'/>
|
||||||
<BsThreeDotsVertical/>
|
<BsThreeDotsVertical/>
|
||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
<DropdownMenuContent className='border border-gray-200 mt-1'>
|
<DropdownMenuContent className='border border-gray-200 mt-1 bg-white'>
|
||||||
<DropdownMenuLabel>{user.given_name}</DropdownMenuLabel>
|
<DropdownMenuLabel>{user.given_name}</DropdownMenuLabel>
|
||||||
<DropdownMenuSeparator />
|
<DropdownMenuSeparator />
|
||||||
<DropdownMenuItem>Profile</DropdownMenuItem>
|
<DropdownMenuItem>Profile</DropdownMenuItem>
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
"use client"
|
||||||
|
import React, { useEffect, useState } from 'react'
|
||||||
|
import { app } from '@/config/FirebaseConfig'
|
||||||
|
import { useKindeBrowserClient } from '@kinde-oss/kinde-auth-nextjs'
|
||||||
|
import { collection, getDocs, getFirestore, orderBy, query, where } from 'firebase/firestore'
|
||||||
|
import { GoClock } from "react-icons/go";
|
||||||
|
import { PiMapPinLight, PiCopyLight, PiShareFatLight } from 'react-icons/pi'
|
||||||
|
import { IoSettingsOutline } from "react-icons/io5";
|
||||||
|
import { toast } from 'sonner'
|
||||||
|
|
||||||
|
const MeetingEventList = () => {
|
||||||
|
const [eventList, setEventList] = useState([]);
|
||||||
|
const db = getFirestore(app);
|
||||||
|
const {user} = useKindeBrowserClient();
|
||||||
|
|
||||||
|
const getEventList = async () => {
|
||||||
|
setEventList([]);
|
||||||
|
const q = query(collection(db, "MeetingEvent"), where("createdBy", "==", user?.email), orderBy('id', 'desc'));
|
||||||
|
const querySnapshot = await getDocs(q);
|
||||||
|
querySnapshot.forEach((doc) => {
|
||||||
|
console.log(doc.id, " => ", doc.data());
|
||||||
|
setEventList(prevEvent => [...prevEvent, doc.data()])
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
user && getEventList()
|
||||||
|
}, [user])
|
||||||
|
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='mt-5 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-5'>
|
||||||
|
{eventList.length > 0 ? eventList?.map((event, index) => (
|
||||||
|
<div className='border shadow-md border-t-8 rounded-md p-5 flex flex-col gap-5' style={{borderTopColor:event?.themeColor}}>
|
||||||
|
<p className='text-lg'>{event?.eventName}</p>
|
||||||
|
<div className='flex justify-between'>
|
||||||
|
<p className='flex gap-1 items-center'><GoClock/>{event.timeDuration} minutes</p>
|
||||||
|
<p className='flex gap-1 items-center'><PiMapPinLight/>{event.locationMeeting}</p>
|
||||||
|
</div>
|
||||||
|
<hr/>
|
||||||
|
<div className='flex justify-between'>
|
||||||
|
<div className='flex gap-2'>
|
||||||
|
<button onClick={() => {navigator.clipboard.writeText(event.urlMeeting), toast('Copied')}} className='text-lg'><PiCopyLight/></button>
|
||||||
|
<button className="text-lg"><PiShareFatLight/></button>
|
||||||
|
</div>
|
||||||
|
<IoSettingsOutline className='cursor-pointer'/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)): <p className='font-semibold text-green-800'>Loading...</p>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default MeetingEventList
|
|
@ -1,8 +1,19 @@
|
||||||
|
"use client"
|
||||||
|
import { Input } from '@/components/ui/input'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
import MeetingEventList from './_components/MeetingEventList'
|
||||||
|
|
||||||
|
|
||||||
const Meeting = () => {
|
const Meeting = () => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>This is a meeting page</div>
|
<div className='px-5'>
|
||||||
|
<div className='flex flex-col gap-5'>
|
||||||
|
<p className='font-semibold text-xl'>Event/Meeting </p>
|
||||||
|
<Input placeholder='Search...' className='max-w-xs'/><hr/>
|
||||||
|
</div>
|
||||||
|
<MeetingEventList/>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/** @type {import('next').NextConfig} */
|
/** @type {import('next').NextConfig} */
|
||||||
const nextConfig = {
|
const nextConfig = {
|
||||||
|
reactStrictMode: false,
|
||||||
images:{
|
images:{
|
||||||
domains:['lh3.googleusercontent.com']
|
domains:['lh3.googleusercontent.com']
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue