added a swicher on the properties
Some checks failed
Build frontend / build (push) Failing after 40s
Some checks failed
Build frontend / build (push) Failing after 40s
This commit is contained in:
@ -20,8 +20,6 @@ import AuthService from '../../services/AuthService';
|
||||
import { useFavorites } from '@/app/contexts/FavoritesContext';
|
||||
import { BuildingTypeKeys, PropertyStatusKeys, extractCity } from '../../enums';
|
||||
import PropertyRatingList from '@/app/components/ratings/PropertyRatingList';
|
||||
import PropertyRatingForm from '@/app/components/ratings/PropertyRatingForm';
|
||||
import StarRating from '@/app/components/ratings/StarRating';
|
||||
import { getPropertyAverageRating } from '../../utils/ratings';
|
||||
import dynamic from 'next/dynamic';
|
||||
import 'leaflet/dist/leaflet.css';
|
||||
@ -189,7 +187,6 @@ export default function PropertyDetailsPage() {
|
||||
const [isOwnProperty, setIsOwnProperty] = useState(false);
|
||||
const [favLoading, setFavLoading] = useState(false);
|
||||
const [avgRating, setAvgRating] = useState(null);
|
||||
const [showRatingForm, setShowRatingForm] = useState(false);
|
||||
const [showContact, setShowContact] = useState(false);
|
||||
const [contactInfo, setContactInfo] = useState(null);
|
||||
const [ownerData, setOwnerData] = useState(null);
|
||||
@ -264,7 +261,6 @@ export default function PropertyDetailsPage() {
|
||||
const avg = await getPropertyAverageRating(propId);
|
||||
setAvgRating(avg);
|
||||
} catch {}
|
||||
};
|
||||
|
||||
const fetchContactInfo = async () => {
|
||||
if (!property) return;
|
||||
@ -605,7 +601,7 @@ export default function PropertyDetailsPage() {
|
||||
<div className="text-[10px] text-gray-500">بلكونات</div>
|
||||
</div>
|
||||
)}
|
||||
{avgRating !== null && avgRating > 0 && (
|
||||
{avgRating !== null && avgRating > 0 && (
|
||||
<div className="bg-gray-50 rounded-lg p-2 text-center">
|
||||
<Star className="w-4 h-4 text-amber-500 mx-auto mb-0.5 fill-amber-500" />
|
||||
<div className="font-bold text-gray-900 text-sm">{avgRating.toFixed(1)}</div>
|
||||
@ -782,23 +778,6 @@ export default function PropertyDetailsPage() {
|
||||
<PropertyRatingList propertyId={property._raw?.propertyInformationId || property.id} />
|
||||
</motion.div>
|
||||
|
||||
{AuthService.isAuthenticated() && !showRatingForm && (
|
||||
<motion.div initial={{ opacity: 0, y: 20 }} animate={{ opacity: 1, y: 0 }}
|
||||
className="bg-amber-50 border-2 border-dashed border-amber-200 rounded-2xl p-6 text-center cursor-pointer hover:bg-amber-100 transition-colors"
|
||||
onClick={() => setShowRatingForm(true)}>
|
||||
<Star className="w-10 h-10 text-amber-500 mx-auto mb-2" />
|
||||
<h3 className="font-bold text-amber-800 text-lg mb-1">قيّم هذا العقار</h3>
|
||||
<p className="text-amber-600 text-sm">شارك تجربتك مع المستأجرين الآخرين</p>
|
||||
</motion.div>
|
||||
)}
|
||||
|
||||
{showRatingForm && (
|
||||
<PropertyRatingForm
|
||||
reservationId={property._raw?.propertyInformationId || property.id}
|
||||
onSuccess={handleRatingSuccess}
|
||||
onCancel={() => setShowRatingForm(false)}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Sidebar */}
|
||||
|
||||
Reference in New Issue
Block a user