From b87070f93b1d9576924dc94293d5857b19feb5d8 Mon Sep 17 00:00:00 2001 From: iFixKart Dev Date: Tue, 17 Nov 2026 13:49:05 +0530 Subject: [PATCH] feat(reviews): add product thumbnail, renavigation link, and fix broken image rendering in review moderation --- app/(admin)/reviews-moderation/page.tsx | 74 +++++++++++++++++++++---- 1 file changed, 63 insertions(+), 11 deletions(-) diff --git a/app/(admin)/reviews-moderation/page.tsx b/app/(admin)/reviews-moderation/page.tsx index 9c29e59..e069a6f 100644 --- a/app/(admin)/reviews-moderation/page.tsx +++ b/app/(admin)/reviews-moderation/page.tsx @@ -1,7 +1,7 @@ 'use client'; import { useMemo, useState, useEffect } from 'react'; -import { Star, RefreshCw, Search, ShieldCheck, Image as ImageIcon } from 'lucide-react'; +import { Star, RefreshCw, Search, ShieldCheck, Image as ImageIcon, ExternalLink, Package } from 'lucide-react'; import { toast } from 'sonner'; import { TablePagination, useClientPagination } from '@/components/ui/TablePagination'; import { adminService } from '@/services/api/adminService'; @@ -9,6 +9,9 @@ import { adminService } from '@/services/api/adminService'; interface ReviewItem { review_id: string; product_id: string; + product_name?: string; + product_slug?: string; + product_thumbnail?: string; author_name: string; author_email?: string; rating: number; @@ -161,7 +164,7 @@ export default function ReviewsModerationPage() { - + @@ -187,6 +190,11 @@ export default function ReviewsModerationPage() { ) : ( pager.items.map((rev) => { const photos = (rev.images || []).filter(Boolean); + const prodThumb = rev.product_thumbnail + ? (rev.product_thumbnail.startsWith('http') + ? rev.product_thumbnail + : `https://ifixkart.trionixsolution.com${rev.product_thumbnail.startsWith('/') ? '' : '/'}${rev.product_thumbnail}`) + : null; return (
@@ -202,9 +210,35 @@ export default function ReviewsModerationPage() { )} - - {rev.product_id} - +
+ {prodThumb ? ( + { e.currentTarget.style.display = 'none'; }} + className="w-10 h-10 object-contain rounded border border-border bg-white shrink-0 p-0.5" + /> + ) : ( +
+ +
+ )} + +
{renderStars(rev.rating)} @@ -214,12 +248,30 @@ export default function ReviewsModerationPage() {

{rev.comment}

{photos.length > 0 && (
- {photos.map((imgUrl, i) => ( - - - - ))} + {photos.map((imgUrl, i) => { + const fullUrl = imgUrl.startsWith('http') + ? imgUrl + : `https://ifixkart.trionixsolution.com${imgUrl.startsWith('/') ? '' : '/'}${imgUrl}`; + return ( + + { + const el = e.currentTarget.closest('a'); + if (el) el.style.display = 'none'; + }} + /> + + ); + })}
)} {rev.images.length > 0 && photos.length === 0 && (