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
|
|
|
{
|
|
|
|
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-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-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-04-20 08:11:24 +00:00
|
|
|
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
|
2023-04-20 08:11:24 +00:00
|
|
|
? "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;
|