Add new QR card layout documentation and updates

- Introduced new QR card layout as of October 9, 2026.
- Updated `PassengerQr.tsx` and QR styles, including camera/phone icons.
- Confirmed successful TypeScript and Vite builds; tests for QR decoding passed.
- Detailed specifications for various display resolutions and configurations.
- Included animations and accessibility considerations for reduced motion preferences.
- Added example images for visual reference.
This commit is contained in:
2026-10-09 03:21:59 +03:00
parent bc95d0c122
commit 1e3a911055
9 changed files with 107 additions and 19 deletions

View File

@@ -44,7 +44,7 @@ npm start
При сбое появляется пометка сохранённых данных. Истёкшие рейсы удаляются. Если сохранённые рейсы закончились, табло честно сообщает об этом и продолжает переподключение. Предупреждения фильтруются по городу, маршрутам, срокам действия; сохраняются полный текст и детали отмены. Полный кеш расписания не подтверждает актуальность предупреждений — без свежего ответа API это явно указано.
QR-код создаётся локально, без стороннего сервиса генерации, и открывает `https://pwa.ridebus.by/?city=1&stop=1` для текущей остановки (параметры меняются вместе с площадкой). Адрес PWA можно переопределить серверной переменной `BOARD_PWA_URL`. QR использует скруглённые чёрные модули, белый фон и свободное поле шириной 4 модуля; рамка и внешняя подсветка следуют акценту темы. Декодирование нескольких ссылок проверено автоматически.
QR-код создаётся локально, без стороннего сервиса генерации, и открывает `https://pwa.ridebus.by/?city=1&stop=1` для текущей остановки (параметры меняются вместе с площадкой). Адрес PWA можно переопределить серверной переменной `BOARD_PWA_URL`. Карточка оформлена как приглашение забрать расписание: большой неподвижный QR на акцентной панели с плавно движущейся линией маршрута, название остановки, шаги открытия и заметная ссылка. В узкой и короткой карточке используется упрощённая компоновка, размер кода рассчитывается по свободному месту. Декоративное движение выключено при `prefers-reduced-motion`. QR использует скруглённые чёрные модули, белый фон и свободное поле шириной 4 модуля; рамка и внешняя подсветка следуют акценту темы. Декодирование нескольких ссылок и QR на снимках страницы проверено автоматически.
Погода запрашивается независимо через `/api/weather` у [Open-Meteo](https://open-meteo.com/en/docs) по публичным координатам остановки из API. В шапке — температура и состояние; на информационном экране — ощущаемая температура, ветер в м/с и три следующих часа. Процент осадков — максимальная почасовая вероятность в этих трёх часах. Это модельные погодные данные. Обновление раз в 10 минут; сохранённая погода помечается и показывается не дольше часа, затем скрывается. При отсутствии координат или сбое погоды транспорт продолжает работать. Данные сохраняются по городу и остановке; RideBus-ключ не передаётся поставщику погоды. Указаны источник и CC BY 4.0.

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
artifacts/board-qr-wide.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

View File

@@ -0,0 +1,14 @@
# Новая QR-карточка — 9 октября 2026
Изменены `PassengerQr.tsx`, иконки камеры/телефона VK и стили QR. Данные остановки, генератор QR и публичная ссылка сохранены.
- `npm run build`: TypeScript и Vite проходят. `node --test test/qr.test.mjs`: декодирование трёх ссылок и свободное поле 4 модуля проходят.
- 1000×900, отдельная карточка: QR-панель и информация заполняют доступную высоту. Рамка QR 380×380 px, карточка 520 px по высоте. В обеих темах `scrollHeight = clientHeight`, горизонтального переполнения нет.
- 1280×900, три карточки: QR-панель расположена над остановкой, шагами и ссылкой. Высота карточки 497 px, QR 182×182 px, внутреннего переполнения нет.
- 855×723: широкий QR 260×260 px, высота карточки 375 px, все элементы видны без прокрутки.
- 879×593: QR 200×200 px, карточка 314 px; краткие шаги помещаются рядом с кодом.
- 390×667: код сверху, подсказка и ссылка в одной строке снизу. QR 167×167 px, карточка 320 px, внутреннего и горизонтального переполнения нет. Код увеличен относительно варианта с боковым текстом.
- Фоновая линия имеет анимацию `qr-route-flow`; сам QR не движется. При `prefers-reduced-motion` декоративная анимация явно отключена в CSS.
- Дополнительно `jsQR` декодировал код с настоящего снимка светлой страницы 1000×900, тёмного снимка 390×667 и компоновки 1280×900. Во всех случаях результат — `https://pwa.ridebus.by/?city=1&stop=1`. Это проверка пикселей страницы, а не испытание физической камеры или уличного дисплея.
Снимки: `board-qr-wide.jpg`, `board-qr-light.jpg`, `board-qr-three-cards.jpg`, `board-qr-ticket-portrait.jpg`.

View File

@@ -5,6 +5,7 @@ import {
Icon20Play, Icon20FullscreenOutline, Icon20InfoCircleOutline,
Icon20HelpOutline, Icon20CheckShieldOutline, Icon20ArrowUturnLeftOutline,
Icon20SunOutline, Icon20MoonOutline, Icon20CloudOutline, Icon16CloudRain, Icon16Snowflake, Icon16CloudLighting, Icon20WindOutline,
Icon28CameraOutline, Icon28SmartphoneOutline,
} from '@vkontakte/icons';
import type { ComponentType } from 'react';
@@ -38,3 +39,5 @@ export const Rain = adapt(Icon16CloudRain);
export const Snow = adapt(Icon16Snowflake);
export const Storm = adapt(Icon16CloudLighting);
export const Wind = adapt(Icon20WindOutline);
export const Camera = adapt(Icon28CameraOutline);
export const Smartphone = adapt(Icon28SmartphoneOutline);

View File

@@ -1,13 +1,21 @@
import { useMemo } from 'react';
import { ArrowUpRight } from './Icons';
import { ArrowUpRight, Camera, Smartphone } from './Icons';
import type { Config, Stop } from './types';
import { createPassengerQr, passengerLink } from './lib/passenger.mjs';
export function PassengerQr({ config, stop }: { config: Config; stop: Stop | undefined }) {
const url = passengerLink(config.passengerBaseUrl, config.cityId, stop?.id || config.defaultStopId);
const qr = useMemo(() => createPassengerQr(url), [url]);
return <><h3>Расписание в телефоне</h3><div className="qr-content"><a className="qr-paper" href={url} target="_blank" rel="noreferrer" aria-label={`Открыть ${stop?.name || config.stopName} в RideBus`}>
const stopName = stop?.name || config.stopName;
return <><h3>Расписание в телефоне</h3><div className="qr-content"><div className="qr-stage">
<div className="qr-route-backdrop" aria-hidden="true"><svg className="qr-route-art" viewBox="0 0 500 500"><path d="M-50 400H75Q130 400 130 340V140Q130 80 190 80H310Q370 80 370 140V340Q370 400 430 400H550" /><circle cx="130" cy="230" r="12" /><circle cx="370" cy="230" r="12" /></svg></div>
<a className="qr-paper" href={url} target="_blank" rel="noreferrer" aria-label={`Открыть ${stopName} в RideBus`}>
<svg className="passenger-qr" viewBox={`0 0 ${qr.size} ${qr.size}`} role="img" aria-label="QR-код расписания этой остановки">
<rect width={qr.size} height={qr.size} fill="#ffffff" />{qr.rectangles.map((rectangle, index) => <rect key={index} {...rectangle} />)}
</svg></a><div className="qr-description"><p>Наведите камеру на QR-код</p><a className="passenger-link" href={url} target="_blank" rel="noreferrer">{new URL(url).host}<ArrowUpRight size={20} /></a></div></div></>;
</svg></a><span className="qr-stage-corner" aria-hidden="true"><ArrowUpRight size={30} /></span></div>
<div className="qr-description"><div className="qr-intro"><span className="qr-eyebrow">С ВАМИ ПО ПУТИ</span><h4 className="qr-stop">{stopName}</h4><p className="qr-summary">Заберите расписание этой остановки с собой.</p></div>
<ol className="qr-steps"><li><span className="qr-step-icon"><Camera size={32} /></span><div><span className="qr-step-number">01</span><strong>Наведите камеру</strong><span className="qr-step-detail">на QR-код слева</span></div></li>
<li><span className="qr-step-icon"><Smartphone size={32} /></span><div><span className="qr-step-number">02</span><strong>Откройте RideBus</strong><span className="qr-step-detail">в браузере телефона</span></div></li></ol>
<a className="passenger-link" href={url} target="_blank" rel="noreferrer"><span>{new URL(url).host}</span><ArrowUpRight size={24} /></a>
</div></div></>;
}

View File

@@ -136,14 +136,83 @@ h1 { font-size: clamp(30px, 3.8vw, 76px); letter-spacing: -.05em; line-height: 1
.weather-attribution { margin-top: auto; padding-top: 16px; display: flex; flex-wrap: wrap; gap: 5px 12px; font-size: clamp(12px, .8vw, 17px); color: var(--muted); }
.weather-attribution a { color: inherit; text-underline-offset: 3px; }
.weather-now-label, .weather-hour-rain { display: none; }
.qr-info { align-items: center; text-align: center; }
.qr-info h3 { width: 100%; }
.qr-content { flex: 1 1 0; min-height: 0; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; }
.qr-paper { display: block; flex-shrink: 0; padding: 8px; border: 1px solid var(--outline); border-radius: 24px; background: #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.passenger-qr { width: clamp(108px, calc(100cqh - 175px), 248px); max-width: 100%; aspect-ratio: 1; }
.qr-description { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.qr-description p { font-size: clamp(16px, 1.25vw, 24px); line-height: 1.3; margin: 0; }
.passenger-link { display: flex; align-items: center; gap: 9px; color: var(--accent); text-decoration: none; font-size: clamp(17px, 1.4vw, 27px); }
.qr-info { text-align: left; container-name: qr-card; }
.qr-content { flex: 1 1 0; min-height: 0; width: 100%; display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: clamp(16px, 2cqw, 36px); }
.qr-stage { position: relative; isolation: isolate; min-width: 0; min-height: 0; display: grid; place-items: center; padding: clamp(16px, 2cqw, 32px); border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line)); border-radius: 24px; background: color-mix(in srgb, var(--accent) 8%, var(--background)); overflow: hidden; container-type: size; }
.qr-route-backdrop { position: absolute; inset: 0; overflow: hidden; z-index: -1; }
.qr-route-art { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; color: var(--accent); opacity: .22; transform: rotate(-12deg) scale(1.3); }
.qr-route-art path { fill: none; stroke: currentColor; stroke-width: 3; stroke-dasharray: 3 12; stroke-linecap: round; animation: qr-route-flow 12s linear infinite; }
.qr-route-art circle { fill: var(--background); stroke: currentColor; stroke-width: 3; }
.qr-stage-corner { position: absolute; right: 14px; top: 14px; color: var(--accent); }
.qr-paper { display: block; position: relative; z-index: 1; width: min(100cqw, 100cqh, 440px); aspect-ratio: 1; flex-shrink: 0; padding: 8px; border: 1px solid var(--outline); border-radius: 24px; background: #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.passenger-qr { width: 100%; height: 100%; aspect-ratio: 1; }
.qr-description { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; justify-content: space-between; gap: 16px; padding: clamp(8px, 1cqw, 18px) 0; }
.qr-eyebrow { display: block; color: var(--accent); font-size: clamp(12px, 1.4cqw, 20px); letter-spacing: .12em; margin-bottom: 12px; }
.qr-stop { margin: 0; font-size: clamp(26px, 4.3cqw, 70px); line-height: 1.08; letter-spacing: -.04em; font-weight: 600; overflow-wrap: anywhere; }
.qr-info .qr-summary { font-size: clamp(18px, 2.2cqw, 32px); line-height: 1.3; margin: 14px 0 0; }
.qr-steps { margin: 0; padding: 0; display: grid; gap: clamp(12px, 1.5cqw, 22px); list-style: none; }
.qr-steps li { display: flex; align-items: center; gap: 14px; }
.qr-step-icon { display: grid; place-items: center; width: clamp(42px, 5cqw, 68px); height: clamp(42px, 5cqw, 68px); color: var(--accent); border: 1px solid var(--line); border-radius: 16px; background: color-mix(in srgb, var(--accent) 5%, var(--background)); flex-shrink: 0; }
.qr-steps li > div { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 5px 9px; }
.qr-step-number { font-size: clamp(12px, 1.4cqw, 20px); color: var(--accent); align-self: center; }
.qr-steps strong { font-size: clamp(17px, 2cqw, 29px); font-weight: 550; line-height: 1.15; }
.qr-step-detail { grid-column: 2; color: var(--muted); font-size: clamp(13px, 1.5cqw, 21px); }
.passenger-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--accent); text-decoration: none; font-size: clamp(18px, 2.1cqw, 30px); font-weight: 550; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); background: color-mix(in srgb, var(--accent) 8%, var(--background)); border-radius: 16px; padding: 14px 18px; }
.passenger-link span { min-width: 0; overflow-wrap: anywhere; }
@keyframes qr-route-flow { to { stroke-dashoffset: -150; } }
@container qr-card (max-width: 600px) {
.qr-content { display: flex; flex-direction: column; gap: 12px; }
.qr-stage { flex: 1 1 0; min-height: 0; padding: 12px; border-radius: 20px; }
.qr-stage-corner { display: none; }
.qr-paper { max-width: 100%; border-radius: 20px; padding: 6px; }
.qr-description { padding: 0; gap: 12px; flex-shrink: 0; }
.qr-eyebrow { font-size: 11px; margin-bottom: 6px; }
.qr-stop { font-size: clamp(22px, 6cqw, 30px); }
.qr-info .qr-summary, .qr-step-detail { display: none; }
.qr-steps { gap: 8px; }
.qr-steps li { gap: 9px; }
.qr-step-icon { width: 30px; height: 30px; border: 0; border-radius: 9px; }
.qr-step-icon svg { width: 24px; height: 24px; }
.qr-steps strong { font-size: 15px; }
.qr-step-number { font-size: 11px; }
.passenger-link { font-size: 18px; padding: 10px 12px; border-radius: 12px; }
}
@container qr-card (min-width: 601px) and (max-height: 420px) {
.qr-description { gap: 12px; padding: 0; }
.qr-eyebrow, .qr-step-detail { display: none; }
.qr-stop { font-size: clamp(26px, 3.5cqw, 40px); }
.qr-info .qr-summary { font-size: 18px; margin-top: 10px; }
.qr-steps { gap: 10px; }
.qr-step-icon { width: 42px; height: 42px; }
.qr-steps strong { font-size: 20px; }
.passenger-link { font-size: 22px; padding: 10px 14px; }
}
@container qr-card (min-width: 601px) and (max-height: 320px) {
.qr-description { gap: 10px; padding: 0; }
.qr-eyebrow, .qr-info .qr-summary, .qr-step-detail { display: none; }
.qr-stop { font-size: clamp(26px, 3.5cqw, 40px); }
.qr-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.qr-steps li { gap: 8px; }
.qr-step-icon { width: 36px; height: 36px; border: 0; }
.qr-step-icon svg { width: 28px; height: 28px; }
.qr-steps li > div { display: flex; flex-direction: column; gap: 3px; }
.qr-steps strong { font-size: 17px; }
.qr-step-number { align-self: flex-start; font-size: 12px; }
.passenger-link { font-size: 22px; padding: 10px 14px; }
}
@container qr-card (max-width: 600px) and (max-height: 380px) {
.qr-content { display: flex; flex-direction: column; }
.qr-stage { padding: 10px; }
.qr-paper { padding: 5px; border-radius: 16px; }
.qr-intro, .qr-steps li:nth-child(2) { display: none; }
.qr-description { flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; }
.qr-step-number { display: none; }
.qr-steps li > div { display: block; }
.qr-step-icon { display: none; }
.qr-steps strong { font-size: 14px; }
.passenger-link { font-size: 14px; padding: 8px; gap: 4px; }
.passenger-link svg { width: 18px; height: 18px; }
}
.info-screen[data-compact='true'] .info-grid { grid-template-columns: minmax(0, 1fr); }
.info-screen[data-compact='true'] .information-tabs { display: flex; }
.info-screen[data-compact='true'] .info-card:not([data-active='true']) { display: none; }
@@ -280,10 +349,6 @@ h1 { font-size: clamp(30px, 3.8vw, 76px); letter-spacing: -.05em; line-height: 1
.info-screen[data-compact='true'] .weather-hours strong { font-size: clamp(26px, 3.5cqw, 48px); }
.info-screen[data-compact='true'] .weather-hour-rain { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px 4px; font-size: clamp(12px, 1.5cqw, 20px); color: var(--secondary); }
.info-screen[data-compact='true'] .precipitation-chance { text-align: center; font-size: 17px; }
.info-screen[data-compact='true'] .qr-content { flex-direction: row; gap: 40px; }
.info-screen[data-compact='true'] .passenger-qr { width: clamp(110px, calc(100cqh - 85px), 230px); }
.info-screen[data-compact='true'] .qr-description { align-items: flex-start; text-align: left; }
.info-screen[data-compact='true'] .qr-description p { font-size: clamp(22px, 2.5vw, 32px); }
}
@media (max-width: 1100px) {
.brand-word { display: none; }
@@ -433,9 +498,6 @@ h1 { font-size: clamp(30px, 3.8vw, 76px); letter-spacing: -.05em; line-height: 1
.precipitation-chance { margin-top: 8px; }
.weather-attribution { padding-top: 8px; font-size: 10px; }
.weather-info { padding: 16px; }
.passenger-qr { width: clamp(108px, calc(100cqh - 130px), 190px); }
.qr-content { gap: 14px; }
.qr-description { gap: 9px; }
}
::view-transition { pointer-events: none; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 320ms; }
@@ -446,6 +508,7 @@ h1 { font-size: clamp(30px, 3.8vw, 76px); letter-spacing: -.05em; line-height: 1
.destination-old { visibility: hidden; }
.destination-current { transform: none !important; }
.route-track { animation: none !important; }
.qr-route-art path { animation: none !important; }
.route-lane { transform: none; overflow: auto; }
.route-group:nth-child(2) { display: none; }
}