import type { Metadata } from "next"; import { redirect } from "next/navigation"; import { auth } from "@/auth"; import { TopNav } from "@/components/navigation/top-nav"; import { prisma } from "@/lib/db/prisma"; import { getBranding } from "@/lib/business/branding"; import { CalendarConnectionPanel } from "@/features/calendar/components/calendar-connection-panel"; export const metadata: Metadata = { title: "Google Calendar" }; export const dynamic = "force-dynamic"; export default async function StaffCalendarSettingsPage() { const session = await auth(); if (!session?.user?.id) redirect("/sign-in?callbackUrl=/staff/settings/calendar"); const staffProfile = await prisma.staffProfile.findUnique({ where: { userId: session.user.id } }); if (!staffProfile) redirect("/home"); const [connection, branding] = await Promise.all([ prisma.staffCalendarConnection.findUnique({ where: { staffId: staffProfile.id } }), getBranding(), ]); const connected = !!connection && !connection.revokedAt; const configured = !!process.env.GOOGLE_CALENDAR_CLIENT_ID && !!process.env.GOOGLE_CALENDAR_CLIENT_SECRET; return (
One-way sync: {branding.name} stays the source of truth, and your confirmed appointments are pushed to Google Calendar. Nothing is ever imported back from Google.