From 31a39d74360ca60744741b275f66a3554b726415 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 21 Aug 2026 12:03:58 +0000 Subject: [PATCH] =?UTF-8?q?Debug:=20console.log=20=D0=B2=20UserProfileView?= =?UTF-8?q?=20+=20selfMarker=20=E2=86=92=20Profile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/js/views/map.js | 10 ++++++++-- public/js/views/profile.js | 5 ++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/public/js/views/map.js b/public/js/views/map.js index 6338972..7afe043 100644 --- a/public/js/views/map.js +++ b/public/js/views/map.js @@ -217,11 +217,17 @@ const MapView = { this.map.removeSource('radius-circle'); } - // маркер "Я" + // маркер "Я" (клик → свой профиль) this.selfMarkerEl = this.makeMarkerEl( - '
', + '
', 18 ); + this.selfMarkerEl.addEventListener('click', () => { + const me = API.Store.user; + if (me && (me.id || me.user_id)) { + App.showView('profile'); + } + }); this.selfMarkerObj = new maplibregl.Marker({ element: this.selfMarkerEl }) .setLngLat([lng, lat]) .addTo(this.map); diff --git a/public/js/views/profile.js b/public/js/views/profile.js index 0dd6533..90383cc 100644 --- a/public/js/views/profile.js +++ b/public/js/views/profile.js @@ -222,6 +222,7 @@ const UserProfileView = { ]); this.data = user.user || user; const u = this.data; + console.log('[UserProfile] loaded:', u && u.id, 'stats:', stats); const init = ((u.name || u.email || '?')[0] || '?').toUpperCase(); const rating = stats.rating_avg ? Number(stats.rating_avg).toFixed(1) : '—'; const reviewsCount = stats.rating_count || 0; @@ -229,10 +230,11 @@ const UserProfileView = { document.getElementById('up-content').innerHTML = `
-
${u.photo_url ? '' : init}
+
${u.photo ? '' : init}
${escapeHtml(u.name || '')}
${u.city ? `
📍 ${escapeHtml(u.city)}
` : ''} + ${u.age ? `
🎂 ${u.age} лет
` : ''} ${reviewsCount > 0 ? `
★ ${rating} · ${reviewsCount} ${pluralRu(reviewsCount, 'отзыв', 'отзыва', 'отзывов')}
` : ''}
@@ -272,6 +274,7 @@ const UserProfileView = { const revBtn = document.getElementById('up-reviews'); if (revBtn) revBtn.onclick = () => UserReviewsView.render(root, { userId: this.userId, userName: u.name }); } catch (e) { + console.error('[UserProfile] load failed:', e, 'userId:', this.userId); document.getElementById('up-content').innerHTML = `
⚠️ Не удалось загрузить
`; App._toast('Ошибка загрузки профиля', 'err'); }