Display property images from API using full URLs
All checks were successful
Build frontend / build (push) Successful in 1m3s

- All mappers extract images from propertyInformation.images
- Paths prefixed with API base URL (http://45.93.137.91/api)
- Falls back to placeholder if no images
- Updated: main page, properties listing, property detail, owner properties
This commit is contained in:
Claw AI
2026-03-30 01:01:42 +00:00
parent 4299968764
commit 39193337b3
5 changed files with 69 additions and 42 deletions

View File

@ -70,6 +70,13 @@ function mapApiDetail(item) {
const typeLabels = { 0: 'شقة', 1: 'فيلا', 2: 'بيت' };
// Extract images from API and build full URLs
const apiBase = typeof window !== 'undefined' ? (process.env.NEXT_PUBLIC_API_URL || 'http://45.93.137.91/api') : '';
const rawImages = Array.isArray(info.images) ? info.images : [];
const images = rawImages.length > 0
? rawImages.map(img => img.startsWith('http') ? img : `${apiBase}${img}`)
: ['/property-placeholder.jpg', '/villa1.jpg', '/villa2.jpg'];
return {
id: item.id,
title: info.address || `عقار #${item.id}`,
@ -90,7 +97,7 @@ function mapApiDetail(item) {
features: features.length > 0 ? features : [
{ name: 'متاح للإيجار', available: true, description: '' },
],
images: ['/property-placeholder.jpg', '/villa1.jpg', '/villa2.jpg'],
images,
status,
rating: item.rating || 4.5,
reviews: 0,