The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Refactor integrations page layout and file structure
Kiran Kfddc0bd164fd
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/integrations/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/page-client.tsxsimilarity index 79%rename from apps/web/app/app.dub.co/(dashboard)/[slug]/settings/integrations/page-client.tsxrename to apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/page-client.tsxindex cd45632677..74e5b7db9c 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/integrations/page-client.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/page-client.tsx@@ -9,6 +9,7 @@ import {BlurImage,Button,LoadingSpinner,+ MaxWidthWrapper,Popover,TokenAvatar,} from "@dub/ui";@@ -27,15 +28,18 @@ export default function AuthorizedAppsPageClient() {return (<>- <div className="rounded-lg border border-gray-200 bg-white">- <div className="flex flex-col items-center justify-between gap-4 space-y-3 border-b border-gray-200 p-5 sm:flex-row sm:space-y-0 sm:p-10">- <div className="flex max-w-screen-sm flex-col space-y-3">- <h2 className="text-xl font-medium">Integrations Enabled</h2>- <p className="text-sm text-gray-500">- Applications that have access to your workspace resources.- </p>+ <div className="flex h-36 w-full items-center border-b border-gray-200 bg-white">+ <MaxWidthWrapper>+ <div className="flex items-center justify-between">+ <h1 className="text-2xl font-semibold tracking-tight text-black">+ Integrations+ </h1>+ <div className="flex gap-2"></div></div>- </div>+ </MaxWidthWrapper>+ </div>++ <MaxWidthWrapper className="flex flex-col space-y-3 py-3">{isLoading || !apps ? (<div className="flex flex-col items-center justify-center space-y-4 py-20"><LoadingSpinner className="h-6 w-6 text-gray-500" />@@ -44,15 +48,10 @@ export default function AuthorizedAppsPageClient() {</p></div>) : apps.length > 0 ? (- <div>- <div className="grid grid-cols-5 border-b border-gray-200 px-5 py-2 text-sm font-medium text-gray-500 sm:px-10">- <div className="col-span-3">Name</div>- </div>- <div className="divide-y divide-gray-200">- {apps.map((app) => (- <AppRow key={app.id} {...app} />- ))}- </div>+ <div className="divide-y divide-gray-200">+ {apps.map((app) => (+ <AppRow key={app.id} {...app} />+ ))}</div>) : (<div className="flex flex-col items-center justify-center gap-y-4 py-20">@@ -62,7 +61,7 @@ export default function AuthorizedAppsPageClient() {/></div>)}- </div>+ </MaxWidthWrapper></>);}@@ -81,7 +80,7 @@ const AppRow = (app: OAuthAuthorizedAppProps) => {return (<><DeleteAppModal />- <div className="relative grid grid-cols-5 items-center px-5 py-3 sm:px-10">+ <div className="relative grid grid-cols-5 items-center bg-white px-5 py-3 sm:px-10"><div className="col-span-3 flex items-center space-x-3">{app.logo ? (<BlurImagediff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/integrations/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/page.tsxsimilarity index 100%rename from apps/web/app/app.dub.co/(dashboard)/[slug]/settings/integrations/page.tsxrename to apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/page.tsxdiff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/layout.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/layout.tsxindex 174181a419..6478ee748f 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@@ -40,11 +40,6 @@ export default function WorkspaceSettingsLayout({icon: Key,segment: "tokens",},- {- name: "Integrations",- icon: Gear2,- segment: "integrations",- },{name: "OAuth Apps",icon: Key,diff --git a/apps/web/lib/api/oauth/constants.ts b/apps/web/lib/api/oauth/constants.tsindex fd2412ae8a..632e439b3e 100644--- a/apps/web/lib/api/oauth/constants.ts+++ b/apps/web/lib/api/oauth/constants.ts@@ -4,8 +4,8 @@ export const OAUTH_CONFIG = {REFRESH_TOKEN_LIFETIME: 60 * 24 * 60 * 60, // 60 daysCODE_LIFETIME: 2 * 60, // 2 minutes- CLIENT_ID_LENGTH: 32,- CLIENT_SECRET_LENGTH: 32,+ CLIENT_ID_LENGTH: 24,+ CLIENT_SECRET_LENGTH: 30,ACCESS_TOKEN_LENGTH: 40,REFRESH_TOKEN_LENGTH: 40,CODE_LENGTH: 40,@@ -30,7 +30,7 @@ export const OAUTH_SCOPES = ["analytics.read","domains.read","domains.write",- "user.read",+ "user.read", // default scope, no need to request it];// Scope descriptionsdiff --git a/apps/web/lib/edge-config/get-feature-flags.ts b/apps/web/lib/edge-config/get-feature-flags.tsindex 05de0fcf73..81dcbfe6cd 100644--- a/apps/web/lib/edge-config/get-feature-flags.ts+++ b/apps/web/lib/edge-config/get-feature-flags.ts@@ -24,7 +24,6 @@ export const getFeatureFlags = async (workspaceId: string) => {betaFeatures = await get("betaFeatures");} catch (e) {console.error(`Error getting beta features: ${e}`);- betaFeatures = undefined;}if (betaFeatures) {diff --git a/apps/web/lib/zod/schemas/oauth.ts b/apps/web/lib/zod/schemas/oauth.tsindex 99eb2995b2..3cedc3018c 100644--- a/apps/web/lib/zod/schemas/oauth.ts+++ b/apps/web/lib/zod/schemas/oauth.ts@@ -61,15 +61,18 @@ export const authorizeRequestSchema = z.object({scope: z.string().nullable()- .transform((scope) => [...new Set(scope?.split(/[,\s]/).filter(Boolean))])- .refine(- (scopes) => {- return scopes.every((scope) => OAUTH_SCOPES.includes(scope));- },- {- message: "Invalid scopes",- },- ),+ .transform((scope) => {+ const scopes = [...new Set(scope?.split(/[,\s]/).filter(Boolean))];++ if (!scopes.includes("user.read")) {+ scopes.push("user.read");+ }++ return scopes;+ })+ .refine((scopes) => scopes.every((scope) => OAUTH_SCOPES.includes(scope)), {+ message: "Invalid scopes",+ }),code_challenge: z.string().max(190).optional(),code_challenge_method: z.string()diff --git a/apps/web/ui/layout/nav-tabs.tsx b/apps/web/ui/layout/nav-tabs.tsxindex 96f12acf84..ded8d795e6 100644--- a/apps/web/ui/layout/nav-tabs.tsx+++ b/apps/web/ui/layout/nav-tabs.tsx@@ -26,6 +26,9 @@ export default function NavTabs() {...(flags?.conversions? [{ name: "Events", href: `/${slug}/events` }]: []),+ ...(flags?.integrations+ ? [{ name: "Integrations", href: `/${slug}/integrations` }]+ : []),{ name: "Settings", href: `/${slug}/settings` },],[flags],