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.

improve implementation

Steven Tey2ff1f95b77fc
diff --git a/apps/web/app/app.dub.co/(auth)/oauth/authorize/loading.tsx b/apps/web/app/app.dub.co/(auth)/oauth/authorize/loading.tsx
index b6f6993e6d..88a47db1a0 100644
--- a/apps/web/app/app.dub.co/(auth)/oauth/authorize/loading.tsx
+++ b/apps/web/app/app.dub.co/(auth)/oauth/authorize/loading.tsx
@@ -4,7 +4,7 @@ import { ArrowLeftRight } from "lucide-react";
export default function AuthorizeLoading() {
return (
<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 gap-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 flex-col items-center justify-center gap-3 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">
<div className="size-12 rounded-full border border-gray-200 bg-gradient-to-t from-gray-100" />
<ArrowLeftRight className="size-5 text-gray-300" />
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 f70995becb..2792a9e25d 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
@@ -4,8 +4,9 @@ import z from "@/lib/zod";
import { authorizeRequestSchema } from "@/lib/zod/schemas/oauth";
import EmptyState from "@/ui/shared/empty-state";
import { BlurImage, Logo } from "@dub/ui";
+import { CircleWarning } from "@dub/ui/src/icons";
import { HOME_DOMAIN, constructMetadata } from "@dub/utils";
-import { ArrowLeftRight, TriangleAlert } from "lucide-react";
+import { ArrowLeftRight } from "lucide-react";
import { redirect } from "next/navigation";
import { Suspense } from "react";
import { AuthorizeForm } from "./authorize-form";
@@ -43,7 +44,7 @@ export default async function Authorize({
return (
<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-5 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 flex-col items-center justify-center gap-3 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={integration.website} target="_blank" rel="noreferrer">
{integration.logo ? (
@@ -64,13 +65,6 @@ export default async function Authorize({
</a>
</div>
- {!integration.verified && (
- <div className="flex items-center gap-2 rounded-md bg-yellow-50 p-2 text-sm text-yellow-700">
- <TriangleAlert className="size-4" />
- <span>Dub hasn't verified this app</span>
- </div>
- )}
-
<p className="text-md">
<span className="font-bold">{integration.name}</span> is requesting
API access to a workspace on Dub.
@@ -86,6 +80,13 @@ export default async function Authorize({
{integration.developer}
</a>
</span>
+
+ {!integration.verified && (
+ <div className="flex items-center gap-2 rounded-md bg-yellow-50 p-2 text-sm text-yellow-700">
+ <CircleWarning className="size-4" />
+ <span>Dub hasn't verified this app</span>
+ </div>
+ )}
</div>
<div className="flex flex-col space-y-3 bg-white px-2 py-6 sm:px-10">
<ScopesRequested scopes={requestParams.scope} />
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/integrations/[integrationSlug]/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/integrations/[integrationSlug]/page-client.tsx
index 302e1d9a5b..d7f3020b72 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/integrations/[integrationSlug]/page-client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/integrations/[integrationSlug]/page-client.tsx
@@ -18,8 +18,14 @@ import {
Popover,
TokenAvatar,
} from "@dub/ui";
-import { ConnectedDots, Globe, OfficeBuilding } from "@dub/ui/src/icons";
-import { TooltipContent } from "@dub/ui/src/tooltip";
+import {
+ CircleWarning,
+ ConnectedDots,
+ Globe,
+ OfficeBuilding,
+ ShieldCheck,
+} from "@dub/ui/src/icons";
+import { Tooltip, TooltipContent } from "@dub/ui/src/tooltip";
import { cn, formatDate, getPrettyUrl } from "@dub/utils";
import { BookOpenText, ChevronLeft, Trash } from "lucide-react";
import { useAction } from "next-safe-action/hooks";
@@ -86,7 +92,24 @@ export default function IntegrationPageClient({
)}
</div>
<div>
- <p className="font-semibold text-gray-700">{integration.name}</p>
+ <div className="flex items-center gap-1">
+ <p className="font-semibold text-gray-700">{integration.name}</p>
+ <Tooltip
+ content={
+ integration.verified
+ ? "This is a verified integration."
+ : "Dub hasn't verified this integration. Install it at your own risk."
+ }
+ >
+ <div>
+ {integration.verified ? (
+ <ShieldCheck className="size-5 text-[#E2B719]" invert />
+ ) : (
+ <CircleWarning className="size-5 text-gray-500" invert />
+ )}
+ </div>
+ </Tooltip>
+ </div>
<p className="text-sm text-gray-500">{integration.description}</p>
</div>
</div>
diff --git a/apps/web/lib/types.ts b/apps/web/lib/types.ts
index efead7a00c..a4e97baab1 100644
--- a/apps/web/lib/types.ts
+++ b/apps/web/lib/types.ts
@@ -220,6 +220,7 @@ export type InstalledIntegrationInfoProps = Pick<
| "name"
| "developer"
| "description"
+ | "verified"
| "readme"
| "website"
| "screenshots"
diff --git a/apps/web/ui/integrations/integration-card.tsx b/apps/web/ui/integrations/integration-card.tsx
index fc9d0f9e34..961407ce0c 100644
--- a/apps/web/ui/integrations/integration-card.tsx
+++ b/apps/web/ui/integrations/integration-card.tsx
@@ -2,8 +2,13 @@ import useIntegrations from "@/lib/swr/use-integrations";
import useWorkspace from "@/lib/swr/use-workspace";
import { InstalledIntegrationProps } from "@/lib/types";
import { BlurImage, TokenAvatar } from "@dub/ui";
-import { Download, OfficeBuilding } from "@dub/ui/src/icons";
-import { BadgeCheck } from "lucide-react";
+import {
+ CircleWarning,
+ Download,
+ OfficeBuilding,
+ ShieldCheck,
+} from "@dub/ui/src/icons";
+import { Tooltip } from "@dub/ui/src/tooltip";
import Link from "next/link";
export default function IntegrationCard(
@@ -41,9 +46,21 @@ export default function IntegrationCard(
<div>
<div className="flex items-center gap-1">
<p className="font-semibold text-gray-700">{integration.name}</p>
- {integration.verified && (
- <BadgeCheck className="h-5 w-5 text-blue-600" />
- )}
+ <Tooltip
+ content={
+ integration.verified
+ ? "This is a verified integration."
+ : "Dub hasn't verified this integration. Install it at your own risk."
+ }
+ >
+ <div>
+ {integration.verified ? (
+ <ShieldCheck className="size-4 text-[#E2B719]" invert />
+ ) : (
+ <CircleWarning className="size-4 text-gray-500" invert />
+ )}
+ </div>
+ </Tooltip>
</div>
<div className="flex items-center gap-1 text-gray-500">
<OfficeBuilding className="size-3" />
diff --git a/packages/ui/src/icons/nucleo/circle-warning.tsx b/packages/ui/src/icons/nucleo/circle-warning.tsx
index 1f256a95e9..53c1200f66 100644
--- a/packages/ui/src/icons/nucleo/circle-warning.tsx
+++ b/packages/ui/src/icons/nucleo/circle-warning.tsx
@@ -1,6 +1,8 @@
import { SVGProps } from "react";
-export function CircleWarning(props: SVGProps<SVGSVGElement>) {
+export function CircleWarning(
+ props: SVGProps<SVGSVGElement> & { invert?: boolean },
+) {
return (
<svg
height="18"
@@ -10,32 +12,41 @@ export function CircleWarning(props: SVGProps<SVGSVGElement>) {
{...props}
>
<g fill="currentColor">
- <circle
- cx="9"
- cy="9"
- fill="none"
- r="7.25"
- stroke="currentColor"
- strokeLinecap="round"
- strokeLinejoin="round"
- strokeWidth="1.5"
- />
- <line
- fill="none"
- stroke="currentColor"
- strokeLinecap="round"
- strokeLinejoin="round"
- strokeWidth="1.5"
- x1="9"
- x2="9"
- y1="5.431"
- y2="9.569"
- />
- <path
- d="M9,13.417c-.552,0-1-.449-1-1s.448-1,1-1,1,.449,1,1-.448,1-1,1Z"
- fill="currentColor"
- stroke="none"
- />
+ {props.invert ? (
+ <path
+ d="M9,1.5C4.86,1.5,1.5,4.86,1.5,9s3.36,7.5,7.5,7.5,7.5-3.36,7.5-7.5S13.14,1.5,9,1.5Zm0,11.917c-.552,0-1-.449-1-1s.448-1,1-1,1,.449,1,1-.448,1-1,1Zm.75-4.348c0,.414-.336,.75-.75,.75s-.75-.336-.75-.75V5.431c0-.414,.336-.75,.75-.75s.75,.336,.75,.75v3.638Z"
+ fill="currentColor"
+ />
+ ) : (
+ <>
+ <circle
+ cx="9"
+ cy="9"
+ fill="none"
+ r="7.25"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ />
+ <line
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ x1="9"
+ x2="9"
+ y1="5.431"
+ y2="9.569"
+ />
+ <path
+ d="M9,13.417c-.552,0-1-.449-1-1s.448-1,1-1,1,.449,1,1-.448,1-1,1Z"
+ fill="currentColor"
+ stroke="none"
+ />
+ </>
+ )}
</g>
</svg>
);
diff --git a/packages/ui/src/icons/nucleo/shield-check.tsx b/packages/ui/src/icons/nucleo/shield-check.tsx
index cd68b7281b..2f16556431 100644
--- a/packages/ui/src/icons/nucleo/shield-check.tsx
+++ b/packages/ui/src/icons/nucleo/shield-check.tsx
@@ -1,6 +1,8 @@
import { SVGProps } from "react";
-export function ShieldCheck(props: SVGProps<SVGSVGElement>) {
+export function ShieldCheck(
+ props: SVGProps<SVGSVGElement> & { invert?: boolean },
+) {
return (
<svg
height="18"
@@ -10,22 +12,31 @@ export function ShieldCheck(props: SVGProps<SVGSVGElement>) {
{...props}
>
<g fill="currentColor">
- <path
- d="M9.305,1.848l5.25,1.68c.414,.133,.695,.518,.695,.952v6.52c0,3.03-4.684,4.748-5.942,5.155-.203,.066-.413,.066-.616,0-1.258-.407-5.942-2.125-5.942-5.155V4.48c0-.435,.281-.82,.695-.952l5.25-1.68c.198-.063,.411-.063,.61,0Z"
- fill="none"
- stroke="currentColor"
- strokeLinecap="round"
- strokeLinejoin="round"
- strokeWidth="1.5"
- />
- <polyline
- fill="none"
- points="6.497 9.75 8.106 11.25 11.503 6.75"
- stroke="currentColor"
- strokeLinecap="round"
- strokeLinejoin="round"
- strokeWidth="1.5"
- />
+ {props.invert ? (
+ <path
+ d="M14.783,2.813l-5.25-1.68c-.349-.112-.718-.111-1.066,0L3.216,2.813c-.728,.233-1.216,.903-1.216,1.667v6.52c0,3.508,4.946,5.379,6.46,5.869,.177,.057,.358,.086,.54,.086s.362-.028,.538-.085c1.516-.49,6.462-2.361,6.462-5.869V4.48c0-.764-.489-1.434-1.217-1.667Zm-2.681,4.389l-3.397,4.5c-.128,.169-.322,.276-.534,.295-.021,.002-.043,.003-.065,.003-.189,0-.372-.071-.511-.201l-1.609-1.5c-.303-.283-.32-.757-.038-1.06,.284-.303,.758-.319,1.06-.038l1.001,.933,2.896-3.836c.25-.33,.72-.396,1.051-.146,.331,.25,.396,.72,.146,1.051Z"
+ fill="currentColor"
+ />
+ ) : (
+ <>
+ <path
+ d="M9.305,1.848l5.25,1.68c.414,.133,.695,.518,.695,.952v6.52c0,3.03-4.684,4.748-5.942,5.155-.203,.066-.413,.066-.616,0-1.258-.407-5.942-2.125-5.942-5.155V4.48c0-.435,.281-.82,.695-.952l5.25-1.68c.198-.063,.411-.063,.61,0Z"
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ />
+ <polyline
+ fill="none"
+ points="6.497 9.75 8.106 11.25 11.503 6.75"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ />
+ </>
+ )}
</g>
</svg>
);