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.

fix styles, limit to integrations flag

Steven Teyaaf0536c7e17
diff --git a/apps/web/app/app.dub.co/(auth)/oauth/authorize/page.tsx b/apps/web/app/app.dub.co/(auth)/oauth/authorize/page.tsx
index f4db3ab9a0..3a04fccbee 100644
--- a/apps/web/app/app.dub.co/(auth)/oauth/authorize/page.tsx
+++ b/apps/web/app/app.dub.co/(auth)/oauth/authorize/page.tsx
@@ -43,25 +43,25 @@ export default async function Authorize({
}
return (
- <div className="relative z-10 m-auto h-fit w-full max-w-md overflow-hidden border-y border-gray-200 sm:rounded-2xl sm:border sm:shadow-xl">
- <div className="flex flex-col items-center justify-center space-y-6 border-b border-gray-200 bg-white px-4 py-6 pt-8 text-center sm:px-16">
+ <div className="relative z-10 m-auto w-full max-w-md border-y border-gray-200 sm:rounded-2xl sm:border sm:shadow-xl">
+ <div className="flex flex-col items-center justify-center space-y-6 border-b border-gray-200 bg-white px-4 py-6 pt-8 text-center sm:rounded-t-2xl sm:px-16">
<div className="flex items-center gap-3">
<a href={oAuthApp.website} target="_blank" rel="noreferrer">
{oAuthApp.logo ? (
<BlurImage
src={oAuthApp.logo}
alt={`Logo for ${oAuthApp.name}`}
- className="h-14 w-14 rounded-full border border-gray-200"
+ className="size-12 rounded-full border border-gray-200"
width={20}
height={20}
/>
) : (
- <Logo className="h-14 w-14" />
+ <Logo className="size-12" />
)}
</a>
- <ArrowLeftRight className="h-6 w-6 text-gray-500" />
+ <ArrowLeftRight className="size-5 text-gray-500" />
<a href={HOME_DOMAIN} target="_blank" rel="noreferrer">
- <Logo className="h-14 w-14" />
+ <Logo className="size-12" />
</a>
</div>
<p className="text-md">
@@ -83,7 +83,7 @@ export default async function Authorize({
<div className="flex flex-col space-y-3 bg-white px-2 py-6 sm:px-10">
<ScopesRequested scopes={requestParams.scope} />
</div>
- <div className="flex flex-col space-y-2 border-t border-gray-200 bg-white px-2 py-6 sm:px-10">
+ <div className="flex flex-col space-y-2 border-t border-gray-200 bg-white px-2 py-6 sm:rounded-b-2xl sm:px-10">
<Suspense fallback={<></>}>
<AuthorizeForm oAuthApp={oAuthApp} {...requestParams} />
</Suspense>
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/page-client.tsx
index 74e5b7db9c..59616d6473 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/page-client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/page-client.tsx
@@ -1,8 +1,10 @@
"use client";
import useWorkspace from "@/lib/swr/use-workspace";
-import { OAuthAuthorizedAppProps } from "@/lib/types";
+import { OAuthAppProps, OAuthAuthorizedAppProps } from "@/lib/types";
+import { useAddEditAppModal } from "@/ui/modals/add-edit-oauth-app-modal";
import { useDeleteAppModal } from "@/ui/modals/delete-oauth-app-modal";
+import { useAppCreatedModal } from "@/ui/modals/oauth-app-created-modal";
import EmptyState from "@/ui/shared/empty-state";
import { Delete } from "@/ui/shared/icons";
import {
@@ -16,30 +18,58 @@ import {
import { Key } from "@dub/ui/src/icons";
import { fetcher, formatDate } from "@dub/utils";
import { MoreVertical } from "lucide-react";
+import { redirect } from "next/navigation";
import { useState } from "react";
import useSWR from "swr";
export default function AuthorizedAppsPageClient() {
- const { id: workspaceId } = useWorkspace();
+ const { id: workspaceId, slug, flags } = useWorkspace();
const { data: apps, isLoading } = useSWR<OAuthAuthorizedAppProps[]>(
`/api/oauth-apps/authorized?workspaceId=${workspaceId}`,
fetcher,
);
+ if (!flags?.integrations) {
+ redirect(`/${slug}`);
+ }
+
+ const [app, setApp] = useState<OAuthAppProps | null>(null);
+ const { AppCreatedModal, setShowAppCreatedModal } = useAppCreatedModal({
+ app,
+ });
+
+ const onAppCreated = (app: OAuthAppProps) => {
+ if (!app) return;
+
+ setApp(app);
+ setShowAppCreatedModal(true);
+ };
+
+ const { AddEditAppModal, setShowAddEditAppModal } = useAddEditAppModal({
+ onAppCreated,
+ });
+
return (
<>
+ <AddEditAppModal />
+ <AppCreatedModal />
<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 className="flex gap-2">
+ <Button
+ text="Create"
+ onClick={() => setShowAddEditAppModal(true)}
+ />
+ </div>
</div>
</MaxWidthWrapper>
</div>
- <MaxWidthWrapper className="flex flex-col space-y-3 py-3">
+ <MaxWidthWrapper className="flex flex-col gap-3 py-4">
{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" />
@@ -54,10 +84,10 @@ export default function AuthorizedAppsPageClient() {
))}
</div>
) : (
- <div className="flex flex-col items-center justify-center gap-y-4 py-20">
+ <div className="flex flex-col items-center justify-center gap-y-4 rounded-xl border border-gray-200 bg-white py-36">
<EmptyState
icon={Key}
- title="You haven’t authorized any applications to access Dub workspace on your behalf."
+ title="You haven't authorized any applications to access Dub workspace on your behalf."
/>
</div>
)}
@@ -80,7 +110,7 @@ const AppRow = (app: OAuthAuthorizedAppProps) => {
return (
<>
<DeleteAppModal />
- <div className="relative grid grid-cols-5 items-center bg-white px-5 py-3 sm:px-10">
+ <div className="relative grid grid-cols-5 items-center rounded-xl border border-gray-200 bg-white px-5 py-4">
<div className="col-span-3 flex items-center space-x-3">
{app.logo ? (
<BlurImage
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 6478ee748f..12fab91219 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: "OAuth Apps",
- icon: Key,
- segment: "oauth-apps",
- },
{
name: "Security",
icon: ShieldCheck,
diff --git a/apps/web/ui/modals/add-edit-oauth-app-modal.tsx b/apps/web/ui/modals/add-edit-oauth-app-modal.tsx
index c429276ce7..196760dbd1 100644
--- a/apps/web/ui/modals/add-edit-oauth-app-modal.tsx
+++ b/apps/web/ui/modals/add-edit-oauth-app-modal.tsx
@@ -1,14 +1,6 @@
import useWorkspace from "@/lib/swr/use-workspace";
import { OAuthAppProps } from "@/lib/types";
-import {
- BlurImage,
- Button,
- ButtonProps,
- InfoTooltip,
- Logo,
- Modal,
- Switch,
-} from "@dub/ui";
+import { Button, ButtonProps, InfoTooltip, Logo, Modal, Switch } from "@dub/ui";
import {
Dispatch,
FormEvent,
@@ -98,21 +90,14 @@ function AddEditAppModal({
setShowModal={setShowAddEditAppModal}
className="scrollbar-hide h-fit max-h-[95vh] overflow-auto"
>
- <div className="flex flex-col items-center justify-center space-y-3 border-b border-gray-200 px-4 py-4 pt-8 sm:px-16">
- {workspaceLogo ? (
- <BlurImage
- src={workspaceLogo}
- alt={`Logo for ${slug}`}
- className="h-10 w-10 rounded-full border border-gray-200"
- width={20}
- height={20}
- />
- ) : (
- <Logo />
- )}
+ <div className="flex flex-col items-center justify-center gap-1 border-b border-gray-200 px-4 py-4 pt-8 text-center sm:px-16">
+ <Logo className="mb-3" />
<h1 className="text-lg font-medium">
- {app ? "Update" : "Add New"} OAuth Application
+ {app ? "Update" : "Create"} OAuth Application
</h1>
+ <p className="text-sm text-gray-500">
+ Allow users to sign in to your application using their Dub account.
+ </p>
</div>
<form