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

View File

@ -4,8 +4,8 @@ import useSWR from "swr";
import { observer } from "mobx-react-lite";
import { Loader } from "@plane/ui";
// components
import { InstanceAIForm } from "components/ai";
import { PageHeader } from "@/components/core";
import { InstanceAIForm } from "./components";
// 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 { Loader, ToggleSwitch, setPromiseToast } from "@plane/ui";
// components
import { AuthenticationMethodCard, InstanceGithubConfigForm } from "components/authentication";
import { PageHeader } from "@/components/core";
import { AuthenticationMethodCard } from "../components";
import { InstanceGithubConfigForm } from "./components";
// hooks
import { useInstance } from "@/hooks";
// helpers

View File

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

View File

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

View File

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

View File

@ -6,7 +6,7 @@ import { useInstance } from "@/hooks";
import { Button, TOAST_TYPE, ToggleSwitch, setToast } from "@plane/ui";
// components
import { ControllerInput, TControllerInputFormField } from "components/common";
import { SendTestEmailModal } from "./send-test-email-modal";
import { SendTestEmailModal } from "./test-email-modal";
// 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";
// layouts
import { AuthLayout } from "@/layouts";
import { AdminLayout } from "@/layouts";
// lib
import { AuthWrapper, InstanceWrapper } from "@/lib/wrappers";
@ -13,7 +13,7 @@ interface EmailLayoutProps {
const EmailLayout = ({ children }: EmailLayoutProps) => (
<InstanceWrapper>
<AuthWrapper>
<AuthLayout>{children}</AuthLayout>
<AdminLayout>{children}</AdminLayout>
</AuthWrapper>
</InstanceWrapper>
);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -5,7 +5,7 @@ import { observer } from "mobx-react-lite";
import { Loader } from "@plane/ui";
// components
import { PageHeader } from "@/components/core";
import { InstanceImageConfigForm } from "components/image";
import { InstanceImageConfigForm } from "./components";
// 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";
// components
import { PageHeader } from "@/components/core";
import { InstanceSignInForm } from "@/components/user-authentication-forms";
import { InstanceSignInForm } from "./components";
const LoginPage = () => (
<>

View File

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

View File

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

View File

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

View File

@ -1,19 +1,15 @@
"use client";
import { Fragment } from "react";
// import { useRouter } from "next/navigation";
import { useTheme as useNextTheme } from "next-themes";
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 { Menu, Transition } from "@headlessui/react";
import { Avatar, TOAST_TYPE, setToast } from "@plane/ui";
// hooks
import { useTheme, useUser } from "@/hooks";
// ui
import { Avatar, TOAST_TYPE, setToast } from "@plane/ui";
// helpers
import { API_BASE_URL } from "@/helpers/common.helper";
export const SidebarDropdown = observer(() => {
// store hooks
@ -97,6 +93,7 @@ export const SidebarDropdown = observer(() => {
</Menu.Item>
</div>
<div className="py-2">
<form method="POST" action={`${API_BASE_URL}/api/instances/admins/sign-out/`}>
<Menu.Item
as="button"
type="button"
@ -106,6 +103,7 @@ export const SidebarDropdown = observer(() => {
<LogOut className="h-4 w-4 stroke-[1.5]" />
Sign out
</Menu.Item>
</form>
</div>
</Menu.Items>
</Transition>

View File

@ -69,7 +69,7 @@ export const SidebarMenu = observer(() => {
isActive
? "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",
isSidebarCollapsed ? "justify-center" : ""
isSidebarCollapsed ? "justify-center" : "w-[260px]"
)}
>
{<item.Icon className="h-4 w-4 flex-shrink-0" />}

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) => {
const {
name,
control,
type,
label,
description,
placeholder,
error,
required,
} = props;
const { name, control, type, label, description, placeholder, error, required } = props;
// states
const [showPassword, setShowPassword] = useState(false);
@ -81,9 +72,7 @@ export const ControllerInput: React.FC<Props> = (props) => {
</button>
))}
</div>
{description && (
<p className="text-xs text-custom-text-400">{description}</p>
)}
{description && <p className="text-xs text-custom-text-400">{description}</p>}
</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 { InstanceHeader } from "@/components/auth-header";
type TAuthLayout = {
type TAdminLayout = {
children: ReactNode;
};
export const AuthLayout: FC<TAuthLayout> = (props) => {
export const AdminLayout: FC<TAdminLayout> = (props) => {
const { children } = props;
return (

View File

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

View File

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

View File

@ -42,14 +42,15 @@ const nextConfig = {
},
{
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)) {
module.exports = withSentryConfig(nextConfig,
module.exports = withSentryConfig(
nextConfig,
{ silent: true, authToken: process.env.SENTRY_AUTH_TOKEN },
{ hideSourceMaps: true }
);