Skip to content

Commit d9501de

Browse files
committed
fix iframeable
1 parent aab3379 commit d9501de

File tree

2 files changed

+24
-32
lines changed

2 files changed

+24
-32
lines changed

apps/web/ui/modals/link-builder/options-list.tsx

Lines changed: 23 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { AlertCircleFill, CheckCircleFill, X } from "@/ui/shared/icons";
2-
import { Tooltip, useMediaQuery } from "@dub/ui";
2+
import { SimpleTooltipContent, Tooltip, useMediaQuery } from "@dub/ui";
33
import { LoadingSpinner } from "@dub/ui/icons";
4-
import { cn, fetcher, isValidUrl as isValidUrlFn } from "@dub/utils";
4+
import { fetcher, isValidUrl as isValidUrlFn } from "@dub/utils";
55
import { AnimatePresence, motion } from "framer-motion";
66
import { ReactNode, useMemo } from "react";
77
import { useFormContext } from "react-hook-form";
@@ -121,10 +121,10 @@ function LinkCloakingToggleBadge({
121121
icon={
122122
isLoading ? (
123123
<LoadingSpinner className="size-3.5" />
124-
) : !data ? null : data?.iframeable ? (
124+
) : !data ? null : data.iframeable ? (
125125
<CheckCircleFill className="size-3.5 text-green-500" />
126126
) : (
127-
<AlertCircleFill className="size-3.5 text-red-500" />
127+
<AlertCircleFill className="size-3.5 text-amber-500" />
128128
)
129129
}
130130
/>
@@ -135,34 +135,26 @@ function LinkCloakingToggleBadge({
135135
return data ? (
136136
<Tooltip
137137
content={
138-
<div
139-
className={cn(
140-
"block max-w-lg text-pretty p-4 text-center text-sm text-gray-700",
141-
{
142-
"max-w-sm": !data.iframeable,
143-
},
144-
)}
145-
>
146-
{data.iframeable ? (
147-
<div className="grid gap-2">
148-
<div className="h-[250px] w-[444px] overflow-hidden rounded-lg border border-gray-200">
149-
<iframe
150-
src={url}
151-
style={{
152-
zoom: 0.5,
153-
}}
154-
className="h-[500px] w-[888px]"
155-
/>
156-
</div>
157-
<p>Your link will be successfully cloaked.</p>
138+
data.iframeable ? (
139+
<div className="grid max-w-lg gap-2 text-pretty p-4 text-center text-sm text-gray-700">
140+
<div className="h-[250px] w-[444px] overflow-hidden rounded-lg border border-gray-200">
141+
<iframe
142+
src={url}
143+
style={{
144+
zoom: 0.5,
145+
}}
146+
className="h-[500px] w-[888px]"
147+
/>
158148
</div>
159-
) : (
160-
<span>
161-
There are some issues with the link you provided. Please try
162-
again.
163-
</span>
164-
)}
165-
</div>
149+
<p>Your link will be successfully cloaked.</p>
150+
</div>
151+
) : (
152+
<SimpleTooltipContent
153+
title="Your link is not cloakable – make sure you have the right security headers set on your target URL."
154+
cta="Learn more"
155+
href="https://dub.co/help/article/link-cloaking#link-cloaking-with-security-headers"
156+
/>
157+
)
166158
}
167159
>
168160
<div>{badge}</div>

packages/utils/src/functions/is-iframeable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ export const isIframeable = async ({
2929
return false;
3030
}
3131

32-
return false;
32+
return true;
3333
};

0 commit comments

Comments
 (0)