feat: display connected calendars on platform calendars page (#14203)
* feat: display connected calendars on platform calendars page * fixup! feat: display connected calendars on platform calendars page
This commit is contained in:
1 parent
59d45afc56
commit
75c3c596c2
4 files changed
+43
-14
No files matched your search
@@ -1,14 +1,41 @@
|
||||
import { Navbar } from "@/components/Navbar";
|
||||
import { Inter } from "next/font/google";
|
||||
|
||||
import { useConnectedCalendars } from "@calcom/atoms";
|
||||
|
||||
const inter = Inter({ subsets: ["latin"] });
|
||||
|
||||
export default function Calendars(props: { calUsername: string; calEmail: string }) {
|
||||
const { isLoading, data: calendars } = useConnectedCalendars();
|
||||
const connectedCalendars = calendars?.connectedCalendars ?? [];
|
||||
const destinationCalendar = calendars?.destinationCalendar ?? {};
|
||||
return (
|
||||
<main className={`flex min-h-screen flex-col ${inter.className}`}>
|
||||
<Navbar username={props.calUsername} />
|
||||
<div>
|
||||
<h1>This is the google calendar page</h1>
|
||||
<div className="p-4">
|
||||
<h1 className="my-4 text-lg font-bold">Your Connected Calendars</h1>
|
||||
{isLoading ? (
|
||||
<div>Loading...</div>
|
||||
) : (
|
||||
Boolean(connectedCalendars?.length) &&
|
||||
connectedCalendars.map((connectedCalendar) => (
|
||||
<div key={connectedCalendar.credentialId}>
|
||||
<h1 className="text-md font-bold">{connectedCalendar.integration.name}</h1>
|
||||
{connectedCalendar.calendars.map((calendar) => (
|
||||
<div key={calendar.id}>
|
||||
<h2>{calendar.name}</h2>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
))
|
||||
)}
|
||||
<hr className="my-4" />
|
||||
{!isLoading && destinationCalendar.id && (
|
||||
<div className="">
|
||||
<h2 className="text-md font-bold">Destination Calendar: {destinationCalendar.name}</h2>
|
||||
<p>{destinationCalendar.integrationTitle}</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user