Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

update tabs

Kiran K15a23ce47fec
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/layout.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/layout.tsx
index 3e23f2d15a..affec10b20 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/layout.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/layout.tsx
@@ -1,6 +1,8 @@
import SettingsLayout from "@/ui/layout/settings-layout";
import {
CircleInfo,
+ Cube,
+ Dots,
Gear2,
Globe,
Key,
@@ -17,57 +19,80 @@ export default function WorkspaceSettingsLayout({
children: ReactNode;
}) {
const tabs = [
+ // Workspace Settings
{
- name: "General",
- icon: Gear2,
- segment: null,
- },
- {
- name: "Domains",
- icon: Globe,
- segment: "domains",
- },
- {
- name: "Tags",
- icon: Tag,
- segment: "tags",
- },
- {
- name: "Billing",
- icon: Receipt2,
- segment: "billing",
- },
- {
- name: "People",
- icon: Users6,
- segment: "people",
- },
- {
- name: "API Keys",
- icon: Key,
- segment: "tokens",
+ group: "Workspace Settings",
+ tabs: [
+ {
+ name: "General",
+ icon: Gear2,
+ segment: null,
+ },
+ {
+ name: "Domains",
+ icon: Globe,
+ segment: "domains",
+ },
+ {
+ name: "Tags",
+ icon: Tag,
+ segment: "tags",
+ },
+ {
+ name: "Billing",
+ icon: Receipt2,
+ segment: "billing",
+ },
+ {
+ name: "People",
+ icon: Users6,
+ segment: "people",
+ },
+ {
+ name: "Integrations",
+ icon: Dots,
+ segment: "integrations",
+ },
+ {
+ name: "Security",
+ icon: ShieldCheck,
+ segment: "security",
+ },
+ ],
},
+
+ // Developer Settings
{
- name: "Security",
- icon: ShieldCheck,
- segment: "security",
+ group: "Developer Settings",
+ tabs: [
+ {
+ name: "API Keys",
+ icon: Key,
+ segment: "tokens",
+ },
+ {
+ name: "OAuth Apps",
+ icon: Cube,
+ segment: "oauth-apps",
+ },
+ ],
},
- ];
- const extraTabs = [
+ // Account Settings
{
- name: "Notifications",
- icon: CircleInfo,
- segment: "notifications",
+ group: "Account Settings",
+ tabs: [
+ {
+ name: "Notifications",
+ icon: CircleInfo,
+ segment: "notifications",
+ },
+ ],
},
];
return (
- <SettingsLayout
- tabs={tabs}
- extraTabs={extraTabs}
- tabContainerClassName="top-16"
- >
+ <SettingsLayout tabs={tabs} tabContainerClassName="top-16">
{children}
</SettingsLayout>
);
diff --git a/apps/web/app/app.dub.co/(dashboard)/account/settings/layout.tsx b/apps/web/app/app.dub.co/(dashboard)/account/settings/layout.tsx
index 20f940f9d8..8b23f97f71 100644
--- a/apps/web/app/app.dub.co/(dashboard)/account/settings/layout.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/account/settings/layout.tsx
@@ -9,19 +9,24 @@ export default function PersonalSettingsLayout({
}) {
const tabs = [
{
- name: "General",
- icon: Gear2,
- segment: null,
- },
- {
- name: "Security",
- icon: ShieldCheck,
- segment: "security",
- },
- {
- name: "API Keys",
- icon: Key,
- segment: "tokens",
+ group: "",
+ tabs: [
+ {
+ name: "General",
+ icon: Gear2,
+ segment: null,
+ },
+ {
+ name: "Security",
+ icon: ShieldCheck,
+ segment: "security",
+ },
+ {
+ name: "API Keys",
+ icon: Key,
+ segment: "tokens",
+ },
+ ],
},
];
diff --git a/apps/web/ui/layout/settings-layout.tsx b/apps/web/ui/layout/settings-layout.tsx
index b97e6be7d0..396e833b93 100644
--- a/apps/web/ui/layout/settings-layout.tsx
+++ b/apps/web/ui/layout/settings-layout.tsx
@@ -1,50 +1,50 @@
-import NavLink from "@/ui/layout/settings-nav-link";
import { Icon, MaxWidthWrapper } from "@dub/ui";
import { cn } from "@dub/utils";
import { ReactNode } from "react";
+import NavLink from "./settings-nav-link";
-interface TabProps {
+interface Tab {
name: string;
icon: Icon;
segment: string | null;
}
-[];
+
+interface SettingsLayoutProps {
+ tabs: {
+ group: string;
+ tabs: Tab[];
+ }[];
+ tabContainerClassName?: string;
+ children: ReactNode;
+}
export default function SettingsLayout({
tabs,
- extraTabs,
tabContainerClassName,
children,
-}: {
- tabs: TabProps[];
- extraTabs?: TabProps[];
- tabContainerClassName?: string;
- children: ReactNode;
-}) {
+}: SettingsLayoutProps) {
return (
<div className="relative min-h-[calc(100vh-16px)] bg-white">
<MaxWidthWrapper className="grid items-start gap-8 py-10 lg:grid-cols-5">
<div
className={cn(
- "flex flex-wrap gap-1 lg:sticky lg:grid",
+ "flex flex-wrap gap-4 lg:sticky lg:grid",
tabContainerClassName,
)}
>
- {tabs.map(({ name, segment, icon }) => (
- <NavLink segment={segment} icon={icon}>
- {name}
- </NavLink>
- ))}
- {extraTabs && (
- <>
- <div className="my-4 border-t border-gray-200" />
- {extraTabs.map(({ name, segment, icon }) => (
+ {tabs.map(({ group, tabs }) => (
+ <div className="flex flex-col">
+ {group && (
+ <span className="pb-2 text-sm text-gray-500">{group}</span>
+ )}
+
+ {tabs.map(({ name, icon, segment }) => (
<NavLink segment={segment} icon={icon}>
{name}
</NavLink>
))}
- </>
- )}
+ </div>
+ ))}
</div>
<div className="grid gap-5 lg:col-span-4">{children}</div>
</MaxWidthWrapper>