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 CandidateCardProps {
|
||||
categoryName: string;
|
||||
categoryIcon: string;
|
||||
imageFilename: string | null;
|
||||
productUrl?: string | null;
|
||||
threadId: number;
|
||||
isActive: boolean;
|
||||
}
|
||||
@@ -22,6 +23,7 @@ export function CandidateCard({
|
||||
categoryName,
|
||||
categoryIcon,
|
||||
imageFilename,
|
||||
productUrl,
|
||||
threadId,
|
||||
isActive,
|
||||
}: CandidateCardProps) {
|
||||
@@ -30,9 +32,38 @@ export function CandidateCard({
|
||||
(s) => s.openConfirmDeleteCandidate,
|
||||
);
|
||||
const openResolveDialog = useUIStore((s) => s.openResolveDialog);
|
||||
const openExternalLink = useUIStore((s) => s.openExternalLink);
|
||||
|
||||
return (
|
||||
<div className="bg-white rounded-xl border border-gray-100 hover:border-gray-200 hover:shadow-sm transition-all overflow-hidden">
|
||||
<div className="relative 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={() => openExternalLink(productUrl)}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter" || e.key === " ") {
|
||||
openExternalLink(productUrl);
|
||||
}
|
||||
}}
|
||||
className="absolute top-2 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>
|
||||
)}
|
||||
<div className="aspect-[4/3] bg-gray-50">
|
||||
{imageFilename ? (
|
||||
<img
|
||||
|
||||
Reference in New Issue
Block a user