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.

use feature flag in layout

Kiran Kf9fcf817276e
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 affec10b20..ccfd27e080 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,3 +1,4 @@
+import { getFeatureFlags } from "@/lib/edge-config";
import SettingsLayout from "@/ui/layout/settings-layout";
import {
CircleInfo,
@@ -13,11 +14,16 @@ import {
} from "@dub/ui/src/icons";
import { ReactNode } from "react";
-export default function WorkspaceSettingsLayout({
+export default async function WorkspaceSettingsLayout({
children,
+ params,
}: {
children: ReactNode;
+ params: { slug: string };
}) {
+ const { slug } = params;
+ const flags = await getFeatureFlags(slug);
+
const tabs = [
// Workspace Settings
{
@@ -48,11 +54,9 @@ export default function WorkspaceSettingsLayout({
icon: Users6,
segment: "people",
},
- {
- name: "Integrations",
- icon: Dots,
- segment: "integrations",
- },
+ ...(flags?.integrations
+ ? [{ name: "Integrations", icon: Dots, segment: "integrations" }]
+ : []),
{
name: "Security",
icon: ShieldCheck,
@@ -70,11 +74,9 @@ export default function WorkspaceSettingsLayout({
icon: Key,
segment: "tokens",
},
- {
- name: "OAuth Apps",
- icon: Cube,
- segment: "oauth-apps",
- },
+ ...(flags?.integrations
+ ? [{ name: "OAuth Apps", icon: Cube, segment: "oauth-apps" }]
+ : []),
],
},
diff --git a/apps/web/ui/layout/nav-tabs.tsx b/apps/web/ui/layout/nav-tabs.tsx
index bbc990e41a..e54dcdc9dd 100644
--- a/apps/web/ui/layout/nav-tabs.tsx
+++ b/apps/web/ui/layout/nav-tabs.tsx
@@ -24,9 +24,6 @@ export default function NavTabs() {
{ name: "Links", href: `/${slug}` },
{ name: "Analytics", href: `/${slug}/analytics` },
{ name: "Events", href: `/${slug}/events` },
- ...(flags?.integrations
- ? [{ name: "Integrations", href: `/${slug}/integrations` }]
- : []),
{ name: "Settings", href: `/${slug}/settings` },
],
[flags],