Spaces:
Running

DISSASTER commited on
Commit
9de0fc9
·
verified ·
1 Parent(s): bdff6d0

Задача: при клике на маркер на карте должна открываться мини-карточка объекта. 1. Для каждого объекта уже есть карточка на главной странице. У каждой карточки есть уникальный ID или другой идентификатор. Используй этот же ID, чтобы связать маркер на карте с карточкой объекта. 2. При клике на маркер: - Автоматически получай данные из существующей карточки на главной (фото, заголовок, адрес, цена (в правом верхнем углу фотографии), тип предложения (в левом верхнем углу фотографии), 3 ячейки информации как на основной карточки (с подписью что за данные в данных ячейках), кнопка «Подробнее» которая открывает overlay карточки объекта. - НЕ создавай и не заполняй эти данные вручную — они должны подгружаться из уже готовой карточки. 3. Мини-карточка на карте: - Размер примерно 35–40% от карточки на главной странице. - Фото уменьшено пропорционально. - Заголовок и описание обрезаны до 1–2 строк. - Сохраняй тот же дизайн, но в миниатюрном виде. 4. Кнопка «Подробнее» в мини-карточке: - Открывает то же Overlay-окно с полным описанием объекта, что и при клике на кнопку «Подробнее» на карточках главной странице. 5. Мини-карточка должна появляться во всплывающем окне (popup) рядом с маркером. 6. На мобильных устройствах карточка должна открываться корректно и не перекрывать карту. - Follow Up Deployment

Browse files
Files changed (1) hide show
  1. index.html +72 -14
index.html CHANGED
@@ -172,9 +172,31 @@
172
  font-family: 'Montserrat', sans-serif;
173
  }
174
 
175
- .map-popup h4 {
176
- margin-bottom: 6px;
177
- font-size: 16px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  }
179
 
180
  .map-placeholder {
@@ -1300,22 +1322,58 @@
1300
  title: title
1301
  }).addTo(mainMap);
1302
 
1303
- // Customize popup content
 
 
 
 
 
 
 
 
 
 
 
 
1304
  const popupContent = `
1305
- <div class="map-popup">
1306
- <h4 class="font-bold">${title}</h4>
1307
- <div class="text-gold-600">${price}</div>
1308
- <div class="text-sm">${type}</div>
1309
- <button class="mt-2 px-2 py-1 bg-gold-500 text-black text-sm rounded hover:bg-gold-600 transition"
1310
- onclick="document.querySelector('[data-coords=\"${coords}\"] .view-details-btn').click()">
1311
- Подробнее
1312
- </button>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1313
  </div>
1314
  `;
1315
 
1316
  marker.bindPopup(popupContent, {
1317
- maxWidth: 250,
1318
- className: 'map-popup-container'
 
 
 
1319
  });
1320
 
1321
  propertyMarkers.push(marker);
 
172
  font-family: 'Montserrat', sans-serif;
173
  }
174
 
175
+ .map-popup-mini {
176
+ font-family: 'Montserrat', sans-serif;
177
+ background: white;
178
+ border-radius: 0.5rem;
179
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
180
+ }
181
+
182
+ .map-popup-mini h4 {
183
+ margin-bottom: 4px;
184
+ font-size: 14px;
185
+ }
186
+
187
+ .leaflet-popup-content {
188
+ margin: 0 !important;
189
+ }
190
+
191
+ .leaflet-popup-content-wrapper {
192
+ padding: 0 !important;
193
+ border-radius: 0.5rem !important;
194
+ }
195
+
196
+ @media (max-width: 768px) {
197
+ .map-popup-mini {
198
+ width: 200px !important;
199
+ }
200
  }
201
 
202
  .map-placeholder {
 
1322
  title: title
1323
  }).addTo(mainMap);
1324
 
1325
+ // Get the property card HTML for this marker
1326
+ const propertyCard = card;
1327
+ const propertyImage = propertyCard.querySelector('img').src;
1328
+ const propertyTitle = propertyCard.querySelector('h3').textContent;
1329
+ const propertyAddress = propertyCard.querySelector('.flex.items-center span').textContent;
1330
+ const propertyPrice = propertyCard.querySelector('.price-tag').textContent;
1331
+ const propertyType = propertyCard.querySelector('.type-tag').textContent;
1332
+ const propertyFeatures = Array.from(propertyCard.querySelectorAll('.grid-cols-3 > div')).map(feature => ({
1333
+ label: feature.querySelector('.text-sm').textContent,
1334
+ value: feature.querySelector('.font-semibold').textContent
1335
+ }));
1336
+
1337
+ // Create mini card popup content
1338
  const popupContent = `
1339
+ <div class="map-popup-mini" style="width: 250px;">
1340
+ <div class="relative">
1341
+ <img src="${propertyImage}" alt="${propertyTitle}" class="w-full h-32 object-cover rounded-t-lg">
1342
+ <div class="absolute top-2 left-2 text-xs font-bold px-2 py-1 rounded ${propertyType === 'ПРЕМИУМ' ? 'bg-yellow-500 text-black' : 'bg-blue-500 text-white'}">
1343
+ ${propertyType}
1344
+ </div>
1345
+ <div class="absolute top-2 right-2 bg-yellow-500 text-black font-bold text-xs px-2 py-1 rounded-full">
1346
+ ${propertyPrice}
1347
+ </div>
1348
+ </div>
1349
+ <div class="p-3">
1350
+ <h4 class="font-bold text-sm mb-1 truncate">${propertyTitle}</h4>
1351
+ <p class="text-gray-600 text-xs mb-2 truncate">
1352
+ <i class="fas fa-map-marker-alt text-yellow-500 mr-1"></i>
1353
+ ${propertyAddress}
1354
+ </p>
1355
+ <div class="grid grid-cols-3 gap-1 mb-3">
1356
+ ${propertyFeatures.slice(0, 3).map(feature => `
1357
+ <div class="text-center">
1358
+ <div class="text-xs text-gray-500">${feature.label}</div>
1359
+ <div class="text-sm font-semibold">${feature.value}</div>
1360
+ </div>
1361
+ `).join('')}
1362
+ </div>
1363
+ <button class="w-full bg-yellow-500 text-black text-xs font-bold py-2 px-3 rounded hover:bg-yellow-600 transition"
1364
+ onclick="document.querySelector('[data-coords=\"${coords}\"] .view-details-btn').click()">
1365
+ Подробнее
1366
+ </button>
1367
+ </div>
1368
  </div>
1369
  `;
1370
 
1371
  marker.bindPopup(popupContent, {
1372
+ maxWidth: 300,
1373
+ minWidth: 200,
1374
+ className: 'map-popup-mini-container',
1375
+ closeButton: false,
1376
+ offset: L.point(0, -20)
1377
  });
1378
 
1379
  propertyMarkers.push(marker);