This commit is contained in:
ben
2026-08-20 12:23:30 +02:00
parent e61750f314
commit a980812137
9 changed files with 351 additions and 106 deletions
+15 -1
View File
@@ -12,6 +12,7 @@ import { CreateEventDialog } from "@/components/create-event-dialog"
import { EventDetailDialog } from "@/components/event-detail-dialog"
import { CreateRoomDialog, JoinRoomDialog } from "@/components/room-dialogs"
import { RoomSettingsDialog } from "@/components/room-settings-dialog"
import { AccountSettingsDialog } from "@/components/account-settings-dialog"
import { RoomBackground } from "@/components/room-background"
import { getRoomBackground } from "@/lib/room-theme"
import { addDays, startOfWeek, toDateParam, formatMonthYear } from "@/lib/date-utils"
@@ -20,10 +21,12 @@ import type { CalendarEvent, User } from "@/lib/types"
type DialogState =
| { type: "none" }
| { type: "create-event" }
| { type: "edit-event"; event: CalendarEvent }
| { type: "event-detail"; event: CalendarEvent }
| { type: "create-room" }
| { type: "join-room" }
| { type: "room-settings" }
| { type: "account-settings" }
export default function Home() {
const { user, loading, logout } = useAuth()
@@ -105,6 +108,7 @@ function CalendarApp({ user, onLogout }: { user: User; onLogout: () => void }) {
onJoinRoom={() => setDialog({ type: "join-room" })}
user={user}
onLogout={onLogout}
onOpenAccountSettings={() => setDialog({ type: "account-settings" })}
/>
</div>
@@ -162,11 +166,12 @@ function CalendarApp({ user, onLogout }: { user: User; onLogout: () => void }) {
</main>
</div>
{dialog.type === "create-event" && (
{(dialog.type === "create-event" || dialog.type === "edit-event") && (
<CreateEventDialog
rooms={rooms}
defaultRoomId={activeRoomId}
defaultDate={selectedDate}
editingEvent={dialog.type === "edit-event" ? dialog.event : undefined}
onClose={() => setDialog({ type: "none" })}
onCreated={() => {
setDialog({ type: "none" })
@@ -182,6 +187,7 @@ function CalendarApp({ user, onLogout }: { user: User; onLogout: () => void }) {
currentUserId={user.id}
onClose={() => setDialog({ type: "none" })}
onChanged={refreshAll}
onEdit={() => setDialog({ type: "edit-event", event: dialog.event })}
/>
)}
@@ -220,6 +226,14 @@ function CalendarApp({ user, onLogout }: { user: User; onLogout: () => void }) {
}}
/>
)}
{dialog.type === "account-settings" && (
<AccountSettingsDialog
user={user}
onClose={() => setDialog({ type: "none" })}
onLogout={onLogout}
/>
)}
</div>
)
}