Улучшить UI регистрации и связанные сценарии

This commit is contained in:
AidarKC
2026-11-08 18:04:06 +03:00
parent 9405f28525
commit 4068465ee6
66 changed files with 842 additions and 221 deletions
+11 -13
View File
@@ -14,8 +14,7 @@ import {
softHaptic,
writeChannelNotificationsState,
} from '../services/channels-ux.js';
import { makeShineChannelRoute } from '../services/shine-routes.js';
import { makeShineChannelShortRoute } from '../services/shine-routes.js';
import { formatChannelAddress, makeShineChannelRoute, makeShineChannelShortRoute } from '../services/shine-routes.js';
import { renderAvatar } from '../components/avatar-image.js';
import { createOverflowDots } from '../components/overflow-dots.js';
import { createDropdownMenu } from '../components/dropdown-menu.js';
@@ -243,7 +242,7 @@ function channelSuggestionsByInput(rawInput) {
if (!owner || !channel) return null;
return {
key: `${owner.toLowerCase()}/${channel.toLowerCase()}`,
label: `@${owner}/${channel}`,
label: formatChannelAddress({ ownerLogin: owner, channelName: channel }),
owner,
channel,
};
@@ -252,8 +251,7 @@ function channelSuggestionsByInput(rawInput) {
return uniqueBy(rows, (it) => it.key)
.filter((it) => (
it.channel.toLowerCase().includes(q) ||
`${it.owner.toLowerCase()}/${it.channel.toLowerCase()}`.includes(q) ||
`@${it.owner.toLowerCase()}/${it.channel.toLowerCase()}`.includes(q)
formatChannelAddress({ ownerLogin: it.owner.toLowerCase(), channelName: it.channel.toLowerCase() }).includes(normalizeLoginInput(q))
))
.slice(0, 7)
.map((it) => it.label);
@@ -334,10 +332,10 @@ function isFollowedChannelVisible(target) {
function openSimpleSubscribeModal({ kind, kindLabel, submitLabel, unfollow = false, onSuccess }) {
const targetHint = kind === 'channel'
? '<p class="meta-muted">Канал: user/channel или имя канала.</p>'
: '<p class="meta-muted">Автор: @login или login.</p>';
? '<p class="meta-muted">Канал: Alice@free/channel или имя канала.</p>'
: '<p class="meta-muted">Автор: Alice@free (старый ввод с @ тоже принимается).</p>';
const submitText = submitLabel || (unfollow ? 'Отписаться' : 'Подписаться');
const placeholder = kind === 'channel' ? '@owner/channel' : '@login';
const placeholder = kind === 'channel' ? 'Alice@free/channel' : 'Alice@free';
const root = document.getElementById('modal-root');
root.innerHTML = `
@@ -401,7 +399,7 @@ function openSimpleSubscribeModal({ kind, kindLabel, submitLabel, unfollow = fal
return;
}
const logins = await authService.searchUsers(prefix);
const suggestions = (Array.isArray(logins) ? logins : []).slice(0, 8).map((login) => `@${login}`);
const suggestions = (Array.isArray(logins) ? logins : []).slice(0, 8).map((login) => normalizeLoginInput(login));
renderSuggestions(suggestEl, suggestions, applySuggestion);
return;
}
@@ -564,7 +562,7 @@ function mapApiChannelRow(summary, bucketKey, idx, index, notificationsState) {
const channelTypeVersion = Number(summary?.channel?.channelTypeVersion ?? 1);
const isOwn = bucketKey === 'own';
const title = displayTitle || channelName;
const technicalLabel = `@${ownerLogin}/${channelName}`;
const technicalLabel = formatChannelAddress({ ownerLogin, channelName });
const lastMessage = resolveChannelLastMessage(summary);
return {
@@ -619,7 +617,7 @@ function mapDeletedOwnedChannels(payload, notificationsState = {}) {
avaAr: String(item?.avatarAr || '').trim(),
avaSha256: String(item?.avatarSha256 || '').trim().toLowerCase(),
title: displayTitle,
technicalLabel: `@${ownerLogin}/${channelName}`,
technicalLabel: formatChannelAddress({ ownerLogin, channelName }),
channelName,
displayTitle,
channelDescription: '',
@@ -854,8 +852,8 @@ function renderChannelMain(channel) {
const technical = document.createElement('p');
technical.className = 'channel-row-technical';
technical.textContent = `@${channel.ownerName || 'автор'}`;
technical.hidden = !!channel.isOwnChannel;
technical.textContent = channel.technicalLabel || formatChannelAddress({ ownerLogin: channel.ownerName || 'автор', channelName: channel.channelName });
// Системный адрес одинаково виден в собственных и чужих каналах.
if (channel.channelDescription) {
const desc = document.createElement('p');