2023-10-17 17:46:55 -04:00
|
|
|
"use client";
|
2023-10-17 17:46:20 -04:00
|
|
|
import { useModal } from "@/app/_providers/modal/provider";
|
2023-10-30 10:37:45 -04:00
|
|
|
import useCurrentUser from "@/lib/hooks/useCurrentUser";
|
2023-10-17 17:46:20 -04:00
|
|
|
import NewEventModal from "@/components/Modals/NewEvent";
|
|
|
|
import { RiAddFill } from "react-icons/ri";
|
2023-10-30 10:37:45 -04:00
|
|
|
import LoginModal from "@/components/Modals/Login";
|
2023-10-17 17:46:20 -04:00
|
|
|
import { Button } from "@/components/ui/button";
|
|
|
|
|
|
|
|
export default function NewEventButton() {
|
|
|
|
const modal = useModal();
|
2023-10-30 10:37:45 -04:00
|
|
|
const { currentUser } = useCurrentUser();
|
|
|
|
|
2023-10-17 17:46:20 -04:00
|
|
|
return (
|
|
|
|
<Button
|
2023-10-30 10:37:45 -04:00
|
|
|
onClick={() => {
|
|
|
|
if (currentUser) {
|
|
|
|
return modal?.show(<NewEventModal />);
|
|
|
|
} else {
|
|
|
|
return modal?.show(<LoginModal />);
|
|
|
|
}
|
|
|
|
}}
|
2023-10-17 17:46:20 -04:00
|
|
|
size={"icon"}
|
|
|
|
className="h-[50px] w-[50px]"
|
|
|
|
>
|
|
|
|
<RiAddFill className="h-[32px] w-[32px]" />
|
|
|
|
</Button>
|
|
|
|
);
|
|
|
|
}
|