diff --git a/public/index.html b/public/index.html index 6127380..7a40884 100644 --- a/public/index.html +++ b/public/index.html @@ -8,7 +8,7 @@ - + @@ -34,15 +34,15 @@ - - - - - - - - - - + + + + + + + + + + diff --git a/public/js/views/profile.js b/public/js/views/profile.js index 644c7b4..8ced81e 100644 --- a/public/js/views/profile.js +++ b/public/js/views/profile.js @@ -200,6 +200,22 @@ const ProfileView = { window.ProfileView = ProfileView; +// Словари — общие для ProfileView и UserProfileView +const DRINKS = [ + ['beer', '🍺 Пиво'], ['wine', '🍷 Вино'], ['whiskey', '🥃 Виски'], ['vodka', '🍸 Водка'], + ['cocktail', '🍹 Коктейль'], ['rum', '🥃 Ром'], ['gin', '🍸 Джин'], ['tequila', '🌵 Текила'], + ['champagne', '🍾 Шампанское'], ['non_alcoholic', '🥤 Безалкогольное'], +]; +const ACTIVITIES = [ + ['walk', '🚶 Прогулка'], ['dinner', '🍽️ Ужин'], ['bar', '🍻 Бар'], ['cafe', '☕ Кафе'], + ['travel', '✈️ Путешествие'], ['movie', '🎬 Кино'], ['concert', '🎵 Концерт'], + ['sport', '⚽ Спорт'], ['gaming', '🎮 Игры'], ['reading', '📚 Чтение'], +]; +const PURPOSES = [ + ['chat', '💬 Пообщаться'], ['drink', '🍻 Выпить'], ['walk', '🌳 Погулять'], + ['dinner', '🍽️ Поужинать'], ['travel', '✈️ Поехать'], ['friendship', '🤝 Дружба'], +]; + // UserProfileView — чужой профиль (read-only) — открывается по тапу на маркер на карте const UserProfileView = { userId: null, @@ -228,6 +244,12 @@ const UserProfileView = { const rating = stats.rating_avg ? Number(stats.rating_avg).toFixed(1) : '—'; const reviewsCount = stats.rating_count || 0; + // prefs чужие — подтянем из ответа /users/:id (prefs включены в публичный ответ) + const prefs = u.prefs || {}; + const drinkLabels = DRINKS.filter(([k]) => (prefs.drinks || []).includes(k)).map(([, l]) => l); + const activityLabels = ACTIVITIES.filter(([k]) => (prefs.activities || []).includes(k)).map(([, l]) => l); + const purposeLabels = PURPOSES.filter(([k]) => (prefs.purposes || []).includes(k)).map(([, l]) => l); + document.getElementById('up-content').innerHTML = `
@@ -248,6 +270,30 @@ const UserProfileView = {
` : ''} + + ${(drinkLabels.length || activityLabels.length || purposeLabels.length) ? ` +
+ ${drinkLabels.length ? ` +
+
🍻 Что пьёт
+
${drinkLabels.map((l) => `${escapeHtml(l)}`).join('')}
+
+ ` : ''} + ${activityLabels.length ? ` +
+
🎯 Чем занимается
+
${activityLabels.map((l) => `${escapeHtml(l)}`).join('')}
+
+ ` : ''} + ${purposeLabels.length ? ` +
+
💡 Цели
+
${purposeLabels.map((l) => `${escapeHtml(l)}`).join('')}
+
+ ` : ''} +
+ ` : ''} +