Remove all fallback dummy data - API-only
All checks were successful
Build frontend / build (push) Successful in 38s

- Removed FALLBACK_PROPERTIES from main page, properties listing, and property detail
- Pages now start empty and populate only from API responses
- Show empty state / error on API failure instead of dummy data
This commit is contained in:
Claw AI
2026-03-28 17:48:00 +00:00
parent b6e9f01938
commit da0c36727f
3 changed files with 10 additions and 138 deletions

View File

@ -85,86 +85,7 @@ function mapApiProperty(item, index) {
// extractCity is now imported from @/app/enums
// Fallback dummy data
const FALLBACK_PROPERTIES = [
{
id: 1,
title: 'فيلا فاخرة في المزة',
description: 'فيلا فاخرة مع حديقة خاصة ومسبح في أفضل أحياء دمشق.',
type: 'villa',
price: 500000,
priceUSD: 50,
priceUnit: 'daily',
location: { city: 'دمشق', district: 'المزة', address: 'شارع المزة - فيلات غربية', lat: 33.5138, lng: 36.2765 },
bedrooms: 5, bathrooms: 4, area: 450,
features: ['مسبح', 'حديقة خاصة', 'موقف سيارات', 'أمن 24/7', 'تدفئة مركزية', 'تكييف مركزي'],
images: ['/villa1.jpg', '/villa2.jpg', '/villa3.jpg'],
status: 'available', rating: 4.8, isNew: true,
allowedIdentities: ['syrian', 'passport'],
priceDisplay: { daily: 500000, monthly: 15000000 },
bookings: [{ startDate: '2024-03-10', endDate: '2024-03-15' }, { startDate: '2024-03-20', endDate: '2024-03-25' }]
},
{
id: 2,
title: 'شقة حديثة في الشهباء',
description: 'شقة عصرية في حي الشهباء الراقي بحلب.',
type: 'apartment',
price: 250000, priceUSD: 25, priceUnit: 'daily',
location: { city: 'حلب', district: 'الشهباء', address: 'شارع النيل - بناء الرحاب', lat: 36.2021, lng: 37.1347 },
bedrooms: 3, bathrooms: 2, area: 180,
features: ['مطبخ مجهز', 'بلكونة', 'موقف سيارات', 'مصعد'],
images: ['/apartment1.jpg', '/apartment2.jpg'],
status: 'available', rating: 4.5, isNew: false,
allowedIdentities: ['syrian'],
priceDisplay: { daily: 250000, monthly: 7500000 },
bookings: [{ startDate: '2024-03-05', endDate: '2024-03-08' }]
},
{
id: 3,
title: 'بيت عائلي في بابا عمرو',
description: 'بيت واسع مناسب للعائلات في حمص.',
type: 'house',
price: 350000, priceUSD: 35, priceUnit: 'daily',
location: { city: 'حمص', district: 'بابا عمرو', address: 'حي الزهور', lat: 34.7265, lng: 36.7186 },
bedrooms: 4, bathrooms: 3, area: 300,
features: ['حديقة كبيرة', 'موقف سيارات', 'مدفأة', 'كراج'],
images: ['/house1.jpg'],
status: 'booked', rating: 4.3, isNew: false,
allowedIdentities: ['syrian', 'passport'],
priceDisplay: { daily: 350000, monthly: 10500000 },
bookings: []
},
{
id: 4,
title: 'شقة بجانب البحر',
description: 'شقة رائعة مع إطلالة بحرية في اللاذقية.',
type: 'apartment',
price: 300000, priceUSD: 30, priceUnit: 'daily',
location: { city: 'اللاذقية', district: 'الشاطئ الأزرق', address: 'الكورنيش الغربي', lat: 35.5306, lng: 35.7801 },
bedrooms: 3, bathrooms: 2, area: 200,
features: ['إطلالة بحرية', 'شرفة', 'تكييف', 'أمن'],
images: ['/seaside1.jpg', '/seaside2.jpg', '/seaside3.jpg'],
status: 'available', rating: 4.9, isNew: true,
allowedIdentities: ['passport'],
priceDisplay: { daily: 300000, monthly: 9000000 },
bookings: []
},
{
id: 5,
title: 'فيلا في درعا',
description: 'فيلا فاخرة في حي الأطباء بدرعا.',
type: 'villa',
price: 400000, priceUSD: 40, priceUnit: 'daily',
location: { city: 'درعا', district: 'حي الأطباء', address: 'شارع الشفاء', lat: 32.6237, lng: 36.1016 },
bedrooms: 4, bathrooms: 3, area: 350,
features: ['حديقة مثمرة', 'أنظمة أمن', 'مسبح', 'كراج'],
images: ['/villa4.jpg', '/villa5.jpg'],
status: 'available', rating: 4.6, isNew: false,
allowedIdentities: ['syrian', 'passport'],
priceDisplay: { daily: 400000, monthly: 12000000 },
bookings: []
}
];
// API-only — no fallback data
export default function HomePage() {
const mapSectionRef = useRef(null);
@ -176,7 +97,7 @@ export default function HomePage() {
const [showUserMenu, setShowUserMenu] = useState(false);
const menuRef = useRef(null);
const [allProperties, setAllProperties] = useState(FALLBACK_PROPERTIES);
const [allProperties, setAllProperties] = useState([]);
const [loading, setLoading] = useState(true);
// Fetch properties from API on mount
@ -210,8 +131,7 @@ export default function HomePage() {
}
// If API returns empty, keep fallback
} catch (err) {
console.warn('Failed to fetch properties, using fallback data:', err);
// keep fallback data
console.error('[Home] Failed to fetch properties:', err);
} finally {
setLoading(false);
}

View File

@ -85,14 +85,7 @@ function extractCity(address) {
return '';
}
// Fallback data
const FALLBACK_PROPERTIES = [
{ id: 1, title: 'فيلا فاخرة في المزة', description: 'فيلا فاخرة مع حديقة خاصة ومسبح في أفضل أحياء دمشق.', type: 'villa', price: 500000, priceUnit: 'daily', location: { city: 'دمشق', district: 'المزة' }, bedrooms: 5, bathrooms: 4, area: 450, features: ['مسبح', 'حديقة خاصة', 'موقف سيارات', 'أمن'], images: ['/villa1.jpg'], status: 'available', rating: 4.8, isNew: true },
{ id: 2, title: 'شقة حديثة في الشهباء', description: 'شقة عصرية في حي الشهباء الراقي بحلب.', type: 'apartment', price: 250000, priceUnit: 'daily', location: { city: 'حلب', district: 'الشهباء' }, bedrooms: 3, bathrooms: 2, area: 180, features: ['مطبخ مجهز', 'بلكونة', 'موقف سيارات', 'مصعد'], images: ['/apartment1.jpg'], status: 'available', rating: 4.5, isNew: false },
{ id: 3, title: 'بيت عائلي في بابا عمرو', description: 'بيت واسع مناسب للعائلات في حمص.', type: 'house', price: 350000, priceUnit: 'daily', location: { city: 'حمص', district: 'بابا عمرو' }, bedrooms: 4, bathrooms: 3, area: 300, features: ['حديقة كبيرة', 'موقف سيارات', 'مدفأة'], images: ['/house1.jpg'], status: 'booked', rating: 4.3, isNew: false },
{ id: 4, title: 'شقة بجانب البحر', description: 'شقة رائعة مع إطلالة بحرية في اللاذقية.', type: 'apartment', price: 300000, priceUnit: 'daily', location: { city: 'اللاذقية', district: 'الشاطئ الأزرق' }, bedrooms: 3, bathrooms: 2, area: 200, features: ['إطلالة بحرية', 'شرفة', 'تكييف'], images: ['/seaside1.jpg'], status: 'available', rating: 4.9, isNew: true },
{ id: 5, title: 'فيلا في درعا', description: 'فيلا فاخرة في حي الأطباء بدرعا.', type: 'villa', price: 400000, priceUnit: 'daily', location: { city: 'درعا', district: 'حي الأطباء' }, bedrooms: 4, bathrooms: 3, area: 350, features: ['حديقة مثمرة', 'أنظمة أمن', 'مسبح'], images: ['/villa4.jpg'], status: 'available', rating: 4.6, isNew: false },
];
// API-only — no fallback data
const PropertyCard = ({ property, viewMode = 'grid' }) => {
const [isFavorite, setIsFavorite] = useState(false);
@ -470,7 +463,7 @@ const FilterBar = ({ filters, onFilterChange }) => {
export default function PropertiesPage() {
const [viewMode, setViewMode] = useState('grid');
const [sortBy, setSortBy] = useState('newest');
const [properties, setProperties] = useState(FALLBACK_PROPERTIES);
const [properties, setProperties] = useState([]);
const [loading, setLoading] = useState(true);
const [filters, setFilters] = useState({
search: '',
@ -503,7 +496,7 @@ export default function PropertiesPage() {
setProperties(mapped);
}
} catch (err) {
console.warn('Failed to fetch properties:', err);
console.error('[Properties] Failed to fetch properties:', err);
} finally {
setLoading(false);
}

View File

@ -122,39 +122,7 @@ function mapApiDetail(item) {
// extractCity is now imported from @/app/enums
// Fallback data (same as before)
const FALLBACK_PROPERTIES = {
1: {
id: 1,
title: 'فيلا فاخرة في المزة',
description: `تتميز هذه الفيلا الفاخرة بتصميمها العصري وموقعها المميز في أفضل أحياء دمشق.`,
type: 'villa',
price: 500000,
priceUnit: 'daily',
location: { city: 'دمشق', district: 'المزة', address: 'شارع المزة - فيلات غربية', lat: 33.5, lng: 36.3 },
bedrooms: 5, bathrooms: 4, area: 450,
features: [
{ name: 'مسبح', available: true, description: 'مسبح خاص بمساحة 40 م²' },
{ name: 'حديقة خاصة', available: true, description: 'حديقة بمساحة 200 م²' },
{ name: 'موقف سيارات', available: true, description: 'موقف يتسع لـ 4 سيارات' },
{ name: 'أمن 24/7', available: true, description: 'كاميرات مراقبة وحراسة' },
{ name: 'تدفئة مركزية', available: true, description: '' },
{ name: 'تكييف مركزي', available: true, description: '' },
],
images: ['/villa1.jpg', '/villa2.jpg', '/villa3.jpg'],
status: 'available', rating: 4.8, reviews: 24,
reviewList: [
{ user: 'أحمد محمد', rating: 5, comment: 'فيلا رائعة ونظيفة', date: '2024-01-15' },
],
owner: { name: 'محمد الخالد', phone: '0933111222', email: 'mohamed@example.com', rating: 4.9, properties: 5, memberSince: '2023', responseRate: '98%', responseTime: 'خلال ساعة' },
nearby: [
{ type: 'مدرسة', distance: '500م' },
{ type: 'مستشفى', distance: '1كم' },
],
specifications: { constructionYear: 2022, floor: 'أرضي + 2', parking: 4, gardenArea: 200, poolArea: 40, furnished: true, airConditioning: 'مركزي', heating: 'مركزي', electricity: '220V', water: 'شبكة عامة' },
rules: ['لا يسمح بالحيوانات الأليفة', 'لا يسمح بالتدخين داخل الغرف'],
},
};
// API-only — no fallback data
export default function PropertyDetailsPage() {
const params = useParams();
@ -195,19 +163,10 @@ export default function PropertyDetailsPage() {
return;
}
}
// Fallback to local data
const fallback = FALLBACK_PROPERTIES[id];
if (fallback) {
setProperty(fallback);
} else {
// Use property 1 as last resort
setProperty(FALLBACK_PROPERTIES[1] || null);
}
setProperty(null);
} catch (err) {
console.warn('Failed to fetch property, using fallback:', err);
const fallback = FALLBACK_PROPERTIES[id];
setProperty(fallback || FALLBACK_PROPERTIES[1] || null);
console.error('[Property] Failed to fetch property:', err);
setProperty(null);
} finally {
setLoading(false);
}