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;
|
|
|
|
};
|
|
|
|
|
|
|
|
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`,
|
|
|
|
},
|
2023-03-23 17:57:11 +00:00
|
|
|
{
|
|
|
|
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`,
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
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 px-5 py-1.5 text-sm sm:px-7 sm:py-2 sm:text-base ${
|
|
|
|
router.asPath === link.href
|
|
|
|
? "border-theme bg-theme text-white"
|
|
|
|
: "border-gray-300 bg-white hover:bg-hover-gray"
|
|
|
|
}`}
|
|
|
|
>
|
|
|
|
{link.label}
|
|
|
|
</div>
|
|
|
|
</a>
|
|
|
|
</Link>
|
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default SettingsNavbar;
|