From e865df33a4fb09655cdc7d8c7512b1e49f9bbedf Mon Sep 17 00:00:00 2001 From: loki5512344 Date: Sat, 24 Oct 2026 17:11:40 +0200 Subject: [PATCH] feat(web): add light client memory block and scroll animations --- README.md | 1 + docs/design.md | 2 + docs/memory-sources.md | 17 ++++ src/app.ts | 49 ++++++++-- src/i18n/en.ts | 15 +++ src/i18n/ru.ts | 15 +++ src/styles.css | 207 +++++++++++++++++++++++++++++++++++++++++ tests/browser_qa.py | 11 +++ 8 files changed, 311 insertions(+), 6 deletions(-) create mode 100644 docs/memory-sources.md diff --git a/README.md b/README.md index a59eac3..1b6c920 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ Actual screenshots of [central.loki-code.dev](https://central.loki-code.dev), ca - Responsive Russian/English project pages with the approved VNOX mark. - Interactive, clearly labelled layout illustration and a real native-client screenshot. +- A "light client" block with measured memory use (sources in [docs/memory-sources.md](docs/memory-sources.md)), scroll reveal and a counter that respects `prefers-reduced-motion`. - Account loading, signed-out, signed-in, unavailable and sign-out states. - GitHub sign-in through VNOX Hub, same-origin cookies and CSRF-protected sign-out. - Explicit early-development status; no invented releases, people or download links. diff --git a/docs/design.md b/docs/design.md index e5a0414..d6fb66c 100644 --- a/docs/design.md +++ b/docs/design.md @@ -23,3 +23,5 @@ Central status Footer ``` Review: a giant neutral product screenshot alone would feel like any desktop-app page. The hero instead explains persistent voice while browsing text through an intentionally small, labelled diagram. Real native-client imagery appears where it supports the appearance/settings explanation. Sand is the approved V brand colour, not a secondary decorative accent. + +Motion: sections fade in on scroll (IntersectionObserver), the hero enters once, the voice waveform and connection dots pulse softly, buttons and cards lift on hover. The memory block draws a short sand bar for VNOX against a long stone bar and counts up to 120 MB when it scrolls into view. All of it is plain CSS plus a small script, and it is switched off under `prefers-reduced-motion: reduce` (the final values are shown at once). Memory numbers and their sources: `docs/memory-sources.md`. diff --git a/docs/memory-sources.md b/docs/memory-sources.md new file mode 100644 index 0000000..8c61126 --- /dev/null +++ b/docs/memory-sources.md @@ -0,0 +1,17 @@ +# Memory figures on the site + +Block "A light client" on the landing page. All numbers were measured on Linux with `/proc` (RSS and PSS summed over all processes of the app). + +| App | State | RSS | PSS | +| --- | --- | --- | --- | +| VNOX client (Rust + Slint, release build) | idle, connection screen | 121 MB | 96 MB | +| Discord in the Vesktop Electron client, 8 processes | in use | 1333 MB | 1103 MB | + +The site says "about 120 MB" for VNOX (RSS 121 MB, not rounded to 100) and "about 1.3 GB" for Discord by the same RSS metric; PSS is stated in the text. The states differ (idle vs in use), and the site says so. Bar length is 1.3 GB. + +General statement "Electron clients often use from a few hundred MB to a gigabyte and more" rests on press reports, not on our measurement: + +- PCWorld, 9 December 2025, https://www.pcworld.com/article/3005317/discord-admits-windows-11-app-hogs-ram-tries-solving-it-with-auto-restarts.html : Discord's memory use is typically around 1 GB; Discord tests an automatic restart above 4 GB. +- Windows Latest, 27 September 2026, https://www.windowslatest.com/2026/09/27/electron-is-one-of-windows-11s-biggest-ram-offenders-and-discords-game-mode-doesnt-fix-it/ : a Discord employee said normal usage should stay under 1 GB (December 2025). No measurement method is given there. + +No other product is given a number. Electron apps vary widely, so no claim is made about them as a group beyond "often". diff --git a/src/app.ts b/src/app.ts index 46d5deb..70efef2 100644 --- a/src/app.ts +++ b/src/app.ts @@ -67,7 +67,7 @@ const external = (href: string, key: MessageKey) => `${tr(key)}${icon("external", 15)}`; function landing() { main.innerHTML = ` -
+

${tr("development")}

${tr("heroTitle", "h1", 'id="hero-title"')}${tr("heroText", "p", 'class="hero-description"')} ${tr("earlyNote", "p", 'class="small hero-note"')}
${tr("diagramLabel")}
@@ -76,12 +76,14 @@ function landing() {
${tr("diagramNote", "p", 'class="small diagram-note"')}
-
${tr("projectTitle", "h2", 'id="project-title"')}${tr("projectText", "p")}
${icon("chat", 24)}
${tr("projectNative", "h3")}${tr("projectNativeText", "p")}
${icon("voice", 24)}
${tr("projectServer", "h3")}${tr("projectServerText", "p")}
${tr("projectCentral", "h3")}${tr("projectCentralText", "p")}
-
${tr("clientTitle", "h2", 'id="client-title"')}${tr("clientText", "p")}
${t(${tr("screenshotCaption", "figcaption")}
${tr("appearanceTitle", "h3")}${tr("appearanceText", "p")}
${tr("identityTitle", "h3")}${tr("identityText", "p")}
-
${tr("roadmapTitle", "h2", 'id="roadmap-title"')}${tr("roadmapText", "p")}

${tr("available")}

  • ${tr("availableOne")}
  • ${tr("availableTwo")}
  • ${tr("availableThree")}
  • ${tr("availableFour")}
  • ${tr("availableFive")}

${tr("next")}

  • ${tr("nextOne")}
  • ${tr("nextTwo")}
  • ${tr("nextThree")}
${tr("downloadNote", "p", 'class="release-note"')}
-
${tr("faqTitle", "h2", 'id="faq-title"')}
${(["Server", "Central", "Release"] as const).map((key) => `
${tr(`faq${key}`)}${tr(`faq${key}Answer`, "p")}
`).join("")}
-

${t("statusLoading")}

${tr("openCentral")}${icon("external", 15)}
`; +
${tr("projectTitle", "h2", 'id="project-title"')}${tr("projectText", "p")}
${icon("chat", 24)}
${tr("projectNative", "h3")}${tr("projectNativeText", "p")}
${icon("voice", 24)}
${tr("projectServer", "h3")}${tr("projectServerText", "p")}
${tr("projectCentral", "h3")}${tr("projectCentralText", "p")}
+
${tr("lightTitle", "h2", 'id="light-title"')}${tr("lightText", "p")}
${tr("lightVnoxName")}${tr("lightAbout")} 120 ${tr("lightUnit")}
${tr("lightElectronName")}${tr("lightElectronValue")}
${tr("lightElectronNote", "p", 'class="meter-note"')}
${tr("lightCaption", "p", 'class="small light-caption"')}${tr("lightScale", "p", 'class="small light-caption"')}
+
${tr("clientTitle", "h2", 'id="client-title"')}${tr("clientText", "p")}
${t(${tr("screenshotCaption", "figcaption")}
${tr("appearanceTitle", "h3")}${tr("appearanceText", "p")}
${tr("identityTitle", "h3")}${tr("identityText", "p")}
+
${tr("roadmapTitle", "h2", 'id="roadmap-title"')}${tr("roadmapText", "p")}

${tr("available")}

  • ${tr("availableOne")}
  • ${tr("availableTwo")}
  • ${tr("availableThree")}
  • ${tr("availableFour")}
  • ${tr("availableFive")}

${tr("next")}

  • ${tr("nextOne")}
  • ${tr("nextTwo")}
  • ${tr("nextThree")}
${tr("downloadNote", "p", 'class="release-note"')}
+
${tr("faqTitle", "h2", 'id="faq-title"')}
${(["Server", "Central", "Release"] as const).map((key) => `
${tr(`faq${key}`)}${tr(`faq${key}Answer`, "p")}
`).join("")}
+

${t("statusLoading")}

${tr("openCentral")}${icon("external", 15)}
`; renderDiagram(); + initMotion(); main.querySelectorAll("[data-tab]").forEach((button) => { button.addEventListener("click", () => { activeTab = button.dataset.tab as Tab; @@ -103,6 +105,41 @@ function landing() { }); }); } +/** Scroll reveal and the memory counter. Skipped when motion is reduced. */ +function initMotion() { + const reduced = matchMedia("(prefers-reduced-motion: reduce)").matches; + if (reduced || !("IntersectionObserver" in window)) return; + const targets = main.querySelectorAll(".reveal"); + const counters = main.querySelectorAll("[data-count]"); + document.documentElement.classList.add("motion"); + counters.forEach((counter) => (counter.textContent = "0")); + const count = (counter: HTMLElement) => { + const goal = Number(counter.dataset.count); + const start = performance.now(); + const step = (now: number) => { + const progress = Math.min((now - start) / 1400, 1); + counter.textContent = String( + Math.round(goal * (1 - Math.pow(1 - progress, 3))), + ); + if (progress < 1) requestAnimationFrame(step); + }; + requestAnimationFrame(step); + }; + const observer = new IntersectionObserver( + (entries) => { + for (const entry of entries) { + if (!entry.isIntersecting) continue; + entry.target.classList.add("in"); + entry.target + .querySelectorAll("[data-count]") + .forEach(count); + observer.unobserve(entry.target); + } + }, + { threshold: 0.2 }, + ); + targets.forEach((target) => observer.observe(target)); +} function renderDiagram() { const content = document.querySelector("#diagram-content"); if (!content) return; diff --git a/src/i18n/en.ts b/src/i18n/en.ts index bbff1bb..92f92b6 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -54,6 +54,21 @@ export const en = { projectCentral: "Vnox Central", projectCentralText: "A web account with GitHub sign-in. It is not linked to the desktop client key yet.", + lightTitle: "A light client", + lightText: + "The Rust and Slint client does not carry a browser with it. It uses about 120 MB of memory when idle.", + lightAbout: "about", + lightUnit: "MB", + lightVnoxName: "VNOX", + lightElectronName: "Discord (Vesktop, Electron)", + lightElectronValue: "about 1.3 GB", + lightElectronNote: + "Discord in the Vesktop Electron client, 8 processes, in use: RSS 1333 MB, PSS 1103 MB (about 1.1 GB). Electron clients in general often use from a few hundred MB to a gigabyte and more.", + lightCaption: + "Measured on Linux. VNOX: connection screen, release build, RSS 121 MB, PSS 96 MB. Discord: in use.", + lightScale: + "These are two different states: VNOX idle, Discord under load. Bar length: 1.3 GB by RSS.", + lightSource: "On Electron in general: PCWorld, December 2025", clientCode: "Client source", serverCode: "Server source", clientTitle: "Appearance settings", diff --git a/src/i18n/ru.ts b/src/i18n/ru.ts index fcf6695..14b4ba8 100644 --- a/src/i18n/ru.ts +++ b/src/i18n/ru.ts @@ -56,6 +56,21 @@ export const ru: Catalog = { projectCentral: "Vnox Central", projectCentralText: "Веб-аккаунт с входом через GitHub. С ключом настольного клиента он пока не связан.", + lightTitle: "Лёгкий клиент", + lightText: + "Клиент на Rust и Slint не носит с собой браузер. В простое он занимает около 120 МБ памяти.", + lightAbout: "около", + lightUnit: "МБ", + lightVnoxName: "VNOX", + lightElectronName: "Discord (Vesktop, Electron)", + lightElectronValue: "около 1,3 ГБ", + lightElectronNote: + "Discord в клиенте Vesktop на Electron, 8 процессов, в работе: RSS 1333 МБ, PSS 1103 МБ (около 1,1 ГБ). Клиенты на Electron вообще часто занимают от нескольких сотен МБ до гигабайта и больше.", + lightCaption: + "Замер на Linux. VNOX: экран подключения, release-сборка, RSS 121 МБ, PSS 96 МБ. Discord: в работе.", + lightScale: + "Это два разных состояния: VNOX в простое, Discord под нагрузкой. Длина полосы: 1,3 ГБ по RSS.", + lightSource: "Про Electron в целом: PCWorld, декабрь 2025", clientCode: "Код клиента", serverCode: "Код сервера", clientTitle: "Настройки внешнего вида", diff --git a/src/styles.css b/src/styles.css index d80e648..2f1dc29 100644 --- a/src/styles.css +++ b/src/styles.css @@ -1879,3 +1879,210 @@ p { .waveform i:nth-child(11n + 11) { height: 24px; } + +/* Lightweight client block */ +.light-section { + padding-block: 85px 100px; + border-top: 1px solid var(--line); + display: grid; + grid-template-columns: 1fr 1.2fr; + gap: 110px; + align-items: start; +} +.light-intro > p { + margin-top: 25px; + max-width: 40ch; +} +.light-meters { + display: flex; + flex-direction: column; + gap: 30px; +} +.meter-head { + display: flex; + justify-content: space-between; + align-items: baseline; + gap: 16px; + margin-bottom: 10px; + font-size: 0.9rem; +} +.meter-head strong { + font-size: 1.15rem; + font-variant-numeric: tabular-nums; + white-space: nowrap; +} +.meter.vnox .meter-head strong { + color: var(--sand); +} +.meter-track { + height: 14px; + background: var(--surface); + border: 1px solid var(--line); + border-radius: 4px; + overflow: hidden; +} +.meter-track i { + display: block; + height: 100%; + width: var(--w); + transform-origin: left; + border-radius: 3px; +} +.meter.vnox .meter-track i { + background: var(--sand); +} +.meter.electron .meter-track i { + background: #5a5752; +} +.meter-note { + font-size: 0.82rem; + margin-top: 12px; + max-width: 52ch; +} +.light-caption { + color: var(--muted); + margin: -10px 0 0; +} +@media (max-width: 1100px) { + .light-section { + gap: 60px; + } +} +@media (max-width: 800px) { + .light-section { + grid-template-columns: 1fr; + gap: 40px; + padding-block: 60px 70px; + } +} +@media (max-width: 480px) { + .meter-head { + flex-wrap: wrap; + gap: 2px 16px; + } +} + +/* Motion: everything below is off when the visitor prefers reduced motion. */ +@media (prefers-reduced-motion: no-preference) { + .motion .reveal { + opacity: 0; + transform: translateY(22px); + transition: + opacity 0.7s ease, + transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1); + } + .motion .reveal.in { + opacity: 1; + transform: none; + } + .motion .meter-track i { + transform: scaleX(0); + } + .motion .light-section.in .meter-track i { + transform: scaleX(1); + transition: transform 1.4s cubic-bezier(0.2, 0.7, 0.2, 1) 0.2s; + } + .motion .light-section.in .meter.electron .meter-track i { + transition-duration: 2.2s; + } + .enter .hero-copy > * { + animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) backwards; + } + .enter .hero-copy > :nth-child(2) { + animation-delay: 0.08s; + } + .enter .hero-copy > :nth-child(3) { + animation-delay: 0.16s; + } + .enter .hero-copy > :nth-child(4) { + animation-delay: 0.24s; + } + .enter .hero-copy > :nth-child(5) { + animation-delay: 0.32s; + } + .enter .diagram-wrap { + animation: rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) 0.2s backwards; + } + #diagram-content > * { + animation: fade 0.35s ease; + } + .diagram-call .connection-dot, + .person-dot { + animation: pulse 2.4s ease-in-out infinite; + } + .person-dot.second { + animation-delay: 0.8s; + } + .waveform i { + animation: wave 1.2s ease-in-out infinite; + transform-origin: center; + } + .waveform i:nth-child(odd) { + animation-duration: 0.9s; + } + .waveform i:nth-child(3n) { + animation-delay: -0.4s; + } + .waveform i:nth-child(4n) { + animation-delay: -0.7s; + } + .button, + .point-icon, + .theme-option, + .client-image, + .faq summary span { + transition: + transform 0.2s ease, + background-color 0.2s ease, + border-color 0.2s ease; + } + .button:hover { + transform: translateY(-2px); + } + .button:active { + transform: none; + } + .project-points article:hover .point-icon { + transform: translateY(-3px); + background: #2e2d2b; + } + .theme-option:hover { + transform: translateY(-2px); + } + .client-image:hover { + border-color: #6b6559; + } + .roadmap-columns article { + transition: border-color 0.25s ease; + } + .roadmap-columns article:hover { + border-top-color: var(--sand); + } +} +@keyframes rise { + from { + opacity: 0; + transform: translateY(18px); + } +} +@keyframes fade { + from { + opacity: 0; + } +} +@keyframes pulse { + 50% { + opacity: 0.35; + } +} +@keyframes wave { + 50% { + transform: scaleY(0.45); + } +} +@media (prefers-reduced-motion: reduce) { + * { + animation: none !important; + transition: none !important; + } +} diff --git a/tests/browser_qa.py b/tests/browser_qa.py index 707e629..50616f1 100644 --- a/tests/browser_qa.py +++ b/tests/browser_qa.py @@ -37,6 +37,8 @@ with sync_playwright() as p: page.locator('#service-status').filter(has_text='отвечает').wait_for() page.screenshot(path=str(artifacts / 'desktop-hero.png')) page.screenshot(path=str(artifacts / 'desktop-full.png'), full_page=True) + page.locator('#light').scroll_into_view_if_needed() + page.wait_for_function("document.querySelector('.count').textContent === '120'") page.locator('[data-tab="voice"]').click() assert page.locator('.voice-orbit').count() == 1 page.locator('[data-tab="voice"]').press('ArrowRight') @@ -57,7 +59,16 @@ with sync_playwright() as p: page.set_viewport_size({'width': width, 'height': 844}) assert not page.evaluate('document.documentElement.scrollWidth > innerWidth'), (locale, width) page.set_viewport_size({'width': 390, 'height': 844}) + page.evaluate("document.querySelectorAll('.reveal').forEach(e => e.classList.add('in'))") page.screenshot(path=str(artifacts / 'mobile-full.png'), full_page=True) + reduced = browser.new_context(viewport={'width': 390, 'height': 844}, reduced_motion='reduce') + rp = reduced.new_page() + rp.goto(args.url) + rp.locator('.light-section').wait_for() + assert not rp.evaluate("document.documentElement.classList.contains('motion')") + assert rp.locator('.count').inner_text() == '120' + assert rp.evaluate("getComputedStyle(document.querySelector('.reveal')).opacity") == '1' + reduced.close() page.goto(args.url + '/account') page.locator('.github-login[href="/v1/auth/github/start"]').wait_for() assert page.locator('.github-login').get_attribute('aria-disabled') is None