54 lines
1.7 KiB
TypeScript
54 lines
1.7 KiB
TypeScript
import Layout from "../components/layout"
|
||
import GoogleDriveFolderPreview from "../components/board/GoogleDriveFolderPreview"
|
||
import AvCalendar from '../components/calendar/avcalendar';
|
||
import { useEffect } from 'react';
|
||
import { getSession } from "next-auth/react";
|
||
|
||
import { useSession, signIn } from "next-auth/react";
|
||
import { serverSideAuth } from '../components/protectedRoute'; // Adjust the path as needed
|
||
|
||
import { useRouter } from 'next/router';
|
||
|
||
export default function IndexPage() {
|
||
|
||
const { data: session, status } = useSession();
|
||
const router = useRouter();
|
||
|
||
useEffect(() => {
|
||
// Redirect to /dash if user is logged in
|
||
if (session) {
|
||
router.push('/dash?newLogin=true');
|
||
}
|
||
}, [session, router]);
|
||
|
||
if (status === "loading") {
|
||
return (
|
||
<div className="flex justify-center items-center h-screen">
|
||
<p className="text-lg font-medium">Loading...</p>
|
||
</div>
|
||
);
|
||
}
|
||
|
||
if (session) {
|
||
return null; // Or a loading indicator until the redirect happens
|
||
}
|
||
|
||
return (
|
||
<Layout>
|
||
<div className="flex items-center justify-center min-h-screen">
|
||
<div className="text-center">
|
||
<h1 className="text-2xl font-bold mb-4">Специално Свидетелстване София</h1>
|
||
<p className="mb-6">
|
||
Моля влезте в профила си.
|
||
</p>
|
||
|
||
{/* If GoogleDriveFolderPreview is a custom component, ensure it accepts and applies className props */}
|
||
<GoogleDriveFolderPreview folderId="1DADj8OUWz2sMEmiW3sDETuihJvFS5x_p" className="w-full max-w-lg">
|
||
{/* Content of the Google Drive Folder Preview */}
|
||
</GoogleDriveFolderPreview>
|
||
</div>
|
||
</div>
|
||
</Layout>
|
||
)
|
||
}
|