SHA256
Merge origin/main: умный поиск каналов и пользователей
This commit is contained in:
+1
-1
@@ -39,7 +39,7 @@
|
||||
}());
|
||||
</script>
|
||||
<script>
|
||||
window.__SHINE_BUILD_HASH__ = '20261012121500';
|
||||
window.__SHINE_BUILD_HASH__ = '20261012150000';
|
||||
window.__SHINE_CLIENT_VERSION__ = '1.2.10';
|
||||
</script>
|
||||
<script>
|
||||
|
||||
+4
-1
@@ -106,7 +106,8 @@ import * as chatView from './pages/chat-view.js?v=202609260900';
|
||||
import * as userProfileView from './pages/user-profile-view.js';
|
||||
import * as userProfileListView from './pages/user-profile-list-view.js';
|
||||
import * as userRelationManageView from './pages/user-relation-manage-view.js';
|
||||
import * as channelsList from './pages/channels-list.js?v=202609260900';
|
||||
import * as channelsList from './pages/channels-list.js?v=20261011-search';
|
||||
import * as searchView from './pages/search-view.js';
|
||||
import * as channelView from './pages/channel-view.js';
|
||||
import * as channelAboutView from './pages/channel-about-view.js';
|
||||
import * as channelDonateView from './pages/channel-donate-view.js';
|
||||
@@ -178,6 +179,7 @@ const routes = {
|
||||
'user-profile-list-view': userProfileListView,
|
||||
'user-relation-manage-view': userRelationManageView,
|
||||
'channels-list': channelsList,
|
||||
'search-view': searchView,
|
||||
'channel-view': channelView,
|
||||
'channel-about-view': channelAboutView,
|
||||
'channel-donate-view': channelDonateView,
|
||||
@@ -297,6 +299,7 @@ const GUEST_ALLOWED_PAGES = new Set([
|
||||
'language-view',
|
||||
'network-view',
|
||||
'channels-list',
|
||||
'search-view',
|
||||
'channel-view',
|
||||
'channel-about-view',
|
||||
'channel-thread-view',
|
||||
|
||||
@@ -507,187 +507,6 @@ function openSimpleSubscribeModal({ kind, kindLabel, submitLabel, unfollow = fal
|
||||
if (inputEl) inputEl.focus();
|
||||
}
|
||||
|
||||
function openChannelFinderModal({ navigate }) {
|
||||
const root = document.getElementById('modal-root');
|
||||
root.innerHTML = `
|
||||
<div class="modal" id="channels-find-modal">
|
||||
<div class="modal-card stack">
|
||||
<h3 class="modal-title">Поиск каналов</h3>
|
||||
<p class="meta-muted">Введите логин (или начало логина), затем выберите пользователя и канал.</p>
|
||||
<input id="channels-find-input" class="input" placeholder="Например: aidar" autocomplete="off" />
|
||||
<div id="channels-find-suggest" class="channels-search-suggest" style="display:none"></div>
|
||||
<div id="channels-find-list" class="channels-search-suggest" style="display:none"></div>
|
||||
<div id="channels-find-error" class="meta-muted inline-error"></div>
|
||||
<div class="form-actions-grid">
|
||||
<button class="primary-btn" id="channels-find-run" type="button">Найти</button>
|
||||
<button class="secondary-btn" id="channels-find-close" type="button">Закрыть</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
const inputEl = root.querySelector('#channels-find-input');
|
||||
const suggestEl = root.querySelector('#channels-find-suggest');
|
||||
const channelsEl = root.querySelector('#channels-find-list');
|
||||
const errorEl = root.querySelector('#channels-find-error');
|
||||
const close = () => { root.innerHTML = ''; };
|
||||
|
||||
const renderButtons = (container, values, onPick) => {
|
||||
container.innerHTML = '';
|
||||
if (!values.length) {
|
||||
container.style.display = 'none';
|
||||
return;
|
||||
}
|
||||
container.style.display = '';
|
||||
values.forEach((value) => {
|
||||
const btn = document.createElement('button');
|
||||
btn.type = 'button';
|
||||
btn.className = 'ui-button channel-search-item';
|
||||
btn.textContent = value.label;
|
||||
btn.addEventListener('click', () => onPick(value));
|
||||
container.append(btn);
|
||||
});
|
||||
};
|
||||
|
||||
const renderChannelRows = (values) => {
|
||||
channelsEl.innerHTML = '';
|
||||
if (!values.length) {
|
||||
channelsEl.style.display = 'none';
|
||||
return;
|
||||
}
|
||||
channelsEl.style.display = '';
|
||||
values.forEach((item) => {
|
||||
const row = document.createElement('div');
|
||||
row.className = 'channel-search-item';
|
||||
|
||||
const label = document.createElement('span');
|
||||
label.textContent = item.label;
|
||||
|
||||
const openBtn = document.createElement('button');
|
||||
openBtn.type = 'button';
|
||||
openBtn.className = 'secondary-btn small-btn';
|
||||
openBtn.textContent = 'Просмотреть';
|
||||
openBtn.addEventListener('click', () => {
|
||||
close();
|
||||
const route = makeShineChannelRoute({
|
||||
ownerLogin: String(item.ownerLogin || '').trim(),
|
||||
ownerBlockchainName: String(item.ownerBlockchainName || '').trim(),
|
||||
channelName: String(item.channelName || '').trim(),
|
||||
});
|
||||
if (route) navigate(route);
|
||||
});
|
||||
|
||||
row.style.display = 'flex';
|
||||
row.style.alignItems = 'center';
|
||||
row.style.justifyContent = 'space-between';
|
||||
row.style.gap = '8px';
|
||||
row.append(label, openBtn);
|
||||
channelsEl.append(row);
|
||||
});
|
||||
};
|
||||
|
||||
const loadChannelsForLogin = async (login, filterChannel = '') => {
|
||||
const ownerLogin = normalizeLoginInput(login);
|
||||
if (!ownerLogin) return;
|
||||
const feed = await authService.listSubscriptionsFeed(ownerLogin, 1000);
|
||||
const rows = Array.isArray(feed?.ownedChannels) ? feed.ownedChannels.filter(isVisibleChannelSummary) : [];
|
||||
const needle = String(filterChannel || '').trim().toLowerCase();
|
||||
const channels = rows
|
||||
.map((item) => ({
|
||||
ownerBlockchainName: String(item?.channel?.ownerBlockchainName || '').trim(),
|
||||
channelName: String(item?.channel?.channelName || '').trim(),
|
||||
}))
|
||||
.filter((item) => !!item.channelName)
|
||||
.filter((item) => !needle || item.channelName.toLowerCase().includes(needle))
|
||||
.slice(0, 200)
|
||||
.map((item) => ({
|
||||
label: `${ownerLogin} / ${item.channelName}`,
|
||||
ownerLogin,
|
||||
ownerBlockchainName: item.ownerBlockchainName,
|
||||
channelName: item.channelName,
|
||||
}));
|
||||
renderChannelRows(channels);
|
||||
if (!channels.length) {
|
||||
errorEl.textContent = filterChannel
|
||||
? 'Каналы с таким фильтром не найдены.'
|
||||
: `У пользователя "${ownerLogin}" пока нет доступных каналов.`;
|
||||
} else {
|
||||
errorEl.textContent = '';
|
||||
}
|
||||
};
|
||||
|
||||
const runSearch = async () => {
|
||||
const raw = String(inputEl?.value || '').trim();
|
||||
errorEl.textContent = '';
|
||||
if (!raw) {
|
||||
suggestEl.style.display = 'none';
|
||||
suggestEl.innerHTML = '';
|
||||
channelsEl.style.display = 'none';
|
||||
channelsEl.innerHTML = '';
|
||||
errorEl.textContent = 'Введите логин или начало логина.';
|
||||
return;
|
||||
}
|
||||
|
||||
const parts = raw.split('/');
|
||||
const loginPrefix = normalizeLoginInput(parts[0] || '');
|
||||
const channelFilter = String(parts[1] || '').trim();
|
||||
|
||||
try {
|
||||
if (raw.includes('/')) {
|
||||
suggestEl.style.display = 'none';
|
||||
suggestEl.innerHTML = '';
|
||||
await loadChannelsForLogin(loginPrefix, channelFilter);
|
||||
return;
|
||||
}
|
||||
|
||||
if (loginPrefix.length < 1) {
|
||||
suggestEl.style.display = 'none';
|
||||
suggestEl.innerHTML = '';
|
||||
channelsEl.style.display = 'none';
|
||||
channelsEl.innerHTML = '';
|
||||
return;
|
||||
}
|
||||
|
||||
const logins = await authService.searchUsers(loginPrefix);
|
||||
const rows = Array.isArray(logins) ? logins : [];
|
||||
if (!rows.length) {
|
||||
suggestEl.style.display = 'none';
|
||||
suggestEl.innerHTML = '';
|
||||
channelsEl.style.display = 'none';
|
||||
channelsEl.innerHTML = '';
|
||||
errorEl.textContent = `Логины, начинающиеся на "${loginPrefix}", не найдены.`;
|
||||
return;
|
||||
}
|
||||
const items = (Array.isArray(logins) ? logins : []).slice(0, 15).map((login) => ({
|
||||
label: login,
|
||||
login,
|
||||
}));
|
||||
errorEl.textContent = '';
|
||||
renderButtons(suggestEl, items, async (item) => {
|
||||
inputEl.value = `${item.login}/`;
|
||||
suggestEl.style.display = 'none';
|
||||
suggestEl.innerHTML = '';
|
||||
await loadChannelsForLogin(item.login, '');
|
||||
});
|
||||
} catch (error) {
|
||||
errorEl.textContent = toUserMessage(error, 'Не удалось выполнить поиск.');
|
||||
}
|
||||
};
|
||||
|
||||
const refresh = createDebounced(runSearch, 220);
|
||||
|
||||
root.querySelector('#channels-find-close')?.addEventListener('click', close);
|
||||
root.querySelector('#channels-find-run')?.addEventListener('click', () => {
|
||||
void runSearch();
|
||||
});
|
||||
inputEl?.addEventListener('keydown', (event) => {
|
||||
if (event.key !== 'Enter') return;
|
||||
event.preventDefault();
|
||||
void runSearch();
|
||||
});
|
||||
inputEl?.addEventListener('input', refresh);
|
||||
if (inputEl) inputEl.focus();
|
||||
}
|
||||
|
||||
function mapMockGroups() {
|
||||
const mapRow = (channel) => ({
|
||||
@@ -940,12 +759,12 @@ function renderEmptyState(listState, navigate) {
|
||||
heading.textContent = listState.query ? 'Ничего не найдено' : listState.viewMode === CHANNELS_VIEW_DELETED ? 'Удалённых каналов нет' : listState.viewMode === CHANNELS_VIEW_FOLLOWING ? 'Пока нет подписок' : listState.viewMode === CHANNELS_VIEW_OWNED ? 'Здесь будут ваши каналы' : 'Откройте свой первый канал';
|
||||
const text = document.createElement('p');
|
||||
text.className = 'meta-muted';
|
||||
text.textContent = listState.viewMode === CHANNELS_VIEW_DELETED ? 'Здесь появятся только ваши каналы, помеченные как удалённые.' : state.session.isAuthorized ? 'Найдите канал по имени автора или создайте свой.' : 'Войдите, чтобы видеть свои каналы и подписки.';
|
||||
text.textContent = listState.viewMode === CHANNELS_VIEW_DELETED ? 'Здесь появятся только ваши каналы, помеченные как удалённые.' : state.session.isAuthorized ? 'Найдите канал по названию, адресу или автору — либо создайте свой.' : 'Войдите, чтобы видеть свои каналы и подписки.';
|
||||
const action = document.createElement('button');
|
||||
action.type = 'button';
|
||||
action.className = 'primary-btn';
|
||||
action.textContent = state.session.isAuthorized ? 'Найти по @автору' : 'Войти';
|
||||
action.addEventListener('click', () => state.session.isAuthorized ? openChannelFinderModal({ navigate }) : navigate('login-view'));
|
||||
action.textContent = 'Найти каналы';
|
||||
action.addEventListener('click', () => navigate('search-view'));
|
||||
wrap.append(heading, text, action);
|
||||
|
||||
return wrap;
|
||||
@@ -1290,8 +1109,8 @@ export function render({ navigate, route, chrome }) {
|
||||
const serverSearchButton = document.createElement('button');
|
||||
serverSearchButton.type = 'button';
|
||||
serverSearchButton.className = 'text-btn channels-server-search';
|
||||
serverSearchButton.textContent = 'По @автору';
|
||||
serverSearchButton.addEventListener('click', () => openChannelFinderModal({ navigate }));
|
||||
serverSearchButton.textContent = 'Поиск в SHiNE';
|
||||
serverSearchButton.addEventListener('click', () => navigate('search-view'));
|
||||
searchWrap.append(searchInput, serverSearchButton);
|
||||
|
||||
const tabs = document.createElement('div');
|
||||
|
||||
@@ -0,0 +1,219 @@
|
||||
import { authService } from '../state.js';
|
||||
import { createTopBar } from '../components/topbar.js';
|
||||
import { renderAvatar, renderUserAvatar } from '../components/avatar-image.js';
|
||||
import { makeShineChannelRoute, makeProfileRoute } from '../services/shine-routes.js';
|
||||
|
||||
export const pageMeta = {
|
||||
id: 'search-view',
|
||||
title: 'Поиск SHiNE',
|
||||
shellMode: { contentWidth: 'wide', topFade: false },
|
||||
};
|
||||
|
||||
const SEARCH_DELAY_MS = 280;
|
||||
|
||||
function channelRow(item, navigate) {
|
||||
const row = document.createElement('button');
|
||||
row.type = 'button';
|
||||
row.className = 'shine-search-result';
|
||||
const displayName = String(item.displayName || item.slug || 'Канал').trim();
|
||||
const ownerLogin = String(item.ownerLogin || '').trim();
|
||||
const slug = String(item.slug || '').trim();
|
||||
row.append(renderAvatar({
|
||||
initials: Array.from(displayName)[0] || '#',
|
||||
avatar: item.avatarAr || item.avatarSha256
|
||||
? { ar: item.avatarAr || '', sha256Hex: item.avatarSha256 || '' }
|
||||
: null,
|
||||
authorLogin: ownerLogin,
|
||||
size: 'lg',
|
||||
className: 'avatar-plain',
|
||||
title: displayName,
|
||||
alt: 'Аватар канала',
|
||||
}));
|
||||
const text = document.createElement('span');
|
||||
text.className = 'shine-search-result__text';
|
||||
const title = document.createElement('strong');
|
||||
title.className = 'shine-search-result__title';
|
||||
title.textContent = displayName;
|
||||
const address = document.createElement('span');
|
||||
address.className = 'shine-search-result__address';
|
||||
address.textContent = `@${ownerLogin}/${slug} · ${Number(item.subscribersCount || 0)} подписчиков`;
|
||||
text.append(title, address);
|
||||
const description = String(item.description || '').trim();
|
||||
if (description) {
|
||||
const desc = document.createElement('span');
|
||||
desc.className = 'shine-search-result__description';
|
||||
desc.textContent = description;
|
||||
text.append(desc);
|
||||
}
|
||||
row.append(text);
|
||||
row.addEventListener('click', () => {
|
||||
const route = makeShineChannelRoute({
|
||||
ownerLogin,
|
||||
ownerBlockchainName: String(item.ownerBlockchainName || '').trim(),
|
||||
channelName: slug,
|
||||
});
|
||||
if (route) navigate(route);
|
||||
});
|
||||
return row;
|
||||
}
|
||||
|
||||
function personRow(person, navigate) {
|
||||
const login = String(person?.login || '').trim();
|
||||
const displayName = String(person?.displayName || '').trim();
|
||||
const row = document.createElement('button');
|
||||
row.type = 'button';
|
||||
row.className = 'shine-search-result';
|
||||
row.append(renderUserAvatar({ login, avatar: person.avatarAr ? { ar: person.avatarAr } : null, size: 'lg', className: 'avatar' }));
|
||||
const text = document.createElement('span');
|
||||
text.className = 'shine-search-result__text';
|
||||
const title = document.createElement('strong');
|
||||
title.className = 'shine-search-result__title';
|
||||
title.textContent = displayName || `@${login}`;
|
||||
text.append(title);
|
||||
if (displayName) {
|
||||
const address = document.createElement('span');
|
||||
address.className = 'shine-search-result__address';
|
||||
address.textContent = `@${login}`;
|
||||
text.append(address);
|
||||
}
|
||||
row.append(text);
|
||||
row.addEventListener('click', () => navigate(makeProfileRoute(login)));
|
||||
return row;
|
||||
}
|
||||
|
||||
export function render({ navigate, chrome }) {
|
||||
const screen = document.createElement('section');
|
||||
screen.className = 'stack shine-search-screen';
|
||||
chrome?.setTopbar(createTopBar({
|
||||
title: 'Поиск SHiNE',
|
||||
back: { label: '←', onClick: () => navigate('channels-list') },
|
||||
}));
|
||||
|
||||
const search = document.createElement('input');
|
||||
search.type = 'search';
|
||||
search.className = 'input shine-search-input';
|
||||
search.placeholder = 'Название канала, @автор или автор/канал';
|
||||
search.maxLength = 120;
|
||||
search.autocomplete = 'off';
|
||||
search.enterKeyHint = 'search';
|
||||
search.setAttribute('aria-label', 'Поиск по всей сети SHiNE');
|
||||
const initialQuery = new URLSearchParams(window.location.search).get('q') || '';
|
||||
search.value = initialQuery;
|
||||
|
||||
const tabs = document.createElement('div');
|
||||
tabs.className = 'shine-search-tabs';
|
||||
tabs.setAttribute('role', 'tablist');
|
||||
const buttons = [['all', 'Все'], ['channels', 'Каналы'], ['people', 'Люди']].map(([id, label]) => {
|
||||
const btn = document.createElement('button');
|
||||
btn.type = 'button';
|
||||
btn.className = 'shine-search-tab';
|
||||
btn.textContent = label;
|
||||
btn.dataset.tab = id;
|
||||
btn.setAttribute('role', 'tab');
|
||||
tabs.append(btn);
|
||||
return btn;
|
||||
});
|
||||
|
||||
const status = document.createElement('p');
|
||||
status.className = 'shine-search-status';
|
||||
status.setAttribute('role', 'status');
|
||||
status.textContent = 'Введите имя канала, его адрес или логин пользователя.';
|
||||
const list = document.createElement('div');
|
||||
list.className = 'shine-search-results';
|
||||
|
||||
let selectedTab = 'all';
|
||||
let channels = [];
|
||||
let people = [];
|
||||
let error = '';
|
||||
let timer = null;
|
||||
let seq = 0;
|
||||
let disposed = false;
|
||||
|
||||
const appendSection = (title, items, factory) => {
|
||||
if (!items.length) return;
|
||||
const header = document.createElement('h3');
|
||||
header.className = 'shine-search-section-heading';
|
||||
header.textContent = `${title} · ${items.length}`;
|
||||
list.append(header);
|
||||
items.forEach((item) => list.append(factory(item, navigate)));
|
||||
};
|
||||
|
||||
const renderResults = () => {
|
||||
buttons.forEach((button) => {
|
||||
const active = button.dataset.tab === selectedTab;
|
||||
button.classList.toggle('is-active', active);
|
||||
button.setAttribute('aria-selected', String(active));
|
||||
});
|
||||
list.replaceChildren();
|
||||
const query = search.value.trim();
|
||||
if (!query) {
|
||||
status.textContent = 'Введите имя канала, его адрес или логин пользователя.';
|
||||
return;
|
||||
}
|
||||
if (selectedTab !== 'people') appendSection('Каналы', channels, channelRow);
|
||||
if (selectedTab !== 'channels') appendSection('Люди', people, personRow);
|
||||
const shown = (selectedTab === 'people' ? people.length
|
||||
: selectedTab === 'channels' ? channels.length : channels.length + people.length);
|
||||
if (error && !shown) status.textContent = error;
|
||||
else status.textContent = shown ? `Показано: ${shown}` : 'Ничего не найдено. Попробуйте другое название.';
|
||||
};
|
||||
|
||||
const runSearch = async () => {
|
||||
const query = search.value.trim();
|
||||
const currentSeq = ++seq;
|
||||
if (!query) {
|
||||
channels = []; people = []; error = '';
|
||||
renderResults();
|
||||
return;
|
||||
}
|
||||
status.textContent = 'Ищем…';
|
||||
const userQuery = query.replace(/^@/, '').trim();
|
||||
const requests = [authService.searchChannels(query, { limit: 10 })];
|
||||
if (userQuery && !userQuery.includes('/')) requests.push(authService.searchPeople(userQuery, { limit: 10 }));
|
||||
const results = await Promise.allSettled(requests);
|
||||
if (disposed || currentSeq !== seq) return;
|
||||
channels = results[0].status === 'fulfilled' ? results[0].value : [];
|
||||
people = results[1]?.status === 'fulfilled' ? results[1].value : [];
|
||||
error = results.every((result) => result.status === 'rejected')
|
||||
? 'Не удалось выполнить поиск. Проверьте подключение к серверу.'
|
||||
: '';
|
||||
renderResults();
|
||||
};
|
||||
|
||||
const rememberQueryInAddress = () => {
|
||||
const url = new URL(window.location.href);
|
||||
if (search.value.trim()) url.searchParams.set('q', search.value.trim());
|
||||
else url.searchParams.delete('q');
|
||||
window.history.replaceState(window.history.state, '', `${url.pathname}${url.search}${url.hash}`);
|
||||
};
|
||||
const scheduleSearch = () => {
|
||||
if (timer) clearTimeout(timer);
|
||||
++seq; // Устаревший ответ не должен подменить новый ввод.
|
||||
channels = []; people = []; error = '';
|
||||
list.replaceChildren();
|
||||
status.textContent = search.value.trim() ? 'Ищем…' : 'Введите название или адрес.';
|
||||
rememberQueryInAddress();
|
||||
timer = setTimeout(() => { timer = null; void runSearch(); }, SEARCH_DELAY_MS);
|
||||
};
|
||||
search.addEventListener('input', scheduleSearch);
|
||||
search.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
if (timer) clearTimeout(timer);
|
||||
timer = null;
|
||||
void runSearch();
|
||||
}
|
||||
});
|
||||
buttons.forEach((btn) => btn.addEventListener('click', () => {
|
||||
selectedTab = btn.dataset.tab;
|
||||
renderResults();
|
||||
}));
|
||||
screen.append(search, tabs, status, list);
|
||||
screen.cleanup = () => {
|
||||
disposed = true;
|
||||
++seq;
|
||||
if (timer) clearTimeout(timer);
|
||||
};
|
||||
if (initialQuery.trim()) void runSearch();
|
||||
return screen;
|
||||
}
|
||||
@@ -20,6 +20,7 @@ const PRETTY_PATHS = new Map([
|
||||
['profiles-view', 'profiles'],
|
||||
['messages-list', 'messages'],
|
||||
['contact-search-view', 'contacts'],
|
||||
['search-view', 'search'],
|
||||
['chat-view', 'chat'],
|
||||
['channels-list', 'channels'],
|
||||
['add-channel-view', 'channels/new'],
|
||||
@@ -265,6 +266,8 @@ export function parseRouteFromPath(pathname = '') {
|
||||
return { pageId: 'messages-list', params: {} };
|
||||
}
|
||||
|
||||
if (pageId === 'search') return { pageId: 'search-view', params: {} };
|
||||
|
||||
if (pageId === 'contacts') {
|
||||
return { pageId: 'contact-search-view', params: {} };
|
||||
}
|
||||
@@ -583,7 +586,7 @@ function resolveToolbarTab(pageId) {
|
||||
pageId === 'solana-users-init-view'
|
||||
) return 'profile-view';
|
||||
if (pageId === 'chat-view' || pageId === 'contact-search-view') return 'messages-list';
|
||||
if (pageId === 'channel-view' || pageId === 'channel-about-view' || pageId === 'channel-donate-view' || pageId === 'channel-thread-view' || pageId === 'add-channel-view' || pageId === 'add-personal-public-chat-view') return 'channels-list';
|
||||
if (pageId === 'search-view' || pageId === 'channel-view' || pageId === 'channel-about-view' || pageId === 'channel-donate-view' || pageId === 'channel-thread-view' || pageId === 'add-channel-view' || pageId === 'add-personal-public-chat-view') return 'channels-list';
|
||||
return 'profile-view';
|
||||
}
|
||||
|
||||
|
||||
@@ -3206,8 +3206,23 @@ export class AuthService {
|
||||
return response.payload || {};
|
||||
}
|
||||
|
||||
async searchChannels(query, { limit = 10, ownerLogin = '' } = {}) {
|
||||
const payload = { query, limit };
|
||||
if (ownerLogin) payload.ownerLogin = ownerLogin;
|
||||
const response = await this.ws.request('SearchChannels', payload);
|
||||
if (response.status !== 200) throw opError('SearchChannels', response);
|
||||
return Array.isArray(response.payload?.channels) ? response.payload.channels : [];
|
||||
}
|
||||
|
||||
async searchPeople(query, { limit = 10 } = {}) {
|
||||
const response = await this.ws.request('SearchUsers', { prefix: query, limit });
|
||||
if (response.status !== 200) throw opError('SearchUsers', response);
|
||||
return Array.isArray(response.payload?.users) ? response.payload.users : [];
|
||||
}
|
||||
|
||||
async searchUsers(prefix, options = {}) {
|
||||
const payload = { prefix };
|
||||
if (Number.isInteger(options?.limit)) payload.limit = options.limit;
|
||||
if (typeof options?.isServer === 'boolean') {
|
||||
payload.isServer = options.isServer;
|
||||
}
|
||||
|
||||
@@ -289,3 +289,20 @@
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.channel-row { animation: none; transition: none; }
|
||||
}
|
||||
|
||||
/* Единый поиск каналов и людей */
|
||||
.shine-search-screen { width: min(100%, 640px); margin-inline: auto; gap: 14px; padding-top: var(--page-top-gap); }
|
||||
.shine-search-input { width: 100%; min-height: 48px; border-radius: 14px; font-size: 16px; }
|
||||
.shine-search-tabs { display: flex; gap: 6px; padding: 4px; border-radius: 12px; background: var(--surface); }
|
||||
.shine-search-tab { flex: 1; padding: 10px 8px; border: 0; border-radius: 9px; background: transparent; color: var(--text-secondary); cursor: pointer; }
|
||||
.shine-search-tab.is-active { background: var(--surface-selected); color: var(--text-primary); font-weight: 600; }
|
||||
.shine-search-tab:focus-visible, .shine-search-result:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
|
||||
.shine-search-status { margin: 0; min-height: 18px; color: var(--text-secondary); font-size: 13px; }
|
||||
.shine-search-results { display: grid; gap: 2px; padding-bottom: 30px; }
|
||||
.shine-search-section-heading { margin: 14px 0 4px; color: var(--text-secondary); font-size: 13px; font-weight: 600; }
|
||||
.shine-search-result { display: flex; align-items: center; gap: 12px; width: 100%; min-width: 0; padding: 12px 6px; border: 0; border-bottom: 1px solid var(--border-subtle); background: transparent; color: var(--text-primary); text-align: left; cursor: pointer; }
|
||||
.shine-search-result:hover { background: var(--surface); }
|
||||
.shine-search-result .avatar { flex-shrink: 0; }
|
||||
.shine-search-result__text { display: grid; gap: 3px; min-width: 0; }
|
||||
.shine-search-result__title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
|
||||
.shine-search-result__address, .shine-search-result__description { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-secondary); font-size: 12px; }
|
||||
|
||||
Reference in New Issue
Block a user