Обновить UI-кнопки и прокрутку

This commit is contained in:
2026-08-22 11:28:12 +03:00
parent d3e6aa2be2
commit bc8c7f318b
9 changed files with 286 additions and 26 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ window.__SHINE_BUILD_HASH__ = '20260819190000';
<script>
(function attachStylesWithBuildHash() {
const v = encodeURIComponent(window.__SHINE_BUILD_HASH__ || 'dev');
const cssFiles = ['./styles/main.css', './styles/layout.css', './styles/components.css', './styles/network-graph.css'];
const cssFiles = ['./styles/main.css', './styles/layout.css', './styles/components.css', './styles/network-graph.css', './styles/buttons-white.css'];
cssFiles.forEach((file) => {
const link = document.createElement('link');
link.rel = 'stylesheet';
+24 -1
View File
@@ -5,6 +5,7 @@ import {
syncTrackedRouteHistory,
} from './router.js';
import { renderToolbar } from './components/toolbar.js';
import { attachScrollToBottomButton } from './components/scroll-to-bottom-button.js';
import { captureClientError, setClientErrorSentNotifier, setClientErrorTransport } from './services/client-error-reporter.js';
import { initPwaInstallPromptHandling } from './services/pwa-install-service.js';
import { initPwaPush } from './services/pwa-push-service.js';
@@ -190,6 +191,15 @@ let initialConnectionCompleted = false;
let orientationLockInFlight = false;
let currentChromeCleanup = null;
const CALL_PUSH_PENDING_ACTION_KEY = 'shine-ui-call-push-pending-action-v1';
const SCROLL_TO_BOTTOM_PAGE_IDS = new Set([
'messages-list',
'chat-view',
'channels-list',
'channel-view',
'channel-thread-view',
'notifications-view',
]);
const GUEST_ALLOWED_PAGES = new Set([
'start-view',
'entry-settings-view',
@@ -1128,6 +1138,14 @@ function renderPageFailureFallback(pageId, error) {
refreshConnectionUi();
}
function attachPageScrollToBottom(pageId, screen) {
if (!SCROLL_TO_BOTTOM_PAGE_IDS.has(pageId)) return null;
return attachScrollToBottomButton({
scrollContainer: () => screen.querySelector('.dm-chat-wrap') || screenEl,
});
}
function renderApp() {
syncTrackedRouteHistory(window.location.pathname || '/');
const route = getRoute();
@@ -1164,7 +1182,12 @@ function renderApp() {
}
screenEl.append(screen);
currentCleanup = typeof screen.cleanup === 'function' ? screen.cleanup : null;
const pageCleanup = typeof screen.cleanup === 'function' ? screen.cleanup : null;
const scrollToBottomControl = attachPageScrollToBottom(pageId, screen);
currentCleanup = () => {
pageCleanup?.();
scrollToBottomControl?.cleanup();
};
screenEl.classList.toggle('no-app-chrome', !showAppChrome);
screenEl.classList.toggle('preauth-flow', PRE_AUTH_PAGES.includes(pageId));
@@ -30,6 +30,7 @@ export function attachScrollToBottomButton({
button.className = 'scroll-to-bottom-btn';
button.title = title;
button.setAttribute('aria-label', 'Прокрутить ленту вниз');
button.tabIndex = -1;
button.append(buildArrowIcon());
target.append(button);
@@ -42,6 +43,7 @@ export function attachScrollToBottomButton({
const hide = () => {
button.classList.remove('is-visible');
button.setAttribute('aria-hidden', 'true');
button.tabIndex = -1;
};
const scheduleRefresh = () => {
@@ -103,6 +105,7 @@ export function attachScrollToBottomButton({
button.classList.toggle('is-visible', shouldShow);
button.setAttribute('aria-hidden', shouldShow ? 'false' : 'true');
button.tabIndex = shouldShow ? 0 : -1;
}
const scrollToBottom = () => {
-4
View File
@@ -1,5 +1,4 @@
import { renderHeader } from '../components/header.js';
import { attachScrollToBottomButton } from '../components/scroll-to-bottom-button.js';
import { authService, getMessageReactionState, setMessageReactionState, state } from '../state.js';
import { captureClientError } from '../services/client-error-reporter.js';
import { toUserMessage } from '../services/ui-error-texts.js';
@@ -1144,7 +1143,6 @@ export function render({ navigate, route, chrome }) {
screen.className = 'stack channels-screen channels-screen--thread';
const appScreen = document.getElementById('app-screen');
appScreen?.classList.add('channels-scroll-clean');
const scrollToBottomControl = attachScrollToBottomButton({ scrollContainer: appScreen });
const header = renderHeader({
title: '',
@@ -1356,7 +1354,6 @@ export function render({ navigate, route, chrome }) {
invalid.textContent = 'Некорректный идентификатор треда в адресе страницы.';
screen.append(invalid);
screen.cleanup = () => {
scrollToBottomControl.cleanup();
appScreen?.classList.remove('channels-scroll-clean');
};
return screen;
@@ -1545,7 +1542,6 @@ export function render({ navigate, route, chrome }) {
})();
screen.cleanup = () => {
scrollToBottomControl.cleanup();
appScreen?.classList.remove('channels-scroll-clean');
};
-3
View File
@@ -1,5 +1,4 @@
import { renderHeader } from '../components/header.js';
import { attachScrollToBottomButton } from '../components/scroll-to-bottom-button.js';
import {
authService,
getMessageReactionState,
@@ -2042,7 +2041,6 @@ export function render({ navigate, route, chrome }) {
screen.className = 'stack channels-screen channels-screen--channel';
const appScreen = document.getElementById('app-screen');
appScreen?.classList.add('channels-scroll-clean');
const scrollToBottomControl = attachScrollToBottomButton({ scrollContainer: appScreen });
const statusBox = document.createElement('div');
statusBox.className = 'card status-line is-unavailable channels-status';
@@ -2488,7 +2486,6 @@ export function render({ navigate, route, chrome }) {
})();
screen.cleanup = () => {
scrollToBottomControl.cleanup();
appScreen?.classList.remove('channels-scroll-clean');
if (typeof cleanupSeenTracking === 'function') cleanupSeenTracking();
};
-6
View File
@@ -1,5 +1,4 @@
import { renderHeader } from '../components/header.js';
import { attachScrollToBottomButton } from '../components/scroll-to-bottom-button.js';
import { directMessages } from '../mock-data.js';
import {
addAppLogEntry,
@@ -907,10 +906,6 @@ export function render({ navigate, route, chrome }) {
const wrap = document.createElement('div');
wrap.className = 'chat-wrap dm-chat-wrap';
const scrollToBottomControl = attachScrollToBottomButton({
scrollContainer: () => boundScrollContainer || wrap,
});
const historyLoader = document.createElement('div');
historyLoader.className = 'dm-history-loader';
historyLoader.hidden = true;
@@ -1563,7 +1558,6 @@ export function render({ navigate, route, chrome }) {
void loadHistoryPage({ preserveScroll: true });
});
screen.cleanup = () => {
scrollToBottomControl.cleanup();
hideUnreadSeparator({ rerender: false });
stopAllTwemojiAnimations();
window.removeEventListener('shine-chat-messages-updated', handleIncomingChatRefresh);
+38 -8
View File
@@ -306,8 +306,20 @@ export function render({ navigate, chrome } = {}) {
const tabs = document.createElement('div');
tabs.className = 'tabs';
tabs.innerHTML = `
<button class="tab-btn ${state.notificationsTab === 'replies' ? 'active' : ''}" data-tab="replies">Ответы</button>
<button class="tab-btn ${state.notificationsTab === 'events' ? 'active' : ''}" data-tab="events">События</button>
<button
type="button"
class="tab-btn notification-tab-btn ${state.notificationsTab === 'replies' ? 'active' : ''}"
data-tab="replies"
data-selected="${state.notificationsTab === 'replies' ? 'true' : 'false'}"
aria-selected="${state.notificationsTab === 'replies' ? 'true' : 'false'}"
>Ответы</button>
<button
type="button"
class="tab-btn notification-tab-btn ${state.notificationsTab === 'events' ? 'active' : ''}"
data-tab="events"
data-selected="${state.notificationsTab === 'events' ? 'true' : 'false'}"
aria-selected="${state.notificationsTab === 'events' ? 'true' : 'false'}"
>События</button>
`;
const list = document.createElement('div');
@@ -347,13 +359,31 @@ export function render({ navigate, chrome } = {}) {
}
}
tabs.querySelectorAll('.tab-btn').forEach((btn) => {
function setActiveNotificationTab(nextTab) {
const normalizedTab = nextTab === 'events' ? 'events' : 'replies';
state.notificationsTab = normalizedTab;
tabs.querySelectorAll('.notification-tab-btn').forEach((node) => {
const selected = node.dataset.tab === normalizedTab;
node.classList.toggle('active', selected);
node.dataset.selected = selected ? 'true' : 'false';
node.setAttribute('aria-selected', selected ? 'true' : 'false');
});
}
// Активная кнопка остаётся визуально нажатой до выбора второй вкладки.
// При переключении класс active и aria-selected синхронно переходят на новую кнопку.
setActiveNotificationTab(state.notificationsTab);
tabs.querySelectorAll('.notification-tab-btn').forEach((btn) => {
btn.addEventListener('click', () => {
const nextTab = String(btn.dataset.tab || 'replies');
if (state.notificationsTab === nextTab) return;
state.notificationsTab = nextTab;
tabs.querySelectorAll('.tab-btn').forEach((node) => node.classList.remove('active'));
btn.classList.add('active');
const nextTab = btn.dataset.tab === 'events' ? 'events' : 'replies';
if (state.notificationsTab === nextTab) {
setActiveNotificationTab(nextTab);
return;
}
setActiveNotificationTab(nextTab);
void load();
});
});
+165
View File
@@ -0,0 +1,165 @@
/*
* Единый визуальный язык кнопок основного приложения:
* белое содержимое, без рамок и самостоятельной подложки.
*
* Исключения:
* - фильтры групп на экране «Связи» (.fg-filter-chip) сохраняют прежний вид;
* - нижний toolbar (.toolbar-btn) полностью сохраняет исходное оформление.
*/
:root button:not(.fg-filter-chip):not(.toolbar-btn),
:root a.primary-btn,
:root a.secondary-btn,
:root a.destructive-btn,
:root a.ghost-btn,
:root a.icon-btn,
:root a.text-btn {
color: #ffffff !important;
background: transparent !important;
background-image: none !important;
border: 0 !important;
box-shadow: none !important;
text-shadow: none !important;
backdrop-filter: none !important;
-webkit-backdrop-filter: none !important;
transition:
transform 90ms ease,
box-shadow 90ms ease,
background-color 90ms ease,
filter 120ms ease;
}
:root button:not(.fg-filter-chip):not(.toolbar-btn):hover,
:root a.primary-btn:hover,
:root a.secondary-btn:hover,
:root a.destructive-btn:hover,
:root a.ghost-btn:hover,
:root a.icon-btn:hover,
:root a.text-btn:hover {
color: #ffffff !important;
background: transparent !important;
border: 0 !important;
box-shadow: none !important;
filter: brightness(1.12);
}
/* Короткий press-feedback: кнопка визуально уходит внутрь поверхности.
* Эффект существует только пока кнопка физически нажата.
*/
:root button:not(.fg-filter-chip):not(.toolbar-btn):active,
:root a.primary-btn:active,
:root a.secondary-btn:active,
:root a.destructive-btn:active,
:root a.ghost-btn:active,
:root a.icon-btn:active,
:root a.text-btn:active {
color: #ffffff !important;
background: rgba(0, 0, 0, 0.12) !important;
border: 0 !important;
box-shadow:
inset 0 3px 8px rgba(0, 0, 0, 0.58),
inset 0 -1px 2px rgba(255, 255, 255, 0.08) !important;
transform: translateY(1px) scale(0.97);
filter: brightness(0.9);
}
:root button:not(.fg-filter-chip):not(.toolbar-btn):disabled,
:root button:not(.fg-filter-chip):not(.toolbar-btn)[aria-disabled='true'],
:root a.primary-btn[aria-disabled='true'],
:root a.secondary-btn[aria-disabled='true'],
:root a.destructive-btn[aria-disabled='true'],
:root a.ghost-btn[aria-disabled='true'],
:root a.icon-btn[aria-disabled='true'],
:root a.text-btn[aria-disabled='true'] {
color: rgba(255, 255, 255, 0.42) !important;
background: transparent !important;
border: 0 !important;
box-shadow: none !important;
transform: none !important;
filter: none !important;
}
/* Убираем декоративные стеклянные/неоновые подложки самих кнопок.
* Переключатель канала исключён: его ::after является функциональным бегунком.
* Toolbar исключён целиком: у него остаётся исходная графика приложения.
*/
:root button:not(.fg-filter-chip):not(.toolbar-btn):not(.channel-toggle-btn)::before,
:root button:not(.fg-filter-chip):not(.toolbar-btn):not(.channel-toggle-btn)::after {
background: transparent !important;
background-image: none !important;
border-color: transparent !important;
box-shadow: none !important;
}
/* Toolbar возвращён к исходному оформлению. Добавляем только краткое вдавливание
* на физическое нажатие; active-вкладка после отпускания остаётся такой, как была.
*/
:root .toolbar-btn {
transition:
transform 90ms ease,
box-shadow 90ms ease,
background-color 90ms ease,
color 120ms ease;
}
:root .toolbar-btn:active {
transform: translateY(1px) scale(0.96);
background: rgba(0, 0, 0, 0.14) !important;
box-shadow:
inset 0 4px 10px rgba(0, 0, 0, 0.62),
inset 0 -1px 2px rgba(255, 255, 255, 0.08) !important;
}
/* Клавиатурный фокус остаётся различимым без постоянной рамки кнопки. */
:root button:not(.fg-filter-chip):not(.toolbar-btn):focus-visible,
:root a.primary-btn:focus-visible,
:root a.secondary-btn:focus-visible,
:root a.destructive-btn:focus-visible,
:root a.ghost-btn:focus-visible,
:root a.icon-btn:focus-visible,
:root a.text-btn:focus-visible {
outline: 2px solid rgba(255, 255, 255, 0.62);
outline-offset: 2px;
}
/* Уведомления: «Ответы / События».
* ВАЖНО: общий button:hover выше имеет большую специфичность, поэтому для выбранной
* вкладки фиксируем отдельный data-selected и перечисляем hover/focus/active.
* Так выбранная кнопка остаётся визуально вдавленной и после отпускания мыши.
*/
:root body .notifications-screen .tabs button.notification-tab-btn[data-selected='true'],
:root body .notifications-screen .tabs button.notification-tab-btn[data-selected='true']:hover,
:root body .notifications-screen .tabs button.notification-tab-btn[data-selected='true']:focus,
:root body .notifications-screen .tabs button.notification-tab-btn[data-selected='true']:focus-visible,
:root body .notifications-screen .tabs button.notification-tab-btn[data-selected='true']:active {
color: #ffffff !important;
background: rgba(0, 0, 0, 0.18) !important;
border: 0 !important;
box-shadow:
inset 0 4px 11px rgba(0, 0, 0, 0.72),
inset 0 -1px 2px rgba(255, 255, 255, 0.10) !important;
transform: translateY(1px) scale(0.965) !important;
filter: brightness(0.88) !important;
}
:root body .notifications-screen .tabs button.notification-tab-btn[data-selected='false'],
:root body .notifications-screen .tabs button.notification-tab-btn[data-selected='false']:hover {
color: #ffffff !important;
background: transparent !important;
border: 0 !important;
box-shadow: none !important;
transform: none !important;
filter: none !important;
}
/* Неактивная вкладка кратко вдавливается во время физического нажатия.
* После click data-selected меняется и постоянный стиль остаётся уже на ней.
*/
:root body .notifications-screen .tabs button.notification-tab-btn[data-selected='false']:active {
background: rgba(0, 0, 0, 0.12) !important;
box-shadow:
inset 0 3px 8px rgba(0, 0, 0, 0.58),
inset 0 -1px 2px rgba(255, 255, 255, 0.08) !important;
transform: translateY(1px) scale(0.97) !important;
filter: brightness(0.9) !important;
}
+55 -3
View File
@@ -6408,9 +6408,9 @@ html, body { overflow-x: hidden; }
.dm-screen .bubble.out {
justify-self: end;
border-radius: 18px 18px 4px 18px;
border: 1px solid rgba(212, 175, 55, 0.38);
background: rgba(212, 175, 55, 0.16);
color: rgba(255, 236, 191, 0.96);
border: 1px solid rgba(83, 216, 251, 0.4);
background: rgba(83, 216, 251, 0.16);
color: rgba(225, 248, 255, 0.97);
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
}
@@ -8141,3 +8141,55 @@ html, body { overflow-x: hidden; }
.notifications-screen .notification-card--clickable:active {
transform: scale(0.99);
}
/* ===== Общая кнопка прокрутки ленты вниз ===== */
.scroll-to-bottom-btn {
position: absolute;
right: 18px;
bottom: calc(var(--toolbar-height, 78px) + var(--composer-height, 0px) + 18px + env(safe-area-inset-bottom));
width: 48px;
height: 48px;
margin: 0;
padding: 0;
cursor: pointer;
-webkit-tap-highlight-color: transparent;
border-radius: 999px;
border: 1px solid rgba(212, 175, 55, 0.45);
background: linear-gradient(160deg, rgba(16, 24, 38, 0.94), rgba(12, 18, 30, 0.9));
color: rgba(255, 227, 150, 0.96);
box-shadow: 0 12px 26px rgba(3, 8, 18, 0.45), 0 0 20px rgba(212, 175, 55, 0.16);
display: inline-flex;
align-items: center;
justify-content: center;
z-index: 38;
opacity: 0;
pointer-events: none;
transform: translateY(8px);
transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.scroll-to-bottom-btn.is-visible {
opacity: 1;
pointer-events: auto;
transform: translateY(0);
}
.scroll-to-bottom-btn:hover {
box-shadow: 0 14px 30px rgba(3, 8, 18, 0.55), 0 0 24px rgba(212, 175, 55, 0.22);
}
.scroll-to-bottom-btn:focus-visible {
outline: 2px solid rgba(255, 227, 150, 0.92);
outline-offset: 3px;
}
.scroll-to-bottom-btn__icon {
font-size: 22px;
line-height: 1;
transform: translateY(-1px);
}
body.chat-topbar-overlay .app-shell.keyboard-open .scroll-to-bottom-btn {
bottom: calc(var(--keyboard-offset, 0px) + var(--composer-height, 0px) + 18px);
}