fixed the logic and build the ownerResirvation page
All checks were successful
Build frontend / build (push) Successful in 1m36s
All checks were successful
Build frontend / build (push) Successful in 1m36s
This commit is contained in:
@ -678,7 +678,6 @@ export default function PropertiesPage() {
|
||||
const saleList = Array.isArray(saleData) ? saleData : [];
|
||||
|
||||
const mapped = [...rentList.map((p, i) => ({ ...mapApiProperty(t, p, i), purpose: "rent" })), ...saleList.map((p, i) => ({ ...mapApiProperty(t, p, rentList.length + i), purpose: "sale" }))];
|
||||
|
||||
setProperties(mapped);
|
||||
} catch (err) {
|
||||
console.error("[Properties] Failed to fetch properties:", err);
|
||||
@ -691,7 +690,9 @@ export default function PropertiesPage() {
|
||||
}, [filters, t]);
|
||||
|
||||
const filteredProperties = properties
|
||||
// العقارات يلي 0 ما تنعرض
|
||||
.filter((p) => p.purpose === purposeTab)
|
||||
.filter((p) => p.purpose === "rent" || p.status === 1)
|
||||
.filter((property) => {
|
||||
if (filters.search && !property.title.includes(filters.search) && !property.description.includes(filters.search)) {
|
||||
return false;
|
||||
@ -785,9 +786,12 @@ export default function PropertiesPage() {
|
||||
</div>
|
||||
|
||||
<div className={viewMode === "grid" ? "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6" : "space-y-4"}>
|
||||
{filteredProperties.map((property) => (
|
||||
<PropertyCard key={property.id} property={property} viewMode={viewMode} type={property.purpose} onLoginRequired={() => setShowLoginDialog(true)} />
|
||||
))}
|
||||
{/* شرط مشان ينعرض او لا */}
|
||||
{filteredProperties.map((property) =>
|
||||
property.purpose === "rent" || property.status === 1 ? (
|
||||
<PropertyCard key={property.id} property={property} viewMode={viewMode} type={property.purpose} onLoginRequired={() => setShowLoginDialog(true)} />
|
||||
) : null,
|
||||
)}
|
||||
</div>
|
||||
|
||||
{!loading && filteredProperties.length === 0 && (
|
||||
|
||||
Reference in New Issue
Block a user