From e6d3d07fd46bf8223bd61add7ed1f3552c8b4cda Mon Sep 17 00:00:00 2001 From: kenilkb Date: Thu, 16 Jul 2026 09:41:22 +0530 Subject: [PATCH] Feat: Redesign URL asset viewer preview with browser mockup & access guide --- .../features/assets/components/AssetCard.tsx | 85 +++++++--- .../assets/components/AssetViewerModal.tsx | 150 ++++++++++++++---- 2 files changed, 178 insertions(+), 57 deletions(-) diff --git a/Channel-Frontend/src/features/assets/components/AssetCard.tsx b/Channel-Frontend/src/features/assets/components/AssetCard.tsx index 3bb0f4c..110a1ec 100644 --- a/Channel-Frontend/src/features/assets/components/AssetCard.tsx +++ b/Channel-Frontend/src/features/assets/components/AssetCard.tsx @@ -12,13 +12,23 @@ import { ExternalLink, Download, Clock, - AlertCircle + AlertCircle, + Globe } from 'lucide-react'; import type { Asset } from '../../../types/assets'; import type { User } from '../../../types/auth'; import { axiosInstance } from '../../../services/axios'; import { PdfThumbnail } from './PdfThumbnail'; +const getFriendlyHostname = (urlStr: string) => { + try { + const urlObj = new URL(urlStr); + return urlObj.hostname.replace('www.', ''); + } catch { + return 'website.com'; + } +}; + interface AssetCardProps { asset: Asset; user: User | null; @@ -250,33 +260,56 @@ export const AssetCard: React.FC = ({ } /> ) : asset.type === 'url' ? ( -
- {asset.title} { - e.currentTarget.style.display = 'none'; - const placeholder = document.getElementById(`fallback-${asset.id}`); - if (placeholder) placeholder.style.display = 'flex'; - }} - /> -
-
-
-
- Web Link +
+ {/* Browser Header Bar */} +
+ {/* Windows Dots */} +
+ + + +
+ {/* URL Bar */} +
+ + {getFriendlyHostname(asset.url)} +
+
+ + {/* Browser Body Web Mockup */} +
+ {/* Decorative Grid Pattern */} +
+ + {/* Mock Web Page Hero Abstract Layout */} +
+ {/* Mock Navbar */} +
+
+
+
+
-
- +
+ {/* Mock Page Content */} +
+
+
+
+
+
+ + {/* Mock Card Domain Display */} +
+
+ {getFriendlyHostname(asset.url).charAt(0).toUpperCase()} +
+
+
+ {getFriendlyHostname(asset.url)}
-
- URL LINK - HTML +
+ EXTERNAL PORTAL
diff --git a/Channel-Frontend/src/features/assets/components/AssetViewerModal.tsx b/Channel-Frontend/src/features/assets/components/AssetViewerModal.tsx index 6a92f5d..889281b 100644 --- a/Channel-Frontend/src/features/assets/components/AssetViewerModal.tsx +++ b/Channel-Frontend/src/features/assets/components/AssetViewerModal.tsx @@ -299,46 +299,134 @@ export const AssetViewerModal: React.FC = ({
- External Web Link Preview + External Web Link Portal Guide {asset.url}
-
-
- {asset.thumbnailUrl ? ( -
- Web Preview Banner + +
+ {/* Visual Section: Browser Mockup */} +
+ {/* Browser Header Bar */} +
+
+ + +
- ) : ( -
- +
+ + {(() => { + try { + return new URL(asset.url).hostname.replace('www.', ''); + } catch { + return 'website.com'; + } + })()} +
+
+ + {/* Browser Content */} +
+
+ +
+
+
+
+
+
+
+
+ +
+
+
+
+
- )} -
-

{asset.title}

- {asset.description ? ( -

{asset.description}

- ) : ( -

No description provided for this external link.

- )} +
+
+ {(() => { + try { + return new URL(asset.url).hostname.replace('www.', '').charAt(0).toUpperCase(); + } catch { + return 'W'; + } + })()} +
+
+
+ {(() => { + try { + return new URL(asset.url).hostname.replace('www.', ''); + } catch { + return 'website.com'; + } + })()} +
+
+ SECURE PORTAL LINK +
+
+
+
+
+ + {/* Info & Guide Section */} +
+
+
+ + External Portal Link + +

{asset.title}

+ {asset.description ? ( +

{asset.description}

+ ) : ( +

No description provided for this external portal link.

+ )} +
+ + {/* Step-by-Step Access Guide */} +
+ Access Guide +
    +
  • + 1 + Click the primary button below or select Open in New Tab from the footer to access this asset. +
  • +
  • + 2 + If the partner resource requires authorization, use your partner account credentials to sign in. +
  • +
+
-
+
{(user?.role === 'ADMIN' || asset.isDownloadable || asset.downloadRequests?.[0]?.status === 'APPROVED') ? ( - - Open Website in New Tab - - +
+ + Open Website in New Tab + + + +
) : (
Access Restricted: You must request and receive approval from the Administrator to open this external link.