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.

fixed logo for add-edit link modal

Steven Teya30b8f141a49
diff --git a/app/ui/modals/add-edit-link-modal/index.tsx b/app/ui/modals/add-edit-link-modal/index.tsx
index b87107750c..92e0b68177 100644
--- a/app/ui/modals/add-edit-link-modal/index.tsx
+++ b/app/ui/modals/add-edit-link-modal/index.tsx
@@ -21,7 +21,7 @@ import { mutate } from "swr";
import { useDebounce } from "use-debounce";
import BlurImage from "#/ui/blur-image";
import { AlertCircleFill, Lock, Random, X } from "@/components/shared/icons";
-import { LoadingCircle } from "#/ui/icons";
+import { LoadingCircle, Logo } from "#/ui/icons";
import Modal from "#/ui/modal";
import Tooltip, { TooltipContent } from "#/ui/tooltip";
import useProject from "#/lib/hooks/use-project";
@@ -178,16 +178,21 @@ function AddEditLinkModal({
}, [debouncedUrl, password, showAddEditLinkModal, proxy]);
const logo = useMemo(() => {
- // if the link is password protected, or if it's a new link and there's no URL yet,
- // return the default Dub logo
- if (password || (!debouncedUrl && !props)) {
- return "/_static/logo.png";
- // otherwise, get the favicon of the URL
- } else {
- return `${GOOGLE_FAVICON_URL}${getApexDomain(
- debouncedUrl || props?.url || "https://dub.sh",
- )}`;
- }
+ // if the link is password protected, or if it's a new link and there's no URL yet, return the default Dub logo
+ // otherwise, get the favicon of the URL
+ const url = password || !debouncedUrl ? null : debouncedUrl || props?.url;
+
+ return url ? (
+ <BlurImage
+ src={`${GOOGLE_FAVICON_URL}${getApexDomain(url)}`}
+ alt="Logo"
+ className="h-10 w-10 rounded-full"
+ width={20}
+ height={20}
+ />
+ ) : (
+ <Logo />
+ );
}, [password, debouncedUrl, props]);
const endpoint = useMemo(() => {
@@ -276,13 +281,7 @@ function AddEditLinkModal({
onScroll={handleScroll}
>
<div className="z-10 flex flex-col items-center justify-center space-y-3 border-b border-gray-200 bg-white px-4 pb-8 pt-8 transition-all md:sticky md:top-0 md:px-16">
- <BlurImage
- src={logo}
- alt="Logo"
- className="h-10 w-10 rounded-full"
- width={20}
- height={20}
- />
+ {logo}
<h3 className="text-lg font-medium">
{props
? `Edit ${linkConstructor({
diff --git a/components/app/modals/add-edit-link-modal/index.tsx b/components/app/modals/add-edit-link-modal/index.tsx
index da7edc83d5..27f09c4db1 100644
--- a/components/app/modals/add-edit-link-modal/index.tsx
+++ b/components/app/modals/add-edit-link-modal/index.tsx
@@ -13,7 +13,7 @@ import { mutate } from "swr";
import { useDebounce } from "use-debounce";
import BlurImage from "#/ui/blur-image";
import { AlertCircleFill, Lock, Random, X } from "@/components/shared/icons";
-import { LoadingCircle } from "#/ui/icons";
+import { LoadingCircle, Logo } from "#/ui/icons";
import Modal from "#/ui/modal";
import Tooltip, { TooltipContent } from "#/ui/tooltip";
import useProject from "#/lib/swr/use-project";
@@ -182,16 +182,21 @@ function AddEditLinkModal({
}, [debouncedUrl, password, showAddEditLinkModal, proxy]);
const logo = useMemo(() => {
- // if the link is password protected, or if it's a new link and there's no URL yet,
- // return the default Dub logo
- if (password || (!debouncedUrl && !props)) {
- return "/_static/logo.png";
- // otherwise, get the favicon of the URL
- } else {
- return `${GOOGLE_FAVICON_URL}${getApexDomain(
- debouncedUrl || props?.url || "https://dub.sh",
- )}`;
- }
+ // if the link is password protected, or if it's a new link and there's no URL yet, return the default Dub logo
+ // otherwise, get the favicon of the URL
+ const url = password || !debouncedUrl ? null : debouncedUrl || props?.url;
+
+ return url ? (
+ <BlurImage
+ src={`${GOOGLE_FAVICON_URL}${getApexDomain(url)}`}
+ alt="Logo"
+ className="h-10 w-10 rounded-full"
+ width={20}
+ height={20}
+ />
+ ) : (
+ <Logo />
+ );
}, [password, debouncedUrl, props]);
const endpoint = useMemo(() => {
@@ -284,13 +289,7 @@ function AddEditLinkModal({
onScroll={handleScroll}
>
<div className="z-10 flex flex-col items-center justify-center space-y-3 border-b border-gray-200 bg-white px-4 pb-8 pt-8 transition-all md:sticky md:top-0 md:px-16">
- <BlurImage
- src={logo}
- alt="Logo"
- className="h-10 w-10 rounded-full"
- width={20}
- height={20}
- />
+ {logo}
<h3 className="max-w-sm truncate text-lg font-medium">
{props
? `Edit ${linkConstructor({