The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
update more settings pages to use new layout
Steven Tey06f1a62f9dcf
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/oauth-apps/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/oauth-apps/page.tsxdeleted file mode 100644index 7353b17202..0000000000--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/oauth-apps/page.tsx+++ /dev/null@@ -1,5 +0,0 @@-import OAuthAppsPageClient from "./page-client";--export default async function OAuthAppsPage() {- return <OAuthAppsPageClient />;-}diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/tokens/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/tokens/page.tsxdeleted file mode 100644index 1ac838426c..0000000000--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/tokens/page.tsx+++ /dev/null@@ -1,5 +0,0 @@-import TokensPageClient from "./page-client";--export default function TokensPage() {- return <TokensPageClient />;-}diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/oauth-apps/[appId]/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/oauth-apps/[appId]/page-client.tsxsimilarity index 100%rename from apps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/oauth-apps/[appId]/page-client.tsxrename to apps/web/app/app.dub.co/(dashboard)/[slug]/settings/oauth-apps/[appId]/page-client.tsxdiff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/oauth-apps/[appId]/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/oauth-apps/[appId]/page.tsxsimilarity index 100%rename from apps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/oauth-apps/[appId]/page.tsxrename to apps/web/app/app.dub.co/(dashboard)/[slug]/settings/oauth-apps/[appId]/page.tsxdiff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/oauth-apps/new/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/oauth-apps/new/page-client.tsxsimilarity index 100%rename from apps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/oauth-apps/new/page-client.tsxrename to apps/web/app/app.dub.co/(dashboard)/[slug]/settings/oauth-apps/new/page-client.tsxdiff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/oauth-apps/new/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/oauth-apps/new/page.tsxsimilarity index 100%rename from apps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/oauth-apps/new/page.tsxrename to apps/web/app/app.dub.co/(dashboard)/[slug]/settings/oauth-apps/new/page.tsxdiff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/oauth-apps/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/oauth-apps/page-client.tsxsimilarity index 61%rename from apps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/oauth-apps/page-client.tsxrename to apps/web/app/app.dub.co/(dashboard)/[slug]/settings/oauth-apps/page-client.tsxindex 9ac8552ebd..175e34b24c 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/oauth-apps/page-client.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/oauth-apps/page-client.tsx@@ -6,7 +6,7 @@ import { OAuthAppProps } from "@/lib/types";import OAuthAppCard from "@/ui/oauth-apps/oauth-app-card";import OAuthAppPlaceholder from "@/ui/oauth-apps/oauth-app-placeholder";import EmptyState from "@/ui/shared/empty-state";-import { Button, Cube, InfoTooltip, TooltipContent } from "@dub/ui";+import { Cube } from "@dub/ui";import { fetcher } from "@dub/utils";import { useRouter } from "next/navigation";import useSWR from "swr";@@ -27,32 +27,6 @@ export default function OAuthAppsPageClient() {return (<div className="grid gap-5">- <div className="flex flex-wrap justify-between gap-6">- <div className="flex items-center gap-x-2">- <h1 className="text-2xl font-semibold tracking-tight text-black">- OAuth Applications- </h1>- <InfoTooltip- content={- <TooltipContent- title="Learn how to use OAuth applications to build integrations with Dub."- href="https://dub.co/docs/integrations/quickstart"- target="_blank"- cta="Learn more"- />- }- />- </div>- <div className="flex w-full items-center gap-3 sm:w-auto">- <Button- className="flex h-10 items-center justify-center whitespace-nowrap rounded-lg border px-4 text-sm"- text="Create OAuth App"- onClick={() => router.push(`/${slug}/settings/oauth-apps/new`)}- disabledTooltip={permissionsError}- />- </div>- </div>-<div className="animate-fade-in">{!isLoading ? (oAuthApps && oAuthApps.length > 0 ? (diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/oauth-apps/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/oauth-apps/page.tsxnew file mode 100644index 0000000000..6935d38698--- /dev/null+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/oauth-apps/page.tsx@@ -0,0 +1,20 @@+import { PageContent } from "@/ui/layout/page-content";+import { PageWidthWrapper } from "@/ui/layout/page-width-wrapper";+import OAuthAppsPageClient from "./page-client";++export default async function OAuthAppsPage() {+ return (+ <PageContent+ title="OAuth Applications"+ titleInfo={{+ title:+ "Learn how to use OAuth applications to build integrations with Dub.",+ href: "https://dub.co/docs/integrations/quickstart",+ }}+ >+ <PageWidthWrapper>+ <OAuthAppsPageClient />+ </PageWidthWrapper>+ </PageContent>+ );+}diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/tokens/create-token-button.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/tokens/create-token-button.tsxnew file mode 100644index 0000000000..3a0c0f0cf0--- /dev/null+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/tokens/create-token-button.tsx@@ -0,0 +1,33 @@+"use client";++import { TokenProps } from "@/lib/types";+import { useAddEditTokenModal } from "@/ui/modals/add-edit-token-modal";+import { useTokenCreatedModal } from "@/ui/modals/token-created-modal";+import { useState } from "react";++export function CreateTokenButton() {+ const [createdToken, setCreatedToken] = useState<string | null>(null);+ const [_selectedToken, setSelectedToken] = useState<TokenProps | null>(null);++ const { TokenCreatedModal, setShowTokenCreatedModal } = useTokenCreatedModal({+ token: createdToken || "",+ });++ const onTokenCreated = (token: string) => {+ setCreatedToken(token);+ setShowTokenCreatedModal(true);+ };++ const { AddTokenButton, AddEditTokenModal } = useAddEditTokenModal({+ onTokenCreated,+ setSelectedToken,+ });++ return (+ <>+ <TokenCreatedModal />+ <AddEditTokenModal />+ <AddTokenButton />+ </>+ );+}diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/tokens/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/tokens/page-client.tsxsimilarity index 81%rename from apps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/tokens/page-client.tsxrename to apps/web/app/app.dub.co/(dashboard)/[slug]/settings/tokens/page-client.tsxindex db1bb091f3..78bff400e5 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/tokens/page-client.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/tokens/page-client.tsx@@ -68,6 +68,21 @@ export default function TokensPageClient() {customPermissionDescription: "update or delete API keys",}).error;+ const TokenEmptyState = () => (+ <AnimatedEmptyState+ title="No tokens found"+ description="No tokens have been created for this workspace yet."+ cardContent={() => (+ <>+ <Key className="size-4 text-neutral-700" />+ <div className="h-2.5 w-24 min-w-0 rounded-sm bg-neutral-200" />+ </>+ )}+ addButton={<AddTokenButton />}+ learnMoreHref="https://dub.co/docs/api-reference/tokens"+ />+ );+const { table, ...tableProps } = useTable({data: tokens || [],loading: isLoading && !error && !tokens,@@ -164,63 +179,22 @@ export default function TokensPageClient() {setSelectedToken(row.original);setShowAddEditTokenModal(true);},- emptyState: (- <AnimatedEmptyState- title="No tokens found"- description="No tokens have been created for this workspace yet."- cardContent={() => (- <>- <Key className="size-4 text-neutral-700" />- <div className="h-2.5 w-24 min-w-0 rounded-sm bg-neutral-200" />- </>- )}- addButton={<AddTokenButton />}- learnMoreHref="https://dub.co/docs/api-reference/tokens"- />- ),+ emptyState: <TokenEmptyState />,resourceName: (plural) => `token${plural ? "s" : ""}`,});return (- <div className="grid grid-cols-1">+ <><TokenCreatedModal /><AddEditTokenModal />-- <h1 className="text-2xl font-semibold tracking-tight text-black">- Secret keys- </h1>- <p className="mb-2 mt-2 text-base text-neutral-600">- These API keys allow other apps to access your workspace. Use it with- caution – do not share your API key with others, or expose it in the- browser or other client-side code.{" "}- <a- href="https://dub.co/docs/api-reference/tokens"- target="_blank"- className="font-medium underline underline-offset-4 hover:text-black"- >- Learn more- </a>- </p>-- <div className="flex w-full items-center justify-end pb-4">- <AddTokenButton />+ <div className="grid grid-cols-1">+ {tokens?.length !== 0 ? (+ <Table {...tableProps} table={table} />+ ) : (+ <TokenEmptyState />+ )}</div>-- {tokens?.length !== 0 ? (- <Table {...tableProps} table={table} />- ) : (- <AnimatedEmptyState- title="No tokens found"- description="No tokens have been created for this workspace yet."- cardContent={() => (- <>- <Key className="size-4 text-neutral-700" />- <div className="h-2.5 w-24 min-w-0 rounded-sm bg-neutral-200" />- </>- )}- />- )}- </div>+ </>);}diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/tokens/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/tokens/page.tsxnew file mode 100644index 0000000000..e11d8a5e5c--- /dev/null+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/tokens/page.tsx@@ -0,0 +1,22 @@+import { PageContent } from "@/ui/layout/page-content";+import { PageWidthWrapper } from "@/ui/layout/page-width-wrapper";+import { CreateTokenButton } from "./create-token-button";+import TokensPageClient from "./page-client";++export default function TokensPage() {+ return (+ <PageContent+ title="Secret keys"+ titleInfo={{+ title:+ " These API keys allow other apps to access your workspace. Use it with caution – do not share your API key with others, or expose it in the browser or other client-side code.",+ href: "https://dub.co/docs/api-reference/tokens",+ }}+ controls={<CreateTokenButton />}+ >+ <PageWidthWrapper>+ <TokensPageClient />+ </PageWidthWrapper>+ </PageContent>+ );+}diff --git a/apps/web/ui/modals/add-edit-token-modal.tsx b/apps/web/ui/modals/add-edit-token-modal.tsxindex c26e4cad92..ebcf939b4f 100644--- a/apps/web/ui/modals/add-edit-token-modal.tsx+++ b/apps/web/ui/modals/add-edit-token-modal.tsx@@ -358,6 +358,7 @@ function AddTokenButton({customPermissionDescription: "create new API keys",}).error || undefined}+ className="h-9 px-3"{...buttonProps}/></div>