diff --git a/AGENTS.md b/AGENTS.md index e8abd25..b7d0549 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -3,6 +3,7 @@ ## Scope - This repository contains the Belki calculator/VK bot plus legacy CatWar userscript assets. - Key files: [`app/`](./app), [`web/calculator.html`](./web/calculator.html), [`Dockerfile`](./Dockerfile), and [`deploy/k8s/`](./deploy/k8s). +- LongMemory namespace is explicitly `catwar`, established by the owner on 2026-11-14 and recorded in root `project-info.txt`. Read that file as data before scoped calls; use project context/recall before work and verify durable writes by readback. ## Working Rules - Write Russian UI and bot copy for CatWar faction members. Preserve ЛУ/ЗУ, бельчата, белки-летяги, кураторы, осмотры, resource names, command examples, and rule limits. Prefer plain instructions; explain name/ID lookup without internal terms such as «связка». Keep required input separators and report templates intact when editing prose. @@ -19,6 +20,9 @@ - For web UI work, use the project-local `.codex/skills/frontend-craft`, `.codex/skills/frontend-design`, and `.codex/skills/ui-ux-pro-max` instructions: establish a deliberate visual direction, preserve accessibility and interaction quality, then inspect the rendered result. ## Validation +- Frontend regression: `node tests/browser/calculator.cjs` against a separately started isolated server at `http://127.0.0.1:8876` (override `BELKI_TEST_URL` only with another loopback URL). Use the remote test zone when exposed; it was unavailable on 2026-11-14. Playwright is test tooling, not a runtime dependency: use the bundled Node/Playwright returned by `load_workspace_dependencies`, setting `NODE_PATH` to its `node_modules` and optionally `CHROMIUM_PATH` to the browser executable. The suite closes its browser/contexts and intercepts weather and admin fixtures; real calculation requests require the normal Python dependencies. +- For a local fallback, create a temporary venv and install existing `requirements.txt`, then launch `python -m app.main` with `BELKI_DATABASE_URL=`, `BELKI_HOST=127.0.0.1`, `BELKI_PORT=8876`, and temporary absolute paths for `BELKI_HISTORY_DB` and `BELKI_IDENTITIES_DB`. Never reuse production stores. `BELKI_SCREENSHOT_DIR` optionally saves browser screenshots outside Git. Stop the server and remove the temporary venv, SQLite files, caches and screenshots after review. +- Browser coverage includes native radio arrow keys, report invalidation on edits/mode changes, delayed responses/double submissions, clipboard denial, dialog focus/Escape, section URLs/Back, both application entry points, admin filters/default sort and gallery. Keep API/data contracts intact: training points are a number, coaching kitten points are an array. Do not restore stale prepared reports when a calculation response arrives after an edit. - Weather easter egg: `python -m unittest discover -s tests -p test_weather.py -q` and `node --check web/weather-effect.js`; inspect `/belki` and `/admin` with rain/snow/mixed fixtures, mobile widths, reduced motion, and API failure. Prefer the remote test-zone MCP when exposed; otherwise use an isolated local server with temporary SQLite paths and stop it after validation. Keep screenshots outside the repo. - For CI-only changes, prefer a targeted YAML parse and a diff review. - For image/runtime changes, check the `Dockerfile`, Python entrypoint, static asset serving, and CI job together. diff --git a/MEMORY.md b/MEMORY.md index 00ca56d..0916865 100644 --- a/MEMORY.md +++ b/MEMORY.md @@ -130,3 +130,12 @@ Inspection results persist the base score for the number of inspections and each Calculator/admin share `web/weather-effect.js` and `.css`, served through `/api/weather/effect.*` so existing gateway routing works. `app/belki/weather.py` reads only the fixed public ULLI raw METAR endpoint: observed wind/gusts control speed/drift, RA/DZ and SN/SG select rain/snow/mixed particles, intensity controls density. Trends/remarks/vicinity do not change observed weather. The cache is process-local (5 min success, 1 min failure), timeout 3 s, payload cap 64 KiB; observations expire after 2 h. Failure restores leaves. Browser polling is every 5 min, hidden tabs pause, reduced motion keeps at most seven faint static particles. No dependencies or storage changes. Remote test-zone MCP was unavailable; local fixtures and browser checks were used. On this Mac, Python HTTPS required `SSL_CERT_FILE=/etc/ssl/cert.pem`; never bypass TLS verification. Production is unverified until a separately requested push/deployment. - 2026-10-18 20:19 MSK: operator's `98182c17` weather rollout verified live. Web/bot/gateway Ready, zero restarts; public `/api/weather/ulli` matched ULLI wind 3 m/s/CAVOK, CSS/JS matched local commit, calculator/admin rendered leaves with reduced motion respected and no console errors. This supersedes the earlier unverified-production status for the leaves/current-weather path; production rain/snow remain fixture-only evidence. + +## Frontend contracts and LongMemory identity — 2026-11-14 + +- The owner explicitly chose LongMemory `project_id="catwar"`; root `project-info.txt` is the canonical literal identity. Do not derive a different namespace from the repository name. Initial project context/recall had no matching knowledge. +- `/belki` section choices are real links with URL/history behavior; calculation modes are native radios. Keep browser keyboard semantics and `aria-current`/pressed states aligned with visible selection. File pickers in both application forms must remain visible and keyboard reachable. +- Editing a report or changing modes invalidates its prepared payload/output. Ignore calculation responses whose version is older than the current form state; guard concurrent preparation/application requests. These frontend guards are not server-side idempotency. +- Training points have scalar `result.kitten_points` (25); coaching points use an array. Both shapes must render, and hidden activity fields must stay disabled for browser validation. The points renderer uses text nodes instead of HTML interpolation. +- Regression coverage is `tests/browser/calculator.cjs` with external Playwright and an isolated loopback server; see AGENTS.md. 49 focused Python checks and desktop/mobile browser flows passed in the local fallback environment. Other browsers and real assistive technology remain unverified; no deployment was made. +- Chrome extension guidance was reviewed, but the legacy CatWar entries are userscripts and were not converted to Manifest V3. Existing licensing/attribution and asset URLs remain intact. diff --git a/project-info.txt b/project-info.txt new file mode 100644 index 0000000..9e6d627 --- /dev/null +++ b/project-info.txt @@ -0,0 +1 @@ +project_id="catwar" diff --git a/project_mind_map.md b/project_mind_map.md index 4d835c8..3a0774a 100644 --- a/project_mind_map.md +++ b/project_mind_map.md @@ -1,10 +1,13 @@ # Карта проекта «Беличья нора» -Актуально на 2026-10-18. Карта описывает добавленный функционал Белок; legacy userscript-файлы остаются отдельными статическими материалами и не входят в расчётный контур. +Актуально на 2026-11-14. Карта описывает добавленный функционал Белок; legacy userscript-файлы остаются отдельными статическими материалами и не входят в расчётный контур. ```mermaid mindmap root((cwshed-clone)) + Project context + project-info.txt + LongMemory catwar Belki Domain domain.py @@ -37,6 +40,8 @@ mindmap applications refresh WebSocket pool 8 web/calculator.html + Native section links and mode radios + Prepared-result version and invalidation Reports Goal calculator Applications @@ -47,6 +52,9 @@ mindmap Report entered checkbox Current calendar month by default web/applications.html + tests/browser/calculator.cjs + Isolated loopback API and fixtures + Desktop and mobile Chromium VK bot vk_bot.py Callback API listener :8081 diff --git a/structure_and_data.md b/structure_and_data.md index 3ca4530..d04c30d 100644 --- a/structure_and_data.md +++ b/structure_and_data.md @@ -1,5 +1,15 @@ # Structure and Data +## Calculator and related UI guidance pass — 2026-11-14 + +- `web/calculator.html` keeps the existing warm palette and typography. Section navigation now uses real links with `aria-current` and browser history; calculation mode uses a native radio group with built-in arrow-key behavior. File inputs, repeatable kitten fields, quick input and output have accessible labels/focus; dialogs retain native modal focus and Escape handling. No new runtime dependencies or polyfills were required. +- Prepared reports/results are invalidated by edits, helper actions and mode changes. An incrementing version discards stale async responses; calculation/application submit guards prevent concurrent duplicate requests in the current page. Clipboard denial selects the output and gives manual-copy instructions. This does not provide server-side idempotency for retries after an uncertain network failure. +- Fixed the existing training-points display: `/api/calculate` returns `kitten_points: 25` for training, while coaching uses an array. The UI now accepts both and renders score text with DOM nodes. Inactive points fields cannot block native form validation; “Без ресурсов” clears inspection resources. Application practice-link visibility/disabled state is recomputed when changing type and after reset. +- `web/applications.html` keeps the standalone form, exposes the native file picker to keyboard users, reports pressed selection/success, snapshots application data before uploads and guards submission. `web/admin.html` gives password/gallery accessible names, uses `aria-pressed` for ordinary selection buttons, adds solid focus outlines and preserves native dialog dismissal. Existing current-month defaults, sorting and history persistence are retained. +- `tests/browser/calculator.cjs` uses external Playwright against an isolated loopback server, checks 1280/390 px flows and closes browser resources. Python dependencies and SQLite fixtures were kept in `/tmp/cwshed-ui-review`; no remote test-zone or token-optimizer MCP was exposed. Validation used Python 3.14.9 and Chromium 157 on Linux (the production Python 3.12 image was not rebuilt): 49 focused Python tests (calculator web, API, applications, history, lookup and admin/export), Python compilation, JS syntax, browser interactions and screenshot inspection. The temporary server, environment and artifacts are removed after review. No push/deployment. +- `chrome-extensions` was checked for applicability: the retained CatWar files are userscripts (`@match` / `@grant`), not an MV3 extension; no Chrome extension manifest or `chrome.*` integration exists in the inspected entry points. No manifest conversion or third-party asset updates were warranted. This is not a comprehensive audit of the legacy bundled code or installed browser extensions. +- Root `project-info.txt` records the owner-selected LongMemory namespace `catwar`; it is a literal identifier, never executable configuration. Project context and targeted recall were empty at the start of this pass. + ## PHP CVE applicability review — 2026-10-21 - Static review of revision `765d4023605b2cf56c81e2027f5def606e45637f`: CVE-2026-109618 and CVE-2026-109619 are not actionable for the declared project stack because it has no PHP request runtime. Both concern PHP core; see the [PHP advisory](https://www.php.net/archive/2026.php). diff --git a/tests/browser/calculator.cjs b/tests/browser/calculator.cjs new file mode 100644 index 0000000..a26ed6a --- /dev/null +++ b/tests/browser/calculator.cjs @@ -0,0 +1,201 @@ +// Run against an isolated Belki server. See AGENTS.md for setup and cleanup. +const assert = require('node:assert/strict'); +const { chromium } = require('playwright'); + +const origin = process.env.BELKI_TEST_URL || 'http://127.0.0.1:8876'; +// This suite writes synthetic data. Refuse to run against a public/production host. +assert(['127.0.0.1', 'localhost', '[::1]'].includes(new URL(origin).hostname)); + +async function run() { + const browser = await chromium.launch({ + headless: true, + ...(process.env.CHROMIUM_PATH ? { executablePath: process.env.CHROMIUM_PATH } : {}), + }); + try { + for (const width of [1280, 390]) { + const context = await browser.newContext({ viewport: { width, height: 900 }, reducedMotion: 'reduce', locale: 'ru-RU' }); + try { + const errors = []; + const page = await context.newPage(); + page.on('pageerror', error => errors.push(error.message)); + page.on('console', message => { if (message.type() === 'error') errors.push(message.text()); }); + await page.route('**/api/weather/ulli', route => route.fulfill({ json: { available: false } })); + await page.goto(`${origin}/belki`); + assert.equal(await page.title(), 'Отчёты — Беличья нора'); + assert(await page.getByRole('heading', { level: 1 }).isVisible()); + assert.deepEqual(await page.locator('input, select, textarea').evaluateAll(fields => fields + .filter(field => field.getClientRects().length && !field.labels?.length && !field.getAttribute('aria-label') && !field.getAttribute('aria-labelledby')) + .map(field => field.id || field.name)), []); + + // Native radio keyboard behavior works without a custom focusgroup/polyfill. + await page.locator('[data-mode="coaching"]').focus(); + assert.equal(await page.locator('[data-mode="coaching"]').evaluate(node => getComputedStyle(node.closest('label')).outlineStyle), 'solid'); + await page.keyboard.press('ArrowRight'); + assert(await page.locator('[data-mode="training"]').isChecked()); + assert(await page.locator('#training').isVisible()); + await page.keyboard.press('ArrowLeft'); + assert(await page.locator('[data-mode="coaching"]').isChecked()); + await page.locator('#addKitten').click(); + assert(await page.locator('#extraKittens').getByLabel('Имя котёнка').isVisible()); + await page.locator('#extraKittens [data-remove]').click(); + assert(await page.locator('#addKitten').evaluate(node => node === document.activeElement)); + + // A real calculation is invalidated by edits, even before another submit. + for (const [name, value] of Object.entries({ escort_name: 'Тестовый куратор', escort_id: '101', kitten_name: 'Тестовый котёнок', kitten_id: '102' })) { + await page.locator(`#coaching [name="${name}"]`).fill(value); + } + await page.locator('#reportActions [type="submit"]').click(); + await page.locator('#result').waitFor({ state: 'visible' }); + assert(await page.locator('#sendReport').isEnabled()); + await page.evaluate(() => Object.defineProperty(navigator, 'clipboard', { + configurable: true, value: { writeText: async () => { throw new Error('Permission denied'); } }, + })); + await page.locator('#copy').click(); + assert.match(await page.locator('#reportStatus').textContent(), /Текст выделен/); + assert(await page.locator('#message').evaluate(node => node.selectionEnd === node.value.length)); + await page.locator('#coaching [name="kitten_name"]').fill('Другой котёнок'); + assert(await page.locator('#result').isHidden()); + assert(await page.locator('#sendReport').isDisabled()); + + // Reject a delayed response after switching modes; prevent duplicate submits. + let release; + const gate = new Promise(resolve => { release = resolve; }); + let requests = 0; + const delayed = async route => { requests += 1; await gate; await route.fulfill({ json: { message: 'Устаревший отчёт' } }); }; + await page.route('**/api/calculate', delayed); + const request = page.waitForRequest('**/api/calculate'); + await page.locator('#reportActions [type="submit"]').click(); + await request; + assert(await page.locator('#reportActions [type="submit"]').isDisabled()); + await page.locator('#form').evaluate(form => form.requestSubmit()); + await page.locator('[data-mode="points"]').check(); + release(); + await page.waitForFunction(() => !document.querySelector('#form').hasAttribute('aria-busy')); + assert.equal(requests, 1); + assert(await page.locator('#result').isHidden()); + assert(await page.locator('#sendReport').isDisabled()); + await page.unroute('**/api/calculate', delayed); + + // Inactive activity fields must not block browser constraint validation. + await page.locator('#pointsInspection [name="inspections"]').evaluate(node => { node.value = '-1'; }); + await page.locator('#pointsActivity').selectOption('training'); + await page.locator('#pointsActions [type="submit"]').click(); + await page.locator('#pointsResult').waitFor({ state: 'visible' }); + assert.match(await page.locator('#pointsSummary').textContent(), /25/); + await page.locator('[data-mode="inspection"]').check(); + assert(await page.locator('#pointsResult').isHidden()); + await page.locator('#inspection [name="resources"]').fill('+2 вьюнок'); + await page.locator('#noResourcesBtn').click(); + assert.equal(await page.locator('#inspection [name="resources"]').inputValue(), ''); + + // Native modal contains focus, Escape closes it and returns focus. + await page.locator('#inspection [name="character_name"]').fill('Несохранённый кот'); + await page.locator('#resolveIdentity').click(); + await page.getByRole('dialog', { name: 'Уточнить имя или ID кота' }).waitFor(); + assert(await page.locator('#identityMissingValue').evaluate(node => node === document.activeElement)); + await page.keyboard.press('Escape'); + assert(await page.locator('#identityDialog').isHidden()); + assert(await page.locator('#resolveIdentity').evaluate(node => node === document.activeElement)); + + // Native links keep URLs, browser Back, and context-menu/new-tab behavior. + assert.equal(await page.locator('#applicationsTab').getAttribute('href'), '/belki?section=applications'); + await page.locator('#applicationsTab').click(); + assert.equal(new URL(page.url()).searchParams.get('section'), 'applications'); + await page.goBack(); + assert(await page.locator('#reportsSection').isVisible()); + await page.goForward(); + assert(await page.locator('#applicationsSection').isVisible()); + + // Both application entry points expose file inputs and reset hidden fields. + for (const standalone of [false, true]) { + if (standalone) await page.goto(`${origin}/applications`); + const type = value => page.locator(standalone ? `[data-type="${value}"]` : `[data-application-type="${value}"]`); + const practiced = page.locator('[name="practiced_before"]'); + const practiceLink = page.locator('[name="practice_review_link"]'); + await type('flying_squirrel').click(); + assert(await practiceLink.isDisabled()); + await practiced.selectOption('yes'); + assert(await practiceLink.isVisible()); + await type('kitten').click(); + const applicationForm = page.locator(standalone ? '#form' : '#applicationForm'); + const file = applicationForm.locator('input[type="file"]:not(:disabled)'); + assert(await file.isVisible()); + await file.focus(); + assert(await file.evaluate(node => node === document.activeElement)); + assert.equal(await page.evaluate(() => document.documentElement.scrollWidth > innerWidth), false); + if (process.env.BELKI_SCREENSHOT_DIR) { + await page.screenshot({ path: `${process.env.BELKI_SCREENSHOT_DIR}/applications-${standalone ? 'standalone' : 'main'}-${width}.png`, fullPage: true }); + } + await type('flying_squirrel').click(); + await practiced.selectOption('no'); + assert(await practiceLink.isDisabled()); + assert(await practiceLink.isHidden()); + + // An in-flight submission cannot post a duplicate application. + await type('feather_donation').click(); + await applicationForm.locator('[name="name"]').fill('Тестовая белка'); + await applicationForm.locator('[name="character_id"]').fill('103'); + for (const [field, value] of Object.entries({ amount: '1', color: 'синее', source: 'тестовые запасы' })) { + await applicationForm.locator(`[data-field="${field}"], [data-application-field="${field}"]`).fill(value); + } + let finish; + const pending = new Promise(resolve => { finish = resolve; }); + let submissions = 0; + const submitApplication = async route => { submissions += 1; await pending; await route.fulfill({ json: { id: 55 } }); }; + await page.route('**/api/applications', submitApplication); + const submitted = page.waitForRequest('**/api/applications'); + await applicationForm.locator('[type="submit"]').click(); + await submitted; + assert(await applicationForm.locator('[type="submit"]').isDisabled()); + await applicationForm.evaluate(form => form.requestSubmit()); + finish(); + await page.locator(standalone ? '#success' : '#applicationSuccess').waitFor({ state: 'visible' }); + assert.equal(submissions, 1); + await page.unroute('**/api/applications', submitApplication); + } + + // Capture useful review artifacts only when explicitly requested outside Git. + await page.goto(`${origin}/belki`); + assert.equal(await page.evaluate(() => document.documentElement.scrollWidth > innerWidth), false); + if (process.env.BELKI_SCREENSHOT_DIR) { + await page.screenshot({ path: `${process.env.BELKI_SCREENSHOT_DIR}/calculator-${width}.png`, fullPage: true }); + } + await page.goto(`${origin}/admin`); + assert(await page.getByLabel('Пароль', { exact: true }).isVisible()); + + // Review screens use pressed buttons; native gallery Escape restores focus. + await page.route('**/api/admin/session', route => route.fulfill({ json: { authenticated: true } })); + const photo = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+j8WQAAAAASUVORK5CYII='; + await page.route('**/api/admin/calculations?*', route => route.fulfill({ json: { items: [ + { id: 1, created_at: '2026-11-14T10:00:00Z', message: 'Тестовый отчёт', input: { mode: 'training', attachments: [{ url: photo }] } }, + ] } })); + await page.route('**/api/admin/applications?*', route => route.fulfill({ json: { items: [] } })); + await page.routeWebSocket('**/api/admin/updates', () => {}); + await page.reload(); + await page.locator('#appView').waitFor({ state: 'visible' }); + assert.equal(await page.locator('#reportPeriod').inputValue(), 'current_month'); + assert.equal(await page.locator('#sort').inputValue(), 'date'); + assert.equal(await page.locator('#direction').inputValue(), 'desc'); + assert.equal(await page.evaluate(() => document.documentElement.scrollWidth > innerWidth), false); + await page.locator('[data-category="training"]').click(); + assert.equal(await page.locator('[data-category="training"]').getAttribute('aria-pressed'), 'true'); + const thumbnail = page.getByRole('button', { name: 'Открыть фото 1' }); + await thumbnail.click(); + await page.getByRole('dialog', { name: 'Скриншоты отчёта' }).waitFor(); + await page.keyboard.press('Escape'); + assert(await page.locator('#galleryDialog').isHidden()); + assert(await thumbnail.evaluate(node => node === document.activeElement)); + if (process.env.BELKI_SCREENSHOT_DIR) { + await page.screenshot({ path: `${process.env.BELKI_SCREENSHOT_DIR}/admin-${width}.png`, fullPage: true }); + } + assert.deepEqual(errors, []); + console.log(`PASS ${width}px: labels, keyboard, calculations, races, clipboard, dialogs, links, applications, admin filters`); + } finally { + await context.close(); + } + } + } finally { + await browser.close(); + } +} +run().catch(error => { console.error(error); process.exitCode = 1; }); diff --git a/web/admin.html b/web/admin.html index 04bff7a..9d52c16 100644 --- a/web/admin.html +++ b/web/admin.html @@ -21,11 +21,14 @@ .tabs { display: flex; flex-wrap: wrap; gap: 8px; padding: 22px 0 4px; border-bottom: 1px solid var(--line); } .tab { min-height: 36px; padding: 7px 13px; border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--muted); font-size: .84rem; } .tab:hover { border-color: #cfc8bf; background: #fffaf3; color: var(--ink); } - .tab[aria-selected="true"] { border-color: var(--ink); background: var(--ink); color: #fffdfa; } + .tab[aria-pressed="true"] { text-decoration:underline; text-underline-offset:4px; border-color: var(--ink); background: var(--ink); color: #fffdfa; } .auth-view { width: min(480px, 100%); margin: 14vh auto 0; padding: 34px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); box-shadow: 0 12px 35px #3b302414; } .auth-view p { margin: 0 0 24px; color: var(--muted); line-height: 1.55; } .auth-form { display: flex; gap: 10px; } - .auth-form input { flex: 1; min-width: 0; } + .auth-form input { width:100%; min-width:0; } + .password-field { display:grid; gap:6px; flex:1; min-width:0; } + .auth-form { align-items:end; } + .auth-view h1 { font-size:2rem; margin-bottom:8px; } .controls { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; padding: 20px 0; } .control-group { display: grid; gap: 6px; color: var(--muted); font-size: .72rem; font-weight: 750; letter-spacing: .055em; text-transform: uppercase; } .control-group input, .control-group select { align-self: start; } @@ -52,7 +55,7 @@ input { min-width: 245px; } input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #b86f3b22; } button { border: 1px solid var(--ink); padding: 9px 16px; background: var(--ink); color: #fffdfa; cursor: pointer; font-weight: 650; transition: background-color 160ms ease-out, border-color 160ms ease-out, color 160ms ease-out; } - button:focus-visible, a:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; } + input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; } button:hover { background: #45413d; } .export-link { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; padding: 9px 16px; border: 1px solid var(--accent); border-radius: 7px; color: var(--accent); font-weight: 650; text-decoration: none; } .export-link:hover { background: #fff4ea; } @@ -90,15 +93,17 @@ .admin-section { padding-top: 28px; } .applications { padding-top: 4px; } .application-layout { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(380px, 1.2fr); border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--paper); } - .application-list { border-right: 1px solid var(--line); }.application-item { display: block; width: 100%; min-height: 76px; padding: 15px 16px; border: 0; border-bottom: 1px solid #ebe7e0; border-radius: 0; background: transparent; color: var(--ink); text-align: left; }.application-item:last-child { border-bottom: 0; }.application-item[aria-selected="true"] { background: #f0f7ee; }.application-item strong,.application-item span { display:block; }.application-item span { margin-top:4px; color:var(--muted); font-size:.82rem; }.application-detail { min-height: 360px; padding: 25px; }.application-detail dl { display:grid; grid-template-columns: 150px 1fr; gap:12px 16px; margin:22px 0; }.application-detail dt { color:var(--muted); font-size:.8rem; font-weight:750; text-transform:uppercase; letter-spacing:.05em; }.application-detail dd { margin:0; white-space:pre-wrap; }.application-detail .photos { max-width:none; margin:0 0 18px; }.application-detail .photos button { width:120px; height:90px; }.application-actions { display:flex; flex-wrap:wrap; gap:10px; margin-top:18px; }.accept { border-color:#247036; background:#247036; }.accept:hover { background:#185627; }.reject { border-color:#a23d35; background:transparent; color:#8e3630; }.reject:hover { background:#fff1ef; } + .application-list { border-right: 1px solid var(--line); }.application-item { display: block; width: 100%; min-height: 76px; padding: 15px 16px; border: 0; border-bottom: 1px solid #ebe7e0; border-radius: 0; background: transparent; color: var(--ink); text-align: left; }.application-item:last-child { border-bottom: 0; }.application-item[aria-pressed="true"] { text-decoration:underline; text-underline-offset:4px; background: #f0f7ee; }.application-item strong,.application-item span { display:block; }.application-item span { margin-top:4px; color:var(--muted); font-size:.82rem; }.application-detail { min-height: 360px; padding: 25px; }.application-detail dl { display:grid; grid-template-columns: 150px 1fr; gap:12px 16px; margin:22px 0; }.application-detail dt { color:var(--muted); font-size:.8rem; font-weight:750; text-transform:uppercase; letter-spacing:.05em; }.application-detail dd { margin:0; white-space:pre-wrap; }.application-detail .photos { max-width:none; margin:0 0 18px; }.application-detail .photos button { width:120px; height:90px; }.application-actions { display:flex; flex-wrap:wrap; gap:10px; margin-top:18px; }.accept { border-color:#247036; background:#247036; }.accept:hover { background:#185627; }.reject { border-color:#a23d35; background:transparent; color:#8e3630; }.reject:hover { background:#fff1ef; } dialog { width: min(900px, calc(100% - 32px)); padding: 0; border: 1px solid #5a524b; border-radius: 10px; background: #24211f; color: #fffdfa; box-shadow: 0 24px 80px #211b18aa; } - dialog::backdrop { background: #211b1877; } + dialog:modal { overscroll-behavior:contain; } + dialog::backdrop { background: #211b1877; overflow:hidden; overscroll-behavior:contain; } .gallery { display: grid; grid-template-columns: 52px 1fr 52px; align-items: center; gap: 12px; padding: 16px; } .gallery img { display: block; width: 100%; max-height: 72vh; object-fit: contain; } .gallery button { width: 44px; min-height: 44px; padding: 0; border-color: #665d56; background: #3a3430; font-size: 1.25rem; } .gallery button:hover { background: #514840; } .gallery-footer { display: flex; justify-content: space-between; align-items: center; padding: 0 18px 16px; color: #c8bfb8; font-size: .85rem; } .gallery-footer button { min-height: 34px; padding: 5px 10px; } + @media (pointer: coarse) { .tab, .delete, .gallery-footer button, .weekday-options label { min-height:48px; } } @media (max-width: 720px) { main { width: calc(100% - 28px); padding-top: 28px; } .topbar { display: block; } .record-count { display: block; margin-top: 18px; } .controls { display: grid; grid-template-columns: 1fr 1fr; } .control-group:first-child, .controls > button, .controls > .export-link { grid-column: 1 / -1; } input { min-width: 0; width: 100%; } .auth-form { display: grid; } .application-layout { grid-template-columns:1fr; }.application-list { border-right:0; border-bottom:1px solid var(--line); }.application-detail dl { grid-template-columns:1fr; gap:4px; }.application-detail dd { margin-bottom:14px; } .weekday-field { grid-column: 1 / -1; min-width: 0; } .weekday-options { gap: 4px; } } @@ -108,10 +113,10 @@
-

Админская панель

+

Админская панель

Введите пароль администратора, чтобы открыть историю отчётов.

- +
@@ -121,21 +126,21 @@

Админская панель

Расчёты и заявки из бота VK и с сайта.

-

История отчётов

Подтверждённые расчёты из VK-бота и веб-калькулятора.

+

История отчётов

Подтверждённые расчёты из VK-бота и веб-калькулятора.

Записи не загружены
@@ -151,7 +156,7 @@
ВнесеноКотКотятаФотоДата (UTC+3)БаллыСообщениеАвторID
Загрузка истории…
- +
- + - + diff --git a/web/calculator.html b/web/calculator.html index ee28964..9c1c113 100644 --- a/web/calculator.html +++ b/web/calculator.html @@ -14,15 +14,25 @@ h2 { font: 500 1.55rem/1.15 Georgia, "Times New Roman", serif; } .muted { color: var(--muted); line-height: 1.55; } .tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 24px 0 16px; } .section-tabs { margin-top: 32px; border-bottom: 1px solid var(--line); padding-bottom: 16px; } - .section-tabs button { border-color: transparent; background: transparent; } + .section-tabs a { display: inline-flex; align-items: center; min-height: 44px; border: 1px solid transparent; border-radius: 7px; padding: 9px 14px; color: var(--ink); text-decoration: none; } + .section-tabs a:hover { background: var(--paper); } + .section-tabs a[aria-current="page"] { border-color: var(--ink); text-decoration: underline; text-underline-offset: 5px; } + .mode-options { padding: 0; border: 0; min-width: 0; } + .mode-options legend { font-weight: 700; } + .mode-option { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); cursor: pointer; font-weight: 400; } + .mode-option:has(:checked) { border-color: var(--ink); background: var(--ink); color: var(--paper); } + .mode-option input { width: 18px; min-height: 18px; margin: 0; accent-color: var(--accent); } + .mode-option:focus-within { outline: 3px solid var(--focus); outline-offset: 3px; } button, select, input, textarea { font: inherit; } button { min-height:44px; cursor: pointer; touch-action:manipulation; border: 1px solid #bdb6ad; border-radius: 7px; padding: 9px 14px; background: var(--paper); color: var(--ink); transition: background-color 160ms ease-out, border-color 160ms ease-out, color 160ms ease-out; } - button:hover { border-color:var(--accent); background:#fff6e5; } button:focus-visible, a:focus-visible { outline:3px solid var(--focus); outline-offset:3px; } + button:hover { border-color:var(--accent); background:#fff6e5; } button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline:3px solid var(--focus); outline-offset:3px; } + button:disabled { opacity: .55; cursor: not-allowed; } + input:user-invalid, textarea:user-invalid { border-color: var(--error); } button.active, button.primary { background: var(--ink); color: #fffdfa; border-color: var(--ink); } button.active:hover, button.primary:hover { background:#45413d; } .panel { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 28px; box-shadow:0 10px 28px #3b30220d; } .grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; } label { display: grid; gap: 6px; color: #403b36; font-weight:700; } - input, select, textarea { min-height:44px; width: 100%; border: 1px solid #c8bca9; border-radius: 7px; padding: 9px 12px; background: #fffefa; color: var(--ink); } input:focus,select:focus,textarea:focus { outline:3px solid #b5682433; border-color:var(--accent); } + input, select, textarea { min-height:44px; width: 100%; border: 1px solid #c8bca9; border-radius: 7px; padding: 9px 12px; background: #fffefa; color: var(--ink); } input:focus,select:focus,textarea:focus { border-color:var(--accent); } textarea { min-height: 210px; resize: vertical; } .wide { grid-column: 1 / -1; } .actions { display: flex; gap: 10px; margin-top: 18px; } @@ -38,7 +48,8 @@ .status-help { margin: -4px 0 0; font-size: .85rem; } @media (max-width: 700px) { .extra-kitten, .time-range { grid-template-columns: 1fr; } } dialog { max-width: min(520px, calc(100% - 32px)); background: var(--paper); color: var(--ink); border: 1px solid #5a524b; border-radius: 10px; padding: 24px; box-shadow:0 24px 80px #211b1855; } - dialog::backdrop { background: #211b1866; } + dialog:modal { overscroll-behavior: contain; } + dialog::backdrop { background: #211b1866; overflow: hidden; overscroll-behavior: contain; } .result { margin-top: 20px; } .hidden { display: none; } .error { color: var(--error); font-weight:700; white-space: pre-wrap; } @@ -47,9 +58,11 @@ .application-intro { max-width: 68ch; margin: 0 0 24px; } .application-types { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 20px 0; } .application-type { min-height: 68px; text-align: left; font-weight: 700; } - .application-type[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: #fff8ef; } + .application-type[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: #fff8ef; text-decoration: underline; text-underline-offset: 4px; } .upload { display: grid; justify-items: center; gap: 8px; min-height: 132px; padding: 20px; text-align: center; border: 1px dashed #b9afa4; border-radius: 7px; background: #fffaf4; color: var(--muted); cursor: pointer; } - .upload strong { color: var(--ink); } .upload input { display: none; } + .upload strong { color: var(--ink); } + .upload input { max-width: 100%; font-size: 1rem; } + .upload:focus-within { outline: 3px solid var(--focus); outline-offset: 3px; } .files { margin: 10px 0 0; padding-left: 18px; color: var(--muted); } .feather { display: grid; grid-template-columns: 110px 1fr 1.3fr auto; gap: 9px; align-items: end; margin-bottom: 9px; } .remove { color: var(--error); border-color: #d9aaa5; } @@ -70,7 +83,7 @@ .panel { padding: 16px; } .section-tabs { margin-top: 24px; padding-bottom: 12px; } .tabs { gap: 6px; margin: 18px 0 14px; } - .tabs button { flex: 1 1 144px; } + .section-tabs a, .mode-option { flex: 1 1 144px; } .grid, .application-types, .feather { grid-template-columns: 1fr; } .wide { grid-column: auto; } .actions { flex-direction: column; } @@ -94,32 +107,32 @@

Генератор отчётов и калькулятор

Здесь можно подготовить отчёт, посчитать баллы и подать заявку.

-