Skip to content

armgit / plane

Public Imported from GitHub
0

πŸ”₯πŸ”₯πŸ”₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.

[WEB-1404] chore: space app infinite loader and scroll fix. (#4559)

Prateek Shourya780caf59a0d1
diff --git a/space/app/loading.tsx b/space/app/loading.tsx
deleted file mode 100644
index d35e42a767..0000000000
--- a/space/app/loading.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-"use client";
-import Image from "next/image";
-import { useTheme } from "next-themes";
-// assets
-import LogoSpinnerDark from "@/public/images/logo-spinner-dark.gif";
-import LogoSpinnerLight from "@/public/images/logo-spinner-light.gif";
-
-export default function LogoSpinner() {
- const { resolvedTheme } = useTheme();
-
- const logoSrc = resolvedTheme === "dark" ? LogoSpinnerDark : LogoSpinnerLight;
-
- return (
- <div className="h-screen w-full flex min-h-[600px] justify-center items-center">
- <div className="flex items-center justify-center">
- <Image src={logoSrc} alt="logo" className="w-[82px] h-[82px] mr-2" />
- </div>
- </div>
- );
-}
diff --git a/space/app/page.tsx b/space/app/page.tsx
index d03300a254..a6058fb8a3 100644
--- a/space/app/page.tsx
+++ b/space/app/page.tsx
@@ -1,5 +1,6 @@
"use client";
+import { observer } from "mobx-react-lite";
// components
import { UserLoggedIn } from "@/components/account";
import { LogoSpinner } from "@/components/common";
@@ -7,7 +8,7 @@ import { AuthView } from "@/components/views";
// hooks
import { useUser } from "@/hooks/store";
-export default function HomePage() {
+const HomePage = observer(() => {
const { data: currentUser, isAuthenticated, isLoading } = useUser();
if (isLoading) return <LogoSpinner />;
@@ -15,4 +16,6 @@ export default function HomePage() {
if (currentUser && isAuthenticated) return <UserLoggedIn />;
return <AuthView />;
-}
+});
+
+export default HomePage;
diff --git a/space/components/views/auth.tsx b/space/components/views/auth.tsx
index 88023dbef3..5992ca5a5d 100644
--- a/space/components/views/auth.tsx
+++ b/space/components/views/auth.tsx
@@ -37,7 +37,7 @@ export const AuthView = observer(() => {
</Link>
</div>
</div>
- <div className="flex-grow container mx-auto max-w-lg px-10 lg:max-w-md lg:px-5 py-10 lg:pt-28 transition-all">
+ <div className="flex flex-col justify-center flex-grow container h-[100vh-60px] mx-auto max-w-lg px-10 lg:max-w-md lg:px-5 transition-all">
<AuthRoot />
</div>
</div>
diff --git a/space/helpers/authentication.helper.tsx b/space/helpers/authentication.helper.tsx
index e2be3c6177..0e5ab01861 100644
--- a/space/helpers/authentication.helper.tsx
+++ b/space/helpers/authentication.helper.tsx
@@ -1,5 +1,7 @@
import { ReactNode } from "react";
import Link from "next/link";
+// helpers
+import { SUPPORT_EMAIL } from "./common.helper";
export enum EPageTypes {
INIT = "INIT",
@@ -152,7 +154,7 @@ const errorCodeMessages: {
// sign in
[EAuthenticationErrorCodes.USER_ACCOUNT_DEACTIVATED]: {
title: `User account deactivated`,
- message: () => <div>Your account is deactivated. Contact [email protected].</div>,
+ message: () => `User account deactivated. Please contact ${!!SUPPORT_EMAIL ? SUPPORT_EMAIL : "administrator"}.`,
},
[EAuthenticationErrorCodes.USER_DOES_NOT_EXIST]: {
diff --git a/space/helpers/common.helper.ts b/space/helpers/common.helper.ts
index 52c61e4e20..6db73a4a10 100644
--- a/space/helpers/common.helper.ts
+++ b/space/helpers/common.helper.ts
@@ -8,6 +8,8 @@ export const ADMIN_BASE_PATH = process.env.NEXT_PUBLIC_ADMIN_BASE_PATH || "";
export const SPACE_BASE_PATH = process.env.NEXT_PUBLIC_SPACE_BASE_PATH || "";
+export const SUPPORT_EMAIL = process.env.NEXT_PUBLIC_SUPPORT_EMAIL || "";
+
export const WEB_BASE_URL = process.env.NEXT_PUBLIC_WEB_BASE_URL || "";
export const GOD_MODE_URL = encodeURI(`${ADMIN_BASE_URL}${ADMIN_BASE_PATH}`);
diff --git a/space/lib/instance-provider.tsx b/space/lib/instance-provider.tsx
index a4de61a161..db9b15db7a 100644
--- a/space/lib/instance-provider.tsx
+++ b/space/lib/instance-provider.tsx
@@ -31,7 +31,11 @@ export const InstanceProvider = observer(({ children }: { children: ReactNode })
revalidateIfStale: false,
errorRetryCount: 0,
});
- useSWR("CURRENT_USER", () => fetchCurrentUser());
+ useSWR("CURRENT_USER", () => fetchCurrentUser(), {
+ shouldRetryOnError: false,
+ revalidateOnFocus: false,
+ revalidateIfStale: false,
+ });
if (!instance && !error)
return (