feat(web): add light client memory block and scroll animations
This commit is contained in:
parent
769e25a705
commit
e865df33a4
8 changed files with 311 additions and 6 deletions
49
src/app.ts
49
src/app.ts
|
|
@ -67,7 +67,7 @@ const external = (href: string, key: MessageKey) =>
|
|||
`<a class="text-link" href="${href}" target="_blank" rel="noopener noreferrer">${tr(key)}${icon("external", 15)}</a>`;
|
||||
function landing() {
|
||||
main.innerHTML = `
|
||||
<section class="hero shell" aria-labelledby="hero-title">
|
||||
<section class="hero shell enter" aria-labelledby="hero-title">
|
||||
<div class="hero-copy"><p class="development">${tr("development")}</p>${tr("heroTitle", "h1", 'id="hero-title"')}${tr("heroText", "p", 'class="hero-description"')}
|
||||
<div class="hero-actions"><a class="button primary" href="/account">${tr("openCentral")}</a><a class="button quiet" href="#project">${tr("explore")}</a></div>${tr("earlyNote", "p", 'class="small hero-note"')}</div>
|
||||
<div class="diagram-wrap"><div class="diagram-meta">${tr("diagramLabel")}<span class="diagram-dots" aria-hidden="true"><i></i><i></i><i></i></span></div>
|
||||
|
|
@ -76,12 +76,14 @@ function landing() {
|
|||
<div class="diagram-tabs" role="tablist" aria-label="${t("preview")}" data-i18n-aria="preview"><button role="tab" aria-selected="true" aria-controls="diagram-content" id="tab-text" data-tab="text">${tr("textTab")}</button><button role="tab" aria-selected="false" aria-controls="diagram-content" id="tab-voice" data-tab="voice" tabindex="-1">${tr("voiceTab")}</button><button role="tab" aria-selected="false" aria-controls="diagram-content" id="tab-theme" data-tab="theme" tabindex="-1">${tr("themeTab")}</button></div>${tr("diagramNote", "p", 'class="small diagram-note"')}
|
||||
</div>
|
||||
</section>
|
||||
<section class="project-section shell" id="project" aria-labelledby="project-title"><div class="section-intro">${tr("projectTitle", "h2", 'id="project-title"')}${tr("projectText", "p")}<div class="source-links">${external("https://git.wihuk.pro/boba/VNOX-Client", "clientCode")}${external("https://git.wihuk.pro/boba/VNOX-Server", "serverCode")}</div></div><div class="project-points"><article><div class="point-icon">${icon("chat", 24)}</div><div>${tr("projectNative", "h3")}${tr("projectNativeText", "p")}</div></article><article><div class="point-icon">${icon("voice", 24)}</div><div>${tr("projectServer", "h3")}${tr("projectServerText", "p")}</div></article><article><img src="/assets/vnox-mark.svg" alt="" width="40" height="40"><div>${tr("projectCentral", "h3")}${tr("projectCentralText", "p")}</div></article></div></section>
|
||||
<section class="client-section" id="client" aria-labelledby="client-title"><div class="shell"><div class="client-heading">${tr("clientTitle", "h2", 'id="client-title"')}${tr("clientText", "p")}</div><figure class="client-image"><img src="/assets/client-settings.png" width="1280" height="800" alt="${t("clientScreenshot")}" data-i18n-alt="clientScreenshot" loading="lazy">${tr("screenshotCaption", "figcaption")}</figure><div class="client-details"><article>${tr("appearanceTitle", "h3")}${tr("appearanceText", "p")}</article><article>${tr("identityTitle", "h3")}${tr("identityText", "p")}</article></div></div></section>
|
||||
<section class="roadmap shell" id="roadmap" aria-labelledby="roadmap-title"><div class="roadmap-heading">${tr("roadmapTitle", "h2", 'id="roadmap-title"')}${tr("roadmapText", "p")}</div><div class="roadmap-columns"><article><h3><span class="connection-dot" aria-hidden="true"></span>${tr("available")}</h3><ul><li>${tr("availableOne")}</li><li>${tr("availableTwo")}</li><li>${tr("availableThree")}</li><li>${tr("availableFour")}</li><li>${tr("availableFive")}</li></ul></article><article><h3><span class="planned-dot" aria-hidden="true"></span>${tr("next")}</h3><ul><li>${tr("nextOne")}</li><li>${tr("nextTwo")}</li><li>${tr("nextThree")}</li></ul></article></div>${tr("downloadNote", "p", 'class="release-note"')}</section>
|
||||
<section class="faq shell" aria-labelledby="faq-title">${tr("faqTitle", "h2", 'id="faq-title"')}<div>${(["Server", "Central", "Release"] as const).map((key) => `<details><summary>${tr(`faq${key}`)}<span aria-hidden="true">+</span></summary>${tr(`faq${key}Answer`, "p")}</details>`).join("")}</div></section>
|
||||
<section class="status-section shell" aria-label="${t("statusNote")}" data-i18n-aria="statusNote"><div><span id="service-dot" class="status-dot"></span><p id="service-status" role="status">${t("statusLoading")}</p></div><a href="/account" class="text-link">${tr("openCentral")}${icon("external", 15)}</a></section>`;
|
||||
<section class="project-section shell reveal" id="project" aria-labelledby="project-title"><div class="section-intro">${tr("projectTitle", "h2", 'id="project-title"')}${tr("projectText", "p")}<div class="source-links">${external("https://git.wihuk.pro/boba/VNOX-Client", "clientCode")}${external("https://git.wihuk.pro/boba/VNOX-Server", "serverCode")}</div></div><div class="project-points"><article><div class="point-icon">${icon("chat", 24)}</div><div>${tr("projectNative", "h3")}${tr("projectNativeText", "p")}</div></article><article><div class="point-icon">${icon("voice", 24)}</div><div>${tr("projectServer", "h3")}${tr("projectServerText", "p")}</div></article><article><img src="/assets/vnox-mark.svg" alt="" width="40" height="40"><div>${tr("projectCentral", "h3")}${tr("projectCentralText", "p")}</div></article></div></section>
|
||||
<section class="light-section shell reveal" id="light" aria-labelledby="light-title"><div class="light-intro">${tr("lightTitle", "h2", 'id="light-title"')}${tr("lightText", "p")}<div class="source-links"><a class="text-link" href="https://www.pcworld.com/article/3005317/discord-admits-windows-11-app-hogs-ram-tries-solving-it-with-auto-restarts.html" target="_blank" rel="noopener noreferrer">${tr("lightSource")}${icon("external", 15)}</a></div></div><div class="light-meters"><div class="meter vnox"><div class="meter-head">${tr("lightVnoxName")}<strong>${tr("lightAbout")} <span class="count" data-count="120">120</span> ${tr("lightUnit")}</strong></div><div class="meter-track" aria-hidden="true"><i style="--w: 9.1%"></i></div></div><div class="meter electron"><div class="meter-head">${tr("lightElectronName")}<strong>${tr("lightElectronValue")}</strong></div><div class="meter-track" aria-hidden="true"><i style="--w: 100%"></i></div>${tr("lightElectronNote", "p", 'class="meter-note"')}</div>${tr("lightCaption", "p", 'class="small light-caption"')}${tr("lightScale", "p", 'class="small light-caption"')}</div></section>
|
||||
<section class="client-section reveal" id="client" aria-labelledby="client-title"><div class="shell"><div class="client-heading">${tr("clientTitle", "h2", 'id="client-title"')}${tr("clientText", "p")}</div><figure class="client-image"><img src="/assets/client-settings.png" width="1280" height="800" alt="${t("clientScreenshot")}" data-i18n-alt="clientScreenshot" loading="lazy">${tr("screenshotCaption", "figcaption")}</figure><div class="client-details"><article>${tr("appearanceTitle", "h3")}${tr("appearanceText", "p")}</article><article>${tr("identityTitle", "h3")}${tr("identityText", "p")}</article></div></div></section>
|
||||
<section class="roadmap shell reveal" id="roadmap" aria-labelledby="roadmap-title"><div class="roadmap-heading">${tr("roadmapTitle", "h2", 'id="roadmap-title"')}${tr("roadmapText", "p")}</div><div class="roadmap-columns"><article><h3><span class="connection-dot" aria-hidden="true"></span>${tr("available")}</h3><ul><li>${tr("availableOne")}</li><li>${tr("availableTwo")}</li><li>${tr("availableThree")}</li><li>${tr("availableFour")}</li><li>${tr("availableFive")}</li></ul></article><article><h3><span class="planned-dot" aria-hidden="true"></span>${tr("next")}</h3><ul><li>${tr("nextOne")}</li><li>${tr("nextTwo")}</li><li>${tr("nextThree")}</li></ul></article></div>${tr("downloadNote", "p", 'class="release-note"')}</section>
|
||||
<section class="faq shell reveal" aria-labelledby="faq-title">${tr("faqTitle", "h2", 'id="faq-title"')}<div>${(["Server", "Central", "Release"] as const).map((key) => `<details><summary>${tr(`faq${key}`)}<span aria-hidden="true">+</span></summary>${tr(`faq${key}Answer`, "p")}</details>`).join("")}</div></section>
|
||||
<section class="status-section shell reveal" aria-label="${t("statusNote")}" data-i18n-aria="statusNote"><div><span id="service-dot" class="status-dot"></span><p id="service-status" role="status">${t("statusLoading")}</p></div><a href="/account" class="text-link">${tr("openCentral")}${icon("external", 15)}</a></section>`;
|
||||
renderDiagram();
|
||||
initMotion();
|
||||
main.querySelectorAll<HTMLElement>("[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<HTMLElement>(".reveal");
|
||||
const counters = main.querySelectorAll<HTMLElement>("[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<HTMLElement>("[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;
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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: "Настройки внешнего вида",
|
||||
|
|
|
|||
207
src/styles.css
207
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue