2024-05-16 04:03:43 +05:30
|
|
|
"use client";
|
2024-05-17 14:27:49 +05:30
|
|
|
|
2024-06-20 14:08:52 +05:30
|
|
|
import { observer } from "mobx-react";
|
2024-05-14 14:26:54 +05:30
|
|
|
// components
|
2025-08-15 13:12:36 +05:30
|
|
|
import { UserLoggedIn } from "@/components/account/user-logged-in";
|
|
|
|
|
import { LogoSpinner } from "@/components/common/logo-spinner";
|
2024-05-14 14:26:54 +05:30
|
|
|
import { AuthView } from "@/components/views";
|
2024-05-16 04:03:43 +05:30
|
|
|
// hooks
|
2025-08-15 13:12:36 +05:30
|
|
|
import { useUser } from "@/hooks/store/use-user";
|
2024-05-14 14:26:54 +05:30
|
|
|
|
2024-05-23 14:27:16 +05:30
|
|
|
const HomePage = observer(() => {
|
2025-08-06 22:32:52 +05:30
|
|
|
const { data: currentUser, isAuthenticated, isInitializing } = useUser();
|
2024-05-14 14:26:54 +05:30
|
|
|
|
2025-08-06 22:32:52 +05:30
|
|
|
if (isInitializing)
|
2025-08-06 22:24:47 +05:30
|
|
|
return (
|
2025-08-06 22:32:52 +05:30
|
|
|
<div className="flex h-screen min-h-[500px] w-full justify-center items-center">
|
2025-08-06 22:24:47 +05:30
|
|
|
<LogoSpinner />
|
|
|
|
|
</div>
|
|
|
|
|
);
|
2024-05-16 04:03:43 +05:30
|
|
|
|
2024-05-17 14:27:49 +05:30
|
|
|
if (currentUser && isAuthenticated) return <UserLoggedIn />;
|
2024-05-14 14:26:54 +05:30
|
|
|
|
2024-05-15 02:25:38 +05:30
|
|
|
return <AuthView />;
|
2024-05-23 14:27:16 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export default HomePage;
|