Compare commits

...

7 Commits

Author SHA1 Message Date
13dd8fa426 Merge pull request 'fix: remove fallback image from dashboard race hero' (#35) from fix/dashboard-hero-background-layering into main
Some checks failed
CI / build-and-test (push) Has been cancelled
Reviewed-on: #35
2026-04-27 21:40:55 +00:00
Vaka.pro
f62be600cd fix: remove fallback image from dashboard race hero
Some checks failed
CI / build-and-test (pull_request) Has been cancelled
2026-04-28 00:40:01 +03:00
0f5249726b Merge pull request 'fix: use next race image as dashboard hero background' (#34) from fix/dashboard-hero-race-background into main
Some checks failed
CI / build-and-test (push) Has been cancelled
Reviewed-on: #34
fix: use next race image as dashboard hero background
Set the dashboard hero background from the nearest upcoming race visual, using the existing race visual fallback chain. Add a BEM modifier for the image-backed hero state and bump the frontend patch version.
2026-04-27 20:31:25 +00:00
Vaka.pro
fdb0ba3d2d fix: use next race image as dashboard hero background
Some checks failed
CI / build-and-test (pull_request) Has been cancelled
2026-04-27 23:30:36 +03:00
367868cf1b Merge pull request 'fix: tolerate missing race cover image field' (#33) from fix/race-cover-api-backcompat into main
Some checks failed
CI / build-and-test (push) Has been cancelled
Reviewed-on: #33
2026-04-27 20:08:11 +00:00
Vaka.pro
78d0ab5ece fix: tolerate missing race cover image field
Some checks failed
CI / build-and-test (pull_request) Has been cancelled
2026-04-27 23:07:31 +03:00
e2eb71522d Merge pull request 'feat: add race cover image extraction' (#32) from feature/race-cover-images into main
Some checks failed
CI / build-and-test (push) Has been cancelled
Reviewed-on: #32
2026-04-27 20:02:08 +00:00
6 changed files with 35 additions and 7 deletions

View File

@@ -66,7 +66,7 @@ export function rowToDto(row: RaceRow): RaceDto {
distanceKm: parseFloat(row.distance_km), distanceKm: parseFloat(row.distance_km),
status: row.status, status: row.status,
officialUrl: row.official_url, officialUrl: row.official_url,
coverImageUrl: row.cover_image_url, coverImageUrl: row.cover_image_url ?? null,
startTime: row.start_time, startTime: row.start_time,
clusterSchedule: row.cluster_schedule, clusterSchedule: row.cluster_schedule,
bibPickup: row.bib_pickup, bibPickup: row.bib_pickup,

View File

@@ -1,12 +1,12 @@
{ {
"name": "calendar-run-frontend", "name": "calendar-run-frontend",
"version": "0.6.0", "version": "0.6.1",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "calendar-run-frontend", "name": "calendar-run-frontend",
"version": "0.6.0", "version": "0.6.1",
"dependencies": { "dependencies": {
"react": "^18.3.1", "react": "^18.3.1",
"react-dom": "^18.3.1", "react-dom": "^18.3.1",

View File

@@ -1,7 +1,7 @@
{ {
"name": "calendar-run-frontend", "name": "calendar-run-frontend",
"private": true, "private": true,
"version": "0.6.0", "version": "0.6.1",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@@ -10,6 +10,10 @@ function isNullableString(value: unknown): value is string | null {
return value === null || typeof value === "string"; return value === null || typeof value === "string";
} }
function isOptionalNullableString(value: unknown): value is string | null | undefined {
return value === undefined || isNullableString(value);
}
function normalizeRace(input: unknown): Race { function normalizeRace(input: unknown): Race {
const race = input as Partial<Race>; const race = input as Partial<Race>;
@@ -23,7 +27,7 @@ function normalizeRace(input: unknown): Race {
race?.status === "registered" || race?.status === "registered" ||
race?.status === "completed") && race?.status === "completed") &&
isNullableString(race?.officialUrl) && isNullableString(race?.officialUrl) &&
isNullableString(race?.coverImageUrl) && isOptionalNullableString(race?.coverImageUrl) &&
isNullableString(race?.startTime) && isNullableString(race?.startTime) &&
isNullableString(race?.clusterSchedule) && isNullableString(race?.clusterSchedule) &&
isNullableString(race?.bibPickup) && isNullableString(race?.bibPickup) &&
@@ -49,7 +53,7 @@ function normalizeRace(input: unknown): Race {
distanceKm: race.distanceKm, distanceKm: race.distanceKm,
status: race.status, status: race.status,
officialUrl: race.officialUrl, officialUrl: race.officialUrl,
coverImageUrl: race.coverImageUrl, coverImageUrl: race.coverImageUrl ?? null,
startTime: race.startTime, startTime: race.startTime,
clusterSchedule: race.clusterSchedule, clusterSchedule: race.clusterSchedule,
bibPickup: race.bibPickup, bibPickup: race.bibPickup,

View File

@@ -1,3 +1,4 @@
import type { CSSProperties } from "react";
import { useEffect, useMemo, useState } from "react"; import { useEffect, useMemo, useState } from "react";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import type { Race } from "../api"; import type { Race } from "../api";
@@ -7,6 +8,7 @@ import {
formatDistance, formatDistance,
formatRaceDate, formatRaceDate,
getRaceCountdownLabel, getRaceCountdownLabel,
getRaceVisual,
getPaceLabel, getPaceLabel,
isCloseDistance, isCloseDistance,
parseFinishTimeToSeconds, parseFinishTimeToSeconds,
@@ -16,6 +18,10 @@ import {
const PR_DISTANCES = [5, 10, 21.1, 42.2] as const; const PR_DISTANCES = [5, 10, 21.1, 42.2] as const;
type DashboardHeroStyle = CSSProperties & {
"--dashboard-hero-image"?: string;
};
function getErrorMessage(error: unknown): string { function getErrorMessage(error: unknown): string {
if (error instanceof ApiError) { if (error instanceof ApiError) {
return error.message; return error.message;
@@ -23,6 +29,10 @@ function getErrorMessage(error: unknown): string {
return "Не удалось загрузить данные обзора."; return "Не удалось загрузить данные обзора.";
} }
function toCssUrl(value: string): string {
return `url(${JSON.stringify(value)})`;
}
export function DashboardPage(): JSX.Element { export function DashboardPage(): JSX.Element {
const [races, setRaces] = useState<Race[]>([]); const [races, setRaces] = useState<Race[]>([]);
const [isLoading, setIsLoading] = useState<boolean>(true); const [isLoading, setIsLoading] = useState<boolean>(true);
@@ -136,6 +146,10 @@ export function DashboardPage(): JSX.Element {
dashboardMetrics.seasonTotal > 0 dashboardMetrics.seasonTotal > 0
? Math.round((dashboardMetrics.seasonCompletedCount / dashboardMetrics.seasonTotal) * 100) ? Math.round((dashboardMetrics.seasonCompletedCount / dashboardMetrics.seasonTotal) * 100)
: 0; : 0;
const dashboardHeroVisual = dashboardMetrics.nextRace ? getRaceVisual(dashboardMetrics.nextRace) : null;
const dashboardHeroStyle: DashboardHeroStyle | undefined = dashboardHeroVisual
? { "--dashboard-hero-image": toCssUrl(dashboardHeroVisual.imageSrc) }
: undefined;
if (isLoading) { if (isLoading) {
return ( return (
@@ -157,7 +171,11 @@ export function DashboardPage(): JSX.Element {
return ( return (
<section className="page page--dashboard"> <section className="page page--dashboard">
<section className="dashboard-hero" aria-label="Обзор сезона"> <section
className={`dashboard-hero${dashboardHeroVisual ? " dashboard-hero--with-image" : ""}`}
style={dashboardHeroStyle}
aria-label="Обзор сезона"
>
<div className="dashboard-hero__content"> <div className="dashboard-hero__content">
<p className="dashboard-hero__eyebrow">Календарь сезона</p> <p className="dashboard-hero__eyebrow">Календарь сезона</p>
<h1 className="dashboard-hero__title">Беговой штаб</h1> <h1 className="dashboard-hero__title">Беговой штаб</h1>

View File

@@ -1355,6 +1355,12 @@ body {
url("/images/runner-hero.jpg") center / cover; url("/images/runner-hero.jpg") center / cover;
} }
.dashboard-hero--with-image {
background:
linear-gradient(90deg, rgba(7, 25, 39, 0.94) 0%, rgba(7, 25, 39, 0.68) 48%, rgba(7, 25, 39, 0.2) 100%),
var(--dashboard-hero-image) center / cover;
}
.dashboard-hero__content, .dashboard-hero__content,
.dashboard-hero__panel { .dashboard-hero__panel {
position: relative; position: relative;