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 = {
|
2023-04-08 08:16:46 +00:00
|
|
|
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`,
|
|
|
|
},
|
2023-04-05 19:21:15 +00:00
|
|
|
{
|
2023-05-10 20:45:39 +00:00
|
|
|
label: "Import/Export",
|
2023-04-05 19:21:15 +00:00
|
|
|
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-04-06 09:39:24 +00:00
|
|
|
{
|
|
|
|
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-05-11 13:10:17 +00:00
|
|
|
{
|
|
|
|
label: "Preferences",
|
|
|
|
href: `/${workspaceSlug}/me/profile/preferences`,
|
|
|
|
},
|
2023-03-30 11:34:41 +00:00
|
|
|
];
|
|
|
|
|
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
|
2023-05-17 09:27:58 +00:00
|
|
|
className={`rounded-full border px-5 py-1.5 text-sm outline-none ${
|
2023-05-10 20:45:39 +00:00
|
|
|
(
|
|
|
|
link.label === "Import/Export"
|
|
|
|
? router.asPath.includes(link.href)
|
|
|
|
: router.asPath === link.href
|
|
|
|
)
|
2023-07-10 07:17:00 +00:00
|
|
|
? "border-custom-primary bg-custom-primary text-white"
|
|
|
|
: "border-custom-border-100 bg-custom-background-100 hover:bg-custom-background-90"
|
2023-03-03 07:59:36 +00:00
|
|
|
}`}
|
|
|
|
>
|
|
|
|
{link.label}
|
|
|
|
</div>
|
|
|
|
</a>
|
|
|
|
</Link>
|
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default SettingsNavbar;
|