Отключить мультиаккаунтность и уточнить статусы профиля

This commit is contained in:
AidarKC
2026-11-27 13:22:15 +03:00
parent ae430e84c7
commit 91a8bb9c3c
40 changed files with 312 additions and 383 deletions
+6 -1
View File
@@ -8,6 +8,7 @@ export function confirmDialog({
danger = false,
aboveEditor = false,
rememberChoice = null,
infoOnly = false,
} = {}) {
return new Promise((resolve) => {
const opener = document.activeElement;
@@ -40,6 +41,10 @@ export function confirmDialog({
}
modal.querySelector('[data-answer="no"]').textContent = cancelLabel;
modal.querySelector('[data-answer="yes"]').textContent = confirmLabel;
if (infoOnly) {
modal.querySelector('[data-answer="no"]').remove();
modal.querySelector('.form-actions-grid').classList.add('form-actions-grid--single');
}
const finish = (answer) => {
document.removeEventListener('keydown', onKeydown, true);
@@ -58,6 +63,6 @@ export function confirmDialog({
});
document.addEventListener('keydown', onKeydown, true);
document.body.append(modal);
modal.querySelector('[data-answer="no"]').focus();
modal.querySelector(infoOnly ? '[data-answer="yes"]' : '[data-answer="no"]').focus();
});
}
+8 -12
View File
@@ -15,7 +15,7 @@ export function escapeProfileHtml(text) {
const esc = escapeProfileHtml;
// Карточка статуса у аватара: кто подтвердил этот аккаунт и кого подтвердил он сам.
function statusSideHtml({ kind, title, active, received, given, verb }) {
function statusSideHtml({ kind, title, active, received, given, verb, showGiven = true }) {
const isOfficial = kind === 'primary';
const receivedKind = isOfficial ? 'primary_received' : 'shine_received';
const givenKind = isOfficial ? 'primary_given' : 'shine_given';
@@ -25,9 +25,9 @@ function statusSideHtml({ kind, title, active, received, given, verb }) {
<button type="button" class="pf-sc__row" data-profile-list="${receivedKind}" aria-label="${esc(title)}${th('remaining.html_profile_card.confirmed_by')}${Number(received || 0)}">
<strong>${Number(received || 0)}</strong><span>${th('screens.profile_card.text_017')}</span>
</button>
<button type="button" class="pf-sc__row" data-profile-list="${givenKind}" aria-label="${esc(title)}: ${esc(verb)} ${Number(given || 0)}">
${showGiven ? `<button type="button" class="pf-sc__row" data-profile-list="${givenKind}" aria-label="${esc(title)}: ${esc(verb)} ${Number(given || 0)}">
<strong>${Number(given || 0)}</strong><span>${esc(verb)}</span>
</button>
</button>` : ''}
</section>`;
}
@@ -92,15 +92,11 @@ export function profileCardHtml({ card, login = '', tilesHtml = '', tilesWrapCla
const shineGiven = Number(stats.shineGivenCount || 0);
const primaryReceived = Number(stats.primaryReceivedCount || 0);
const primaryGiven = Number(stats.primaryGivenCount || 0);
// Статусы по бокам аватара: слева «Официальный», справа «Сияние». На своём профиле – всегда
// (пустая сторона бледнее), на чужом – если статус есть или уже есть подтверждения.
const verb = card?.gender === 'female' ? t('screens.profile_card.text_009') : card?.gender === 'male' ? t('screens.profile_card.text_010') : t('screens.profile_card.text_011');
const officialSide = (isSelf || official || primaryReceived || primaryGiven)
? statusSideHtml({ kind: 'primary', title: t('screens.profile_card.text_001'), active: official, received: primaryReceived, given: primaryGiven, verb })
: '';
const shineSide = (isSelf || shining || shineReceived || shineGiven)
? statusSideHtml({ kind: 'shine', title: t('screens.profile_card.text_002'), active: shining, received: shineReceived, given: shineGiven, verb })
: '';
const verb = t('screens.registration_identity.given');
const officialSide = official
? statusSideHtml({ kind: 'primary', title: t('screens.profile_card.text_001'), active: true, received: primaryReceived, given: primaryGiven, verb }) : '';
const shineSide = shining
? statusSideHtml({ kind: 'shine', title: t('screens.profile_card.text_002'), active: true, received: shineReceived, given: shineGiven, verb, showGiven: official }) : '';
return `
<div class="pf-hero" aria-label="${th('remaining.html_profile_card.profile')}${esc(cardLogin)}">
@@ -1,20 +1,20 @@
import { t } from '../i18n/index.js';
/** В выборе тарифа счётчик не показываем: он начинается с логина. */
export function createRegistrationStepper(step) {
const current = Math.max(1, Math.min(4, Number(step) || 1));
export function createRegistrationStepper(step, total = 4) {
const current = Math.max(1, Math.min(total, Number(step) || 1));
const wrapper = document.createElement('div');
wrapper.className = 'signup-stepper';
wrapper.setAttribute('aria-label', t('screens.registration_stepper.text_001', { value1: current }));
wrapper.setAttribute('aria-label', t('screens.registration_stepper.text_001', { value1: current, value2: total }));
const dots = document.createElement('div');
dots.className = 'signup-stepper__dots';
for (let i = 1; i <= 4; i += 1) {
for (let i = 1; i <= total; i += 1) {
const dot = document.createElement('span');
dot.className = `signup-stepper__dot${i === current ? ' is-active' : ''}${i < current ? ' is-complete' : ''}`;
dots.append(dot);
}
const label = document.createElement('span');
label.className = 'signup-stepper__label';
label.textContent = t('screens.registration_stepper.text_002', { value1: current });
label.textContent = t('screens.registration_stepper.text_002', { value1: current, value2: total });
wrapper.append(dots, label);
return wrapper;
}