feat: add external link confirmation dialog for product URLs
Show an external link icon on ItemCard and CandidateCard that opens a confirmation dialog before navigating to product URLs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,7 @@ interface ItemCardProps {
|
||||
categoryName: string;
|
||||
categoryIcon: string;
|
||||
imageFilename: string | null;
|
||||
productUrl?: string | null;
|
||||
onRemove?: () => void;
|
||||
}
|
||||
|
||||
@@ -21,9 +22,11 @@ export function ItemCard({
|
||||
categoryName,
|
||||
categoryIcon,
|
||||
imageFilename,
|
||||
productUrl,
|
||||
onRemove,
|
||||
}: ItemCardProps) {
|
||||
const openEditPanel = useUIStore((s) => s.openEditPanel);
|
||||
const openExternalLink = useUIStore((s) => s.openExternalLink);
|
||||
|
||||
return (
|
||||
<button
|
||||
@@ -31,6 +34,38 @@ export function ItemCard({
|
||||
onClick={() => openEditPanel(id)}
|
||||
className="relative w-full text-left bg-white rounded-xl border border-gray-100 hover:border-gray-200 hover:shadow-sm transition-all overflow-hidden group"
|
||||
>
|
||||
{productUrl && (
|
||||
<span
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
openExternalLink(productUrl);
|
||||
}}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter" || e.key === " ") {
|
||||
e.stopPropagation();
|
||||
openExternalLink(productUrl);
|
||||
}
|
||||
}}
|
||||
className={`absolute top-2 ${onRemove ? "right-10" : "right-2"} z-10 w-6 h-6 flex items-center justify-center rounded-full bg-gray-100/80 text-gray-400 hover:bg-blue-100 hover:text-blue-500 opacity-0 group-hover:opacity-100 transition-all cursor-pointer`}
|
||||
title="Open product link"
|
||||
>
|
||||
<svg
|
||||
className="w-3.5 h-3.5"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth={2}
|
||||
d="M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6M15 3h6v6M10 14L21 3"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
)}
|
||||
{onRemove && (
|
||||
<span
|
||||
role="button"
|
||||
|
||||
Reference in New Issue
Block a user