SHA256
Смерджить карточку «Поддержка» и текст о шифровании в голосовые сообщения
Объединены ветки ui/dm-voice и ui/support-card-ethereal для одного PR. Конфликты: index.html — в список стилей вошли оба файла (dm-voice.css и profile-support.css); VERSION.properties — client 1.21.8, server 1.17.6. chat-view.js, словари ru/en, ui-icon.js и WALLET_SHINE_SUPPORT.md слились автоматически. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -45,7 +45,7 @@ window.__SHINE_BUILD_HASH__ = '20261119-graph-v4c';
|
||||
<script>
|
||||
(function attachStylesWithBuildHash() {
|
||||
const v = encodeURIComponent(window.__SHINE_BUILD_HASH__ || 'dev');
|
||||
const cssFiles = ['./styles/main.css', './styles/layout.css', './styles/app-shell.css', './styles/buttons-white.css', './styles/components/topbar.css', './styles/components/dropdown-menu.css', './styles/components/primitives.css', './styles/components/feedback.css', './styles/components/tabs.css', './styles/components/chips.css', './styles/components/nav-list.css', './styles/components/palette-editor.css', './styles/components/avatar.css', './styles/components/modal.css', './styles/components/person-note.css', './styles/components/person-row.css', './styles/components/compose.css', './styles/components/attachments.css', './styles/components/media-viewer.css', './styles/components/channel-editor.css', './styles/components/emoji-picker.css', './styles/components/call-ui.css', './styles/components/scroll-to-bottom.css', './styles/components/overflow-dots.css', './styles/components/toolbar.css', './styles/features/preauth.css', './styles/features/messages.css', './styles/features/chat.css', './styles/features/dm-voice.css', './styles/features/channels-common.css', './styles/features/channels-list.css', './styles/features/channel.css', './styles/features/channel-thread.css', './styles/features/notifications.css', './styles/features/network.css', './styles/features/profile.css', './styles/features/profile-page.css', './styles/features/settings.css', './styles/features/devices.css', './styles/features/developer-tools.css', './styles/features/wallet-transfer.css', './styles/features/wallet-swap.css', './styles/network-graph.css', './styles/network-legacy.css'];
|
||||
const cssFiles = ['./styles/main.css', './styles/layout.css', './styles/app-shell.css', './styles/buttons-white.css', './styles/components/topbar.css', './styles/components/dropdown-menu.css', './styles/components/primitives.css', './styles/components/feedback.css', './styles/components/tabs.css', './styles/components/chips.css', './styles/components/nav-list.css', './styles/components/palette-editor.css', './styles/components/avatar.css', './styles/components/modal.css', './styles/components/person-note.css', './styles/components/person-row.css', './styles/components/compose.css', './styles/components/attachments.css', './styles/components/media-viewer.css', './styles/components/channel-editor.css', './styles/components/emoji-picker.css', './styles/components/call-ui.css', './styles/components/scroll-to-bottom.css', './styles/components/overflow-dots.css', './styles/components/toolbar.css', './styles/features/preauth.css', './styles/features/messages.css', './styles/features/chat.css', './styles/features/dm-voice.css', './styles/features/channels-common.css', './styles/features/channels-list.css', './styles/features/channel.css', './styles/features/channel-thread.css', './styles/features/notifications.css', './styles/features/network.css', './styles/features/profile.css', './styles/features/profile-page.css', './styles/features/profile-support.css', './styles/features/settings.css', './styles/features/devices.css', './styles/features/developer-tools.css', './styles/features/wallet-transfer.css', './styles/features/wallet-swap.css', './styles/network-graph.css', './styles/network-legacy.css'];
|
||||
// Стили, добавленные скриптом, браузер не ждёт перед первой отрисовкой: без этого
|
||||
// на долю секунды виден экран без CSS (логотип 640×640), а потом он «прыгает» на место.
|
||||
const root = document.documentElement;
|
||||
|
||||
@@ -0,0 +1,335 @@
|
||||
import { formatStarAmount } from '../services/shine-support-amount.js';
|
||||
|
||||
// Одноразовое «сияние» карточки «Поддержка» (после раскрытия и при тапе по ней):
|
||||
// — «пополнение»: в каждой ненулевой строке комета цвета метрики летит дугой от иконки к сумме, оставляя
|
||||
// светящийся хвост и пылинки; при попадании сумма вспыхивает искрами и досчитывается от нуля;
|
||||
// — золотой блик обходит рамку по контуру и гаснет вспышкой-звёздочкой в правом верхнем углу;
|
||||
// — пунктирная орбита с золотыми точками вокруг карточки.
|
||||
// Всё декоративное (aria-hidden), каждый слой удаляет себя по окончании своей анимации, а единый цикл rAF
|
||||
// останавливается, как только страница закрыта, — таймеров, переживающих страницу, нет.
|
||||
|
||||
const COMET_START_MS = 150;
|
||||
const COMET_STAGGER_MS = 260;
|
||||
const COMET_FLIGHT_MS = 650;
|
||||
// Доля пути, которую занимает хвост кометы; после попадания хвост «втягивается» в сумму.
|
||||
const COMET_TRAIL = 0.5;
|
||||
const MOTE_EVERY_MS = 30;
|
||||
const COUNT_MS = 700;
|
||||
const ORBIT_MS = 2400;
|
||||
const ORBIT_GAP = 6;
|
||||
// Поле SVG орбиты вокруг карточки: эффекты не выходят за край дальше 10px (иначе на 320px появится горизонтальная прокрутка).
|
||||
const ORBIT_PAD = 10;
|
||||
const ORBIT_DOTS = 7;
|
||||
const SPARKS = 8;
|
||||
const SVG_NS = 'http://www.w3.org/2000/svg';
|
||||
|
||||
const runs = new WeakMap();
|
||||
let fxSeq = 0;
|
||||
|
||||
export function prefersReducedMotion() {
|
||||
return Boolean(window.matchMedia?.('(prefers-reduced-motion: reduce)').matches);
|
||||
}
|
||||
|
||||
const easeOutCubic = (p) => 1 - (1 - p) ** 3;
|
||||
const easeInOutCubic = (p) => (p < 0.5 ? 4 * p ** 3 : 1 - (-2 * p + 2) ** 3 / 2);
|
||||
|
||||
function removeAfterOwnAnimation(el) {
|
||||
// animationend всплывает от дочерних слоёв — удаляем только по окончании анимации самого элемента.
|
||||
const done = (event) => { if (event.target === el) el.remove(); };
|
||||
el.addEventListener('animationend', done);
|
||||
el.addEventListener('animationcancel', done);
|
||||
}
|
||||
|
||||
// offsetLeft/offsetTop не зависят от transform: замеры верны, даже когда карточка вдавлена (scale .97).
|
||||
function offsetWithin(el, ancestor) {
|
||||
let x = 0;
|
||||
let y = 0;
|
||||
for (let node = el; node && node !== ancestor; node = node.offsetParent) {
|
||||
x += node.offsetLeft;
|
||||
y += node.offsetTop;
|
||||
}
|
||||
return { x, y };
|
||||
}
|
||||
|
||||
function svgEl(name, attrs = {}) {
|
||||
const el = document.createElementNS(SVG_NS, name);
|
||||
for (const [key, value] of Object.entries(attrs)) el.setAttribute(key, String(value));
|
||||
return el;
|
||||
}
|
||||
|
||||
function overlaySvg(card, className, width = card.offsetWidth, height = card.offsetHeight) {
|
||||
const svg = svgEl('svg', { width, height, viewBox: `0 0 ${width} ${height}`, 'aria-hidden': 'true', focusable: 'false' });
|
||||
svg.setAttribute('class', `profile-support-fx ${className}`);
|
||||
const defs = svgEl('defs');
|
||||
svg.append(defs);
|
||||
return { svg, defs, width, height };
|
||||
}
|
||||
|
||||
// Свечение — SVG-фильтр, а не CSS filter: на вложенных элементах SVG CSS-фильтры поддерживаются не везде.
|
||||
// Область фильтра задана в координатах холста: у тонкой линии рамка объекта почти нулевой высоты.
|
||||
// layers — сколько раз наложить ореол: два слоя дают яркий «неоновый» росчерк.
|
||||
function glowFilter(defs, width, height, deviation, layers = 1) {
|
||||
const id = `profile-support-glow-${fxSeq += 1}`;
|
||||
const filter = svgEl('filter', { id, filterUnits: 'userSpaceOnUse', x: 0, y: 0, width, height });
|
||||
filter.append(svgEl('feGaussianBlur', { in: 'SourceGraphic', stdDeviation: deviation, result: 'blur' }));
|
||||
const merge = svgEl('feMerge');
|
||||
for (let i = 0; i < layers; i += 1) merge.append(svgEl('feMergeNode', { in: 'blur' }));
|
||||
merge.append(svgEl('feMergeNode', { in: 'SourceGraphic' }));
|
||||
filter.append(merge);
|
||||
defs.append(filter);
|
||||
return `url(#${id})`;
|
||||
}
|
||||
|
||||
// Скруглённый прямоугольник по часовой стрелке от правого верхнего угла: блик, пройдя круг, гаснет в этом углу.
|
||||
function roundedRectPath(x, y, w, h, r) {
|
||||
const rr = Math.max(0, Math.min(r, w / 2, h / 2));
|
||||
return `M ${x + w - rr} ${y} A ${rr} ${rr} 0 0 1 ${x + w} ${y + rr} V ${y + h - rr}`
|
||||
+ ` A ${rr} ${rr} 0 0 1 ${x + w - rr} ${y + h} H ${x + rr} A ${rr} ${rr} 0 0 1 ${x} ${y + h - rr}`
|
||||
+ ` V ${y + rr} A ${rr} ${rr} 0 0 1 ${x + rr} ${y} Z`;
|
||||
}
|
||||
|
||||
// Четырёхлучевая звёздочка-вспышка с вогнутыми гранями.
|
||||
function sparklePath(cx, cy, s) {
|
||||
return `M ${cx} ${cy - s} Q ${cx} ${cy} ${cx + s} ${cy} Q ${cx} ${cy} ${cx} ${cy + s}`
|
||||
+ ` Q ${cx} ${cy} ${cx - s} ${cy} Q ${cx} ${cy} ${cx} ${cy - s} Z`;
|
||||
}
|
||||
|
||||
function cardRadius(card) {
|
||||
return parseFloat(getComputedStyle(card).borderTopLeftRadius) || 20;
|
||||
}
|
||||
|
||||
function rimGlint(card) {
|
||||
const { svg, defs, width, height } = overlaySvg(card, 'profile-support-fx__rim');
|
||||
const glow = glowFilter(defs, width, height, 2);
|
||||
const r = cardRadius(card);
|
||||
// Линия ложится ровно на грань: середина штриха — в 0.75px от края.
|
||||
const d = roundedRectPath(0.75, 0.75, width - 1.5, height - 1.5, r - 0.75);
|
||||
const tint = svgEl('path', { d });
|
||||
tint.setAttribute('class', 'profile-support-fx__rim-tint');
|
||||
const glint = svgEl('path', { d, pathLength: 1, filter: glow });
|
||||
glint.setAttribute('class', 'profile-support-fx__rim-glint');
|
||||
// Середина дуги правого верхнего угла: r·(1 − cos 45°) от каждого края. Вспышке — своё, более яркое свечение.
|
||||
const corner = r * 0.29;
|
||||
const flare = svgEl('path', { d: sparklePath(width - corner, corner, 11), filter: glowFilter(defs, width, height, 2.5, 2) });
|
||||
flare.setAttribute('class', 'profile-support-fx__flare');
|
||||
svg.append(tint, glint, flare);
|
||||
removeAfterOwnAnimation(svg);
|
||||
card.append(svg);
|
||||
}
|
||||
|
||||
function orbit(card) {
|
||||
const { svg, width, height } = overlaySvg(card, 'profile-support-fx__orbit', card.offsetWidth + ORBIT_PAD * 2, card.offsetHeight + ORBIT_PAD * 2);
|
||||
svg.style.left = `${-ORBIT_PAD}px`;
|
||||
svg.style.top = `${-ORBIT_PAD}px`;
|
||||
const inset = ORBIT_PAD - ORBIT_GAP;
|
||||
const ring = svgEl('path', { d: roundedRectPath(inset, inset, width - inset * 2, height - inset * 2, cardRadius(card) + ORBIT_GAP) });
|
||||
ring.setAttribute('class', 'profile-support-fx__ring');
|
||||
svg.append(ring);
|
||||
const dots = [];
|
||||
for (let i = 0; i < ORBIT_DOTS; i += 1) {
|
||||
const el = svgEl('circle', { r: (1.2 + (i % 3) * 0.5).toFixed(1), opacity: 0 });
|
||||
el.setAttribute('class', 'profile-support-fx__dot');
|
||||
svg.append(el);
|
||||
dots.push({ el, start: (i + Math.random() * 0.6) / ORBIT_DOTS, travel: 0.2 + Math.random() * 0.12, peak: 0.55 + Math.random() * 0.45 });
|
||||
}
|
||||
removeAfterOwnAnimation(svg);
|
||||
card.append(svg);
|
||||
// Длина пути доступна только у вставленного в документ SVG.
|
||||
return { svg, ring, dots, length: ring.getTotalLength() };
|
||||
}
|
||||
|
||||
function moveOrbitDots(fx, elapsed) {
|
||||
const p = Math.min(1, elapsed / ORBIT_MS);
|
||||
const envelope = Math.sin(Math.PI * p);
|
||||
for (const dot of fx.dots) {
|
||||
const point = fx.ring.getPointAtLength(((dot.start + dot.travel * easeOutCubic(p)) % 1) * fx.length);
|
||||
dot.el.setAttribute('cx', point.x.toFixed(1));
|
||||
dot.el.setAttribute('cy', point.y.toFixed(1));
|
||||
dot.el.setAttribute('opacity', (envelope * dot.peak).toFixed(2));
|
||||
}
|
||||
return p < 1;
|
||||
}
|
||||
|
||||
function sparkBurst(amount) {
|
||||
const burst = document.createElement('span');
|
||||
burst.className = 'profile-support-sparks';
|
||||
burst.setAttribute('aria-hidden', 'true');
|
||||
for (let i = 0; i < SPARKS; i += 1) {
|
||||
const spark = document.createElement('span');
|
||||
spark.className = 'profile-support-spark';
|
||||
spark.style.setProperty('--a', `${Math.round(i * (360 / SPARKS) + Math.random() * 24 - 12)}deg`);
|
||||
spark.style.setProperty('--d', `${14 + Math.round(Math.random() * 8)}px`);
|
||||
burst.append(spark);
|
||||
}
|
||||
// Все искры одной длительности — достаточно дождаться первой.
|
||||
const removeBurst = () => burst.remove();
|
||||
burst.firstChild.addEventListener('animationend', removeBurst, { once: true });
|
||||
burst.firstChild.addEventListener('animationcancel', removeBurst, { once: true });
|
||||
amount.append(burst);
|
||||
}
|
||||
|
||||
function spawnMote(card, point, tone) {
|
||||
const mote = document.createElement('span');
|
||||
mote.className = 'profile-support-fx profile-support-fx__mote';
|
||||
mote.setAttribute('aria-hidden', 'true');
|
||||
mote.style.left = `${(point.x + Math.random() * 8 - 4).toFixed(1)}px`;
|
||||
mote.style.top = `${(point.y + Math.random() * 8 - 4).toFixed(1)}px`;
|
||||
mote.style.setProperty('--ps-tone', tone);
|
||||
mote.style.setProperty('--mx', `${Math.round(Math.random() * 10 - 5)}px`);
|
||||
mote.style.setProperty('--my', `${Math.round(Math.random() * 10 - 8)}px`);
|
||||
removeAfterOwnAnimation(mote);
|
||||
card.append(mote);
|
||||
}
|
||||
|
||||
// Хвост — штрих длиной COMET_TRAIL на пути длины 1, голова — светящаяся точка в HTML (у неё мягкая box-shadow).
|
||||
// Градиент вдоль полёта гасит хвост к началу, поэтому свет «стекает» к сумме.
|
||||
function prepareComets(card, counters) {
|
||||
const { svg, defs, width, height } = overlaySvg(card, 'profile-support-fx__comets');
|
||||
const glow = glowFilter(defs, width, height, 2.4, 2);
|
||||
const comets = [];
|
||||
for (const counter of counters) {
|
||||
if (counter.cents === 0n) continue;
|
||||
const icon = counter.row.querySelector('.profile-support-stat__icon');
|
||||
if (!icon) continue;
|
||||
const a = offsetWithin(icon, card);
|
||||
const b = offsetWithin(counter.amount, card);
|
||||
const x0 = a.x + icon.offsetWidth + 4;
|
||||
const y0 = a.y + icon.offsetHeight / 2;
|
||||
const x1 = b.x - 4;
|
||||
const y1 = b.y + counter.amount.offsetHeight / 2;
|
||||
const dx = x1 - x0;
|
||||
const tone = getComputedStyle(icon).color;
|
||||
const id = `profile-support-comet-${fxSeq += 1}`;
|
||||
const gradient = svgEl('linearGradient', { id, gradientUnits: 'userSpaceOnUse', x1: x0, y1: y0, x2: x1, y2: y1 });
|
||||
[[0, 0], [0.4, 0.55], [1, 1]].forEach(([offset, opacity]) => {
|
||||
const stop = svgEl('stop', { offset });
|
||||
stop.style.stopColor = tone;
|
||||
stop.style.stopOpacity = String(opacity);
|
||||
gradient.append(stop);
|
||||
});
|
||||
defs.append(gradient);
|
||||
// Дуга ныряет под строку и поднимается в сумму — как росчерк на референсе.
|
||||
const trail = svgEl('path', {
|
||||
d: `M ${x0} ${y0} C ${x0 + dx * 0.35} ${y0 + 24}, ${x1 - dx * 0.3} ${y1 + 20}, ${x1} ${y1}`,
|
||||
pathLength: 1,
|
||||
stroke: `url(#${id})`,
|
||||
filter: glow,
|
||||
});
|
||||
trail.setAttribute('class', 'profile-support-fx__trail');
|
||||
trail.style.strokeDasharray = `${COMET_TRAIL} 3`;
|
||||
trail.style.strokeDashoffset = String(COMET_TRAIL);
|
||||
svg.append(trail);
|
||||
const head = document.createElement('span');
|
||||
head.className = 'profile-support-fx profile-support-fx__comet';
|
||||
head.setAttribute('aria-hidden', 'true');
|
||||
head.style.setProperty('--ps-tone', tone);
|
||||
head.style.opacity = '0';
|
||||
card.append(head);
|
||||
comets.push({ counter, trail, head, tone, start: COMET_START_MS + comets.length * COMET_STAGGER_MS, length: 0, lastMote: -Infinity, done: false });
|
||||
}
|
||||
// Срок жизни слоя задаёт его CSS-анимация (дольше полёта последней кометы).
|
||||
removeAfterOwnAnimation(svg);
|
||||
card.append(svg);
|
||||
for (const comet of comets) comet.length = comet.trail.getTotalLength();
|
||||
return { svg, comets };
|
||||
}
|
||||
|
||||
function moveComet(card, comet, elapsed, startCount) {
|
||||
const p = (elapsed - comet.start) / COMET_FLIGHT_MS;
|
||||
if (p < 0) return true;
|
||||
const reach = easeInOutCubic(Math.min(1, p)) * (1 + COMET_TRAIL);
|
||||
comet.trail.style.strokeDashoffset = (COMET_TRAIL - reach).toFixed(4);
|
||||
if (reach < 1) {
|
||||
const point = comet.trail.getPointAtLength(reach * comet.length);
|
||||
comet.head.style.opacity = '1';
|
||||
comet.head.style.transform = `translate(${point.x.toFixed(1)}px, ${point.y.toFixed(1)}px)`;
|
||||
if (elapsed - comet.lastMote >= MOTE_EVERY_MS) {
|
||||
comet.lastMote = elapsed;
|
||||
spawnMote(card, comet.trail.getPointAtLength(Math.max(0, reach - 0.06) * comet.length), comet.tone);
|
||||
}
|
||||
} else if (comet.head.isConnected) {
|
||||
// Попадание: голова растворяется в сумме, сумма вспыхивает и начинает досчитываться.
|
||||
comet.head.remove();
|
||||
startCount(comet.counter, elapsed);
|
||||
}
|
||||
if (p >= 1) comet.done = true;
|
||||
return !comet.done;
|
||||
}
|
||||
|
||||
/**
|
||||
* Проигрывает сияние на карточке; повторный вызов прерывает предыдущий. Возвращает stop():
|
||||
* суммы сразу становятся итоговыми, декоративные слои убираются. При reduced-motion ничего не делает.
|
||||
*/
|
||||
export function playSupportShine(card, { isActive = () => true } = {}) {
|
||||
runs.get(card)?.();
|
||||
if (prefersReducedMotion() || !card.isConnected) return () => {};
|
||||
const alive = () => isActive() && card.isConnected;
|
||||
const counters = [...card.querySelectorAll('.profile-support-stat')].map((row) => {
|
||||
const value = row.querySelector('.profile-support-amount__value[data-cents]');
|
||||
return value && { row, value, amount: value.parentElement, cents: BigInt(value.dataset.cents), countFrom: null, done: false };
|
||||
}).filter(Boolean);
|
||||
rimGlint(card);
|
||||
const orbitFx = orbit(card);
|
||||
const { comets } = prepareComets(card, counters);
|
||||
for (const counter of counters) {
|
||||
if (counter.cents === 0n) counter.done = true;
|
||||
else counter.value.textContent = formatStarAmount(0n);
|
||||
}
|
||||
const startCount = (counter, elapsed) => {
|
||||
counter.countFrom = elapsed;
|
||||
counter.amount.classList.add('is-filling');
|
||||
sparkBurst(counter.amount);
|
||||
};
|
||||
// Сумма без кометы (не нашлась иконка строки) досчитывается сразу — иначе зависла бы на нуле.
|
||||
const withComet = new Set(comets.map((comet) => comet.counter));
|
||||
for (const counter of counters) {
|
||||
if (!counter.done && !withComet.has(counter)) startCount(counter, 0);
|
||||
}
|
||||
|
||||
let frame = 0;
|
||||
let finished = false;
|
||||
// Видимое число — aria-hidden; итог всегда восстанавливается точным BigInt, без потерь округления.
|
||||
const finish = () => {
|
||||
if (finished) return;
|
||||
finished = true;
|
||||
cancelAnimationFrame(frame);
|
||||
for (const counter of counters) {
|
||||
counter.value.textContent = formatStarAmount(counter.cents);
|
||||
counter.amount.classList.remove('is-filling');
|
||||
}
|
||||
if (runs.get(card) === stop) runs.delete(card);
|
||||
};
|
||||
function stop() {
|
||||
finish();
|
||||
card.querySelectorAll('.profile-support-fx, .profile-support-sparks').forEach((el) => el.remove());
|
||||
}
|
||||
const startedAt = performance.now();
|
||||
const tick = (now) => {
|
||||
if (!alive()) { finish(); return; }
|
||||
const elapsed = now - startedAt;
|
||||
let pending = false;
|
||||
for (const comet of comets) {
|
||||
if (!comet.done && moveComet(card, comet, elapsed, startCount)) pending = true;
|
||||
}
|
||||
for (const counter of counters) {
|
||||
if (counter.done) continue;
|
||||
pending = true;
|
||||
if (counter.countFrom === null) continue;
|
||||
const q = Math.min(1, (elapsed - counter.countFrom) / COUNT_MS);
|
||||
if (q < 1) {
|
||||
counter.value.textContent = formatStarAmount(BigInt(Math.round(Number(counter.cents) * easeOutCubic(q))));
|
||||
} else {
|
||||
counter.done = true;
|
||||
counter.value.textContent = formatStarAmount(counter.cents);
|
||||
// Цвет и свечение суммы плавно гаснут (переход в CSS).
|
||||
counter.amount.classList.remove('is-filling');
|
||||
}
|
||||
}
|
||||
if (orbitFx.svg.isConnected && moveOrbitDots(orbitFx, elapsed)) pending = true;
|
||||
if (pending) frame = requestAnimationFrame(tick);
|
||||
else finish();
|
||||
};
|
||||
frame = requestAnimationFrame(tick);
|
||||
runs.set(card, stop);
|
||||
return stop;
|
||||
}
|
||||
@@ -1,7 +1,20 @@
|
||||
import { t } from '../i18n/index.js';
|
||||
import { formatDateTime } from '../i18n/format.js';
|
||||
import { authService } from '../state.js';
|
||||
import { getSolanaCluster } from '../services/solana-rpc-gateway.js';
|
||||
import { formatStars } from '../services/shine-support-amount.js';
|
||||
import { formatStarAmount, formatStars } from '../services/shine-support-amount.js';
|
||||
import { iconHtml } from './ui-icon.js';
|
||||
import { playSupportShine, prefersReducedMotion } from './support-shine-effects.js';
|
||||
|
||||
const GOO_FILTER_ID = 'profile-support-goo';
|
||||
// Порядок совпадает с supportStatsValues(). tone — класс цвета метрики (CSS задаёт --ps-tone);
|
||||
// подписи берутся при отрисовке: словари грузятся асинхронно и язык можно сменить.
|
||||
const METRICS = [
|
||||
{ tone: 'is-sent', icon: 'heart', key: 'sent' },
|
||||
{ tone: 'is-received', icon: 'trend-up', key: 'received' },
|
||||
{ tone: 'is-shine', icon: 'sparkle', key: 'shine' },
|
||||
];
|
||||
let panelSeq = 0;
|
||||
|
||||
export function supportStatsValues(stats = {}) {
|
||||
const sent = BigInt(stats.supportSent ?? 0);
|
||||
@@ -10,27 +23,211 @@ export function supportStatsValues(stats = {}) {
|
||||
return [sent, received, daoDirect];
|
||||
}
|
||||
|
||||
/** Adds an independent asynchronous block; failure/Free accounts do not get fictitious statistics. */
|
||||
// Фильтр «жидкого света» один на документ (тот же приём, что fg-shine-glow у прежних «Связей»):
|
||||
// размытие + порог альфы сливают капли света в одну вязкую форму. Применяется только к слою
|
||||
// света под текстом кнопки — на всю кнопку его вешать нельзя, порог «съест» тонкие буквы.
|
||||
function ensureGooFilter() {
|
||||
if (typeof document === 'undefined' || document.getElementById(GOO_FILTER_ID)) return;
|
||||
const holder = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
||||
holder.setAttribute('width', '0');
|
||||
holder.setAttribute('height', '0');
|
||||
holder.setAttribute('aria-hidden', 'true');
|
||||
holder.setAttribute('focusable', 'false');
|
||||
holder.style.position = 'absolute';
|
||||
holder.innerHTML = `<defs><filter id="${GOO_FILTER_ID}" x="-20%" y="-60%" width="140%" height="220%" color-interpolation-filters="sRGB">`
|
||||
+ '<feGaussianBlur in="SourceGraphic" stdDeviation="5" result="blur"/>'
|
||||
+ '<feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 18 -7" result="goo"/>'
|
||||
+ '<feComposite in="SourceGraphic" in2="goo" operator="atop"/>'
|
||||
+ '</filter></defs>';
|
||||
document.body.append(holder);
|
||||
}
|
||||
|
||||
// Видимо — только число и SVG-звезда; скринридер получает прежнюю полную запись «0.10 ⭐».
|
||||
// data-cents — точная сумма для счёта от нуля (support-shine-effects.js).
|
||||
function renderAmount(cents, sign = '') {
|
||||
const wrap = document.createElement('span');
|
||||
wrap.className = 'profile-support-amount';
|
||||
const value = document.createElement('span');
|
||||
value.className = 'profile-support-amount__value';
|
||||
value.setAttribute('aria-hidden', 'true');
|
||||
value.dataset.cents = String(cents);
|
||||
value.textContent = `${sign}${formatStarAmount(cents)}`;
|
||||
const spoken = document.createElement('span');
|
||||
spoken.className = 'sr-only';
|
||||
spoken.textContent = `${sign}${formatStars(cents)}`;
|
||||
wrap.append(value);
|
||||
wrap.insertAdjacentHTML('beforeend', iconHtml('star', true, 'profile-support-amount__star'));
|
||||
wrap.append(spoken);
|
||||
return wrap;
|
||||
}
|
||||
|
||||
function renderChip({ tone, icon }, cents) {
|
||||
const chip = document.createElement('span');
|
||||
chip.className = cents === 0n ? `profile-support-chip ${tone} is-zero` : `profile-support-chip ${tone}`;
|
||||
chip.innerHTML = iconHtml(icon, false, 'profile-support-chip__icon');
|
||||
const value = document.createElement('span');
|
||||
value.textContent = formatStarAmount(cents);
|
||||
chip.append(value);
|
||||
chip.insertAdjacentHTML('beforeend', iconHtml('star', true, 'profile-support-chip__star'));
|
||||
return chip;
|
||||
}
|
||||
|
||||
// Капля света из точки касания + две капельки-спутника: фильтр сливает их в жидкую вспышку.
|
||||
// Удаляется по окончании своей анимации — без таймеров, переживающих страницу.
|
||||
function spawnLiquidLight(layer, event) {
|
||||
if (prefersReducedMotion()) return;
|
||||
const rect = layer.getBoundingClientRect();
|
||||
const group = document.createElement('span');
|
||||
group.className = 'profile-support-goo';
|
||||
group.style.left = `${event.clientX - rect.left}px`;
|
||||
group.style.top = `${event.clientY - rect.top}px`;
|
||||
const main = document.createElement('span');
|
||||
main.className = 'profile-support-goo__drop is-main';
|
||||
const left = document.createElement('span');
|
||||
left.className = 'profile-support-goo__drop is-left';
|
||||
const right = document.createElement('span');
|
||||
right.className = 'profile-support-goo__drop is-right';
|
||||
group.append(main, left, right);
|
||||
// animationcancel — на случай прерванной анимации (элемент скрыли/сменили), иначе капли остались бы в DOM.
|
||||
const removeGroup = () => group.remove();
|
||||
main.addEventListener('animationend', removeGroup, { once: true });
|
||||
main.addEventListener('animationcancel', removeGroup, { once: true });
|
||||
layer.append(group);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an independent asynchronous block: a thin totals line that expands into the support card.
|
||||
* Failure/Free accounts do not get fictitious statistics.
|
||||
*/
|
||||
export function attachSupportStats(parent, { login, isActive = () => true }) {
|
||||
ensureGooFilter();
|
||||
const panelId = `profile-support-panel-${panelSeq += 1}`;
|
||||
const section = document.createElement('section');
|
||||
section.className = 'card stack profile-support-stats';
|
||||
section.style.cssText = 'margin-top:12px;gap:8px;';
|
||||
const title = document.createElement('strong');
|
||||
title.textContent = t('screens.support_phase2.statistics');
|
||||
section.className = 'profile-support';
|
||||
section.dataset.expanded = 'false';
|
||||
|
||||
// Свёрнутый блок-строка: ♡ сумма · ↗ сумма · ✦ сумма ⌄. Пока данных нет — неактивен и показывает статус.
|
||||
const line = document.createElement('div');
|
||||
line.className = 'profile-support__line';
|
||||
const summary = document.createElement('button');
|
||||
summary.type = 'button';
|
||||
summary.className = 'profile-support__summary';
|
||||
summary.disabled = true;
|
||||
summary.setAttribute('aria-expanded', 'false');
|
||||
summary.setAttribute('aria-controls', panelId);
|
||||
summary.textContent = t('screens.support_phase2.loading');
|
||||
line.append(summary);
|
||||
|
||||
// Раскрываемая карточка. inert, пока свёрнута: её кнопки не ловят фокус и не читаются скринридером.
|
||||
const panel = document.createElement('div');
|
||||
panel.className = 'profile-support__panel';
|
||||
panel.id = panelId;
|
||||
panel.inert = true;
|
||||
const card = document.createElement('div');
|
||||
card.className = 'profile-support-stats';
|
||||
const title = document.createElement('button');
|
||||
title.type = 'button';
|
||||
title.className = 'profile-support-stats__title';
|
||||
title.setAttribute('aria-expanded', 'true');
|
||||
title.setAttribute('aria-controls', panelId);
|
||||
const titleLabel = document.createElement('span');
|
||||
titleLabel.textContent = t('screens.support_phase2.statistics');
|
||||
title.append(titleLabel);
|
||||
title.insertAdjacentHTML('beforeend', iconHtml('chevron-up', false, 'profile-support-stats__title-chevron'));
|
||||
const content = document.createElement('div');
|
||||
content.className = 'meta-muted';
|
||||
content.textContent = t('screens.support_phase2.loading');
|
||||
section.append(title, content);
|
||||
content.className = 'profile-support-stats__content';
|
||||
card.append(title, content);
|
||||
|
||||
const history = document.createElement('details');
|
||||
history.className = 'profile-support-history';
|
||||
const historySummary = document.createElement('summary');
|
||||
historySummary.textContent = t('screens.support_phase2.history');
|
||||
historySummary.className = 'profile-support-history__toggle';
|
||||
const light = document.createElement('span');
|
||||
light.className = 'profile-support-history__light';
|
||||
light.setAttribute('aria-hidden', 'true');
|
||||
const historyLabel = document.createElement('span');
|
||||
historyLabel.className = 'profile-support-history__label';
|
||||
historyLabel.textContent = t('screens.support_phase2.history');
|
||||
historySummary.append(light, historyLabel);
|
||||
historySummary.insertAdjacentHTML('beforeend', iconHtml('chevron', false, 'profile-support-history__chevron'));
|
||||
// is-pressed дублирует :active: iOS Safari не включает :active без обработчика касаний.
|
||||
const setPressed = (pressed) => historySummary.classList.toggle('is-pressed', pressed);
|
||||
historySummary.addEventListener('pointerdown', (event) => {
|
||||
if (event.button > 0) return;
|
||||
setPressed(true);
|
||||
spawnLiquidLight(light, event);
|
||||
});
|
||||
for (const type of ['pointerup', 'pointercancel', 'pointerleave']) {
|
||||
historySummary.addEventListener(type, () => setPressed(false));
|
||||
}
|
||||
const historyRows = document.createElement('div');
|
||||
historyRows.className = 'stack';
|
||||
historyRows.style.cssText = 'gap:8px;margin-top:10px;';
|
||||
historyRows.className = 'profile-support-history__rows';
|
||||
history.append(historySummary, historyRows);
|
||||
section.append(history);
|
||||
card.append(history);
|
||||
panel.append(card);
|
||||
section.append(line, panel);
|
||||
parent.append(section);
|
||||
|
||||
let expanded = false;
|
||||
let toggleSeq = 0;
|
||||
let stopShine = null;
|
||||
const shine = () => {
|
||||
stopShine = playSupportShine(card, { isActive });
|
||||
};
|
||||
// Карточка раскрывается вниз: если строка стоит у нижнего края экрана, без подкрутки карточка и её сияние
|
||||
// оказались бы под панелью навигации. Пока идёт «выезд», каждый кадр держим карточку в видимой области.
|
||||
const followReveal = (seq) => {
|
||||
const step = () => {
|
||||
if (seq !== toggleSeq || !expanded || !isActive() || !section.isConnected) return;
|
||||
card.scrollIntoView({ block: 'nearest' });
|
||||
if (!section.classList.contains('is-settled')) requestAnimationFrame(step);
|
||||
};
|
||||
requestAnimationFrame(step);
|
||||
};
|
||||
const setExpanded = (next) => {
|
||||
if (next === expanded || !section.isConnected) return;
|
||||
expanded = next;
|
||||
const seq = toggleSeq += 1;
|
||||
section.dataset.expanded = String(next);
|
||||
section.classList.remove('is-settled');
|
||||
summary.setAttribute('aria-expanded', String(next));
|
||||
// Сначала снимаем inert, потом переводим фокус: в inert-поддерево фокус не попадает.
|
||||
line.inert = next;
|
||||
panel.inert = !next;
|
||||
if (!next) {
|
||||
stopShine?.();
|
||||
stopShine = null;
|
||||
card.classList.remove('is-pressed');
|
||||
}
|
||||
(next ? title : summary).focus({ preventScroll: true });
|
||||
if (!next) return;
|
||||
followReveal(seq);
|
||||
// Пока карточка «выезжает», панель обрезает содержимое; орбита и искры выходят за край карточки,
|
||||
// поэтому сияние запускается после окончания перехода. Нет перехода (reduced-motion) — сразу.
|
||||
const transitions = section.getAnimations?.() ?? [];
|
||||
Promise.all(transitions.map((animation) => animation.finished)).then(() => {
|
||||
if (seq !== toggleSeq || !isActive() || !section.isConnected) return;
|
||||
section.classList.add('is-settled');
|
||||
card.scrollIntoView({ block: 'nearest' });
|
||||
shine();
|
||||
}, () => {});
|
||||
};
|
||||
summary.addEventListener('click', () => setExpanded(true));
|
||||
title.addEventListener('click', () => setExpanded(false));
|
||||
|
||||
// Тап по карточке (кроме заголовка и истории): вдавливание .97, пружинный возврат и повтор сияния.
|
||||
const isCardSurface = (target) => !target.closest('.profile-support-stats__title, .profile-support-history');
|
||||
card.addEventListener('pointerdown', (event) => {
|
||||
if (event.button > 0 || !isCardSurface(event.target)) return;
|
||||
card.classList.add('is-pressed');
|
||||
});
|
||||
for (const type of ['pointerup', 'pointercancel', 'pointerleave']) {
|
||||
card.addEventListener(type, () => card.classList.remove('is-pressed'));
|
||||
}
|
||||
card.addEventListener('click', (event) => {
|
||||
if (expanded && section.classList.contains('is-settled') && isCardSurface(event.target)) shine();
|
||||
});
|
||||
|
||||
let historyOffset = 0;
|
||||
let loadingHistory = false;
|
||||
let historyLoaded = false;
|
||||
@@ -60,24 +257,24 @@ export function attachSupportStats(parent, { login, isActive = () => true }) {
|
||||
const cents = transfer.kind === 'DAO' || outgoing
|
||||
? transfer.amountStarCents : transfer.recipientStarCents;
|
||||
const row = document.createElement('div');
|
||||
row.className = 'row';
|
||||
row.style.cssText = 'display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:6px;';
|
||||
row.className = 'profile-support-transfer';
|
||||
const info = document.createElement('span');
|
||||
info.className = 'profile-support-transfer__peer';
|
||||
info.textContent = transfer.kind === 'DAO'
|
||||
? t('screens.support_phase2.history_dao')
|
||||
: `${outgoing ? '→' : '←'} ${outgoing ? transfer.recipientLogin : transfer.senderLogin}`;
|
||||
const value = document.createElement('strong');
|
||||
value.textContent = `${outgoing ? '−' : '+'}${formatStars(cents)}`;
|
||||
const value = renderAmount(cents, outgoing ? '−' : '+');
|
||||
const detail = document.createElement('small');
|
||||
detail.className = 'meta-muted';
|
||||
const date = transfer.blockTime ? new Date(Number(transfer.blockTime) * 1000).toLocaleString() : '';
|
||||
detail.className = 'profile-support-transfer__detail meta-muted';
|
||||
const date = transfer.blockTime ? formatDateTime(Number(transfer.blockTime) * 1000) : '';
|
||||
const lamports = BigInt(transfer.amountLamports || '0');
|
||||
const sol = `${lamports / 1_000_000_000n}.${String(lamports % 1_000_000_000n).padStart(9, '0').replace(/0+$/, '') || '0'} SOL`;
|
||||
detail.textContent = `${date} · ${sol}`;
|
||||
detail.textContent = date ? `${date} · ${sol}` : sol;
|
||||
const explorer = document.createElement('a');
|
||||
const sig = String(transfer.signature || '');
|
||||
if (/^[1-9A-HJ-NP-Za-km-z]{64,90}$/.test(sig)) {
|
||||
const network = getSolanaCluster();
|
||||
explorer.className = 'profile-support-transfer__link';
|
||||
explorer.href = `https://explorer.solana.com/tx/${sig}${network && network !== 'mainnet-beta' ? `?cluster=${encodeURIComponent(network)}` : ''}`;
|
||||
explorer.target = '_blank'; explorer.rel = 'noopener noreferrer';
|
||||
explorer.textContent = t('screens.support_phase2.transaction');
|
||||
@@ -100,7 +297,14 @@ export function attachSupportStats(parent, { login, isActive = () => true }) {
|
||||
} finally { loadingHistory = false; }
|
||||
};
|
||||
history.addEventListener('toggle', () => {
|
||||
if (history.open && !historyLoaded) void loadHistory();
|
||||
if (!history.open) return;
|
||||
// Записи истории тоже появляются ниже — подтягиваем их в видимую область, когда они на месте.
|
||||
const reveal = () => {
|
||||
if (!history.open || !isActive() || !section.isConnected) return;
|
||||
history.scrollIntoView({ block: 'nearest', behavior: prefersReducedMotion() ? 'auto' : 'smooth' });
|
||||
};
|
||||
if (historyLoaded) reveal();
|
||||
else void loadHistory().then(reveal);
|
||||
});
|
||||
let pendingRefresh = null;
|
||||
const scheduleRetry = () => {
|
||||
@@ -110,13 +314,19 @@ export function attachSupportStats(parent, { login, isActive = () => true }) {
|
||||
if (isActive() && section.isConnected) void refresh();
|
||||
}, 10_000);
|
||||
};
|
||||
const showLineStatus = (text) => {
|
||||
setExpanded(false);
|
||||
summary.disabled = true;
|
||||
summary.removeAttribute('aria-label');
|
||||
summary.textContent = text;
|
||||
};
|
||||
const refresh = async () => {
|
||||
try {
|
||||
const stats = await authService.getSupportStats(login);
|
||||
if (!isActive() || !section.isConnected) return;
|
||||
if (!stats.ready) {
|
||||
// Первичная индексация ещё идёт. Повторим запрос к кешу без RPC Solana.
|
||||
content.textContent = t('screens.support_phase2.loading');
|
||||
showLineStatus(t('screens.support_phase2.loading'));
|
||||
scheduleRetry();
|
||||
return;
|
||||
}
|
||||
@@ -130,23 +340,42 @@ export function attachSupportStats(parent, { login, isActive = () => true }) {
|
||||
supportReceived: stats.supportReceivedStarCents,
|
||||
daoDirect: stats.daoDirectStarCents,
|
||||
});
|
||||
stopShine?.();
|
||||
stopShine = null;
|
||||
summary.replaceChildren();
|
||||
METRICS.forEach((metric, idx) => {
|
||||
if (idx) {
|
||||
const sep = document.createElement('span');
|
||||
sep.className = 'profile-support__sep';
|
||||
sep.textContent = '·';
|
||||
summary.append(sep);
|
||||
}
|
||||
summary.append(renderChip(metric, values[idx]));
|
||||
});
|
||||
summary.insertAdjacentHTML('beforeend', iconHtml('chevron-down', false, 'profile-support__chevron'));
|
||||
// Видимые чипы — числа и значки; скринридер получает всю сводку целиком.
|
||||
summary.setAttribute('aria-label', t('screens.support_phase2.summary', {
|
||||
sent: formatStars(values[0]), received: formatStars(values[1]), shine: formatStars(values[2]),
|
||||
}));
|
||||
summary.disabled = false;
|
||||
content.replaceChildren();
|
||||
content.className = 'stack';
|
||||
[t('screens.support_phase2.sent'), t('screens.support_phase2.received'), t('screens.support_phase2.shine')].forEach((label, idx) => {
|
||||
METRICS.forEach((metric, idx) => {
|
||||
const row = document.createElement('div');
|
||||
row.className = 'row';
|
||||
row.style.cssText = 'display:flex;justify-content:space-between;gap:8px;';
|
||||
// Нулевые суммы приглушены и не «дышат»: свечение — только там, где поддержка есть.
|
||||
row.className = values[idx] === 0n ? `profile-support-stat ${metric.tone} is-zero` : `profile-support-stat ${metric.tone}`;
|
||||
const iconSlot = document.createElement('span');
|
||||
iconSlot.className = 'profile-support-stat__icon';
|
||||
iconSlot.innerHTML = iconHtml(metric.icon);
|
||||
const name = document.createElement('span');
|
||||
const amount = document.createElement('strong');
|
||||
name.textContent = label;
|
||||
amount.textContent = formatStars(values[idx]);
|
||||
row.append(name, amount);
|
||||
name.className = 'profile-support-stat__label';
|
||||
name.textContent = t(`screens.support_phase2.${metric.key}`);
|
||||
row.append(iconSlot, name, renderAmount(values[idx]));
|
||||
content.append(row);
|
||||
});
|
||||
} catch {
|
||||
if (!isActive() || !section.isConnected) return;
|
||||
// A missing Paid PDA means Free, but network errors must not be displayed as zero.
|
||||
content.textContent = t('screens.support_phase2.unavailable');
|
||||
showLineStatus(t('screens.support_phase2.unavailable'));
|
||||
}
|
||||
};
|
||||
void refresh();
|
||||
|
||||
@@ -52,6 +52,8 @@ const paths = {
|
||||
'user-plus': '<circle cx="10" cy="8" r="3.5"/><path d="M3.5 20a6.5 6.5 0 0 1 13 0M19 8v6M16 11h6"/>',
|
||||
refresh: '<path d="M20 12a8 8 0 1 1-2.3-5.6"/><path d="M20 4v4.4h-4.4"/>',
|
||||
sparkle: '<path d="M11 4c.6 4.4 2.6 6.4 7 7-4.4.6-6.4 2.6-7 7-.6-4.4-2.6-6.4-7-7 4.4-.6 6.4-2.6 7-7Z"/><path d="M19 2.5v3M17.5 4h3"/>',
|
||||
'trend-up': '<path d="m3 17 6.5-6.5 4 4L21 7"/><path d="M15 7h6v6"/>',
|
||||
star: '<path d="m12 2.8 2.85 5.78 6.38.93-4.62 4.5 1.09 6.35L12 17.36l-5.7 3 1.09-6.35-4.62-4.5 6.38-.93Z"/>',
|
||||
rings: '<circle cx="12" cy="12" r="2"/><circle cx="12" cy="12" r="5.5"/><circle cx="12" cy="12" r="9"/>',
|
||||
place: '<path d="M12 21s-6.5-5.6-6.5-11a6.5 6.5 0 0 1 13 0c0 5.4-6.5 11-6.5 11Z"/><circle cx="12" cy="10" r="2.4"/>',
|
||||
groups: '<circle cx="9" cy="8" r="3"/><path d="M3.5 19a5.5 5.5 0 0 1 11 0"/><circle cx="17" cy="9.5" r="2.5"/><path d="M15.6 14.1A4.6 4.6 0 0 1 21 18.5"/>',
|
||||
|
||||
@@ -2288,14 +2288,12 @@
|
||||
"chat_view": {
|
||||
"security_notice": {
|
||||
"title": "Private chat security",
|
||||
"encryption": "Messages in this chat are encrypted on the participants' devices.",
|
||||
"servers": "The server delivers encrypted data but should not be able to read the conversation.",
|
||||
"derivation": "Chat keys are derived from account keys and stored on the devices.",
|
||||
"rotation": "After key rotation, some messages may require the keys to be received again.",
|
||||
"source": "Before sending, make sure you are communicating with the intended user and server.",
|
||||
"warning_label": "Important:",
|
||||
"warning": "never share private keys or your account password with anyone.",
|
||||
"recovery": "Access recovery depends on your saved keys and password. Keep them secure."
|
||||
"zero_knowledge_label": "Zero-Knowledge Architecture:",
|
||||
"zero_knowledge": "We don't trust servers. SHiNE does not store your private keys and has no technical access to chat content.",
|
||||
"self_custody_label": "Self-Custody & Open Source:",
|
||||
"self_custody": "Your key is generated locally from your login and password. No hidden algorithms — the code is fully open.",
|
||||
"control_label": "Absolute Control:",
|
||||
"control": "Forget your password and you lose access to your messages forever."
|
||||
},
|
||||
"voice": {
|
||||
"hold_tip": "Hold to record",
|
||||
@@ -4353,9 +4351,10 @@
|
||||
"support_phase2": {
|
||||
"statistics": "Support",
|
||||
"loading": "Loading support totals…",
|
||||
"sent": "❤️ Supported others",
|
||||
"received": "💚 Support received",
|
||||
"shine": "✨ Supported SHiNE",
|
||||
"sent": "Supported others",
|
||||
"received": "Support received",
|
||||
"shine": "Supported SHiNE",
|
||||
"summary": "Support: supported others {sent}, received {received}, supported SHiNE {shine}",
|
||||
"unavailable": "Totals unavailable (Free account or Solana error)",
|
||||
"donate_shine": "✨ Support SHiNE",
|
||||
"donate": "Donate",
|
||||
|
||||
@@ -2423,14 +2423,12 @@
|
||||
"chat_view": {
|
||||
"security_notice": {
|
||||
"title": "Ваша переписка защищена сквозным шифрованием",
|
||||
"encryption": "Все личные сообщения шифруются с использованием современных криптографических алгоритмов. Ключи шифрования хранятся ТОЛЬКО на устройствах участников переписки.",
|
||||
"servers": "Сервера SHiNE не имеют ваших приватных ключей и даже технически никак не могут прочитать ваши сообщения.",
|
||||
"derivation": "Ваш ключ шифрования высчитывается из вашего логина и пароля",
|
||||
"rotation": "При смене пароля перекодирование всех ваших сообщений со старого пароля на новый происходит на устройстве пользователя.",
|
||||
"source": "Код наших приложений полностью открыт и вы легко можете проверить всё это сами.",
|
||||
"warning_label": "Важно:",
|
||||
"warning": "если вы забудете свой пароль, восстановить доступ к вашей зашифрованной переписке будет невозможно.",
|
||||
"recovery": "SHiNE не хранит ваши секретные ключи и никак не сможет помочь вам восстановить вашу переписку"
|
||||
"zero_knowledge_label": "Zero-Knowledge Architecture:",
|
||||
"zero_knowledge": "Мы не доверяем серверам. SHiNE не хранит ваши приватные ключи и технически не имеет доступа к содержимому чатов.",
|
||||
"self_custody_label": "Self-Custody & Open Source:",
|
||||
"self_custody": "Ваш ключ генерируется локально из вашего логина и пароля. Никаких скрытых алгоритмов — код полностью открыт.",
|
||||
"control_label": "Absolute Control:",
|
||||
"control": "Забудете пароль — навсегда потеряете доступ к переписке."
|
||||
},
|
||||
"voice": {
|
||||
"hold_tip": "Удерживайте, чтобы записать",
|
||||
@@ -4353,9 +4351,10 @@
|
||||
"support_phase2": {
|
||||
"statistics": "Поддержка",
|
||||
"loading": "Загрузка статистики…",
|
||||
"sent": "❤️ Поддержал других",
|
||||
"received": "💚 Получил поддержку",
|
||||
"shine": "✨ Поддержал SHiNE",
|
||||
"sent": "Поддержал других",
|
||||
"received": "Получил поддержку",
|
||||
"shine": "Поддержал SHiNE",
|
||||
"summary": "Поддержка: поддержал других {sent}, получил поддержку {received}, поддержал SHiNE {shine}",
|
||||
"unavailable": "Статистика недоступна (Free или ошибка Solana)",
|
||||
"donate_shine": "✨ Поддержать SHiNE",
|
||||
"donate": "Пожертвовать",
|
||||
|
||||
@@ -1070,27 +1070,17 @@ function createDmEncryptionNotice() {
|
||||
heading.textContent = `🔒 ${t('screens.chat_view.security_notice.title')}`;
|
||||
notice.append(heading);
|
||||
|
||||
for (const text of [
|
||||
t('screens.chat_view.security_notice.encryption'),
|
||||
t('screens.chat_view.security_notice.servers'),
|
||||
t('screens.chat_view.security_notice.derivation'),
|
||||
t('screens.chat_view.security_notice.rotation'),
|
||||
t('screens.chat_view.security_notice.source'),
|
||||
for (const [label, text] of [
|
||||
[t('screens.chat_view.security_notice.zero_knowledge_label'), t('screens.chat_view.security_notice.zero_knowledge')],
|
||||
[t('screens.chat_view.security_notice.self_custody_label'), t('screens.chat_view.security_notice.self_custody')],
|
||||
[t('screens.chat_view.security_notice.control_label'), t('screens.chat_view.security_notice.control')],
|
||||
]) {
|
||||
const paragraph = document.createElement('p');
|
||||
paragraph.textContent = text;
|
||||
const strong = document.createElement('strong');
|
||||
strong.textContent = `${label} `;
|
||||
paragraph.append(strong, document.createTextNode(text));
|
||||
notice.append(paragraph);
|
||||
}
|
||||
|
||||
const warning = document.createElement('p');
|
||||
const warningLabel = document.createElement('strong');
|
||||
warningLabel.textContent = `${t('screens.chat_view.security_notice.warning_label')} `;
|
||||
warning.append(warningLabel, document.createTextNode(t('screens.chat_view.security_notice.warning')));
|
||||
notice.append(warning);
|
||||
|
||||
const recovery = document.createElement('p');
|
||||
recovery.textContent = t('screens.chat_view.security_notice.recovery');
|
||||
notice.append(recovery);
|
||||
return notice;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,9 +28,13 @@ export function parseStarCents(input) {
|
||||
if (cents < 10n || cents > 0xffff_ffff_ffff_ffffn) throw new Error('Минимальная поддержка — 0,10 ⭐');
|
||||
return cents;
|
||||
}
|
||||
export function formatStars(value) {
|
||||
/** Только число («0.10»): для вёрстки, где единица показана отдельной SVG-иконкой. */
|
||||
export function formatStarAmount(value) {
|
||||
const cents = BigInt(value);
|
||||
return `${cents / 100n}.${String(cents % 100n).padStart(2, '0')} ⭐`;
|
||||
return `${cents / 100n}.${String(cents % 100n).padStart(2, '0')}`;
|
||||
}
|
||||
export function formatStars(value) {
|
||||
return `${formatStarAmount(value)} ⭐`;
|
||||
}
|
||||
export function splitStarCents(value) {
|
||||
const cents = BigInt(value);
|
||||
|
||||
@@ -0,0 +1,292 @@
|
||||
/* «Поддержка» в профиле (js/components/support-stats.js + support-shine-effects.js), свой и чужой профиль.
|
||||
Блок-строка с тремя суммами под «Сменить профиль»; тап — «выезд» стеклянной карточки «Ethereal Monochrome»,
|
||||
тап по её заголовку — обратно. Цвет метрики: ♡ --accent, ↗ --success, ✦ --warning. Только семантические
|
||||
переменные, обе темы. Всё движение — в блоке prefers-reduced-motion: no-preference внизу файла, поэтому
|
||||
при reduced-motion вид статичный без переопределений. Решение и отклонения: docs/UI-Design/DESIGN.md §11.3. */
|
||||
|
||||
/* Строка и карточка — две строки одной сетки: одна сворачивается (0fr), другая раскрывается (1fr). */
|
||||
.profile-support { display: grid; grid-template-rows: 1fr 0fr; }
|
||||
.profile-support[data-expanded='true'] { grid-template-rows: 0fr 1fr; }
|
||||
.profile-support__line,
|
||||
.profile-support__panel { display: grid; min-height: 0; overflow: hidden; }
|
||||
/* После «выезда» орбита и искры выходят за край карточки (до 10px) — обрезку снимаем. */
|
||||
.profile-support.is-settled .profile-support__panel { overflow: visible; }
|
||||
|
||||
.profile-support .is-sent { --ps-tone: var(--accent); }
|
||||
.profile-support .is-received { --ps-tone: var(--success); }
|
||||
.profile-support .is-shine { --ps-tone: var(--warning); }
|
||||
|
||||
/* Свёрнутый блок: ♡ 0.30★ · ↗ 0.50★ · ✦ 1.00★ ⌄ — по размеру и поверхности как соседний блок «Сменить профиль»
|
||||
(nav-list: surface, border-subtle, radius-lg; высота 64px — как у его строки с подписью), суммы — кеглем
|
||||
крупных чисел профиля (--text-lg). */
|
||||
.profile-support__summary {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: var(--space-1) var(--space-2);
|
||||
width: 100%;
|
||||
min-height: 64px;
|
||||
padding: 10px 14px;
|
||||
border: 1px solid var(--border-subtle);
|
||||
border-radius: var(--radius-lg);
|
||||
background: var(--surface);
|
||||
color: var(--text-primary);
|
||||
font-size: var(--text-lg);
|
||||
line-height: var(--leading-lg);
|
||||
cursor: pointer;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
}
|
||||
@media (hover: hover) { .profile-support__summary:hover:not(:disabled) { background: var(--surface-selected); } }
|
||||
.profile-support__summary:active:not(:disabled) { background: var(--surface-selected); }
|
||||
/* Строка обрезается при сворачивании — фокусное кольцо рисуем внутри кнопки. */
|
||||
.profile-support__summary:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
|
||||
.profile-support__summary:disabled { color: var(--text-secondary); font-size: var(--text-md); cursor: default; }
|
||||
.profile-support__sep { color: var(--text-secondary); }
|
||||
.profile-support__chevron { width: 18px; height: 18px; flex: none; margin-left: var(--space-1); color: var(--text-secondary); }
|
||||
.profile-support-chip { display: inline-flex; align-items: center; gap: 5px; color: var(--ps-tone); font-weight: var(--weight-bold); font-variant-numeric: tabular-nums; white-space: nowrap; }
|
||||
.profile-support-chip.is-zero { color: var(--text-secondary); }
|
||||
.profile-support-chip__icon { width: 20px; height: 20px; flex: none; }
|
||||
.profile-support-chip__star { width: 14px; height: 14px; flex: none; }
|
||||
/* Узкий телефон: та же строка без переноса — чуть меньше кегль и зазоры. */
|
||||
@media (max-width: 380px) {
|
||||
.profile-support__summary { gap: var(--space-1) 6px; padding-inline: 10px; font-size: var(--text-md); }
|
||||
.profile-support__chevron { margin-left: 0; }
|
||||
.profile-support-chip { gap: 4px; }
|
||||
.profile-support-chip__icon { width: 18px; height: 18px; }
|
||||
.profile-support-chip__star { width: 12px; height: 12px; }
|
||||
}
|
||||
|
||||
/* Карточка: ночью тёмное стекло, днём светлое матовое. */
|
||||
.profile-support-stats {
|
||||
--ps-edge: color-mix(in srgb, var(--text-primary) 14%, transparent);
|
||||
--ps-edge-lo: color-mix(in srgb, var(--text-primary) 7%, transparent);
|
||||
--ps-edge-hi: color-mix(in srgb, var(--text-primary) 42%, transparent);
|
||||
position: relative;
|
||||
/* Подкрутка к раскрытой карточке оставляет воздух у края экрана (и место орбите). */
|
||||
scroll-margin: var(--space-4);
|
||||
display: grid;
|
||||
gap: var(--space-1);
|
||||
padding: var(--space-4) var(--space-4) var(--space-2);
|
||||
border-radius: var(--radius-xl);
|
||||
background: linear-gradient(180deg,
|
||||
color-mix(in srgb, var(--surface-raised) 78%, transparent) 0%,
|
||||
color-mix(in srgb, var(--surface) 92%, transparent) 100%);
|
||||
-webkit-backdrop-filter: blur(24px) saturate(1.15);
|
||||
backdrop-filter: blur(24px) saturate(1.15);
|
||||
box-shadow:
|
||||
inset 0 1px 0 color-mix(in srgb, var(--text-primary) 10%, transparent),
|
||||
inset 0 0 0 2px color-mix(in srgb, var(--text-primary) 3%, transparent),
|
||||
0 18px 40px -24px rgb(0 0 0 / 0.55);
|
||||
color: var(--text-primary);
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
}
|
||||
/* Грань стекла — металлический кант 1px градиентом маской (интерьер не подсвечивается): блики на правом верхнем
|
||||
и левом нижнем углах, тёмная середина; внутренняя фаска — второй inset-тенью выше. */
|
||||
.profile-support-stats::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
padding: 1px;
|
||||
border-radius: inherit;
|
||||
background: linear-gradient(225deg, var(--ps-edge-hi) 0%, var(--ps-edge) 18%, var(--ps-edge-lo) 45%, var(--ps-edge-lo) 55%, var(--ps-edge) 82%, var(--ps-edge-hi) 100%);
|
||||
-webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
|
||||
-webkit-mask-composite: xor;
|
||||
mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
|
||||
mask-composite: exclude;
|
||||
pointer-events: none;
|
||||
}
|
||||
/* Заголовок «Поддержка ⌃» — кнопка сворачивания карточки. */
|
||||
.profile-support-stats__title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: var(--space-2);
|
||||
width: 100%;
|
||||
min-height: 44px;
|
||||
margin: calc(-1 * var(--space-2)) 0 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
border-radius: var(--radius-md);
|
||||
background: transparent;
|
||||
color: var(--text-primary);
|
||||
font-size: 1rem;
|
||||
line-height: 1.5;
|
||||
font-weight: var(--weight-bold);
|
||||
text-align: start;
|
||||
cursor: pointer;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
}
|
||||
.profile-support-stats__title:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
|
||||
.profile-support-stats__title-chevron { width: 18px; height: 18px; flex: none; color: var(--text-secondary); }
|
||||
@media (hover: hover) { .profile-support-stats__title:hover .profile-support-stats__title-chevron { color: var(--text-primary); } }
|
||||
.profile-support-stats__content { display: grid; }
|
||||
|
||||
.profile-support-stat {
|
||||
display: grid;
|
||||
grid-template-columns: 22px minmax(0, 1fr) auto;
|
||||
align-items: center;
|
||||
column-gap: var(--space-3);
|
||||
min-height: 44px;
|
||||
font-size: var(--text-md);
|
||||
line-height: var(--leading-md);
|
||||
}
|
||||
.profile-support-stat__icon { display: inline-flex; color: var(--ps-tone); }
|
||||
.profile-support-stat__icon svg { width: 22px; height: 22px; }
|
||||
.profile-support-stat__label { min-width: 0; overflow-wrap: anywhere; }
|
||||
.profile-support-stat .profile-support-amount__star { color: var(--ps-tone); }
|
||||
.profile-support-stat.is-zero .profile-support-stat__icon,
|
||||
.profile-support-stat.is-zero .profile-support-amount,
|
||||
.profile-support-stat.is-zero .profile-support-amount__star { color: var(--text-secondary); }
|
||||
.profile-support-amount { position: relative; display: inline-flex; align-items: center; gap: 6px; font-size: 1rem; font-weight: var(--weight-bold); font-variant-numeric: tabular-nums; white-space: nowrap; }
|
||||
.profile-support-amount__star { width: 14px; height: 14px; flex: none; }
|
||||
|
||||
.profile-support-history { margin-top: var(--space-2); padding-top: var(--space-1); border-top: 1px solid var(--border-subtle); scroll-margin: var(--space-4); }
|
||||
/* Кнопка истории — <summary>: пружинный отклик и слой жидкого света под текстом. */
|
||||
.profile-support-history__toggle {
|
||||
position: relative;
|
||||
isolation: isolate;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: var(--space-1);
|
||||
min-height: 44px;
|
||||
margin: 0 calc(-1 * var(--space-2));
|
||||
padding: var(--space-2) var(--space-3);
|
||||
overflow: hidden;
|
||||
border-radius: var(--radius-md);
|
||||
color: var(--text-secondary);
|
||||
font-size: var(--text-md);
|
||||
list-style: none;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
}
|
||||
.profile-support-history__toggle::-webkit-details-marker { display: none; }
|
||||
.profile-support-history__toggle::marker { content: ""; }
|
||||
.profile-support-history__toggle:hover { color: var(--text-primary); }
|
||||
.profile-support-history__toggle:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
|
||||
.profile-support-history__toggle:active,
|
||||
.profile-support-history__toggle.is-pressed { background-color: color-mix(in srgb, var(--text-primary) 6%, transparent); color: var(--text-primary); }
|
||||
.profile-support-history__label,
|
||||
.profile-support-history__chevron { position: relative; z-index: 1; }
|
||||
.profile-support-history__chevron { width: 18px; height: 18px; flex: none; }
|
||||
.profile-support-history[open] .profile-support-history__chevron { transform: rotate(90deg); }
|
||||
/* Фильтр #profile-support-goo — только на этом слое: капли непрозрачные (порог альфы их не стирает),
|
||||
интенсивность задаёт opacity слоя, текст над ним остаётся чётким. */
|
||||
.profile-support-history__light { position: absolute; inset: 0; z-index: 0; overflow: hidden; border-radius: inherit; filter: url(#profile-support-goo); opacity: .22; pointer-events: none; }
|
||||
:root[data-theme='light'] .profile-support-history__light { opacity: .14; }
|
||||
.profile-support-goo { position: absolute; width: 0; height: 0; }
|
||||
.profile-support-goo__drop { position: absolute; left: calc(var(--drop) / -2); top: calc(var(--drop) / -2); width: var(--drop); height: var(--drop); border-radius: 50%; background: var(--text-primary); }
|
||||
|
||||
.profile-support-history__rows { display: grid; gap: var(--space-2); padding: var(--space-2) 0 var(--space-3); }
|
||||
/* Перевод: «кому/от кого — сумма» сверху, «дата · SOL — транзакция» снизу (порядок DOM задаёт сетку). */
|
||||
.profile-support-transfer { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: var(--space-2); row-gap: 2px; }
|
||||
.profile-support-transfer__peer { min-width: 0; overflow-wrap: anywhere; }
|
||||
.profile-support-transfer__link { justify-self: end; font-size: var(--text-sm); }
|
||||
.profile-support-transfer .profile-support-amount { font-size: var(--text-md); }
|
||||
|
||||
/* Слои сияния (support-shine-effects.js) — декоративные, клики проходят сквозь них. */
|
||||
.profile-support-fx { position: absolute; pointer-events: none; }
|
||||
.profile-support-fx__rim,
|
||||
.profile-support-fx__comets { left: 0; top: 0; overflow: visible; }
|
||||
/* Рамка на время сияния: кант чуть золотится, по нему ровно по контуру обходит тонкий блик
|
||||
и гаснет звёздочкой-вспышкой в правом верхнем углу. */
|
||||
.profile-support-fx__rim-tint { fill: none; stroke: var(--warning); stroke-width: 1; opacity: 0; }
|
||||
.profile-support-fx__rim-glint { fill: none; stroke: var(--warning); stroke-width: 2; stroke-linecap: round; stroke-dasharray: .12 2; stroke-dashoffset: .12; }
|
||||
.profile-support-fx__flare { fill: color-mix(in srgb, var(--warning) 65%, var(--text-primary)); opacity: 0; transform-box: fill-box; transform-origin: center; }
|
||||
/* Комета «пополнения»: хвост — штрих по дуге (его смещение ведёт JS), голова — светящаяся точка, пылинки — за ней. */
|
||||
.profile-support-fx__trail { fill: none; stroke-width: 2.5; stroke-linecap: round; }
|
||||
.profile-support-fx__comet { left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 50%; background: color-mix(in srgb, var(--ps-tone) 55%, var(--text-primary)); box-shadow: 0 0 6px 3px var(--ps-tone), 0 0 20px 7px color-mix(in srgb, var(--ps-tone) 50%, transparent); }
|
||||
/* Днём широкий ореол тёмного тона на светлом стекле выглядит пятном: светлая сердцевина и узкий прозрачный ореол. */
|
||||
:root[data-theme='light'] .profile-support-fx__comet { background: color-mix(in srgb, var(--ps-tone) 60%, var(--surface)); box-shadow: 0 0 3px 1px color-mix(in srgb, var(--ps-tone) 70%, transparent), 0 0 10px 3px color-mix(in srgb, var(--ps-tone) 22%, transparent); }
|
||||
.profile-support-fx__mote { width: 3.5px; height: 3.5px; margin: -1.75px 0 0 -1.75px; border-radius: 50%; background: var(--ps-tone); box-shadow: 0 0 5px 1px var(--ps-tone); opacity: 0; }
|
||||
/* Сумма в момент пополнения — в цвете метрики с мягким свечением, затем плавно возвращается к обычному виду. */
|
||||
.profile-support-stat .profile-support-amount.is-filling { color: var(--ps-tone); text-shadow: 0 0 12px color-mix(in srgb, var(--ps-tone) 60%, transparent); }
|
||||
.profile-support-fx__orbit { overflow: visible; filter: drop-shadow(0 0 3px color-mix(in srgb, var(--warning) 70%, transparent)); }
|
||||
.profile-support-fx__ring { fill: none; stroke: var(--warning); stroke-opacity: .4; stroke-width: 1; stroke-dasharray: 1 7; stroke-linecap: round; }
|
||||
.profile-support-fx__dot { fill: var(--warning); }
|
||||
.profile-support-sparks { position: absolute; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; }
|
||||
.profile-support-spark { position: absolute; left: -2.5px; top: -2.5px; width: 5px; height: 5px; border-radius: 50%; background: var(--ps-tone, var(--warning)); box-shadow: 0 0 8px var(--ps-tone, var(--warning)); opacity: 0; }
|
||||
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
.profile-support { transition: grid-template-rows 420ms cubic-bezier(0.22, 1, 0.36, 1); }
|
||||
.profile-support__summary { transition: background-color var(--duration-fast) ease, transform 180ms cubic-bezier(0.175, 0.885, 0.32, 1.275); }
|
||||
.profile-support__summary:active:not(:disabled) { transform: scale(0.97); }
|
||||
|
||||
/* Тап по карточке: вдавливание за 0.15 с, отпускание — пружина 0.4 с (кривая с перелётом). */
|
||||
.profile-support-stats { transition: transform 400ms cubic-bezier(0.175, 0.885, 0.32, 1.275); }
|
||||
.profile-support-stats.is-pressed { transform: scale(0.97); transition-duration: 150ms; transition-timing-function: ease-out; }
|
||||
|
||||
/* «Дыхание» иконок и звёзд у ненулевых сумм: цикл 4 с, только пока карточка раскрыта. */
|
||||
.profile-support[data-expanded='true'] .profile-support-stat:not(.is-zero) .profile-support-stat__icon svg,
|
||||
.profile-support[data-expanded='true'] .profile-support-stat:not(.is-zero) .profile-support-amount__star { animation: profile-support-breathe 2s ease-in-out infinite alternate; }
|
||||
.profile-support[data-expanded='true'] .profile-support-stat:nth-child(2) :is(.profile-support-stat__icon svg, .profile-support-amount__star) { animation-delay: -.67s; }
|
||||
.profile-support[data-expanded='true'] .profile-support-stat:nth-child(3) :is(.profile-support-stat__icon svg, .profile-support-amount__star) { animation-delay: -1.33s; }
|
||||
|
||||
.profile-support-history__toggle { transition: transform 180ms cubic-bezier(0.175, 0.885, 0.32, 1.275), color var(--duration-fast) ease, background-color var(--duration-fast) ease; }
|
||||
.profile-support-history__toggle:active,
|
||||
.profile-support-history__toggle.is-pressed { transform: scale(0.97); }
|
||||
.profile-support-history__chevron { transition: transform var(--duration-fast) ease; }
|
||||
/* Жидкий свет на «Истории переводов» — 0.8 с. */
|
||||
.profile-support-goo__drop.is-main { --drop: 44px; animation: profile-support-goo-main 800ms cubic-bezier(0.22, 1, 0.36, 1) forwards; }
|
||||
.profile-support-goo__drop.is-left,
|
||||
.profile-support-goo__drop.is-right { --drop: 18px; animation: profile-support-goo-drop 720ms 60ms cubic-bezier(0.22, 1, 0.36, 1) both; }
|
||||
.profile-support-goo__drop.is-left { --dir: -1; }
|
||||
.profile-support-goo__drop.is-right { --dir: 1; }
|
||||
|
||||
.profile-support-fx__rim { animation: profile-support-fx-life 2.2s linear forwards; }
|
||||
.profile-support-fx__rim-tint { animation: profile-support-rim-tint 1.8s ease-in-out forwards; }
|
||||
.profile-support-fx__rim-glint { animation: profile-support-rim-glint 1.4s cubic-bezier(0.45, 0, 0.25, 1) forwards; }
|
||||
.profile-support-fx__flare { animation: profile-support-flare 700ms 1.3s ease-out forwards; }
|
||||
.profile-support-fx__comets { animation: profile-support-fx-life 1.8s linear forwards; }
|
||||
.profile-support-fx__mote { animation: profile-support-mote 800ms ease-out forwards; }
|
||||
.profile-support-fx__orbit { animation: profile-support-fx-fade 2.4s ease-in-out forwards; }
|
||||
.profile-support-spark { animation: profile-support-spark 800ms ease-out forwards; }
|
||||
.profile-support-stat .profile-support-amount { transition: color 600ms ease, text-shadow 600ms ease; }
|
||||
}
|
||||
|
||||
@keyframes profile-support-breathe {
|
||||
from { filter: drop-shadow(0 0 1px color-mix(in srgb, var(--ps-tone) 25%, transparent)); opacity: .82; }
|
||||
to { filter: drop-shadow(0 0 6px color-mix(in srgb, var(--ps-tone) 70%, transparent)); opacity: 1; }
|
||||
}
|
||||
@keyframes profile-support-goo-main {
|
||||
0% { transform: scale(.35); opacity: 1; }
|
||||
60% { opacity: .85; }
|
||||
100% { transform: scale(6); opacity: 0; }
|
||||
}
|
||||
@keyframes profile-support-goo-drop {
|
||||
0% { transform: translateX(0) scale(.6); opacity: 1; }
|
||||
100% { transform: translateX(calc(var(--dir) * 96px)) scale(1.6); opacity: 0; }
|
||||
}
|
||||
@keyframes profile-support-fx-fade {
|
||||
0% { opacity: 0; }
|
||||
15%, 75% { opacity: 1; }
|
||||
100% { opacity: 0; }
|
||||
}
|
||||
/* Срок жизни слоя: держится и гаснет в самом конце — по его animationend слой удаляется. */
|
||||
@keyframes profile-support-fx-life {
|
||||
0%, 90% { opacity: 1; }
|
||||
100% { opacity: 0; }
|
||||
}
|
||||
@keyframes profile-support-rim-tint {
|
||||
0%, 100% { opacity: 0; }
|
||||
45% { opacity: .5; }
|
||||
}
|
||||
/* Блик проходит полный круг (путь длиной 1) и уходит за конец — в правый верхний угол, где загорается вспышка. */
|
||||
@keyframes profile-support-rim-glint { to { stroke-dashoffset: -1; } }
|
||||
@keyframes profile-support-flare {
|
||||
0% { opacity: 0; transform: scale(0) rotate(0deg); }
|
||||
35% { opacity: 1; transform: scale(1.15) rotate(20deg); }
|
||||
100% { opacity: 0; transform: scale(.2) rotate(90deg); }
|
||||
}
|
||||
@keyframes profile-support-mote {
|
||||
0% { opacity: .95; transform: translate(0, 0) scale(1); }
|
||||
100% { opacity: 0; transform: translate(var(--mx), var(--my)) scale(.4); }
|
||||
}
|
||||
/* Искра держит яркость до середины пути и гаснет на излёте — иначе вспышка не успевает читаться. */
|
||||
@keyframes profile-support-spark {
|
||||
0% { transform: rotate(var(--a)) translateX(6px) scale(1); opacity: 1; }
|
||||
50% { opacity: 1; }
|
||||
100% { transform: rotate(var(--a)) translateX(var(--d)) scale(.3); opacity: 0; }
|
||||
}
|
||||
@@ -11,23 +11,21 @@ const en = JSON.parse(source('../js/i18n/locales/en.json'));
|
||||
for (const [locale, language] of [['ru', ru], ['en', en]]) {
|
||||
test(`в ${locale} есть полный текст предупреждения DM`, () => {
|
||||
const note = language.screens.chat_view.security_notice;
|
||||
for (const key of ['title', 'encryption', 'servers', 'derivation', 'rotation', 'source', 'warning_label', 'warning', 'recovery']) {
|
||||
for (const key of ['title', 'zero_knowledge_label', 'zero_knowledge', 'self_custody_label', 'self_custody', 'control_label', 'control']) {
|
||||
assert.ok(typeof note[key] === 'string' && note[key].trim(), `${locale}/${key}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
test('русский текст DM соответствует утверждённой пользователем редакции от 13.11.2026', () => {
|
||||
test('русский текст DM соответствует утверждённой пользователем редакции от 27.11.2026', () => {
|
||||
assert.deepEqual(ru.screens.chat_view.security_notice, {
|
||||
"title": "Ваша переписка защищена сквозным шифрованием",
|
||||
"encryption": "Все личные сообщения шифруются с использованием современных криптографических алгоритмов. Ключи шифрования хранятся ТОЛЬКО на устройствах участников переписки.",
|
||||
"servers": "Сервера SHiNE не имеют ваших приватных ключей и даже технически никак не могут прочитать ваши сообщения.",
|
||||
"derivation": "Ваш ключ шифрования высчитывается из вашего логина и пароля",
|
||||
"rotation": "При смене пароля перекодирование всех ваших сообщений со старого пароля на новый происходит на устройстве пользователя.",
|
||||
"source": "Код наших приложений полностью открыт и вы легко можете проверить всё это сами.",
|
||||
"warning_label": "Важно:",
|
||||
"warning": "если вы забудете свой пароль, восстановить доступ к вашей зашифрованной переписке будет невозможно.",
|
||||
"recovery": "SHiNE не хранит ваши секретные ключи и никак не сможет помочь вам восстановить вашу переписку"
|
||||
"zero_knowledge_label": "Zero-Knowledge Architecture:",
|
||||
"zero_knowledge": "Мы не доверяем серверам. SHiNE не хранит ваши приватные ключи и технически не имеет доступа к содержимому чатов.",
|
||||
"self_custody_label": "Self-Custody & Open Source:",
|
||||
"self_custody": "Ваш ключ генерируется локально из вашего логина и пароля. Никаких скрытых алгоритмов — код полностью открыт.",
|
||||
"control_label": "Absolute Control:",
|
||||
"control": "Забудете пароль — навсегда потеряете доступ к переписке."
|
||||
});
|
||||
// Текст должен отображаться напрямую через textContent, без HTML-сущностей.
|
||||
for (const text of Object.values(ru.screens.chat_view.security_notice)) {
|
||||
|
||||
Reference in New Issue
Block a user