diff --git a/admin/app/email/components/index.ts b/admin/app/email/components/index.ts deleted file mode 100644 index f06acf7f2..000000000 --- a/admin/app/email/components/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./email-config-form"; -export * from "./test-email-modal"; diff --git a/admin/app/email/components/email-config-form.tsx b/admin/app/email/email-config-form.tsx similarity index 98% rename from admin/app/email/components/email-config-form.tsx rename to admin/app/email/email-config-form.tsx index eb73e18b9..8a18b481d 100644 --- a/admin/app/email/components/email-config-form.tsx +++ b/admin/app/email/email-config-form.tsx @@ -1,14 +1,15 @@ import React, { FC, useMemo, useState } from "react"; import { useForm } from "react-hook-form"; -// hooks -import { IFormattedInstanceConfiguration, TInstanceEmailConfigurationKeys } from "@plane/types"; -import { Button, CustomSelect, TOAST_TYPE, setToast } from "@plane/ui"; -import { useInstance } from "@/hooks/store"; -// ui -// components -import { ControllerInput, TControllerInputFormField } from "components/common"; -import { SendTestEmailModal } from "./test-email-modal"; // types +import { IFormattedInstanceConfiguration, TInstanceEmailConfigurationKeys } from "@plane/types"; +// ui +import { Button, CustomSelect, TOAST_TYPE, setToast } from "@plane/ui"; +// components +import { ControllerInput, TControllerInputFormField } from "@/components/common"; +// hooks +import { useInstance } from "@/hooks/store"; +// local components +import { SendTestEmailModal } from "./test-email-modal"; type IInstanceEmailForm = { config: IFormattedInstanceConfiguration; diff --git a/admin/app/email/layout.tsx b/admin/app/email/layout.tsx index 5eb8af8ee..626c5d557 100644 --- a/admin/app/email/layout.tsx +++ b/admin/app/email/layout.tsx @@ -3,19 +3,11 @@ import { ReactNode } from "react"; // layouts import { AdminLayout } from "@/layouts/admin-layout"; -// lib -import { AuthWrapper, InstanceWrapper } from "@/lib/wrappers"; interface EmailLayoutProps { children: ReactNode; } -const EmailLayout = ({ children }: EmailLayoutProps) => ( - - - {children} - - -); +const EmailLayout = ({ children }: EmailLayoutProps) => {children}; export default EmailLayout; diff --git a/admin/app/email/page.tsx b/admin/app/email/page.tsx index 51566e5f2..de776b175 100644 --- a/admin/app/email/page.tsx +++ b/admin/app/email/page.tsx @@ -5,9 +5,10 @@ import useSWR from "swr"; import { Loader } from "@plane/ui"; // components import { PageHeader } from "@/components/core"; -import { useInstance } from "@/hooks/store"; -import { InstanceEmailForm } from "./components"; // hooks +import { useInstance } from "@/hooks/store"; +// components +import { InstanceEmailForm } from "./email-config-form"; const InstanceEmailPage = observer(() => { // store diff --git a/admin/app/email/components/test-email-modal.tsx b/admin/app/email/test-email-modal.tsx similarity index 98% rename from admin/app/email/components/test-email-modal.tsx rename to admin/app/email/test-email-modal.tsx index 6e9f6d9d3..0feea4128 100644 --- a/admin/app/email/components/test-email-modal.tsx +++ b/admin/app/email/test-email-modal.tsx @@ -3,7 +3,7 @@ import { Dialog, Transition } from "@headlessui/react"; // ui import { Button, Input } from "@plane/ui"; // services -import { InstanceService } from "services/instance.service"; +import { InstanceService } from "@/services/instance.service"; type Props = { isOpen: boolean; diff --git a/admin/app/setup/layout.tsx b/admin/app/setup/layout.tsx deleted file mode 100644 index 61038f97f..000000000 --- a/admin/app/setup/layout.tsx +++ /dev/null @@ -1,14 +0,0 @@ -"use client"; - -import { ReactNode } from "react"; -// layouts -import { DefaultLayout } from "@/layouts/default-layout"; -interface SetupLayoutProps { - children: ReactNode; - params: any; -} - -export default function SetupLayout(props: SetupLayoutProps) { - const { children } = props; - return {children}; -} diff --git a/admin/app/setup/page.tsx b/admin/app/setup/page.tsx deleted file mode 100644 index 06174f792..000000000 --- a/admin/app/setup/page.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { Metadata } from "next"; -// components -import { InstanceSetupForm } from "@/components/instance"; - -export const metadata: Metadata = { - title: "Setup - God Mode", -}; - -export default function SetupPage() { - return ; -} diff --git a/admin/components/common/index.ts b/admin/components/common/index.ts index 77f0e9327..005711a62 100644 --- a/admin/components/common/index.ts +++ b/admin/components/common/index.ts @@ -5,3 +5,4 @@ export * from "./copy-field"; export * from "./password-strength-meter"; export * from "./banner"; export * from "./empty-state"; +export * from "./logo-spinner"; diff --git a/admin/components/common/logo-spinner.tsx b/admin/components/common/logo-spinner.tsx new file mode 100644 index 000000000..69bb9423d --- /dev/null +++ b/admin/components/common/logo-spinner.tsx @@ -0,0 +1,17 @@ +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 const LogoSpinner = () => { + const { resolvedTheme } = useTheme(); + + const logoSrc = resolvedTheme === "dark" ? LogoSpinnerDark : LogoSpinnerLight; + + return ( +
+ logo +
+ ); +}; diff --git a/admin/layouts/admin-layout.tsx b/admin/layouts/admin-layout.tsx index 041a5b8bf..f7f828954 100644 --- a/admin/layouts/admin-layout.tsx +++ b/admin/layouts/admin-layout.tsx @@ -3,11 +3,10 @@ import { FC, ReactNode, useEffect } from "react"; import { observer } from "mobx-react-lite"; import { useRouter } from "next/navigation"; import useSWR from "swr"; -// ui -import { Spinner } from "@plane/ui"; // components import { InstanceSidebar } from "@/components/admin-sidebar"; import { InstanceHeader } from "@/components/auth-header"; +import { LogoSpinner } from "@/components/common"; import { NewUserPopup } from "@/components/new-user-popup"; // hooks import { useInstance, useUser } from "@/hooks/store"; @@ -39,7 +38,7 @@ export const AdminLayout: FC = observer((props) => { if (isUserLoggedIn === undefined) { return (
- +
); } diff --git a/admin/lib/app-providers.tsx b/admin/lib/app-providers.tsx index 28bfdd08b..64853c62d 100644 --- a/admin/lib/app-providers.tsx +++ b/admin/lib/app-providers.tsx @@ -2,10 +2,10 @@ import { ReactNode, createContext } from "react"; import { ThemeProvider } from "next-themes"; -// ui -import { AppWrapper } from "@/lib/wrappers"; // store import { RootStore } from "@/store/root.store"; +// store initialization +import { AppWrapper } from "./app-wrapper"; let rootStore = new RootStore(); diff --git a/admin/lib/wrappers/app-wrapper.tsx b/admin/lib/app-wrapper.tsx similarity index 100% rename from admin/lib/wrappers/app-wrapper.tsx rename to admin/lib/app-wrapper.tsx diff --git a/admin/lib/wrappers/auth-wrapper.tsx b/admin/lib/wrappers/auth-wrapper.tsx deleted file mode 100644 index c471b3a23..000000000 --- a/admin/lib/wrappers/auth-wrapper.tsx +++ /dev/null @@ -1,59 +0,0 @@ -"use client"; - -import { FC, ReactNode } from "react"; -import { observer } from "mobx-react-lite"; -import { useRouter } from "next/navigation"; -import useSWR from "swr"; -import { Spinner } from "@plane/ui"; -// hooks -import { EAuthenticationPageType } from "@/helpers"; -import { useInstance, useUser } from "@/hooks/store"; -// helpers - -export interface IAuthWrapper { - children: ReactNode; - authType?: EAuthenticationPageType; -} - -export const AuthWrapper: FC = observer((props) => { - const router = useRouter(); - // props - const { children, authType = EAuthenticationPageType.AUTHENTICATED } = props; - // hooks - const { instance } = useInstance(); - const { isLoading, currentUser, fetchCurrentUser } = useUser(); - - const { isLoading: isSWRLoading } = useSWR("CURRENT_USER_DETAILS", () => fetchCurrentUser(), { - shouldRetryOnError: false, - }); - - if (isSWRLoading || isLoading) - return ( -
- -
- ); - - if (authType === EAuthenticationPageType.NOT_AUTHENTICATED) { - if (currentUser === undefined) return <>{children}; - else { - router.push("/general/"); - return <>; - } - } - - if (authType === EAuthenticationPageType.AUTHENTICATED) { - if (currentUser) return <>{children}; - else { - if (instance && instance?.instance?.is_setup_done) { - router.push("/"); - return <>; - } else { - router.push("/setup/"); - return <>; - } - } - } - - return <>{children}; -}); diff --git a/admin/lib/wrappers/index.ts b/admin/lib/wrappers/index.ts deleted file mode 100644 index 81c379624..000000000 --- a/admin/lib/wrappers/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from "./app-wrapper"; -export * from "./instance-wrapper"; -export * from "./auth-wrapper"; diff --git a/admin/lib/wrappers/instance-wrapper.tsx b/admin/lib/wrappers/instance-wrapper.tsx deleted file mode 100644 index bfc5cc289..000000000 --- a/admin/lib/wrappers/instance-wrapper.tsx +++ /dev/null @@ -1,65 +0,0 @@ -"use client"; - -import { FC, ReactNode } from "react"; -import { observer } from "mobx-react-lite"; -import { redirect, useSearchParams } from "next/navigation"; -import useSWR from "swr"; -import { Spinner } from "@plane/ui"; -// components -import { EmptyState } from "@/components/common"; -import { InstanceNotReady } from "@/components/instance"; -// helpers -import { EInstancePageType } from "@/helpers"; -// hooks -import { useInstance } from "@/hooks/store"; -// layouts -import { DefaultLayout } from "@/layouts/default-layout"; - -type TInstanceWrapper = { - children: ReactNode; - pageType?: EInstancePageType; -}; - -export const InstanceWrapper: FC = observer((props) => { - const { children, pageType } = props; - const searchparams = useSearchParams(); - const authEnabled = searchparams.get("auth_enabled") || "1"; - // hooks - const { isLoading, instance, fetchInstanceInfo } = useInstance(); - - const { isLoading: isSWRLoading } = useSWR("INSTANCE_INFORMATION", () => fetchInstanceInfo(), { - revalidateOnFocus: false, - revalidateIfStale: false, - revalidateOnReconnect: false, - errorRetryCount: 0, - }); - - if (isSWRLoading || isLoading) - return ( -
- -
- ); - - if (!instance) { - return ( - - ); - } - - if (instance?.instance?.is_setup_done === false && authEnabled === "1") - return ( - - - - ); - - if (instance?.instance?.is_setup_done && pageType === EInstancePageType.PRE_SETUP) redirect("/"); - - if (!instance?.instance?.is_setup_done && pageType === EInstancePageType.POST_SETUP) redirect("/setup"); - - return <>{children}; -}); diff --git a/admin/public/images/logo-spinner-dark.gif b/admin/public/images/logo-spinner-dark.gif new file mode 100644 index 000000000..4e0a1deb7 Binary files /dev/null and b/admin/public/images/logo-spinner-dark.gif differ diff --git a/admin/public/images/logo-spinner-light.gif b/admin/public/images/logo-spinner-light.gif new file mode 100644 index 000000000..7c9bfbe0e Binary files /dev/null and b/admin/public/images/logo-spinner-light.gif differ