From 0f44b48801e215615d32e903fc25790788cbbded Mon Sep 17 00:00:00 2001 From: Silberengel Date: Wed, 3 Dec 2025 15:28:49 +0100 Subject: [PATCH] fix url, book, and fallback card responsiveness --- src/components/WebPreview/index.tsx | 141 +++++++++++++++------------- 1 file changed, 74 insertions(+), 67 deletions(-) diff --git a/src/components/WebPreview/index.tsx b/src/components/WebPreview/index.tsx index c7c254f..3b45679 100644 --- a/src/components/WebPreview/index.tsx +++ b/src/components/WebPreview/index.tsx @@ -503,12 +503,12 @@ export default function WebPreview({ url, className }: { url: string; className? // Render all images on left side, crop wider ones return (
{displayImage && (
1 ? "w-[416px]" : "w-52" + imageAspectRatio !== null && imageAspectRatio > 1 ? "w-24 sm:w-32 md:w-52 lg:w-[416px] max-w-[120px] sm:max-w-[160px] md:max-w-[208px] lg:max-w-none" : "w-20 sm:w-28 md:w-40 lg:w-52 max-w-[80px] sm:max-w-[112px] md:max-w-[160px] lg:max-w-none" )}>
)} -
+
- {fetchedEvent ? ( - <> - - {eventAuthorProfile?.avatar && ( - { - e.currentTarget.style.display = 'none' - }} - /> - )} - - {eventTypeName} - - ) : ( - - {isFetchingEventFinal ? 'Loading event...' : 'Event'} - - )} +
+ {fetchedEvent ? ( + <> + + {eventAuthorProfile?.avatar && ( + { + e.currentTarget.style.display = 'none' + }} + /> + )} + + {eventTypeName} + + ) : ( + + {isFetchingEventFinal ? 'Loading event...' : 'Event'} + + )} +
e.stopPropagation()} - className="ml-auto" + className="flex-shrink-0" > - +
{fetchedEvent && ( @@ -593,7 +595,7 @@ export default function WebPreview({ url, className }: { url: string; className? target="_blank" rel="noopener noreferrer" onClick={(e) => e.stopPropagation()} - className="text-xs text-muted-foreground truncate block hover:underline" + className="text-xs text-muted-foreground truncate block hover:underline break-all" > {truncatedUrl} @@ -609,10 +611,10 @@ export default function WebPreview({ url, className }: { url: string; className? return (
{fetchedProfile?.avatar && ( -
+
)} -
+
- {fetchedProfile ? ( - <> - - {fetchedProfile.nip05 && ( - <> - - {fetchedProfile.nip05} - - )} - - ) : ( - - {isFetchingProfile ? 'Loading profile...' : 'Profile'} - - )} +
+ {fetchedProfile ? ( + <> + + {fetchedProfile.nip05 && ( + <> + + {fetchedProfile.nip05} + + )} + + ) : ( + + {isFetchingProfile ? 'Loading profile...' : 'Profile'} + + )} +
e.stopPropagation()} - className="ml-auto" + className="flex-shrink-0" > - +
{fetchedProfile?.about && ( -
{fetchedProfile.about}
+
{fetchedProfile.about}
)}
e.stopPropagation()} - className="text-xs text-muted-foreground truncate block hover:underline" + className="text-xs text-muted-foreground truncate block hover:underline break-all" > {truncatedUrl} @@ -668,18 +672,19 @@ export default function WebPreview({ url, className }: { url: string; className? // Basic fallback for non-nostr URLs - show site information return (
-
+

@@ -702,34 +707,35 @@ export default function WebPreview({ url, className }: { url: string; className? if (isSmallScreen && image) { // Small screen: always use horizontal layout with image on left return ( -
+
1 ? "w-[320px]" : "w-40" + ogImageAspectRatio !== null && ogImageAspectRatio > 1 ? "w-24 max-w-[120px]" : "w-20 max-w-[80px]" )}>
-
+
- {title &&
{title}
} - {!title && description &&
{description}
} + {title &&
{title}
} + {!title && description &&
{description}
}
e.stopPropagation()} - className="text-xs text-muted-foreground truncate block hover:underline" + className="text-xs text-muted-foreground truncate block hover:underline break-all" > {url} @@ -740,11 +746,11 @@ export default function WebPreview({ url, className }: { url: string; className? // Render all OG images on left side, crop wider ones return ( -
+
{image && (
1 ? "w-[416px]" : "w-52" + ogImageAspectRatio !== null && ogImageAspectRatio > 1 ? "w-32 sm:w-52 md:w-[416px]" : "w-20 sm:w-40 md:w-52" )}>
)} -
+
{title &&
{title}
} @@ -780,7 +787,7 @@ export default function WebPreview({ url, className }: { url: string; className? target="_blank" rel="noopener noreferrer" onClick={(e) => e.stopPropagation()} - className="text-xs text-muted-foreground truncate block hover:underline" + className="text-xs text-muted-foreground truncate block hover:underline break-all" > {url}