SHA256
UI: полные счётчики ответов, поле сообщения как в Telegram, переключатель «Связей», шапка
- Счётчик ответов – по всем уровням: обсуждение считает по дереву, лента берёт итог из обсуждения (кэш или фоновая подгрузка видимых записей, они же потом открываются сразу). Сервер пока отдаёт только прямые ответы. - Чат: поле-«таблетка» растёт плавно (высота меряется по скрытой копии, без сброса в auto), смайлик внутри поля справа внизу, «Отправить» 44 px по низу; убраны правила перестройки в две колонки. - «Связи»: фильтры – общий блок-переключатель (.tabs), как на других вкладках, всё помещается. - Шапка: название крупнее и жирнее, подпись под ним компактнее.
This commit is contained in:
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
client.version=1.18.7
|
client.version=1.18.8
|
||||||
server.version=1.14.0
|
server.version=1.14.0
|
||||||
|
|||||||
+1
-1
@@ -39,7 +39,7 @@
|
|||||||
}());
|
}());
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
window.__SHINE_BUILD_HASH__ = '20261012092300';
|
window.__SHINE_BUILD_HASH__ = '20261012094500';
|
||||||
window.__SHINE_CLIENT_VERSION__ = '1.2.10';
|
window.__SHINE_CLIENT_VERSION__ = '1.2.10';
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@@ -677,7 +677,7 @@ function renderNodeCard(node, heading, handlers, localNumber, { focusPost = fals
|
|||||||
const likes = Number(node?.likesCount || 0);
|
const likes = Number(node?.likesCount || 0);
|
||||||
const primaryLikes = Number(node?.primaryLikesCount || 0);
|
const primaryLikes = Number(node?.primaryLikesCount || 0);
|
||||||
const shiningLikes = Number(node?.shiningLikesCount || 0);
|
const shiningLikes = Number(node?.shiningLikesCount || 0);
|
||||||
const replies = Number(node?.repliesCount || 0);
|
const replies = replyCountOf(node);
|
||||||
const ratings = Number(node?.ratingsCount || 0);
|
const ratings = Number(node?.ratingsCount || 0);
|
||||||
const isOwnMessage = Boolean(state.session.isAuthorized && state.session.login) && String(node?.authorLogin || '').trim().toLowerCase() === String(state.session.login).trim().toLowerCase();
|
const isOwnMessage = Boolean(state.session.isAuthorized && state.session.login) && String(node?.authorLogin || '').trim().toLowerCase() === String(state.session.login).trim().toLowerCase();
|
||||||
const msgSubType = Number(node?.msgSubType || 0);
|
const msgSubType = Number(node?.msgSubType || 0);
|
||||||
@@ -1066,6 +1066,38 @@ function flattenDescendants(items, parent = null, out = []) {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// «Всего ответов в ветке»: сервер даёт только прямые ответы (repliesCount), а показывать нужно все уровни.
|
||||||
|
// Незагруженные глубже ветки учитываем по их прямому счётчику – это нижняя оценка.
|
||||||
|
function annotateReplyTotals(branches) {
|
||||||
|
let sum = 0;
|
||||||
|
(Array.isArray(branches) ? branches : []).forEach((branch) => {
|
||||||
|
if (!branch?.node) return;
|
||||||
|
const children = Array.isArray(branch.children) ? branch.children : [];
|
||||||
|
const loadedTotal = annotateReplyTotals(children);
|
||||||
|
const unloaded = Math.max(0, Number(branch.node.repliesCount || 0) - children.length);
|
||||||
|
branch.node.totalReplies = loadedTotal + unloaded;
|
||||||
|
sum += 1 + branch.node.totalReplies;
|
||||||
|
});
|
||||||
|
return sum;
|
||||||
|
}
|
||||||
|
|
||||||
|
function totalRepliesOfPayload(payload) {
|
||||||
|
const descendants = Array.isArray(payload?.descendants) ? payload.descendants : [];
|
||||||
|
const loaded = annotateReplyTotals(descendants);
|
||||||
|
const unloaded = Math.max(0, Number(payload?.focus?.repliesCount || 0) - descendants.length);
|
||||||
|
const total = loaded + unloaded;
|
||||||
|
if (payload?.focus) payload.focus.totalReplies = total;
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function threadTotalReplies(data) {
|
||||||
|
return totalRepliesOfPayload(data?.payload);
|
||||||
|
}
|
||||||
|
|
||||||
|
function replyCountOf(node) {
|
||||||
|
return Number(node?.totalReplies ?? node?.repliesCount ?? 0);
|
||||||
|
}
|
||||||
|
|
||||||
function nodeKey(node) {
|
function nodeKey(node) {
|
||||||
return messageRefKey(buildTargetFromNode(node));
|
return messageRefKey(buildTargetFromNode(node));
|
||||||
}
|
}
|
||||||
@@ -1158,7 +1190,7 @@ function renderComment({ node, parent, focus, channelOwner, handlers, nested = f
|
|||||||
finally { if (like.isConnected) like.disabled = false; }
|
finally { if (like.isConnected) like.disabled = false; }
|
||||||
});
|
});
|
||||||
|
|
||||||
const replies = Number(node?.repliesCount || 0);
|
const replies = replyCountOf(node);
|
||||||
const reply = document.createElement('button');
|
const reply = document.createElement('button');
|
||||||
reply.type = 'button';
|
reply.type = 'button';
|
||||||
reply.className = 'channel-action-item thread-comment__reply';
|
reply.className = 'channel-action-item thread-comment__reply';
|
||||||
@@ -1537,10 +1569,11 @@ const THREAD_PREFETCH_FRESH_MS = 30_000;
|
|||||||
// Начинает загрузку обсуждения заранее (касание карточки до клика); экран потом подхватит тот же запрос.
|
// Начинает загрузку обсуждения заранее (касание карточки до клика); экран потом подхватит тот же запрос.
|
||||||
export function prefetchThreadPage(path) {
|
export function prefetchThreadPage(path) {
|
||||||
const pathname = new URL(path, window.location.origin).pathname;
|
const pathname = new URL(path, window.location.origin).pathname;
|
||||||
if (threadPrefetches.has(pathname) || pageDataAge('thread', pathname) < THREAD_PREFETCH_FRESH_MS) return;
|
if (threadPrefetches.has(pathname)) return threadPrefetches.get(pathname);
|
||||||
|
if (pageDataAge('thread', pathname) < THREAD_PREFETCH_FRESH_MS) return Promise.resolve(readPageData('thread', pathname)?.data || null);
|
||||||
const route = parseRouteFromPath(pathname);
|
const route = parseRouteFromPath(pathname);
|
||||||
const sel = route.pageId === 'channel-thread-view' ? parseThreadSelector(route) : null;
|
const sel = route.pageId === 'channel-thread-view' ? parseThreadSelector(route) : null;
|
||||||
if (!sel) return;
|
if (!sel) return Promise.resolve(null);
|
||||||
const login = state.session.login;
|
const login = state.session.login;
|
||||||
const request = loadThreadData(sel, pathname, () => state.session.login === login)
|
const request = loadThreadData(sel, pathname, () => state.session.login === login)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
@@ -1550,6 +1583,7 @@ export function prefetchThreadPage(path) {
|
|||||||
.finally(() => { threadPrefetches.delete(pathname); });
|
.finally(() => { threadPrefetches.delete(pathname); });
|
||||||
request.catch(() => {});
|
request.catch(() => {});
|
||||||
threadPrefetches.set(pathname, request);
|
threadPrefetches.set(pathname, request);
|
||||||
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function render({ navigate, route, chrome }) {
|
export function render({ navigate, route, chrome }) {
|
||||||
@@ -1833,6 +1867,7 @@ export function render({ navigate, route, chrome }) {
|
|||||||
const ancestors = Array.isArray(payload?.ancestors) ? payload.ancestors : [];
|
const ancestors = Array.isArray(payload?.ancestors) ? payload.ancestors : [];
|
||||||
const focus = payload?.focus || null;
|
const focus = payload?.focus || null;
|
||||||
const descendants = Array.isArray(payload?.descendants) ? payload.descendants : [];
|
const descendants = Array.isArray(payload?.descendants) ? payload.descendants : [];
|
||||||
|
const totalReplies = totalRepliesOfPayload(payload);
|
||||||
const resolvedChannelTitle = resolvedChannelLabel || String(selector?.channel?.ownerBlockchainName || '').trim() || 'неизвестно';
|
const resolvedChannelTitle = resolvedChannelLabel || String(selector?.channel?.ownerBlockchainName || '').trim() || 'неизвестно';
|
||||||
const channelOwner = extractLoginFromBlockchainName(selector?.channel?.ownerBlockchainName || focus?.channelInfo?.ownerBlockchainName || selector?.short?.ownerBlockchainName || '');
|
const channelOwner = extractLoginFromBlockchainName(selector?.channel?.ownerBlockchainName || focus?.channelInfo?.ownerBlockchainName || selector?.short?.ownerBlockchainName || '');
|
||||||
const shortName = String(selector?.short?.channelName || channelSlug).trim();
|
const shortName = String(selector?.short?.channelName || channelSlug).trim();
|
||||||
@@ -1947,7 +1982,7 @@ export function render({ navigate, route, chrome }) {
|
|||||||
listWrap.className = 'thread-block thread-block--replies';
|
listWrap.className = 'thread-block thread-block--replies';
|
||||||
const listTitle = document.createElement('h3');
|
const listTitle = document.createElement('h3');
|
||||||
listTitle.className = 'thread-section-title';
|
listTitle.className = 'thread-section-title';
|
||||||
listTitle.textContent = `Комментарии · ${comments.length}`;
|
listTitle.textContent = `Комментарии · ${Math.max(totalReplies, comments.length)}`;
|
||||||
listWrap.append(listTitle);
|
listWrap.append(listTitle);
|
||||||
|
|
||||||
// Возврат к ответу после перехода по цитате
|
// Возврат к ответу после перехода по цитате
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { confirmDialog } from '../components/confirm-dialog.js';
|
|||||||
import { iconHtml } from '../components/ui-icon.js';
|
import { iconHtml } from '../components/ui-icon.js';
|
||||||
import { rememberChannelPosition, readChannelPosition, requestReplyEditorOnOpen, restoreChannelPosition } from '../services/channel-view-state.js';
|
import { rememberChannelPosition, readChannelPosition, requestReplyEditorOnOpen, restoreChannelPosition } from '../services/channel-view-state.js';
|
||||||
import { getPreviousTrackedPath, parseRouteFromPath, toPrettyPath } from '../router.js';
|
import { getPreviousTrackedPath, parseRouteFromPath, toPrettyPath } from '../router.js';
|
||||||
import { prefetchThreadPage } from './channel-thread-view.js';
|
import { prefetchThreadPage, threadTotalReplies } from './channel-thread-view.js';
|
||||||
import { attachMessageMenu } from '../components/message-menu.js';
|
import { attachMessageMenu } from '../components/message-menu.js';
|
||||||
import { createTopBar } from '../components/topbar.js';
|
import { createTopBar } from '../components/topbar.js';
|
||||||
import {
|
import {
|
||||||
@@ -2078,6 +2078,16 @@ function renderPostCard(post, {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Сервер считает только прямые ответы; полное число по всем уровням берём из обсуждения (кэш или подгрузка).
|
||||||
|
if (Number(post.repliesCount || 0) > 0) {
|
||||||
|
const threadRoute = buildThreadRoute(post, selector);
|
||||||
|
if (threadRoute) {
|
||||||
|
const threadPath = new URL(`/${toPrettyPath(threadRoute)}`, window.location.origin).pathname;
|
||||||
|
card.dataset.threadPath = threadPath;
|
||||||
|
const known = readPageData('thread', threadPath)?.data;
|
||||||
|
if (known) post.repliesCount = threadTotalReplies(known);
|
||||||
|
}
|
||||||
|
}
|
||||||
const discussionButton = document.createElement('button');
|
const discussionButton = document.createElement('button');
|
||||||
discussionButton.type = 'button';
|
discussionButton.type = 'button';
|
||||||
discussionButton.className = 'ui-button channel-action-item channel-action-discussion';
|
discussionButton.className = 'ui-button channel-action-item channel-action-discussion';
|
||||||
@@ -2494,6 +2504,45 @@ function renderBody(screen, navigate, routeKey, channelData, handlers) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Полные счётчики ответов для видимых записей: обсуждения подгружаются по одному (они же потом открываются сразу).
|
||||||
|
function watchReplyTotals(screen) {
|
||||||
|
if (!('IntersectionObserver' in window)) return () => {};
|
||||||
|
let stopped = false;
|
||||||
|
const queue = [];
|
||||||
|
let running = false;
|
||||||
|
const setCount = (card, total) => {
|
||||||
|
card.querySelectorAll('.channel-action-discussion .channel-action-counter, .channel-action-reply .channel-action-counter')
|
||||||
|
.forEach((counter) => { counter.textContent = total ? String(total) : ''; });
|
||||||
|
};
|
||||||
|
const pump = async () => {
|
||||||
|
if (running) return;
|
||||||
|
running = true;
|
||||||
|
while (!stopped && queue.length) {
|
||||||
|
const card = queue.shift();
|
||||||
|
try {
|
||||||
|
const data = await prefetchThreadPage(card.dataset.threadPath);
|
||||||
|
if (!stopped && data && card.isConnected) setCount(card, threadTotalReplies(data));
|
||||||
|
} catch {
|
||||||
|
// Не удалось – остаётся серверный счётчик прямых ответов.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
running = false;
|
||||||
|
};
|
||||||
|
const observer = new IntersectionObserver((entries) => {
|
||||||
|
entries.forEach((entry) => {
|
||||||
|
if (!entry.isIntersecting) return;
|
||||||
|
observer.unobserve(entry.target);
|
||||||
|
queue.push(entry.target);
|
||||||
|
});
|
||||||
|
void pump();
|
||||||
|
}, { rootMargin: '200px 0px' });
|
||||||
|
screen.querySelectorAll('.channel-message-card[data-thread-path]').forEach((card) => observer.observe(card));
|
||||||
|
return () => {
|
||||||
|
stopped = true;
|
||||||
|
observer.disconnect();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// Фоновая подгрузка канала в кэш, чтобы он открывался сразу (вызывается из обхода ленты каналов).
|
// Фоновая подгрузка канала в кэш, чтобы он открывался сразу (вызывается из обхода ленты каналов).
|
||||||
export async function prefetchChannelPage(path) {
|
export async function prefetchChannelPage(path) {
|
||||||
const pathname = new URL(path, window.location.origin).pathname;
|
const pathname = new URL(path, window.location.origin).pathname;
|
||||||
@@ -3024,7 +3073,7 @@ export function render({ navigate, route, chrome }) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
clearContent();
|
clearContent();
|
||||||
cleanupSeenTracking = renderBody(screen, navigate, routeKey, apiData, {
|
const stopSeenTracking = renderBody(screen, navigate, routeKey, apiData, {
|
||||||
chrome,
|
chrome,
|
||||||
restorePosition,
|
restorePosition,
|
||||||
scrollToMessageOrdinal,
|
scrollToMessageOrdinal,
|
||||||
@@ -3118,6 +3167,11 @@ export function render({ navigate, route, chrome }) {
|
|||||||
},
|
},
|
||||||
onSubscribeChannel: (event) => subscribeToChannel(apiData, event),
|
onSubscribeChannel: (event) => subscribeToChannel(apiData, event),
|
||||||
});
|
});
|
||||||
|
const stopReplyTotals = watchReplyTotals(screen);
|
||||||
|
cleanupSeenTracking = () => {
|
||||||
|
if (typeof stopSeenTracking === 'function') stopSeenTracking();
|
||||||
|
stopReplyTotals();
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
refresh = async () => {
|
refresh = async () => {
|
||||||
|
|||||||
@@ -626,10 +626,28 @@ function showTtsMissingConfigDialog() {
|
|||||||
root.querySelector('#chat-tts-ok')?.addEventListener('click', close);
|
root.querySelector('#chat-tts-ok')?.addEventListener('click', close);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Высоту меряем по скрытой копии поля: так поле не сбрасывается в auto и растёт плавно (transition в chat.css).
|
||||||
|
const composerMeasures = new WeakMap();
|
||||||
function autoResizeComposer(textarea) {
|
function autoResizeComposer(textarea) {
|
||||||
if (!textarea) return;
|
if (!textarea) return;
|
||||||
textarea.style.height = 'auto';
|
let measure = composerMeasures.get(textarea);
|
||||||
textarea.style.height = `${Math.min(180, Math.max(42, textarea.scrollHeight))}px`;
|
if (!measure || !measure.isConnected) {
|
||||||
|
measure = textarea.cloneNode(false);
|
||||||
|
measure.removeAttribute('name');
|
||||||
|
measure.removeAttribute('id');
|
||||||
|
measure.tabIndex = -1;
|
||||||
|
measure.setAttribute('aria-hidden', 'true');
|
||||||
|
measure.classList.add('dm-input-measure');
|
||||||
|
measure.removeAttribute('style');
|
||||||
|
textarea.after(measure);
|
||||||
|
composerMeasures.set(textarea, measure);
|
||||||
|
}
|
||||||
|
measure.style.width = `${textarea.offsetWidth}px`;
|
||||||
|
measure.value = textarea.value || ' ';
|
||||||
|
const style = getComputedStyle(textarea);
|
||||||
|
const borders = (Number.parseFloat(style.borderTopWidth) || 0) + (Number.parseFloat(style.borderBottomWidth) || 0);
|
||||||
|
const next = Math.min(180, Math.max(44, measure.scrollHeight + borders));
|
||||||
|
if (textarea.style.height !== `${next}px`) textarea.style.height = `${next}px`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function createHeaderPhoneHandsetIcon() {
|
function createHeaderPhoneHandsetIcon() {
|
||||||
@@ -1566,11 +1584,13 @@ export function render({ navigate, route, chrome }) {
|
|||||||
<span class="dm-voice-recording-time" id="chat-voice-recording-time">0:00</span>
|
<span class="dm-voice-recording-time" id="chat-voice-recording-time">0:00</span>
|
||||||
<span class="dm-voice-recording-hint" id="chat-voice-recording-hint">↑ проведите вверх, чтобы закрепить</span>
|
<span class="dm-voice-recording-hint" id="chat-voice-recording-hint">↑ проведите вверх, чтобы закрепить</span>
|
||||||
</div>
|
</div>
|
||||||
<textarea class="input dm-input" name="message" rows="1" placeholder="Введите сообщение" maxlength="12000" enterkeyhint="enter"></textarea>
|
<div class="dm-field">
|
||||||
|
<textarea class="input dm-input" name="message" rows="1" placeholder="Сообщение" maxlength="12000" enterkeyhint="enter"></textarea>
|
||||||
|
<button class="ghost-btn dm-emoji-btn" type="button" id="chat-emoji-toggle" aria-label="Эмодзи" title="Эмодзи"><span class="dm-emoji-btn__glyph">☺</span></button>
|
||||||
|
</div>
|
||||||
<input id="chat-file-input" type="file" multiple hidden />
|
<input id="chat-file-input" type="file" multiple hidden />
|
||||||
<div class="dm-actions-col">
|
<div class="dm-actions-col">
|
||||||
<button class="ghost-btn dm-file-btn" type="button" id="chat-file-toggle" aria-label="Прикрепить файлы" title="Прикрепить файлы" hidden>📎</button>
|
<button class="ghost-btn dm-file-btn" type="button" id="chat-file-toggle" aria-label="Прикрепить файлы" title="Прикрепить файлы" hidden>📎</button>
|
||||||
<button class="ghost-btn dm-emoji-btn" type="button" id="chat-emoji-toggle" aria-label="Эмодзи" title="Эмодзи"><span class="dm-emoji-btn__glyph">☺</span></button>
|
|
||||||
<button class="primary-btn dm-send-btn dm-send-icon-btn" type="button" title="Записать голосовое сообщение" data-mode="voice" aria-label="Записать голосовое сообщение"></button>
|
<button class="primary-btn dm-send-btn dm-send-icon-btn" type="button" title="Записать голосовое сообщение" data-mode="voice" aria-label="Записать голосовое сообщение"></button>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -896,13 +896,18 @@ export function render({ navigate, route, chrome } = {}) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function syncToggle(button, pressed) {
|
||||||
|
button.classList.toggle('active', pressed);
|
||||||
|
button.setAttribute('aria-pressed', pressed ? 'true' : 'false');
|
||||||
|
}
|
||||||
|
|
||||||
function applyFilter(key) {
|
function applyFilter(key) {
|
||||||
if (!FILTERS[key]) return;
|
if (!FILTERS[key]) return;
|
||||||
if (activeFilters.has(key)) activeFilters.delete(key);
|
if (activeFilters.has(key)) activeFilters.delete(key);
|
||||||
else activeFilters.add(key);
|
else activeFilters.add(key);
|
||||||
FILTER_ORDER.forEach((k) => {
|
FILTER_ORDER.forEach((k) => {
|
||||||
const el = filterChips[k];
|
const el = filterChips[k];
|
||||||
if (el) el.classList.toggle('is-active', activeFilters.has(k));
|
if (el) syncToggle(el, activeFilters.has(k));
|
||||||
});
|
});
|
||||||
if (engine) engine.setFilter(currentFilterPredicate);
|
if (engine) engine.setFilter(currentFilterPredicate);
|
||||||
}
|
}
|
||||||
@@ -931,8 +936,7 @@ export function render({ navigate, route, chrome } = {}) {
|
|||||||
function updateHistoryChip() {
|
function updateHistoryChip() {
|
||||||
if (!(historyChip instanceof HTMLButtonElement)) return;
|
if (!(historyChip instanceof HTMLButtonElement)) return;
|
||||||
historyChip.textContent = historyDepth > 0 ? `Недавние · ${historyDepth}` : 'Недавние';
|
historyChip.textContent = historyDepth > 0 ? `Недавние · ${historyDepth}` : 'Недавние';
|
||||||
historyChip.classList.toggle('is-active', historyDepth > 0);
|
syncToggle(historyChip, historyDepth > 0);
|
||||||
historyChip.setAttribute('aria-pressed', historyDepth > 0 ? 'true' : 'false');
|
|
||||||
historyChip.disabled = x2Enabled;
|
historyChip.disabled = x2Enabled;
|
||||||
historyChip.setAttribute('aria-disabled', x2Enabled ? 'true' : 'false');
|
historyChip.setAttribute('aria-disabled', x2Enabled ? 'true' : 'false');
|
||||||
historyChip.title = x2Enabled
|
historyChip.title = x2Enabled
|
||||||
@@ -954,8 +958,7 @@ export function render({ navigate, route, chrome } = {}) {
|
|||||||
|
|
||||||
function updateX2Chip() {
|
function updateX2Chip() {
|
||||||
if (!(x2Chip instanceof HTMLButtonElement)) return;
|
if (!(x2Chip instanceof HTMLButtonElement)) return;
|
||||||
x2Chip.classList.toggle('is-active', x2Enabled);
|
syncToggle(x2Chip, x2Enabled);
|
||||||
x2Chip.setAttribute('aria-pressed', x2Enabled ? 'true' : 'false');
|
|
||||||
x2Chip.title = x2Enabled ? 'Показаны друзья друзей. Нажмите, чтобы скрыть.' : 'Показать друзей друзей.';
|
x2Chip.title = x2Enabled ? 'Показаны друзья друзей. Нажмите, чтобы скрыть.' : 'Показать друзей друзей.';
|
||||||
updateHistoryChip();
|
updateHistoryChip();
|
||||||
}
|
}
|
||||||
@@ -1329,35 +1332,35 @@ export function render({ navigate, route, chrome } = {}) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Панель фильтров слоёв (оверлей под шапкой)
|
// Панель фильтров слоёв (оверлей под шапкой) – тот же блок-переключатель, что на других вкладках;
|
||||||
|
// пункты независимые, поэтому у каждого своё нажатое состояние (aria-pressed).
|
||||||
const filterBar = document.createElement('div');
|
const filterBar = document.createElement('div');
|
||||||
filterBar.className = 'fg-filter-bar app-top-tabs';
|
filterBar.className = 'fg-filter-bar app-top-tabs';
|
||||||
// Не даём нажатию на чип «провалиться» в сцену: иначе движок делает setPointerCapture на stage,
|
// Не даём нажатию на переключатель «провалиться» в сцену: иначе движок делает setPointerCapture на stage,
|
||||||
// а захват указателя перенаправляет нативный click со сцены — и кнопка фильтра не срабатывает.
|
// а захват указателя перенаправляет нативный click со сцены — и кнопка фильтра не срабатывает.
|
||||||
filterBar.addEventListener('pointerdown', (e) => e.stopPropagation());
|
filterBar.addEventListener('pointerdown', (e) => e.stopPropagation());
|
||||||
|
const filterTabs = document.createElement('div');
|
||||||
|
filterTabs.className = 'tabs tabs--dense fg-filter-tabs';
|
||||||
|
filterBar.append(filterTabs);
|
||||||
|
const makeToggle = (label, onClick) => {
|
||||||
|
const button = document.createElement('button');
|
||||||
|
button.type = 'button';
|
||||||
|
button.className = 'tab-btn';
|
||||||
|
button.textContent = label;
|
||||||
|
button.addEventListener('click', onClick);
|
||||||
|
filterTabs.append(button);
|
||||||
|
return button;
|
||||||
|
};
|
||||||
FILTER_ORDER.forEach((key) => {
|
FILTER_ORDER.forEach((key) => {
|
||||||
const chip = document.createElement('button');
|
const chip = makeToggle(FILTERS[key].label, () => applyFilter(key));
|
||||||
chip.type = 'button';
|
syncToggle(chip, activeFilters.has(key));
|
||||||
chip.className = `fg-filter-chip${activeFilters.has(key) ? ' is-active' : ''}`;
|
|
||||||
chip.textContent = FILTERS[key].label;
|
|
||||||
chip.addEventListener('click', () => applyFilter(key));
|
|
||||||
filterChips[key] = chip;
|
filterChips[key] = chip;
|
||||||
filterBar.append(chip);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
historyChip = document.createElement('button');
|
historyChip = makeToggle('', cycleHistoryDepth);
|
||||||
historyChip.type = 'button';
|
|
||||||
historyChip.className = 'fg-filter-chip fg-history-chip';
|
|
||||||
historyChip.addEventListener('click', cycleHistoryDepth);
|
|
||||||
filterBar.append(historyChip);
|
|
||||||
updateHistoryChip();
|
updateHistoryChip();
|
||||||
|
|
||||||
x2Chip = document.createElement('button');
|
x2Chip = makeToggle('Друзья друзей', () => { void toggleX2(); });
|
||||||
x2Chip.type = 'button';
|
|
||||||
x2Chip.className = 'fg-filter-chip fg-x2-chip';
|
|
||||||
x2Chip.textContent = 'Друзья друзей';
|
|
||||||
x2Chip.addEventListener('click', () => { void toggleX2(); });
|
|
||||||
filterBar.append(x2Chip);
|
|
||||||
updateX2Chip();
|
updateX2Chip();
|
||||||
|
|
||||||
chrome?.setTopbar(header);
|
chrome?.setTopbar(header);
|
||||||
|
|||||||
@@ -24,5 +24,5 @@
|
|||||||
.topbar-identity { display: flex; align-items: center; gap: 10px; min-width: 0; max-width: 100%; min-height: 44px; padding: 0 4px; border: 0; border-radius: 12px; background: transparent; color: var(--text-primary); font: inherit; text-align: left; cursor: pointer; }
|
.topbar-identity { display: flex; align-items: center; gap: 10px; min-width: 0; max-width: 100%; min-height: 44px; padding: 0 4px; border: 0; border-radius: 12px; background: transparent; color: var(--text-primary); font: inherit; text-align: left; cursor: pointer; }
|
||||||
.topbar-identity:disabled { cursor: default; }
|
.topbar-identity:disabled { cursor: default; }
|
||||||
.topbar-identity__text { display: grid; min-width: 0; }
|
.topbar-identity__text { display: grid; min-width: 0; }
|
||||||
.topbar-identity__title { font-size: 1rem; line-height: 1.3; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
.topbar-identity__title { font-size: 1.0625rem; line-height: 1.3; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||||
.topbar-identity__sub { margin-top: 2px; color: var(--text-secondary); font-size: .75rem; line-height: 1.125rem; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
.topbar-identity__sub { margin-top: 0; color: var(--text-secondary); font-size: .75rem; line-height: 1rem; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||||
|
|||||||
@@ -380,24 +380,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.dm-chat-input--multiline .dm-actions-col {
|
|
||||||
grid-template-columns: 46px;
|
|
||||||
grid-template-rows: repeat(2, 46px);
|
|
||||||
grid-template-areas:
|
|
||||||
"emoji"
|
|
||||||
"send";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.dm-emoji-btn {
|
|
||||||
grid-area: emoji;
|
|
||||||
min-width: 46px;
|
|
||||||
width: 46px;
|
|
||||||
padding: 0;
|
|
||||||
line-height: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.dm-emoji-btn__glyph {
|
.dm-emoji-btn__glyph {
|
||||||
display: inline-grid;
|
display: inline-grid;
|
||||||
place-items: center;
|
place-items: center;
|
||||||
@@ -463,11 +445,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.dm-chat-input--multiline .dm-input {
|
|
||||||
padding-right: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.dm-chat-input .dm-input::-webkit-scrollbar {
|
.dm-chat-input .dm-input::-webkit-scrollbar {
|
||||||
width: 0;
|
width: 0;
|
||||||
height: 0;
|
height: 0;
|
||||||
@@ -495,16 +472,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.dm-send-icon-btn {
|
|
||||||
grid-area: send;
|
|
||||||
min-width: 46px;
|
|
||||||
width: 46px;
|
|
||||||
padding: 0;
|
|
||||||
font-size: 15px;
|
|
||||||
line-height: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.dm-message-actions-popover {
|
.dm-message-actions-popover {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
left: 12px;
|
left: 12px;
|
||||||
@@ -866,16 +833,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.dm-chat-input--multiline .dm-actions-col {
|
|
||||||
grid-template-columns: 43px;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.dm-emoji-btn,
|
|
||||||
.dm-send-icon-btn {
|
|
||||||
min-width: 43px;
|
|
||||||
width: 43px;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -999,10 +956,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.dm-chat-input--multiline .dm-file-btn {
|
|
||||||
right: 0;
|
|
||||||
bottom: 104px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ===== DM file transfer v2 + voice notes ===== */
|
/* ===== DM file transfer v2 + voice notes ===== */
|
||||||
.dm-attachment-stack {
|
.dm-attachment-stack {
|
||||||
@@ -1355,3 +1308,46 @@
|
|||||||
.composer-slot:has(> .dm-chat-input) { padding-inline: var(--page-gutter); }
|
.composer-slot:has(> .dm-chat-input) { padding-inline: var(--page-gutter); }
|
||||||
|
|
||||||
.dm-chat-input .dm-send-btn { width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%; }
|
.dm-chat-input .dm-send-btn { width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%; }
|
||||||
|
|
||||||
|
/* ===== Поле сообщения (как в Telegram) =====
|
||||||
|
* Поле-«таблетка» растёт плавно по строкам, смайлик внутри поля справа внизу,
|
||||||
|
* «Отправить» – круг 44 px, выровнен по низу поля. Раскладка не перестраивается при переносе строк. */
|
||||||
|
.dm-field { position: relative; min-width: 0; display: grid; align-self: end; }
|
||||||
|
.dm-chat-input .dm-field .dm-input {
|
||||||
|
min-height: 44px;
|
||||||
|
padding: 11px 48px 11px 16px;
|
||||||
|
border-radius: 22px;
|
||||||
|
line-height: 20px;
|
||||||
|
transition: height 140ms ease-out, border-color var(--duration-fast) ease;
|
||||||
|
}
|
||||||
|
.dm-chat-input .dm-field .dm-input-measure {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
height: 0;
|
||||||
|
min-height: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
visibility: hidden;
|
||||||
|
pointer-events: none;
|
||||||
|
transition: none;
|
||||||
|
}
|
||||||
|
.dm-chat-input .dm-field .dm-emoji-btn {
|
||||||
|
position: absolute;
|
||||||
|
right: 4px;
|
||||||
|
bottom: 4px;
|
||||||
|
width: 36px;
|
||||||
|
min-width: 36px;
|
||||||
|
height: 36px;
|
||||||
|
min-height: 36px;
|
||||||
|
padding: 0;
|
||||||
|
border: 0;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: transparent;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
.dm-chat-input .dm-field .dm-emoji-btn__glyph { font-size: 23px; }
|
||||||
|
.dm-chat-input .dm-field .dm-emoji-btn:hover { background: var(--surface-selected); }
|
||||||
|
.dm-chat-input .dm-actions-col { display: flex; align-items: flex-end; gap: 6px; }
|
||||||
|
.dm-chat-input .dm-send-btn svg { width: 24px; height: 24px; }
|
||||||
|
.dm-chat-input .dm-send-btn[data-mode='send'] svg { transform: translateX(-1px) rotate(0deg); }
|
||||||
|
@media (prefers-reduced-motion: reduce) { .dm-chat-input .dm-field .dm-input { transition: none; } }
|
||||||
|
|||||||
@@ -405,11 +405,6 @@ button.dm-via-node:hover { border-color: color-mix(in srgb, var(--rel-link) 50%,
|
|||||||
|
|
||||||
.dm-actions-col {
|
.dm-actions-col {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(2, 46px);
|
|
||||||
grid-template-rows: 46px;
|
|
||||||
grid-template-areas: "emoji send";
|
|
||||||
gap: 6px;
|
|
||||||
align-self: end;
|
align-self: end;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -615,13 +610,6 @@ button.dm-via-node:hover { border-color: color-mix(in srgb, var(--rel-link) 50%,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.dm-actions-col {
|
|
||||||
grid-template-columns: repeat(2, 43px);
|
|
||||||
grid-template-rows: 46px;
|
|
||||||
gap: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Loader не имеет права участвовать в растяжении пустого flex-контейнера. */
|
/* Loader не имеет права участвовать в растяжении пустого flex-контейнера. */
|
||||||
.dm-history-loader {
|
.dm-history-loader {
|
||||||
flex: 0 0 34px;
|
flex: 0 0 34px;
|
||||||
|
|||||||
@@ -390,13 +390,13 @@
|
|||||||
.network-stage > .fg-filter-bar.app-top-tabs {
|
.network-stage > .fg-filter-bar.app-top-tabs {
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
justify-content: flex-start;
|
|
||||||
flex-wrap: nowrap;
|
|
||||||
overflow-x: auto;
|
|
||||||
padding-inline: var(--page-gutter);
|
padding-inline: var(--page-gutter);
|
||||||
scrollbar-width: none;
|
|
||||||
pointer-events: auto;
|
pointer-events: auto;
|
||||||
-webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
|
|
||||||
mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
|
|
||||||
}
|
}
|
||||||
.network-stage > .fg-filter-bar.app-top-tabs::-webkit-scrollbar { display: none; }
|
/* Тот же блок-переключатель, что на других вкладках: на всю ширину, все пункты видны. */
|
||||||
|
.network-stage .fg-filter-tabs { width: 100%; }
|
||||||
|
.network-stage .fg-filter-tabs .tab-btn:disabled { opacity: .45; cursor: default; }
|
||||||
|
@media (max-width: 360px) {
|
||||||
|
/* На самых узких экранах длинный пункт («Друзья друзей») переносится, а не обрезается. */
|
||||||
|
.network-stage .fg-filter-tabs .tab-btn { white-space: normal; line-height: 1.1; }
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user