chore: updated file structure for admin

This commit is contained in:
gurusainath 2024-04-29 13:43:59 +05:30
parent e178bba9c0
commit bd75bf7bb6
53 changed files with 65 additions and 84 deletions

View File

@ -0,0 +1 @@
export * from "./ai-config-form";

View File

@ -2,7 +2,7 @@
import { ReactNode } from "react"; import { ReactNode } from "react";
// layouts // layouts
import { AuthLayout } from "@/layouts"; import { AdminLayout } from "@/layouts";
// lib // lib
import { AuthWrapper, InstanceWrapper } from "@/lib/wrappers"; import { AuthWrapper, InstanceWrapper } from "@/lib/wrappers";
@ -13,7 +13,7 @@ interface AILayoutProps {
const AILayout = ({ children }: AILayoutProps) => ( const AILayout = ({ children }: AILayoutProps) => (
<InstanceWrapper> <InstanceWrapper>
<AuthWrapper> <AuthWrapper>
<AuthLayout>{children}</AuthLayout> <AdminLayout>{children}</AdminLayout>
</AuthWrapper> </AuthWrapper>
</InstanceWrapper> </InstanceWrapper>
); );

View File

@ -4,8 +4,8 @@ import useSWR from "swr";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { Loader } from "@plane/ui"; import { Loader } from "@plane/ui";
// components // components
import { InstanceAIForm } from "components/ai";
import { PageHeader } from "@/components/core"; import { PageHeader } from "@/components/core";
import { InstanceAIForm } from "./components";
// hooks // hooks
import { useInstance } from "@/hooks"; import { useInstance } from "@/hooks";

View File

@ -0,0 +1 @@
export * from "./authentication-method-card";

View File

@ -0,0 +1,3 @@
export * from "./common";
export * from "./email-config-switch";
export * from "./password-config-switch";

View File

@ -7,8 +7,9 @@ import { observer } from "mobx-react-lite";
import useSWR from "swr"; import useSWR from "swr";
import { Loader, ToggleSwitch, setPromiseToast } from "@plane/ui"; import { Loader, ToggleSwitch, setPromiseToast } from "@plane/ui";
// components // components
import { AuthenticationMethodCard, InstanceGithubConfigForm } from "components/authentication";
import { PageHeader } from "@/components/core"; import { PageHeader } from "@/components/core";
import { AuthenticationMethodCard } from "../components";
import { InstanceGithubConfigForm } from "./components";
// hooks // hooks
import { useInstance } from "@/hooks"; import { useInstance } from "@/hooks";
// helpers // helpers

View File

@ -6,8 +6,9 @@ import { observer } from "mobx-react-lite";
import useSWR from "swr"; import useSWR from "swr";
import { Loader, ToggleSwitch, setPromiseToast } from "@plane/ui"; import { Loader, ToggleSwitch, setPromiseToast } from "@plane/ui";
// components // components
import { AuthenticationMethodCard, InstanceGoogleConfigForm } from "components/authentication";
import { PageHeader } from "@/components/core"; import { PageHeader } from "@/components/core";
import { AuthenticationMethodCard } from "../components";
import { InstanceGoogleConfigForm } from "./components";
// hooks // hooks
import { useInstance } from "@/hooks"; import { useInstance } from "@/hooks";
// icons // icons

View File

@ -2,7 +2,7 @@
import { ReactNode } from "react"; import { ReactNode } from "react";
// layouts // layouts
import { AuthLayout } from "@/layouts"; import { AdminLayout } from "@/layouts";
// lib // lib
import { AuthWrapper, InstanceWrapper } from "@/lib/wrappers"; import { AuthWrapper, InstanceWrapper } from "@/lib/wrappers";
@ -13,7 +13,7 @@ interface AuthenticationLayoutProps {
const AuthenticationLayout = ({ children }: AuthenticationLayoutProps) => ( const AuthenticationLayout = ({ children }: AuthenticationLayoutProps) => (
<InstanceWrapper> <InstanceWrapper>
<AuthWrapper> <AuthWrapper>
<AuthLayout>{children}</AuthLayout> <AdminLayout>{children}</AdminLayout>
</AuthWrapper> </AuthWrapper>
</InstanceWrapper> </InstanceWrapper>
); );

View File

@ -9,13 +9,9 @@ import { Mails, KeyRound } from "lucide-react";
import { Loader, setPromiseToast } from "@plane/ui"; import { Loader, setPromiseToast } from "@plane/ui";
import { TInstanceConfigurationKeys } from "@plane/types"; import { TInstanceConfigurationKeys } from "@plane/types";
// components // components
import { import { AuthenticationMethodCard, EmailCodesConfiguration, PasswordLoginConfiguration } from "./components";
AuthenticationMethodCard, import { GoogleConfiguration } from "./google/components";
EmailCodesConfiguration, import { GithubConfiguration } from "./github/components";
PasswordLoginConfiguration,
GoogleConfiguration,
GithubConfiguration,
} from "components/authentication";
import { PageHeader } from "@/components/core"; import { PageHeader } from "@/components/core";
// hooks // hooks
import { useInstance } from "@/hooks"; import { useInstance } from "@/hooks";

View File

@ -6,7 +6,7 @@ import { useInstance } from "@/hooks";
import { Button, TOAST_TYPE, ToggleSwitch, setToast } from "@plane/ui"; import { Button, TOAST_TYPE, ToggleSwitch, setToast } from "@plane/ui";
// components // components
import { ControllerInput, TControllerInputFormField } from "components/common"; import { ControllerInput, TControllerInputFormField } from "components/common";
import { SendTestEmailModal } from "./send-test-email-modal"; import { SendTestEmailModal } from "./test-email-modal";
// types // types
import { IFormattedInstanceConfiguration, TInstanceEmailConfigurationKeys } from "@plane/types"; import { IFormattedInstanceConfiguration, TInstanceEmailConfigurationKeys } from "@plane/types";

View File

@ -0,0 +1,2 @@
export * from "./email-config-form";
export * from "./test-email-modal";

View File

@ -2,7 +2,7 @@
import { ReactNode } from "react"; import { ReactNode } from "react";
// layouts // layouts
import { AuthLayout } from "@/layouts"; import { AdminLayout } from "@/layouts";
// lib // lib
import { AuthWrapper, InstanceWrapper } from "@/lib/wrappers"; import { AuthWrapper, InstanceWrapper } from "@/lib/wrappers";
@ -13,7 +13,7 @@ interface EmailLayoutProps {
const EmailLayout = ({ children }: EmailLayoutProps) => ( const EmailLayout = ({ children }: EmailLayoutProps) => (
<InstanceWrapper> <InstanceWrapper>
<AuthWrapper> <AuthWrapper>
<AuthLayout>{children}</AuthLayout> <AdminLayout>{children}</AdminLayout>
</AuthWrapper> </AuthWrapper>
</InstanceWrapper> </InstanceWrapper>
); );

View File

@ -4,8 +4,8 @@ import useSWR from "swr";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { Loader } from "@plane/ui"; import { Loader } from "@plane/ui";
// components // components
import { InstanceEmailForm } from "components/email";
import { PageHeader } from "@/components/core"; import { PageHeader } from "@/components/core";
import { InstanceEmailForm } from "./components";
// hooks // hooks
import { useInstance } from "@/hooks"; import { useInstance } from "@/hooks";

View File

@ -8,12 +8,12 @@ import { ControllerInput } from "components/common";
// hooks // hooks
import { useInstance } from "@/hooks"; import { useInstance } from "@/hooks";
export interface IInstanceGeneralForm { export interface IGeneralConfigurationForm {
instance: IInstance["instance"]; instance: IInstance["instance"];
instanceAdmins: IInstanceAdmin[]; instanceAdmins: IInstanceAdmin[];
} }
export const InstanceGeneralForm: FC<IInstanceGeneralForm> = (props) => { export const GeneralConfigurationForm: FC<IGeneralConfigurationForm> = (props) => {
const { instance, instanceAdmins } = props; const { instance, instanceAdmins } = props;
// hooks // hooks
const { updateInstanceInfo } = useInstance(); const { updateInstanceInfo } = useInstance();

View File

@ -0,0 +1 @@
export * from "./general-config-form";

View File

@ -2,7 +2,7 @@
import { ReactNode } from "react"; import { ReactNode } from "react";
// layouts // layouts
import { AuthLayout } from "@/layouts"; import { AdminLayout } from "@/layouts";
// lib // lib
import { AuthWrapper, InstanceWrapper } from "@/lib/wrappers"; import { AuthWrapper, InstanceWrapper } from "@/lib/wrappers";
@ -13,7 +13,7 @@ interface GeneralLayoutProps {
const GeneralLayout = ({ children }: GeneralLayoutProps) => ( const GeneralLayout = ({ children }: GeneralLayoutProps) => (
<InstanceWrapper> <InstanceWrapper>
<AuthWrapper> <AuthWrapper>
<AuthLayout>{children}</AuthLayout> <AdminLayout>{children}</AdminLayout>
</AuthWrapper> </AuthWrapper>
</InstanceWrapper> </InstanceWrapper>
); );

View File

@ -3,7 +3,7 @@
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
// components // components
import { PageHeader } from "@/components/core"; import { PageHeader } from "@/components/core";
import { InstanceGeneralForm } from "@/components/general"; import { GeneralConfigurationForm } from "./components";
// hooks // hooks
import { useInstance } from "@/hooks"; import { useInstance } from "@/hooks";
@ -23,7 +23,7 @@ const GeneralPage = observer(() => {
</div> </div>
<div className="flex-grow overflow-hidden overflow-y-auto"> <div className="flex-grow overflow-hidden overflow-y-auto">
{instance?.instance && instanceAdmins && instanceAdmins?.length > 0 && ( {instance?.instance && instanceAdmins && instanceAdmins?.length > 0 && (
<InstanceGeneralForm instance={instance?.instance} instanceAdmins={instanceAdmins} /> <GeneralConfigurationForm instance={instance?.instance} instanceAdmins={instanceAdmins} />
)} )}
</div> </div>
</div> </div>

View File

@ -2,7 +2,7 @@
import { ReactNode } from "react"; import { ReactNode } from "react";
// layouts // layouts
import { AuthLayout } from "@/layouts"; import { AdminLayout } from "@/layouts";
// lib // lib
import { AuthWrapper, InstanceWrapper } from "@/lib/wrappers"; import { AuthWrapper, InstanceWrapper } from "@/lib/wrappers";
@ -13,7 +13,7 @@ interface ImageLayoutProps {
const ImageLayout = ({ children }: ImageLayoutProps) => ( const ImageLayout = ({ children }: ImageLayoutProps) => (
<InstanceWrapper> <InstanceWrapper>
<AuthWrapper> <AuthWrapper>
<AuthLayout>{children}</AuthLayout> <AdminLayout>{children}</AdminLayout>
</AuthWrapper> </AuthWrapper>
</InstanceWrapper> </InstanceWrapper>
); );

View File

@ -5,7 +5,7 @@ import { observer } from "mobx-react-lite";
import { Loader } from "@plane/ui"; import { Loader } from "@plane/ui";
// components // components
import { PageHeader } from "@/components/core"; import { PageHeader } from "@/components/core";
import { InstanceImageConfigForm } from "components/image"; import { InstanceImageConfigForm } from "./components";
// hooks // hooks
import { useInstance } from "@/hooks"; import { useInstance } from "@/hooks";

View File

@ -0,0 +1 @@
export * from "./sign-in-form";

View File

@ -4,7 +4,7 @@
import { DefaultLayout } from "@/layouts"; import { DefaultLayout } from "@/layouts";
// components // components
import { PageHeader } from "@/components/core"; import { PageHeader } from "@/components/core";
import { InstanceSignInForm } from "@/components/user-authentication-forms"; import { InstanceSignInForm } from "./components";
const LoginPage = () => ( const LoginPage = () => (
<> <>

View File

@ -0,0 +1 @@
export * from "./sign-up-form";

View File

@ -2,7 +2,7 @@
import { DefaultLayout } from "@/layouts"; import { DefaultLayout } from "@/layouts";
// components // components
import { PageHeader } from "@/components/core"; import { PageHeader } from "@/components/core";
import { InstanceSignUpForm } from "@/components/user-authentication-forms"; import { InstanceSignUpForm } from "./components";
const SetupPage = () => ( const SetupPage = () => (
<> <>

View File

@ -1 +0,0 @@
export * from "./ai-config-form";

View File

@ -1,19 +1,15 @@
"use client"; "use client";
import { Fragment } from "react"; import { Fragment } from "react";
// import { useRouter } from "next/navigation";
import { useTheme as useNextTheme } from "next-themes"; import { useTheme as useNextTheme } from "next-themes";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
// import { mutate } from "swr";
// components
import { Menu, Transition } from "@headlessui/react";
// icons
import { LogOut, UserCog2, Palette } from "lucide-react"; import { LogOut, UserCog2, Palette } from "lucide-react";
import { Menu, Transition } from "@headlessui/react";
import { Avatar, TOAST_TYPE, setToast } from "@plane/ui";
// hooks // hooks
import { useTheme, useUser } from "@/hooks"; import { useTheme, useUser } from "@/hooks";
// helpers
// ui import { API_BASE_URL } from "@/helpers/common.helper";
import { Avatar, TOAST_TYPE, setToast } from "@plane/ui";
export const SidebarDropdown = observer(() => { export const SidebarDropdown = observer(() => {
// store hooks // store hooks
@ -97,15 +93,17 @@ export const SidebarDropdown = observer(() => {
</Menu.Item> </Menu.Item>
</div> </div>
<div className="py-2"> <div className="py-2">
<Menu.Item <form method="POST" action={`${API_BASE_URL}/api/instances/admins/sign-out/`}>
as="button" <Menu.Item
type="button" as="button"
className="flex w-full items-center gap-2 rounded px-2 py-1 hover:bg-custom-sidebar-background-80" type="button"
onClick={handleSignOut} className="flex w-full items-center gap-2 rounded px-2 py-1 hover:bg-custom-sidebar-background-80"
> onClick={handleSignOut}
<LogOut className="h-4 w-4 stroke-[1.5]" /> >
Sign out <LogOut className="h-4 w-4 stroke-[1.5]" />
</Menu.Item> Sign out
</Menu.Item>
</form>
</div> </div>
</Menu.Items> </Menu.Items>
</Transition> </Transition>

View File

@ -69,12 +69,12 @@ export const SidebarMenu = observer(() => {
isActive isActive
? "bg-custom-primary-100/10 text-custom-primary-100" ? "bg-custom-primary-100/10 text-custom-primary-100"
: "text-custom-sidebar-text-200 hover:bg-custom-sidebar-background-80 focus:bg-custom-sidebar-background-80", : "text-custom-sidebar-text-200 hover:bg-custom-sidebar-background-80 focus:bg-custom-sidebar-background-80",
isSidebarCollapsed ? "justify-center" : "" isSidebarCollapsed ? "justify-center" : "w-[260px]"
)} )}
> >
{<item.Icon className="h-4 w-4 flex-shrink-0" />} {<item.Icon className="h-4 w-4 flex-shrink-0" />}
{!isSidebarCollapsed && ( {!isSidebarCollapsed && (
<div className="w-full"> <div className="w-full ">
<div <div
className={cn( className={cn(
`text-sm font-medium transition-colors`, `text-sm font-medium transition-colors`,

View File

@ -1 +0,0 @@
export * from "./root";

View File

@ -1,5 +0,0 @@
export * from "./authentication-method-card";
export * from "./email-codes";
export * from "./password";
export * from "./google";
export * from "./github";

View File

@ -1 +0,0 @@
export * from "./root";

View File

@ -29,16 +29,7 @@ export type TControllerInputFormField = {
}; };
export const ControllerInput: React.FC<Props> = (props) => { export const ControllerInput: React.FC<Props> = (props) => {
const { const { name, control, type, label, description, placeholder, error, required } = props;
name,
control,
type,
label,
description,
placeholder,
error,
required,
} = props;
// states // states
const [showPassword, setShowPassword] = useState(false); const [showPassword, setShowPassword] = useState(false);
@ -81,9 +72,7 @@ export const ControllerInput: React.FC<Props> = (props) => {
</button> </button>
))} ))}
</div> </div>
{description && ( {description && <p className="text-xs text-custom-text-400">{description}</p>}
<p className="text-xs text-custom-text-400">{description}</p>
)}
</div> </div>
); );
}; };

View File

@ -1,2 +0,0 @@
export * from "./email-config-form";
export * from "./send-test-email-modal";

View File

@ -1 +0,0 @@
export * from "./general-form";

View File

@ -1,2 +0,0 @@
export * from "./sign-up";
export * from "./sign-in";

View File

@ -2,11 +2,11 @@ import { FC, ReactNode } from "react";
import { InstanceSidebar } from "@/components/auth-sidebar"; import { InstanceSidebar } from "@/components/auth-sidebar";
import { InstanceHeader } from "@/components/auth-header"; import { InstanceHeader } from "@/components/auth-header";
type TAuthLayout = { type TAdminLayout = {
children: ReactNode; children: ReactNode;
}; };
export const AuthLayout: FC<TAuthLayout> = (props) => { export const AdminLayout: FC<TAdminLayout> = (props) => {
const { children } = props; const { children } = props;
return ( return (

View File

@ -2,7 +2,6 @@
import { FC, ReactNode } from "react"; import { FC, ReactNode } from "react";
import Image from "next/image"; import Image from "next/image";
import Link from "next/link";
import { usePathname } from "next/navigation"; import { usePathname } from "next/navigation";
// logo // logo
import BluePlaneLogoWithoutText from "public/plane-logos/blue-without-text.png"; import BluePlaneLogoWithoutText from "public/plane-logos/blue-without-text.png";

View File

@ -1,2 +1,2 @@
export * from "./default-layout"; export * from "./default-layout";
export * from "./auth-layout"; export * from "./admin-layout";

1
web/next-env.d.ts vendored
View File

@ -1,6 +1,5 @@
/// <reference types="next" /> /// <reference types="next" />
/// <reference types="next/image-types/global" /> /// <reference types="next/image-types/global" />
/// <reference types="next/navigation-types/compat/navigation" />
// NOTE: This file should not be edited // NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information. // see https://nextjs.org/docs/basic-features/typescript for more information.

View File

@ -42,14 +42,15 @@ const nextConfig = {
}, },
{ {
source: "/god-mode/:path*", source: "/god-mode/:path*",
destination: (process.env.GOD_MODE_URL || "") + "/:path*", destination: (process.env.NEXT_PUBLIC_GOD_MODE || "") + "/:path*",
} },
] ];
} },
}; };
if (parseInt(process.env.NEXT_PUBLIC_ENABLE_SENTRY || "0", 10)) { if (parseInt(process.env.NEXT_PUBLIC_ENABLE_SENTRY || "0", 10)) {
module.exports = withSentryConfig(nextConfig, module.exports = withSentryConfig(
nextConfig,
{ silent: true, authToken: process.env.SENTRY_AUTH_TOKEN }, { silent: true, authToken: process.env.SENTRY_AUTH_TOKEN },
{ hideSourceMaps: true } { hideSourceMaps: true }
); );