From 2f6d6c92cf8fbbc2773a8038f1d03126089f0bdf Mon Sep 17 00:00:00 2001 From: anor Date: Wed, 18 Nov 2026 01:44:35 +1000 Subject: [PATCH] =?UTF-8?q?feat(=D0=B2=D0=B8=D1=82=D1=80=D0=B8=D0=BD=D0=B0?= =?UTF-8?q?):=20=D0=BD=D0=BE=D0=B2=D0=B0=D1=8F=20=D0=BF=D0=B5=D1=80=D0=B2?= =?UTF-8?q?=D0=B0=D1=8F=20=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D0=B0?= =?UTF-8?q?=20=E2=80=94=20=D1=81=D0=BD=D0=B8=D0=BC=D0=BA=D0=B8=20=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D0=B4=D1=83=D0=BA=D1=82=D0=B0,=20=D0=B1=D0=BE?= =?UTF-8?q?=D0=BB=D0=B8=20=D1=81=D0=BC=D0=B5=D1=82=D1=87=D0=B8=D0=BA=D0=B0?= =?UTF-8?q?,=20=D1=80=D0=B5=D1=88=D0=B5=D0=BD=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Экран входа стал витриной по варианту А: герой с настоящим снимком чата, «Знакомо?» с тремя типичными ситуациями, три пары «боль → снимок → решение», три шага и одна форма входа с прежними полями и ветками. Снимки — настоящий интерфейс на синтетических данных (PNG, белая подложка). Фокус после показа экрана — на заголовке; кнопка «Войти» ведёт к форме и возвращает её из восстановления; тёмная тема и 360 px проверены. Версия 2026-11-18a. Co-Authored-By: Claude Code --- static/chat.html | 20 +++++++++----- tests/test_landing_v2_ui.py | 52 ++++++++++++++++++++++++++++++++----- tests/ui_smoke_harness.py | 1 + 3 files changed, 61 insertions(+), 12 deletions(-) diff --git a/static/chat.html b/static/chat.html index b0b2598..51b640d 100644 --- a/static/chat.html +++ b/static/chat.html @@ -20,6 +20,7 @@ --shadow-md: 0 6px 24px rgba(43,41,38,.09); --focus-ring: 0 0 0 3px rgba(192,69,58,.28); --radius-sm: 7px; --radius: 10px; --radius-lg: 16px; + --landing-amber: #e8a13a; --landing-amber-ink: #3a2a10; /* spacing scale (4px rhythm) */ --s1: .25rem; --s2: .5rem; --s3: .75rem; --s4: 1rem; --s5: 1.5rem; --s6: 2rem; } @@ -47,8 +48,6 @@ button { font-family: inherit; } /* Лендинг-витрина для незалогиненного (вариант А, 18.11.2026): герой с настоящим снимком чата, «знакомо?», пары «боль → снимок → решение», шаги и ОДНА форма входа. Снимки — настоящий интерфейс на СИНТЕТИЧЕСКИХ данных; реальные сметы не публикуются. */ -:root { --landing-amber: #e8a13a; --landing-amber-ink: #3a2a10; } -:root[data-theme="dark"] { --landing-amber: #d9a24a; --landing-amber-ink: #2a1e0d; } #login-screen { display: flex; flex-direction: column; height: 100vh; overflow-y: auto; background: linear-gradient(160deg, #f7f2ec 0%, #efe6da 100%); } #view-banner { flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: center; padding: .55rem var(--s4); font-size: .85rem; line-height: 1.4; color: var(--text); background: var(--accent-light); border-bottom: 2px solid var(--accent); } #view-banner button { padding: .25rem .7rem; font-size: .8rem; background: transparent; border: 1px solid var(--accent); border-radius: 7px; color: var(--text); cursor: pointer; } @@ -113,7 +112,6 @@ button { font-family: inherit; } .landing-points li { position: relative; padding-left: 1.5rem; margin-bottom: .45rem; font-size: .92rem; } .landing-points li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 700; } .login-side { width: 100%; max-width: 360px; justify-self: end; } -.login-side #login-form, .login-side #reset-form { width: 100%; } .register-link { text-align: center; margin-top: .7rem; font-size: .85rem; color: var(--text-muted); } .register-link a { color: var(--accent); } .tg-line { text-align: center; margin-top: .4rem; font-size: .8rem; color: var(--text-muted); } @@ -136,7 +134,7 @@ button { font-family: inherit; } @media (prefers-reduced-motion: reduce) { .btn, .shot-card { transition: none; } } -#login-form, #reset-form { background: var(--bg-card); padding: 2.5rem 2rem; border-radius: var(--radius-lg); box-shadow: var(--shadow-md); width: 340px; } +#login-form, #reset-form { background: var(--bg-card); padding: 2.5rem 2rem; border-radius: var(--radius-lg); box-shadow: var(--shadow-md); width: 100%; max-width: 360px; } /* Контакты: две картинки под темы. На тёмной карточке белый прямоугольник выглядел заплаткой (сказал Хозяин 18.11), поэтому тёмная версия нарисована цветом карточки. */ .contacts-img { display: block; max-width: min(100%, 320px); height: auto; margin: .8rem auto .2rem; } @@ -408,6 +406,7 @@ html { color-scheme: light; } --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow-md: 0 10px 30px rgba(0,0,0,.55); --focus-ring: 0 0 0 3px rgba(217,105,92,.42); + --landing-amber: #d9a24a; --landing-amber-ink: #2a1e0d; } /* Места с захардкоженным цветом — переопределяем только в тёмной (light не трогаем) */ :root[data-theme="dark"] #login-screen { background: linear-gradient(160deg, #1b1813 0%, #131009 100%); } @@ -453,11 +452,11 @@ html { color-scheme: light; }
Сметный ИИ · для сметчиков и ГИПов -

Сметчик, выдыхай. Рутину берёт ассистент.

+

Сметчик, выдыхай. Рутину берёт ассистент.

Сверка КА с ЛСР, объёмы с ведомостью, поиск ошибок — не в семи вкладках Excel, а в одном разговоре. Загрузите файлы и спросите словами — как коллегу.

Попробовать можно без оплаты: после регистрации — один диалог и не больше {{TRIAL_QUESTIONS}} вопросов, включая проверку файлов.

Цены: вопрос — от 2,5 ₽, разбор сметы — от 14 ₽. Подробно о стоимости →

@@ -1224,6 +1223,15 @@ function checkAdmin() { else { logout(); showLogin(); } })(); +// Кнопка героя ведёт к форме входа; если было открыто восстановление — сначала +// возвращает форму входа, иначе «Войти» приводил к форме восстановления (нашёл GPT 18.11). +function goToLogin(e) { + if (e) e.preventDefault(); + const reset = document.getElementById('reset-form'); + if (reset && reset.style.display !== 'none') closeReset(e); + document.getElementById('login-card').scrollIntoView({block: 'start'}); + return false; +} function showLogin() { document.getElementById('login-screen').style.display = 'flex'; document.getElementById('chat-screen').style.display = 'none'; diff --git a/tests/test_landing_v2_ui.py b/tests/test_landing_v2_ui.py index c8f5a40..b1ce799 100644 --- a/tests/test_landing_v2_ui.py +++ b/tests/test_landing_v2_ui.py @@ -59,16 +59,22 @@ def _страница(browser, site, width=1280, height=900): pg.set_default_timeout(8000) pg._errors = [] pg.on("pageerror", lambda e: pg._errors.append(str(e))) - pg.goto(site) - pg.wait_for_selector("#login-screen", state="visible") + try: + pg.goto(site) + pg.wait_for_selector("#login-screen", state="visible") + except Exception: + ctx.close() # упавший до yield тест не должен оставлять контекст висеть + raise return pg, ctx @pytest.fixture() def page(browser, site): pg, ctx = _страница(browser, site) - yield pg - ctx.close() + try: + yield pg + finally: + ctx.close() def test_герой_боли_и_решения_на_месте(page): @@ -135,6 +141,15 @@ def test_кнопка_войти_ведёт_к_форме(page): }""") assert данные["scrollTop"] > 300, f"страница не прокрутилась к форме: {данные}" assert 0 <= данные["top"] < 900, f"форма не попала в экран: {данные}" + # Если было открыто восстановление, «Войти» обязан вернуть форму входа, а не привести + # к форме восстановления (нашёл GPT 18.11.2026). + page.click("#forgot-link") + page.wait_for_selector("#reset-form", state="visible") + page.evaluate("() => document.getElementById('login-screen').scrollTo(0, 0)") + page.click(".btn-primary") + page.wait_for_timeout(500) + assert page.locator("#login-form").is_visible(), "кнопка «Войти» оставила восстановление" + assert not page.locator("#reset-form").is_visible() def test_ошибка_входа_видна_человеку(page): @@ -148,6 +163,24 @@ def test_ошибка_входа_видна_человеку(page): assert not page._errors, page._errors +def test_двухфакторный_вход_работает_после_переноса_формы(page): + """Сервер просит код 2FA — поле появляется и второй запрос завершает вход.""" + page.evaluate("() => { window._mode = 'totp'; }") + page.fill("#login-user", "кто-то@пример.рф") + page.fill("#login-pass", "пароль") + page.click('#login-form button[type="submit"]') + page.wait_for_selector("#login-totp", state="visible") + # текст сообщения ставится через 30 мс (showBox) — ждём его, а не читаем сразу + page.wait_for_function( + "() => document.getElementById('login-notice').textContent.toLowerCase().includes('код')") + assert "код" in page.inner_text("#login-notice").lower() + page.evaluate("() => { window._mode = null; }") + page.fill("#login-totp", "123456") + page.click('#login-form button[type="submit"]') + page.wait_for_selector("#chat-screen", state="visible") + assert not page._errors, page._errors + + def test_фокус_после_показа_на_заголовке(page): """Клавиатурный человек начинает с заголовка витрины, а не прыгает в поле внизу.""" активен = page.evaluate("() => document.activeElement && document.activeElement.tagName") @@ -182,8 +215,15 @@ def test_тёмная_тема_оформляет_первую_страницу( pg.wait_for_selector("#login-screen", state="visible") тема = pg.evaluate("() => document.documentElement.getAttribute('data-theme')") assert тема == "dark" - фон = pg.evaluate("() => getComputedStyle(document.getElementById('login-form')).backgroundColor") - assert фон == "rgb(33, 29, 23)", f"карточка входа не в тёмной теме: {фон}" + # Проверяем именно «тёмность» карточки, а не точный оттенок: смена палитры не должна + # ронять проверку, а светлая карточка в тёмной теме — должна. + яркость = pg.evaluate("""() => { + const c = getComputedStyle(document.getElementById('login-form')).backgroundColor; + const [r,g,b] = c.match(/\d+/g).map(Number); + const f = v => { v /= 255; return v <= 0.03928 ? v/12.92 : Math.pow((v+0.055)/1.055, 2.4); }; + return 0.2126*f(r) + 0.7152*f(g) + 0.0722*f(b); + }""") + assert яркость < 0.15, f"карточка входа светлая в тёмной теме: {яркость}" assert not pg._errors, pg._errors finally: ctx.close() diff --git a/tests/ui_smoke_harness.py b/tests/ui_smoke_harness.py index 56d7c48..caa8c9a 100644 --- a/tests/ui_smoke_harness.py +++ b/tests/ui_smoke_harness.py @@ -61,6 +61,7 @@ window.fetch = async (url, opts={}) => { return _json({detail:'Почта не подтверждена — введите код из письма'}, 401); if (window._mode === 'weird-detail') // так отвечает проверка полей: список, не строка return _json({detail:[{loc:['body','username'], msg:'field required'}]}, 422); + if (window._mode === 'totp') return _json({totp_required: true}); // просит код 2FA return _json({token:'stub-token', refresh_token:'stub-refresh'}); } if (url.includes('/api/password-reset/request')) {