Buchungssystem erste überarbeitungen

This commit is contained in:
PxlLoewe
2025-09-20 00:28:53 +02:00
parent a612cf9951
commit ba027957ce
9 changed files with 136 additions and 228 deletions

View File

@@ -3,29 +3,17 @@
import { useState } from "react";
import { CalendarIcon } from "lucide-react";
import { BookingSystem } from "./BookingSystem";
import { User } from "@repo/db";
interface BookingButtonProps {
currentUser: {
id: string;
emailVerified: boolean;
is_banned: boolean;
permissions: string[];
};
currentUser: User;
}
export const BookingButton = ({ currentUser }: BookingButtonProps) => {
const [isBookingSystemOpen, setIsBookingSystemOpen] = useState(false);
// Check if user can access booking system
const canAccessBookingSystem = currentUser && currentUser.emailVerified && !currentUser.is_banned;
const handleOpenBookingSystem = () => {
setIsBookingSystemOpen(true);
};
const handleCloseBookingSystem = () => {
setIsBookingSystemOpen(false);
};
const canAccessBookingSystem = currentUser && currentUser.emailVerified && !currentUser.isBanned;
// Don't render the button if user doesn't have access
if (!canAccessBookingSystem) {
@@ -37,14 +25,14 @@ export const BookingButton = ({ currentUser }: BookingButtonProps) => {
<button
className="btn btn-sm btn-ghost tooltip tooltip-bottom"
data-tip="Slot Buchung"
onClick={handleOpenBookingSystem}
onClick={() => setIsBookingSystemOpen(true)}
>
<CalendarIcon size={20} />
</button>
<BookingSystem
isOpen={isBookingSystemOpen}
onClose={handleCloseBookingSystem}
onClose={() => setIsBookingSystemOpen(false)}
currentUser={currentUser}
/>
</>