diff --git a/pages/index.tsx b/pages/index.tsx
index c50b3e04..90dad238 100644
--- a/pages/index.tsx
+++ b/pages/index.tsx
@@ -1,65 +1,104 @@
-import Head from 'next/head'
-import Shell from '../components/Shell'
-import { signIn, useSession } from 'next-auth/client'
+import Head from 'next/head';
+import Link from 'next/link';
+import prisma from '../lib/prisma';
+import Shell from '../components/Shell';
+import { signIn, useSession, getSession } from 'next-auth/client';
-export default function Home() {
+export default function Home(props) {
const [ session, loading ] = useSession();
- if (session) {
- return (
-
-
-
Calendso
-
-
-
-
-
-
-
- );
+ if (loading) {
+ return Loading...
;
} else {
- return (
-
-
-
Calendso
-
-
+ if (!session) {
+ window.location.href = "/auth/login";
+ }
+ }
-
-
-
-
-
-
-
-
-
- Sign into your account
-
-
-
- Sign into your account to manage your bookings and other settings.
-
-
-
+ return(
+
+
+
Calendso
+
+
+
+
+
+
+
+
+
+ Welcome to Calendso!
+
+
+
+ Get started by connecting your first calendar integration, enabling us to fetch your availability. Head over to the integrations page, and click the add link.
+
-
-
signIn()} type="button" className="inline-flex justify-center w-full rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:text-sm">
- Login to your account
-
+
-
-
- )
- }
+
+
+
+
+ Your integrations
+
+
+
+
+ {props.credentials.map((integration) =>
+
+ {integration.type == 'google_calendar' && }
+
+ {integration.type == 'google_calendar' &&
Google Calendar
}
+ {integration.type == 'google_calendar' &&
Calendar Integration
}
+
+
+ )}
+
+
+
+
+
+
+ );
}
+
+export async function getServerSideProps(context) {
+ const session = await getSession(context);
+
+ let credentials = [];
+
+ if (session) {
+ const user = await prisma.user.findFirst({
+ where: {
+ email: session.user.email,
+ },
+ select: {
+ id: true
+ }
+ });
+
+ credentials = await prisma.credential.findMany({
+ where: {
+ userId: user.id,
+ },
+ select: {
+ type: true
+ }
+ });
+ }
+ return {
+ props: {credentials}, // will be passed to the page component as props
+ }
+}
\ No newline at end of file