diff --git a/app/dashboard/integrations/page.tsx b/app/dashboard/integrations/page.tsx
deleted file mode 100644
index 8a006a9..0000000
--- a/app/dashboard/integrations/page.tsx
+++ /dev/null
@@ -1,170 +0,0 @@
-import { CheckCircle2, XCircle } from "lucide-react";
-import { redirect } from "next/navigation";
-import { auth } from "@/auth";
-import { Button } from "@/components/ui/button";
-import {
- Card,
- CardContent,
- CardDescription,
- CardHeader,
- CardTitle,
-} from "@/components/ui/card";
-import { prisma } from "@/lib/prisma.server";
-
-export default async function IntegrationsPage() {
- const session = await auth();
-
- if (!session?.user?.id) {
- redirect("/login");
- }
-
- // Check if user has Google account connected
- const googleAccount = await prisma.account.findFirst({
- where: {
- userId: session.user.id,
- provider: "google",
- },
- });
-
- const handleConnect = async () => {
- "use server";
- redirect("/api/auth/signin/google?callbackUrl=/dashboard/integrations");
- };
-
- const handleDisconnect = async () => {
- "use server";
- const session = await auth();
- if (!session?.user?.id) return;
-
- await prisma.account.deleteMany({
- where: {
- userId: session.user.id,
- provider: "google",
- },
- });
-
- redirect("/dashboard/integrations");
- };
-
- return (
-
-
-
Integrations
-
- Connect your accounts to enable calendar sync and meeting links
-
-
-
-
-
-
-
-
-
-
-
- Google Calendar
-
- Sync bookings to your calendar and create Google Meet links
-
-
-
-
- {googleAccount ? (
- <>
-
-
- Connected
-
-
- >
- ) : (
- <>
-
-
- Not connected
-
-
- >
- )}
-
-
-
- {googleAccount && (
-
-
-
- Connected as: {session.user.email}
-
-
- All new bookings will be automatically added to your Google
- Calendar with a Google Meet link.
-
-
-
- )}
-
-
-
-
-
- What can you do with this integration?
-
-
-
-
-
-
- Automatically create calendar events when someone books a meeting
-
-
-
-
-
- Generate Google Meet links for virtual meetings automatically
-
-
-
-
-
- Check your calendar for conflicts before accepting bookings
-
-
-
-
- Send calendar invites to your guests automatically
-
-
-
-
- );
-}
diff --git a/app/dashboard/settings/google-calendar-card.tsx b/app/dashboard/settings/google-calendar-card.tsx
index be70a8b..0ffb409 100644
--- a/app/dashboard/settings/google-calendar-card.tsx
+++ b/app/dashboard/settings/google-calendar-card.tsx
@@ -11,7 +11,13 @@ import {
CardTitle,
} from "@/components/ui/card";
-export function GoogleCalendarCard({ isConnected }: { isConnected: boolean }) {
+export function GoogleCalendarCard({
+ isConnected,
+ disconnectAction,
+}: {
+ isConnected: boolean;
+ disconnectAction: () => Promise;
+}) {
return (
@@ -26,9 +32,16 @@ export function GoogleCalendarCard({ isConnected }: { isConnected: boolean }) {
{isConnected ? (
-
-
-
Connected to Google Calendar
+
+
+
+ Connected to Google Calendar
+
+
) : (
diff --git a/app/dashboard/settings/page.tsx b/app/dashboard/settings/page.tsx
index dc530a9..2d49374 100644
--- a/app/dashboard/settings/page.tsx
+++ b/app/dashboard/settings/page.tsx
@@ -38,6 +38,21 @@ export default async function SettingsPage() {
const googleConnected = await isGoogleCalendarConnected(session.user.id);
+ async function disconnectGoogleCalendar() {
+ "use server";
+ const session = await auth();
+ if (!session?.user?.id) return;
+
+ await prisma.account.deleteMany({
+ where: {
+ userId: session.user.id,
+ provider: "google",
+ },
+ });
+
+ redirect("/dashboard/settings");
+ }
+
async function updateSettings(_prevState: any, formData: FormData) {
"use server";
const session = await auth();
@@ -84,7 +99,10 @@ export default async function SettingsPage() {
{user?.username && }
-
+