Профиль: поле «Город»

Город – обычное поле профиля (параметр city, тот же блок профиля, что у имени и пола):
в редактировании – между полом и адресом, с подсказками городов при вводе; в шапке профиля –
под логином («📍 Москва»). Из него собирается раскладка «Города» на карте связей. Подсказка
у адреса теперь «Улица, дом» – город отдельно. Сервер и формат блокчейна не менялись.
This commit is contained in:
q
2026-10-13 14:09:35 +03:00
parent 5caa4ce0ae
commit 694aaf1f0e
7 changed files with 17 additions and 5 deletions
+1 -1
View File
@@ -1,2 +1,2 @@
client.version=1.19.29
client.version=1.19.30
server.version=1.15.0
+1 -1
View File
@@ -39,7 +39,7 @@
}());
</script>
<script>
window.__SHINE_BUILD_HASH__ = '20261013160000';
window.__SHINE_BUILD_HASH__ = '20261013160500';
window.__SHINE_CLIENT_VERSION__ = '1.2.10';
</script>
<script>
+3
View File
@@ -1,5 +1,6 @@
// data-profile-list / data-self-profile-action / data-profile-action обрабатывают profile-view.js и user-profile-view.js.
import { iconHtml } from './ui-icon.js';
import { displayCity } from '../services/cities.js';
export function escapeProfileHtml(text) {
return String(text || '')
@@ -77,6 +78,7 @@ export function profileCardHtml({ card, login = '', tilesHtml = '', tilesWrapCla
const official = card?.accountRole === 'primary';
const shining = card?.shineStatus === 'shining';
const cardLogin = card?.login || login;
const city = displayCity(card?.city);
const fullName = [card?.firstName, card?.lastName].map((v) => String(v || '').trim()).filter(Boolean).join(' ');
const displayName = fullName || cardLogin || 'Профиль';
const about = String(card?.about || '').trim();
@@ -132,6 +134,7 @@ export function profileCardHtml({ card, login = '', tilesHtml = '', tilesWrapCla
<div class="pf-avatar user-profile-avatar-slot${shining ? ' is-shining' : ''}"></div>
<h2 class="pf-name">${esc(displayName)}</h2>
<div class="pf-login">@${esc(cardLogin)}</div>
${city ? `<div class="pf-city">${iconHtml('place')}<span>${esc(city)}</span></div>` : ''}
${badges ? `<div class="pf-badges">${badges}</div>` : ''}
</div>
+4 -2
View File
@@ -297,7 +297,7 @@ export function render({ navigate, chrome }) {
});
}
function openFieldEditModal({ label, value, placeholder = '', maxLength = 300, multiline = false }) {
function openFieldEditModal({ label, value, placeholder = '', maxLength = 300, multiline = false, suggestions = null }) {
const root = document.getElementById('modal-root');
if (!root) return Promise.resolve(null);
root.innerHTML = `
@@ -317,7 +317,8 @@ export function render({ navigate, chrome }) {
maxlength="${Number(maxLength || 300)}"
placeholder="${escapeHtml(placeholder || `Введите ${label.toLowerCase()}`)}"
value="${escapeHtml(String(value || ''))}"
/>`}
${suggestions?.length ? 'list="profile-field-edit-suggestions" autocomplete="off"' : ''}
/>${suggestions?.length ? `<datalist id="profile-field-edit-suggestions">${suggestions.map((item) => `<option value="${escapeHtml(item)}"></option>`).join('')}</datalist>` : ''}`}
<div class="meta-muted">До ${Number(maxLength || 300)} символов.</div>
<div class="form-actions-grid">
<button class="secondary-btn" id="profile-field-edit-cancel" type="button">Отмена</button>
@@ -711,6 +712,7 @@ export function render({ navigate, chrome }) {
placeholder: field.placeholder || '',
maxLength: field.maxLength || 300,
multiline: Boolean(field.multiline),
suggestions: field.suggestions,
});
if (entered === null) return;
if (String(entered).length > Number(field.maxLength || 300)) {
+1
View File
@@ -251,6 +251,7 @@ export async function loadUserProfileCard(login) {
blockchainName: normalizeLogin(user.blockchainName),
firstName: fields.first_name || '',
lastName: fields.last_name || '',
city: fields.city || '',
address: fields.address || '',
web: fields.web || '',
phone: fields.phone || '',
+5 -1
View File
@@ -1,11 +1,14 @@
import { authService, state } from '../state.js';
import { validateArweaveTxId, validateSha256Hex } from './arweave-file-service.js';
import { buildAvatarReference, parseAvatarReference } from './avatar-reference.js';
import { CITY_MAX_LENGTH, CITY_PARAM, CITY_SUGGESTIONS } from './cities.js';
export const profileFieldDefs = [
{ key: 'first_name', readKeys: ['first_name'], label: 'Имя', placeholder: 'Введите имя' },
{ key: 'last_name', readKeys: ['last_name'], label: 'Фамилия', placeholder: 'Введите фамилию' },
{ key: 'address', readKeys: ['address'], label: 'Адрес', placeholder: 'Город, улица, дом' },
// Город виден в профиле и собирает знакомых в раскладке «Города» на карте связей.
{ key: CITY_PARAM, readKeys: [CITY_PARAM], label: 'Город', placeholder: 'Например, Казань', maxLength: CITY_MAX_LENGTH, suggestions: CITY_SUGGESTIONS },
{ key: 'address', readKeys: ['address'], label: 'Адрес', placeholder: 'Улица, дом' },
{ key: 'web', readKeys: ['web'], label: 'Ссылки', placeholder: 'Сайт, профиль или другая ссылка' },
{ key: 'phone', readKeys: ['phone'], label: 'Телефон', placeholder: '+7 ...' },
{ key: 'about', readKeys: ['about'], label: 'О себе', placeholder: 'Коротко расскажите о себе', maxLength: 160, multiline: true },
@@ -107,6 +110,7 @@ export async function loadProfileSnapshot(login) {
placeholder: field.placeholder,
maxLength: Number(field.maxLength || 300),
multiline: Boolean(field.multiline),
suggestions: Array.isArray(field.suggestions) ? field.suggestions : null,
value: latest?.value || '',
timeMs: latest?.timeMs || 0,
});
@@ -47,6 +47,8 @@
.user-profile-screen .pf-name { margin: var(--space-2) 0 0; color: var(--text-primary); font-size: var(--text-xl); line-height: var(--leading-xl); font-weight: var(--weight-bold); overflow-wrap: anywhere; }
.user-profile-screen .pf-login { color: var(--text-secondary); font-size: var(--text-sm); line-height: var(--leading-sm); }
.user-profile-screen .pf-city { display: inline-flex; align-items: center; justify-content: center; gap: 4px; color: var(--text-secondary); font-size: var(--text-sm); line-height: var(--leading-sm); }
.user-profile-screen .pf-city svg { width: 15px; height: 15px; flex: 0 0 auto; }
@media (max-width: 360px) {
.user-profile-screen .pf-avatar,