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.

account for long links

Steven Tey5aa03fcd194a
diff --git a/apps/web/ui/analytics/toggle.tsx b/apps/web/ui/analytics/toggle.tsx
index 0999ab7436..af615e8ecb 100644
--- a/apps/web/ui/analytics/toggle.tsx
+++ b/apps/web/ui/analytics/toggle.tsx
@@ -5,6 +5,7 @@ import {
cn,
getApexDomain,
linkConstructor,
+ truncate,
} from "@dub/utils";
import { useContext } from "react";
import { AnalyticsContext } from ".";
@@ -62,11 +63,13 @@ export default function Toggle() {
width={48}
height={48}
/>
- {linkConstructor({
- domain: punycode.toUnicode(domain),
- key,
- pretty: true,
- })}
+ <p className="w-48 truncate sm:w-[400px]">
+ {linkConstructor({
+ domain: punycode.toUnicode(domain),
+ key,
+ pretty: true,
+ })}
+ </p>
<ExpandingArrow className="h-5 w-5" />
</a>
) : (
diff --git a/packages/ui/package.json b/packages/ui/package.json
index b3573027dd..4d687520e6 100644
--- a/packages/ui/package.json
+++ b/packages/ui/package.json
@@ -1,7 +1,7 @@
{
"name": "@dub/ui",
"description": "UI components for Dub.co",
- "version": "0.1.1",
+ "version": "0.1.2",
"sideEffects": false,
"main": "./dist/index.js",
"module": "./dist/index.mjs",
diff --git a/packages/ui/src/index.tsx b/packages/ui/src/index.tsx
index e6728c12c2..374b43f68b 100644
--- a/packages/ui/src/index.tsx
+++ b/packages/ui/src/index.tsx
@@ -39,6 +39,7 @@ export * from "./copy-button";
export * from "./counting-numbers";
export * from "./icon-menu";
export * from "./inline-snippet";
+export * from "./link-logo";
export * from "./link-preview";
export * from "./product-hunt";
export * from "./progress-bar";
diff --git a/packages/ui/src/link-logo.tsx b/packages/ui/src/link-logo.tsx
new file mode 100644
index 0000000000..2d1562c1d6
--- /dev/null
+++ b/packages/ui/src/link-logo.tsx
@@ -0,0 +1,30 @@
+import { GOOGLE_FAVICON_URL, cn } from "@dub/utils";
+import { Globe } from "lucide-react";
+import { BlurImage } from "./blur-image";
+
+export function LinkLogo({
+ apexDomain,
+ className,
+}: {
+ apexDomain?: string | null;
+ className?: string;
+}) {
+ return apexDomain ? (
+ <BlurImage
+ src={`${GOOGLE_FAVICON_URL}${apexDomain}`}
+ alt={apexDomain}
+ className={cn("h-8 w-8 rounded-full sm:h-10 sm:w-10", className)}
+ width={20}
+ height={20}
+ />
+ ) : (
+ <div
+ className={cn(
+ "flex h-8 w-8 items-center justify-center rounded-full bg-gray-100 px-0 sm:h-10 sm:w-10",
+ className,
+ )}
+ >
+ <Globe className="h-4 w-4 text-gray-600 sm:h-5 sm:w-5" />
+ </div>
+ );
+}
diff --git a/packages/utils/package.json b/packages/utils/package.json
index 73f55101a9..1875cc95a2 100644
--- a/packages/utils/package.json
+++ b/packages/utils/package.json
@@ -1,7 +1,7 @@
{
"name": "@dub/utils",
"description": "Utility functions and constants for Dub.co",
- "version": "0.0.45",
+ "version": "0.0.46",
"sideEffects": false,
"main": "./dist/index.mjs",
"module": "./dist/index.mjs",