plane/apps/app/layouts/settings-navbar.tsx

112 lines
2.7 KiB
TypeScript
Raw Normal View History

2023-03-03 07:59:36 +00:00
import Link from "next/link";
import { useRouter } from "next/router";
2023-03-30 11:34:41 +00:00
type Props = {
profilePage?: boolean;
2023-03-30 11:34:41 +00:00
};
const SettingsNavbar: React.FC<Props> = ({ profilePage = false }) => {
2023-03-03 07:59:36 +00:00
const router = useRouter();
const { workspaceSlug, projectId } = router.query;
const workspaceLinks: Array<{
label: string;
href: string;
}> = [
{
label: "General",
href: `/${workspaceSlug}/settings`,
},
{
label: "Members",
href: `/${workspaceSlug}/settings/members`,
},
{
label: "Billing & Plans",
href: `/${workspaceSlug}/settings/billing`,
},
{
label: "Integrations",
href: `/${workspaceSlug}/settings/integrations`,
},
{
label: "Import/Export",
href: `/${workspaceSlug}/settings/import-export`,
},
2023-03-03 07:59:36 +00:00
];
const projectLinks: Array<{
label: string;
href: string;
}> = [
{
label: "General",
href: `/${workspaceSlug}/projects/${projectId}/settings`,
},
{
label: "Control",
href: `/${workspaceSlug}/projects/${projectId}/settings/control`,
},
{
label: "Members",
href: `/${workspaceSlug}/projects/${projectId}/settings/members`,
},
{
label: "Features",
href: `/${workspaceSlug}/projects/${projectId}/settings/features`,
},
{
label: "States",
href: `/${workspaceSlug}/projects/${projectId}/settings/states`,
},
{
label: "Labels",
href: `/${workspaceSlug}/projects/${projectId}/settings/labels`,
},
{
label: "Integrations",
href: `/${workspaceSlug}/projects/${projectId}/settings/integrations`,
},
{
label: "Estimates",
href: `/${workspaceSlug}/projects/${projectId}/settings/estimates`,
},
2023-03-03 07:59:36 +00:00
];
2023-03-30 11:34:41 +00:00
const profileLinks: Array<{
label: string;
href: string;
}> = [
{
label: "General",
href: `/${workspaceSlug}/me/profile`,
},
{
label: "Activity",
href: `/${workspaceSlug}/me/profile/activity`,
},
];
2023-03-03 07:59:36 +00:00
return (
<div className="flex flex-wrap gap-4">
2023-03-30 11:34:41 +00:00
{(profilePage ? profileLinks : projectId ? projectLinks : workspaceLinks).map((link) => (
2023-03-03 09:00:21 +00:00
<Link key={link.href} href={link.href}>
2023-03-03 07:59:36 +00:00
<a>
<div
className={`rounded-3xl border border-brand-base px-5 py-1.5 text-sm sm:px-7 sm:py-2 sm:text-base ${
2023-03-03 07:59:36 +00:00
router.asPath === link.href
? "border-brand-accent bg-brand-accent text-white"
: "border-brand-base bg-brand-surface-2 hover:bg-brand-surface-1"
2023-03-03 07:59:36 +00:00
}`}
>
{link.label}
</div>
</a>
</Link>
))}
</div>
);
};
export default SettingsNavbar;