Добавить поддержку уведомлений

This commit is contained in:
2026-08-21 14:11:47 +03:00
parent 19362b950a
commit d3e6aa2be2
23 changed files with 744 additions and 116 deletions
+1 -1
View File
@@ -1371,7 +1371,7 @@ async function loadFromApi(route, channelId) {
throw new Error('Канал не найден.');
}
unreadCount = Number(channel?.unreadCount || 0);
messagesCount = Number(channel?.messagesCount || mergedMessages.length || 0);
messagesCount = Number(channel?.messagesCount || 0);
selector = {
ownerBlockchainName: String(channel.channel.ownerBlockchainName),
channelRootBlockNumber: Number(channel.channel.channelRoot.blockNumber),
-7
View File
@@ -1,5 +1,4 @@
import { renderHeader } from '../components/header.js';
import { attachScrollToBottomButton } from '../components/scroll-to-bottom-button.js';
import { renderUserAvatar } from '../components/avatar-image.js';
import { authService, state } from '../state.js';
import { loadProfileSnapshot } from '../services/user-profile-params.js';
@@ -302,8 +301,6 @@ function renderItem(item, activeTab, navigate) {
export function render({ navigate, chrome } = {}) {
const screen = document.createElement('section');
screen.className = 'stack notifications-screen';
const appScreen = document.getElementById('app-screen');
const scrollToBottomControl = attachScrollToBottomButton({ scrollContainer: appScreen });
chrome?.setTopbar(renderHeader({ title: 'Уведомления' }));
const tabs = document.createElement('div');
@@ -336,7 +333,6 @@ export function render({ navigate, chrome } = {}) {
const items = await Promise.all(baseItems.map((item) => enrichItem(item, activeTab)));
if (seq !== requestSeq) return;
list.replaceChildren(...items.map((item) => renderItem(item, activeTab, navigate)));
scrollToBottomControl.refresh();
} catch (error) {
if (seq !== requestSeq) return;
const card = document.createElement('article');
@@ -364,8 +360,5 @@ export function render({ navigate, chrome } = {}) {
screen.append(tabs, list);
void load();
screen.cleanup = () => {
scrollToBottomControl.cleanup();
};
return screen;
}
+8
View File
@@ -2862,6 +2862,14 @@ export class AuthService {
return response.payload || {};
}
async getNotifications(limit = 50) {
const payload = {};
if (Number.isFinite(Number(limit))) payload.limit = Math.max(1, Math.min(200, Number(limit)));
const response = await this.ws.request('GetNotifications', payload);
if (response.status !== 200) throw opError('GetNotifications', response);
return response.payload || {};
}
async getUserConnectionsGraph(login) {
const response = await this.ws.request('GetUserConnectionsGraph', { login });
if (response.status !== 200) throw opError('GetUserConnectionsGraph', response);
-72
View File
@@ -7453,19 +7453,6 @@ html, body { overflow-x: hidden; }
border-color: rgba(230, 236, 245, 0.28);
}
.profile-head-menu-wrap {
margin-left: auto;
}
.profile-head-menu-item img {
width: 24px;
height: 24px;
flex: 0 0 auto;
display: block;
opacity: 0.94;
filter: drop-shadow(0 0 5px rgba(240, 184, 46, 0.18));
}
.profile-info-modal {
padding: 16px;
background: rgba(2, 5, 11, 0.7);
@@ -8154,62 +8141,3 @@ html, body { overflow-x: hidden; }
.notifications-screen .notification-card--clickable:active {
transform: scale(0.99);
}
/* ===== Shared scroll-to-bottom control ===== */
.scroll-to-bottom-btn {
position: absolute;
right: 16px;
bottom: calc(var(--toolbar-height, 78px) + var(--composer-height, 0px) + 14px + env(safe-area-inset-bottom));
z-index: 28;
width: 44px;
height: 44px;
padding: 0;
display: grid;
place-items: center;
border-radius: 50%;
border: 1px solid rgba(212, 175, 55, 0.38);
background: rgba(15, 20, 31, 0.82);
color: rgba(255, 226, 143, 0.96);
box-shadow:
0 8px 26px rgba(0, 0, 0, 0.34),
0 0 18px rgba(212, 175, 55, 0.14),
inset 0 1px 0 rgba(255, 255, 255, 0.08);
backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
opacity: 0;
pointer-events: none;
transform: translateY(10px) scale(0.92);
transition: opacity 160ms ease, transform 160ms ease, border-color 160ms ease, background 160ms ease;
cursor: pointer;
-webkit-tap-highlight-color: transparent;
}
.scroll-to-bottom-btn.is-visible {
opacity: 1;
pointer-events: auto;
transform: translateY(0) scale(1);
}
.scroll-to-bottom-btn:hover,
.scroll-to-bottom-btn:focus-visible {
border-color: rgba(255, 208, 82, 0.64);
background: rgba(24, 29, 43, 0.92);
outline: none;
}
.scroll-to-bottom-btn:active {
transform: translateY(1px) scale(0.96);
}
.scroll-to-bottom-btn__icon {
display: block;
margin-top: -2px;
font-size: 27px;
line-height: 1;
font-weight: 400;
text-shadow: 0 0 10px rgba(255, 201, 69, 0.34);
}
.app-shell.keyboard-open .scroll-to-bottom-btn {
bottom: calc(var(--keyboard-offset, 0px) + var(--composer-height, 0px) + 14px + env(safe-area-inset-bottom));
}