feat: Instance Admin Panel: Configuration Settings (#2800)

* feat: Instance Admin Panel: Configuration Settings

* refactor: seprate Google and Github form into independent components.

* feat: add admin auth wrapper and access denied page.

* style: design updates.
This commit is contained in:
Prateek Shourya 2023-11-20 20:46:49 +05:30 committed by sriram veeraghanta
parent 7978c8277c
commit 2a2e504ebb
21 changed files with 1144 additions and 105 deletions

View file

@ -1,6 +1,7 @@
import Link from "next/link";
import { useRouter } from "next/router";
import { BarChart2, Briefcase, CheckCircle, LayoutGrid } from "lucide-react";
// icons
import { BrainCog, Cog, Lock, Mail } from "lucide-react";
// mobx store
import { useMobxStore } from "lib/mobx/store-provider";
// ui
@ -8,24 +9,28 @@ import { Tooltip } from "@plane/ui";
const INSTANCE_ADMIN_LINKS = [
{
Icon: LayoutGrid,
Icon: Cog,
name: "General",
description: "General settings here",
href: `/admin`,
},
{
Icon: BarChart2,
name: "OAuth",
href: `/admin/oauth`,
},
{
Icon: Briefcase,
Icon: Mail,
name: "Email",
description: "Email related settings will go here",
href: `/admin/email`,
},
{
Icon: CheckCircle,
name: "AI",
href: `/admin/ai`,
Icon: Lock,
name: "Authorization",
description: "Autorization",
href: `/admin/authorization`,
},
{
Icon: BrainCog,
name: "OpenAI",
description: "OpenAI configurations",
href: `/admin/openai`,
},
];
@ -37,7 +42,7 @@ export const InstanceAdminSidebarMenu = () => {
const router = useRouter();
return (
<div className="h-full overflow-y-auto w-full cursor-pointer space-y-2 p-4">
<div className="h-full overflow-y-auto w-full cursor-pointer space-y-3 p-4">
{INSTANCE_ADMIN_LINKS.map((item, index) => {
const isActive = item.name === "Settings" ? router.asPath.includes(item.href) : router.asPath === item.href;
@ -46,14 +51,29 @@ export const InstanceAdminSidebarMenu = () => {
<a className="block w-full">
<Tooltip tooltipContent={item.name} position="right" className="ml-2" disabled={!sidebarCollapsed}>
<div
className={`group flex w-full items-center gap-2.5 rounded-md px-3 py-2 text-sm font-medium outline-none ${
className={`group flex w-full items-center gap-3 rounded-md px-3 py-2 outline-none ${
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"
} ${sidebarCollapsed ? "justify-center" : ""}`}
>
{<item.Icon className="h-4 w-4" />}
{!sidebarCollapsed && item.name}
{!sidebarCollapsed && (
<div className="flex flex-col leading-snug">
<span
className={`text-sm font-medium ${
isActive ? "text-custom-primary-100" : "text-custom-sidebar-text-200"
}`}
>
{item.name}
</span>
<span
className={`text-xs ${isActive ? "text-custom-primary-100" : "text-custom-sidebar-text-300"}`}
>
{item.description}
</span>
</div>
)}
</div>
</Tooltip>
</a>