fix(andebol): remove FPA feed agenda from homepage UI (BIT-26501)
Remove the FPA fixture agenda section from andebol.net homepage, along with all supporting bridge services, types, i18n strings, and config flags: - Delete FpaAgendaSection.astro component - Remove fpa_agenda section from index.astro homepage - Remove FpaAgendaGame type from frontend and bridge types - Remove fpa_agenda_enabled from DomainConfig and andebol.net.json - Remove fpa_agenda from HomepageData and mock bridge - Remove all fpa_* i18n strings (en + pt) - Remove fpa-agenda.ts, fpa-import.ts, fpa-store.ts, fpa-stream-match.ts - Remove fpa-stream-match.test.ts and fpa-import.test.ts - Remove fpa.ts route and registration from server.ts - Remove fpa-import-cli.ts tool - Remove fpa-import systemd service and timer - Update bridge/package.json test scripts - Remove FPA agenda homepage route logic from homepage.ts Co-authored-by: Paperclip <[email protected]>
This commit is contained in:
1 parent
3c32115eec
commit
c9fd174a30
14 files changed
+28
-1118
No files matched your search
+2
-2
@@ -9,8 +9,8 @@
|
||||
"build": "tsc",
|
||||
"start": "node dist/server.js",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"test": "npm run build && node --test dist/services/ranking.test.js dist/services/aggregator-mapper.test.js dist/services/fpa-stream-match.test.js",
|
||||
"test:coverage": "npm run build && node --experimental-test-coverage --test dist/services/ranking.test.js dist/services/aggregator-mapper.test.js dist/services/fpa-stream-match.test.js"
|
||||
"test": "npm run build && node --test dist/services/ranking.test.js dist/services/aggregator-mapper.test.js dist/services/andeboltv.test.js",
|
||||
"test:coverage": "npm run build && node --experimental-test-coverage --test dist/services/ranking.test.js dist/services/aggregator-mapper.test.js dist/services/andeboltv.test.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fastify/cors": "^9.0.1",
|
||||
|
||||
@@ -3,11 +3,7 @@ import { get_domain_config } from '../config/domain.js';
|
||||
import { resolve_site_host } from '../lib/request-host.js';
|
||||
import { WpClient } from '../services/wp-client.js';
|
||||
import { swr_fetch } from '../services/cache.js';
|
||||
import type { ArticleListItem, FpaAgendaGame, HomepageData } from '../types.js';
|
||||
import type { AndebolTvStreamEvent } from '../services/andeboltv.js';
|
||||
import { fetch_andeboltv_stream_events } from '../services/andeboltv.js';
|
||||
import { fetch_fpa_agenda } from '../services/fpa-agenda.js';
|
||||
import { enrich_fpa_agenda_with_streams } from '../services/fpa-stream-match.js';
|
||||
import type { ArticleListItem, HomepageData } from '../types.js';
|
||||
|
||||
// Number of articles per section
|
||||
const HERO_COUNT = 3;
|
||||
@@ -67,7 +63,7 @@ function take_unique_ids(pool: ArticleListItem[], limit: number): ArticleListIte
|
||||
return out;
|
||||
}
|
||||
|
||||
const empty_homepage = (): Omit<HomepageData, 'fpa_agenda'> => ({
|
||||
const empty_homepage = (): HomepageData => ({
|
||||
hero: [],
|
||||
trending: [],
|
||||
featured: [],
|
||||
@@ -81,7 +77,7 @@ export async function homepage_routes(app: FastifyInstance): Promise<void> {
|
||||
const config = get_domain_config(host);
|
||||
const client = new WpClient(config.wp_endpoint);
|
||||
|
||||
const base = await swr_fetch<Omit<HomepageData, 'fpa_agenda'>>(
|
||||
const base = await swr_fetch<HomepageData>(
|
||||
`${host}:homepage`,
|
||||
async () => {
|
||||
try {
|
||||
@@ -137,30 +133,7 @@ export async function homepage_routes(app: FastifyInstance): Promise<void> {
|
||||
},
|
||||
);
|
||||
|
||||
const fpa_agenda: FpaAgendaGame[] | null = config.fpa_agenda_enabled
|
||||
? await swr_fetch<FpaAgendaGame[]>(`${host}:fpa:agenda`, async () => {
|
||||
try {
|
||||
const [games, streams] = await Promise.all([
|
||||
fetch_fpa_agenda(),
|
||||
swr_fetch<AndebolTvStreamEvent[]>(`${host}:andeboltv:streams`, async () => {
|
||||
try {
|
||||
return await fetch_andeboltv_stream_events();
|
||||
} catch (err) {
|
||||
app.log.warn({ err, host }, 'AndebolTV stream fetch failed');
|
||||
return [];
|
||||
}
|
||||
}),
|
||||
]);
|
||||
return enrich_fpa_agenda_with_streams(games, streams);
|
||||
} catch (err) {
|
||||
app.log.warn({ err, host }, 'FPA agenda fetch failed');
|
||||
return [];
|
||||
}
|
||||
})
|
||||
: null;
|
||||
|
||||
const data: HomepageData = { ...base, fpa_agenda };
|
||||
return reply.send(data);
|
||||
return reply.send(base);
|
||||
});
|
||||
|
||||
// GET /trending — convenience endpoint
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { pixellot_ms_to_lisbon_date } from './andeboltv.js';
|
||||
|
||||
test('pixellot_ms_to_lisbon_date formats in Europe/Lisbon', () => {
|
||||
// 2026-07-17 12:00 UTC → same calendar day in Lisbon (summer)
|
||||
const ms = Date.UTC(2026, 6, 17, 12, 0, 0);
|
||||
assert.equal(pixellot_ms_to_lisbon_date(ms), '2026-07-17');
|
||||
});
|
||||
|
||||
test('AndebolTV portal URLs must use event_id not reference_id (BIT-26487)', () => {
|
||||
const reference_id = '6a4b765f3a96ca9f5ea73ea3';
|
||||
const event_id = '6a4b765f90f0fd82fea4e75a';
|
||||
const portal = 'https://andeboltv.fpa.pt';
|
||||
|
||||
const wrong = `${portal}/events/${encodeURIComponent(reference_id)}`;
|
||||
const correct = `${portal}/events/${encodeURIComponent(event_id)}`;
|
||||
|
||||
assert.notEqual(wrong, correct);
|
||||
assert.equal(correct, 'https://andeboltv.fpa.pt/events/6a4b765f90f0fd82fea4e75a');
|
||||
});
|
||||
@@ -1,136 +0,0 @@
|
||||
import type { FpaAgendaGame } from '../types.js';
|
||||
|
||||
/** Public FPA JSON feed used by portal.fpa.pt for national competition fixtures. */
|
||||
const FPA_AGENDA_URL =
|
||||
process.env['FPA_AGENDA_URL'] ?? 'https://ws.fpa.pt/index.php/getAgendaJogosFAP/';
|
||||
|
||||
const FPA_CLUBE_URL_BASE =
|
||||
process.env['FPA_CLUBE_URL_BASE'] ?? 'https://ws.fpa.pt/index.php/getClube/';
|
||||
|
||||
const FETCH_TIMEOUT_MS = parseInt(process.env['FPA_FETCH_TIMEOUT_MS'] ?? '20000', 10);
|
||||
const MAX_GAMES = Math.min(parseInt(process.env['FPA_AGENDA_MAX'] ?? '48', 10), 200);
|
||||
|
||||
interface ParsedFpaGame extends FpaAgendaGame {
|
||||
home_club_id: string;
|
||||
away_club_id: string;
|
||||
}
|
||||
|
||||
function as_trimmed_string(value: unknown): string {
|
||||
if (value === null || value === undefined) {
|
||||
return '';
|
||||
}
|
||||
return String(value).trim();
|
||||
}
|
||||
|
||||
function parse_goals(value: unknown): number | null {
|
||||
if (value === null || value === undefined || value === '') {
|
||||
return null;
|
||||
}
|
||||
const n = Number(value);
|
||||
return Number.isFinite(n) ? n : null;
|
||||
}
|
||||
|
||||
function sort_key(date: string, time: string): string {
|
||||
return `${date} ${time}`.padEnd(20, '0');
|
||||
}
|
||||
|
||||
async function fetch_club_logo_url(club_id: string): Promise<string | null> {
|
||||
const res = await fetch(`${FPA_CLUBE_URL_BASE}${encodeURIComponent(club_id)}`, {
|
||||
headers: { Accept: 'application/json' },
|
||||
signal: AbortSignal.timeout(FETCH_TIMEOUT_MS),
|
||||
});
|
||||
|
||||
if (!res.ok) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const raw: unknown = await res.json();
|
||||
if (!Array.isArray(raw) || raw.length === 0 || raw[0] === null || typeof raw[0] !== 'object') {
|
||||
return null;
|
||||
}
|
||||
|
||||
const emblem = as_trimmed_string((raw[0] as Record<string, unknown>)['URL_EMBLEMA_CASA']);
|
||||
return emblem || null;
|
||||
}
|
||||
|
||||
async function resolve_club_logos(club_ids: Iterable<string>): Promise<Map<string, string | null>> {
|
||||
const unique = [...new Set([...club_ids].filter(Boolean))];
|
||||
const logos = new Map<string, string | null>();
|
||||
|
||||
await Promise.all(
|
||||
unique.map(async (club_id) => {
|
||||
try {
|
||||
logos.set(club_id, await fetch_club_logo_url(club_id));
|
||||
} catch {
|
||||
logos.set(club_id, null);
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
||||
return logos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch and normalise FPA agenda JSON. Caller should wrap in cache (e.g. swr_fetch).
|
||||
* Throws on network/HTTP errors or invalid payload shape.
|
||||
*/
|
||||
export async function fetch_fpa_agenda(): Promise<FpaAgendaGame[]> {
|
||||
const res = await fetch(FPA_AGENDA_URL, {
|
||||
headers: { Accept: 'application/json' },
|
||||
signal: AbortSignal.timeout(FETCH_TIMEOUT_MS),
|
||||
});
|
||||
|
||||
if (!res.ok) {
|
||||
throw new Error(`FPA agenda HTTP ${res.status}`);
|
||||
}
|
||||
|
||||
const raw: unknown = await res.json();
|
||||
if (!Array.isArray(raw)) {
|
||||
throw new Error('FPA agenda: expected JSON array');
|
||||
}
|
||||
|
||||
const games: ParsedFpaGame[] = [];
|
||||
|
||||
for (const row of raw) {
|
||||
if (row === null || typeof row !== 'object') {
|
||||
continue;
|
||||
}
|
||||
const o = row as Record<string, unknown>;
|
||||
const match_id = as_trimmed_string(o['ID_PROVA_JOGO']);
|
||||
const date = as_trimmed_string(o['JOG_DATA']);
|
||||
const time = as_trimmed_string(o['JOG_HORA']);
|
||||
if (!match_id || !date) {
|
||||
continue;
|
||||
}
|
||||
|
||||
games.push({
|
||||
match_id,
|
||||
date,
|
||||
time: time || '—',
|
||||
home_team: as_trimmed_string(o['EQUIPA_CASA']) || '—',
|
||||
away_team: as_trimmed_string(o['EQUIPA_FORA']) || '—',
|
||||
home_goals: parse_goals(o['GOLOS_CASA']),
|
||||
away_goals: parse_goals(o['GOLOS_FORA']),
|
||||
venue: as_trimmed_string(o['LOCAL']) || '—',
|
||||
competition: as_trimmed_string(o['PROVA']) || '—',
|
||||
phase: as_trimmed_string(o['FASE']) || '',
|
||||
home_logo_url: null,
|
||||
away_logo_url: null,
|
||||
home_club_id: as_trimmed_string(o['CLUBE_CASA_ID']),
|
||||
away_club_id: as_trimmed_string(o['CLUBE_FORA_ID']),
|
||||
});
|
||||
}
|
||||
|
||||
games.sort((a, b) => sort_key(a.date, a.time).localeCompare(sort_key(b.date, b.time)));
|
||||
const limited = games.slice(0, MAX_GAMES);
|
||||
|
||||
const logos = await resolve_club_logos(
|
||||
limited.flatMap((g) => [g.home_club_id, g.away_club_id]),
|
||||
);
|
||||
|
||||
return limited.map(({ home_club_id, away_club_id, ...game }) => ({
|
||||
...game,
|
||||
home_logo_url: home_club_id ? logos.get(home_club_id) ?? null : null,
|
||||
away_logo_url: away_club_id ? logos.get(away_club_id) ?? null : null,
|
||||
}));
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import {
|
||||
enrich_fpa_agenda_with_streams,
|
||||
find_stream_for_game,
|
||||
teams_match_pair,
|
||||
teams_overlap,
|
||||
} from './fpa-stream-match.js';
|
||||
import type { AndebolTvStreamEvent } from './andeboltv.js';
|
||||
import type { FpaAgendaGame } from '../types.js';
|
||||
|
||||
test('teams_overlap matches national team shorthand', () => {
|
||||
assert.equal(teams_overlap('PORTUGAL', 'Portugal M18'), true);
|
||||
assert.equal(teams_overlap('ALEMANHA', 'Germany M18'), true);
|
||||
});
|
||||
|
||||
test('teams_match_pair accepts swapped home/away', () => {
|
||||
assert.equal(teams_match_pair('Benfica', 'Porto', 'FC Porto', 'SL Benfica'), true);
|
||||
});
|
||||
|
||||
test('find_stream_for_game matches by date and team names', () => {
|
||||
const game: FpaAgendaGame = {
|
||||
match_id: '1',
|
||||
date: '2026-07-17',
|
||||
time: '19:00',
|
||||
home_team: 'PORTUGAL',
|
||||
away_team: 'ALEMANHA',
|
||||
home_goals: null,
|
||||
away_goals: null,
|
||||
venue: 'Maia',
|
||||
competition: 'Seleções',
|
||||
phase: 'Sub-18',
|
||||
home_logo_url: null,
|
||||
away_logo_url: null,
|
||||
};
|
||||
|
||||
const streams: AndebolTvStreamEvent[] = [
|
||||
{
|
||||
reference_id: 'abc',
|
||||
event_id: 'abc',
|
||||
home_team: 'Portugal M18',
|
||||
away_team: 'Germany M18',
|
||||
date: '2026-07-17',
|
||||
status: 'upcoming',
|
||||
stream_url: 'https://andeboltv.fpa.pt/events/abc',
|
||||
},
|
||||
];
|
||||
|
||||
const match = find_stream_for_game(game, streams);
|
||||
assert.ok(match);
|
||||
assert.equal(match?.stream_url, 'https://andeboltv.fpa.pt/events/abc');
|
||||
});
|
||||
|
||||
test('enrich_fpa_agenda_with_streams adds stream fields', () => {
|
||||
const games: FpaAgendaGame[] = [
|
||||
{
|
||||
match_id: '1',
|
||||
date: '2026-07-17',
|
||||
time: '19:00',
|
||||
home_team: 'PORTUGAL',
|
||||
away_team: 'ALEMANHA',
|
||||
home_goals: null,
|
||||
away_goals: null,
|
||||
venue: 'Maia',
|
||||
competition: 'Seleções',
|
||||
phase: '',
|
||||
home_logo_url: null,
|
||||
away_logo_url: null,
|
||||
},
|
||||
];
|
||||
|
||||
const streams: AndebolTvStreamEvent[] = [
|
||||
{
|
||||
reference_id: 'live1',
|
||||
event_id: 'live1',
|
||||
home_team: 'Portugal M18',
|
||||
away_team: 'Germany M18',
|
||||
date: '2026-07-17',
|
||||
status: 'live',
|
||||
stream_url: 'https://andeboltv.fpa.pt/events/live1',
|
||||
},
|
||||
];
|
||||
|
||||
const enriched = enrich_fpa_agenda_with_streams(games, streams);
|
||||
assert.equal(enriched[0]?.is_live, true);
|
||||
assert.equal(enriched[0]?.stream_status, 'live');
|
||||
assert.equal(enriched[0]?.stream_url, 'https://andeboltv.fpa.pt/events/live1');
|
||||
});
|
||||
@@ -1,130 +0,0 @@
|
||||
import type { AndebolTvStreamEvent } from './andeboltv.js';
|
||||
import type { FpaAgendaGame } from '../types.js';
|
||||
|
||||
/** PT (FPA feed) ↔ EN (AndebolTV/Pixellot) aliases for national/club name matching. */
|
||||
const TEAM_ALIAS_GROUPS: string[][] = [
|
||||
['portugal', 'por'],
|
||||
['alemanha', 'germany', 'ger', 'deutschland'],
|
||||
['franca', 'france', 'fra'],
|
||||
['espanha', 'spain', 'esp'],
|
||||
['italia', 'italy', 'ita'],
|
||||
['holanda', 'netherlands', 'ned', 'hol'],
|
||||
['suecia', 'sweden', 'swe'],
|
||||
['noruega', 'norway', 'nor'],
|
||||
['dinamarca', 'denmark', 'den'],
|
||||
['islandia', 'iceland', 'isl'],
|
||||
['polonia', 'poland', 'pol'],
|
||||
['croacia', 'croatia', 'cro'],
|
||||
['servia', 'serbia', 'srb'],
|
||||
['eslovenia', 'slovenia', 'svn'],
|
||||
['hungria', 'hungary', 'hun'],
|
||||
['romenia', 'romania', 'rou'],
|
||||
['grecia', 'greece', 'gre'],
|
||||
['angola'],
|
||||
['brasil', 'brazil', 'bra'],
|
||||
];
|
||||
|
||||
function normalize_team_token(value: string): string {
|
||||
return value
|
||||
.normalize('NFD')
|
||||
.replace(/\p{M}/gu, '')
|
||||
.toLowerCase()
|
||||
.replace(/\b(fc|sc|ad|cp|gd|cd|aa|hb|sl)\b/g, ' ')
|
||||
.replace(/[^a-z0-9]+/g, ' ')
|
||||
.trim();
|
||||
}
|
||||
|
||||
function team_tokens(name: string): string[] {
|
||||
const normalized = normalize_team_token(name);
|
||||
if (!normalized) {
|
||||
return [];
|
||||
}
|
||||
const tokens = normalized.split(/\s+/).filter((t) => t.length >= 2);
|
||||
return tokens.length > 0 ? tokens : [normalized];
|
||||
}
|
||||
|
||||
function canonical_team_keys(name: string): Set<string> {
|
||||
const keys = new Set<string>();
|
||||
const compact = normalize_team_token(name).replace(/\s+/g, '');
|
||||
if (compact) {
|
||||
keys.add(compact);
|
||||
}
|
||||
for (const token of team_tokens(name)) {
|
||||
keys.add(token);
|
||||
for (const group of TEAM_ALIAS_GROUPS) {
|
||||
if (group.some((alias) => token.includes(alias) || alias.includes(token))) {
|
||||
for (const alias of group) {
|
||||
keys.add(alias);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return keys;
|
||||
}
|
||||
|
||||
/** True when team names refer to the same side (fuzzy PT/EN + token overlap). */
|
||||
export function teams_overlap(a: string, b: string): boolean {
|
||||
const keys_a = canonical_team_keys(a);
|
||||
const keys_b = canonical_team_keys(b);
|
||||
if (keys_a.size === 0 || keys_b.size === 0) {
|
||||
return false;
|
||||
}
|
||||
for (const key of keys_a) {
|
||||
if (keys_b.has(key)) {
|
||||
return true;
|
||||
}
|
||||
for (const other of keys_b) {
|
||||
if (key.length >= 4 && (other.includes(key) || key.includes(other))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function teams_match_pair(
|
||||
home_a: string,
|
||||
away_a: string,
|
||||
home_b: string,
|
||||
away_b: string,
|
||||
): boolean {
|
||||
const direct = teams_overlap(home_a, home_b) && teams_overlap(away_a, away_b);
|
||||
const swapped = teams_overlap(home_a, away_b) && teams_overlap(away_a, home_b);
|
||||
return direct || swapped;
|
||||
}
|
||||
|
||||
export function find_stream_for_game(
|
||||
game: FpaAgendaGame,
|
||||
streams: AndebolTvStreamEvent[],
|
||||
): AndebolTvStreamEvent | null {
|
||||
const candidates = streams.filter((s) => s.date === game.date);
|
||||
for (const stream of candidates) {
|
||||
if (teams_match_pair(game.home_team, game.away_team, stream.home_team, stream.away_team)) {
|
||||
return stream;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export function enrich_fpa_agenda_with_streams(
|
||||
games: FpaAgendaGame[],
|
||||
streams: AndebolTvStreamEvent[],
|
||||
): FpaAgendaGame[] {
|
||||
if (streams.length === 0) {
|
||||
return games;
|
||||
}
|
||||
|
||||
return games.map((game) => {
|
||||
const stream = find_stream_for_game(game, streams);
|
||||
if (!stream) {
|
||||
return game;
|
||||
}
|
||||
|
||||
return {
|
||||
...game,
|
||||
stream_url: stream.stream_url,
|
||||
stream_status: stream.status,
|
||||
is_live: stream.status === 'live',
|
||||
};
|
||||
});
|
||||
}
|
||||
@@ -15,31 +15,6 @@ export interface DomainConfig {
|
||||
ads_enabled: boolean;
|
||||
analytics_id: string | null;
|
||||
auth_links?: boolean;
|
||||
/** When true, homepage includes `fpa_agenda` from ws.fpa.pt (cached server-side). */
|
||||
fpa_agenda_enabled?: boolean;
|
||||
}
|
||||
|
||||
/** Normalised row from FPA `getAgendaJogosFAP` JSON. */
|
||||
export interface FpaAgendaGame {
|
||||
match_id: string;
|
||||
date: string;
|
||||
time: string;
|
||||
home_team: string;
|
||||
away_team: string;
|
||||
home_goals: number | null;
|
||||
away_goals: number | null;
|
||||
venue: string;
|
||||
competition: string;
|
||||
phase: string;
|
||||
/** Club emblem from FPA `getClube` (si.fpa.pt); null when unavailable. */
|
||||
home_logo_url: string | null;
|
||||
away_logo_url: string | null;
|
||||
/** AndebolTV stream page when matched from andeboltv.fpa.pt (Pixellot). */
|
||||
stream_url?: string | null;
|
||||
/** `live` or `upcoming` from AndebolTV; omitted when no stream. */
|
||||
stream_status?: 'live' | 'upcoming' | null;
|
||||
/** Convenience flag when `stream_status === 'live'`. */
|
||||
is_live?: boolean;
|
||||
}
|
||||
|
||||
export interface CategoryConfig {
|
||||
@@ -105,8 +80,6 @@ export interface HomepageData {
|
||||
featured: ArticleListItem[];
|
||||
latest: ArticleListItem[];
|
||||
by_category: Record<string, ArticleListItem[]>;
|
||||
/** Present when `fpa_agenda_enabled`; otherwise null. */
|
||||
fpa_agenda: FpaAgendaGame[] | null;
|
||||
}
|
||||
|
||||
// Raw WordPress REST API types (minimal subset we use)
|
||||
|
||||
@@ -25,6 +25,5 @@
|
||||
"timezone": "Europe/Lisbon",
|
||||
"ads_enabled": false,
|
||||
"analytics_id": null,
|
||||
"auth_links": true,
|
||||
"fpa_agenda_enabled": true
|
||||
"auth_links": true
|
||||
}
|
||||
@@ -195,7 +195,6 @@ export class MockBridgeClient extends BridgeClient {
|
||||
basketball: this.mockArticles(4),
|
||||
formula1: this.mockArticles(4),
|
||||
},
|
||||
fpa_agenda: null,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -43,11 +43,3 @@ test('getUiStrings en search_results_count', () => {
|
||||
const s = getUiStrings('en');
|
||||
assert.equal(s.search_results_count(3), '3 results');
|
||||
});
|
||||
|
||||
test('getUiStrings pt fpa strings omit feed origin references', () => {
|
||||
const s = getUiStrings('pt-PT');
|
||||
assert.equal(s.fpa_agenda_lead, 'Agenda de competições nacionais.');
|
||||
assert.equal(s.fpa_source_credit, '');
|
||||
assert.equal(s.fpa_agenda_lead.includes('feed'), false);
|
||||
assert.equal(s.fpa_agenda_lead.includes('ws.fpa'), false);
|
||||
});
|
||||
@@ -46,21 +46,6 @@ export type UiStrings = {
|
||||
search_results_count: (n: number) => string;
|
||||
explore_sections: string;
|
||||
discover_lead: string;
|
||||
fpa_agenda_title: string;
|
||||
fpa_agenda_lead: string;
|
||||
fpa_col_when: string;
|
||||
fpa_col_match: string;
|
||||
fpa_col_score: string;
|
||||
fpa_col_venue: string;
|
||||
fpa_col_competition: string;
|
||||
fpa_agenda_empty: string;
|
||||
fpa_source_credit: string;
|
||||
fpa_status_finished: string;
|
||||
fpa_status_upcoming: string;
|
||||
fpa_status_live: string;
|
||||
fpa_watch_live: string;
|
||||
fpa_watch_stream: string;
|
||||
fpa_games_on_date: (count: number) => string;
|
||||
/** News archive page title */
|
||||
news_archive_title: string;
|
||||
/** "All" filter label for category tabs */
|
||||
@@ -141,21 +126,6 @@ const en: UiStrings = {
|
||||
search_results_count: n => `${n} results`,
|
||||
explore_sections: 'Explore',
|
||||
discover_lead: 'Browse by topic or find an article by keyword.',
|
||||
fpa_agenda_title: 'Upcoming matches',
|
||||
fpa_agenda_lead: 'National competition fixtures.',
|
||||
fpa_col_when: 'When',
|
||||
fpa_col_match: 'Match',
|
||||
fpa_col_score: 'Score',
|
||||
fpa_col_venue: 'Venue',
|
||||
fpa_col_competition: 'Competition',
|
||||
fpa_agenda_empty: 'Fixture list is temporarily unavailable.',
|
||||
fpa_source_credit: '',
|
||||
fpa_status_finished: 'FT',
|
||||
fpa_status_upcoming: 'Upcoming',
|
||||
fpa_status_live: 'Live',
|
||||
fpa_watch_live: 'Watch live',
|
||||
fpa_watch_stream: 'Watch on AndebolTV',
|
||||
fpa_games_on_date: count => (count === 1 ? '1 match' : `${count} matches`),
|
||||
news_archive_title: 'News',
|
||||
news_all_filter: 'All',
|
||||
news_archive_desc: 'Latest news and stories across all sections.',
|
||||
@@ -221,21 +191,6 @@ const pt: UiStrings = {
|
||||
search_results_count: n => (n === 1 ? '1 resultado' : `${n} resultados`),
|
||||
explore_sections: 'Explorar',
|
||||
discover_lead: 'Navegue por tema ou encontre um artigo por palavra-chave.',
|
||||
fpa_agenda_title: 'Próximos jogos',
|
||||
fpa_agenda_lead: 'Agenda de competições nacionais.',
|
||||
fpa_col_when: 'Quando',
|
||||
fpa_col_match: 'Jogo',
|
||||
fpa_col_score: 'Resultado',
|
||||
fpa_col_venue: 'Local',
|
||||
fpa_col_competition: 'Competição',
|
||||
fpa_agenda_empty: 'A agenda não está disponível de momento.',
|
||||
fpa_source_credit: '',
|
||||
fpa_status_finished: 'Fim',
|
||||
fpa_status_upcoming: 'Por jogar',
|
||||
fpa_status_live: 'Em direto',
|
||||
fpa_watch_live: 'Ver em direto',
|
||||
fpa_watch_stream: 'Ver na AndebolTV',
|
||||
fpa_games_on_date: count => (count === 1 ? '1 jogo' : `${count} jogos`),
|
||||
news_archive_title: 'Notícias',
|
||||
news_all_filter: 'Todas',
|
||||
news_archive_desc: 'Últimas notícias e histórias de todas as secções.',
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
import Base from '../layouts/Base.astro';
|
||||
import LatestGrid from '../components/home/LatestGrid.astro';
|
||||
import DiscoverSection from '../themes/institutional/DiscoverSection.astro';
|
||||
import FpaAgendaSection from '../themes/institutional/FpaAgendaSection.astro';
|
||||
import { getDomainConfig } from '../lib/domain.js';
|
||||
import { getThemeComponents } from '../lib/theme.js';
|
||||
import { getUiStrings } from '../lib/ui-i18n.js';
|
||||
@@ -64,10 +63,6 @@ const website_schema = {
|
||||
<TrendingBar articles={homepage.trending} locale={config.locale} />
|
||||
<HeroSection articles={homepage.hero} locale={config.locale} />
|
||||
|
||||
{config.fpa_agenda_enabled && homepage.fpa_agenda != null && (
|
||||
<FpaAgendaSection games={homepage.fpa_agenda} locale={config.locale} />
|
||||
)}
|
||||
|
||||
{config.ads_enabled && (
|
||||
<div class="container" style="padding-block: 1rem">
|
||||
<div class="ad-slot ad-slot--leaderboard" aria-label={ui.ad_slot_aria}>{ui.ad_slot_text}</div>
|
||||
|
||||
@@ -1,616 +0,0 @@
|
||||
---
|
||||
import type { FpaAgendaGame } from '../../types/index.js';
|
||||
import { getUiStrings } from '../../lib/ui-i18n.js';
|
||||
|
||||
interface Props {
|
||||
games: FpaAgendaGame[];
|
||||
locale: string;
|
||||
}
|
||||
|
||||
const { games, locale } = Astro.props;
|
||||
const ui = getUiStrings(locale);
|
||||
|
||||
function team_initials(name: string): string {
|
||||
const parts = name.trim().split(/\s+/).filter(Boolean);
|
||||
if (parts.length === 0) return '?';
|
||||
if (parts.length === 1) return parts[0]!.slice(0, 2).toUpperCase();
|
||||
return (parts[0]![0]! + parts[parts.length - 1]![0]!).toUpperCase();
|
||||
}
|
||||
|
||||
function is_finished(game: FpaAgendaGame): boolean {
|
||||
return game.home_goals !== null && game.away_goals !== null;
|
||||
}
|
||||
|
||||
function format_score(game: FpaAgendaGame): string | null {
|
||||
if (!is_finished(game)) return null;
|
||||
return `${game.home_goals} – ${game.away_goals}`;
|
||||
}
|
||||
|
||||
const by_date = new Map<string, FpaAgendaGame[]>();
|
||||
for (const game of games) {
|
||||
const list = by_date.get(game.date) ?? [];
|
||||
list.push(game);
|
||||
by_date.set(game.date, list);
|
||||
}
|
||||
const date_groups = [...by_date.entries()];
|
||||
---
|
||||
<section class="fpa-agenda" aria-labelledby="fpa-agenda-title">
|
||||
<header class="fpa-agenda__masthead">
|
||||
<div class="container">
|
||||
<div class="fpa-agenda__masthead-inner">
|
||||
<div class="fpa-agenda__masthead-text">
|
||||
<p class="fpa-agenda__eyebrow">{ui.fpa_col_competition}</p>
|
||||
<h2 id="fpa-agenda-title" class="fpa-agenda__title">{ui.fpa_agenda_title}</h2>
|
||||
<p class="fpa-agenda__lead">{ui.fpa_agenda_lead}</p>
|
||||
</div>
|
||||
{games.length > 0 && (
|
||||
<div class="fpa-agenda__stat" aria-hidden="true">
|
||||
<span class="fpa-agenda__stat-value">{games.length}</span>
|
||||
<span class="fpa-agenda__stat-label">{ui.fpa_games_on_date(games.length)}</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="container fpa-agenda__body">
|
||||
{games.length === 0 ? (
|
||||
<p class="fpa-agenda__empty" role="status">{ui.fpa_agenda_empty}</p>
|
||||
) : (
|
||||
<div class="fpa-agenda__days">
|
||||
{date_groups.map(([date, day_games]) => (
|
||||
<section class="fpa-agenda__day" aria-label={`${date}`}>
|
||||
<header class="fpa-agenda__day-head">
|
||||
<time class="fpa-agenda__day-date" datetime={date}>{date}</time>
|
||||
<span class="fpa-agenda__day-count">{ui.fpa_games_on_date(day_games.length)}</span>
|
||||
</header>
|
||||
|
||||
<ul class="fpa-agenda__cards" role="list">
|
||||
{day_games.map((g) => {
|
||||
const finished = is_finished(g);
|
||||
const score = format_score(g);
|
||||
const has_stream = Boolean(g.stream_url);
|
||||
const is_live = Boolean(g.is_live);
|
||||
const status_label = finished
|
||||
? ui.fpa_status_finished
|
||||
: is_live
|
||||
? ui.fpa_status_live
|
||||
: ui.fpa_status_upcoming;
|
||||
return (
|
||||
<li class="fpa-agenda__card" role="listitem">
|
||||
<article class="fpa-agenda__match">
|
||||
<header class="fpa-agenda__match-head">
|
||||
<span class="fpa-agenda__comp">{g.competition}</span>
|
||||
{g.phase && <span class="fpa-agenda__phase">{g.phase}</span>}
|
||||
<span
|
||||
class:list={[
|
||||
'fpa-agenda__status',
|
||||
finished && 'fpa-agenda__status--finished',
|
||||
is_live && 'fpa-agenda__status--live',
|
||||
has_stream && !is_live && !finished && 'fpa-agenda__status--stream',
|
||||
]}
|
||||
>
|
||||
{status_label}
|
||||
</span>
|
||||
</header>
|
||||
|
||||
<div class="fpa-agenda__faceoff">
|
||||
<div class="fpa-agenda__side fpa-agenda__side--home">
|
||||
<span
|
||||
class:list={[
|
||||
'fpa-agenda__crest',
|
||||
g.home_logo_url && 'fpa-agenda__crest--logo',
|
||||
]}
|
||||
aria-hidden="true"
|
||||
>
|
||||
{g.home_logo_url ? (
|
||||
<img
|
||||
class="fpa-agenda__crest-img"
|
||||
src={g.home_logo_url}
|
||||
alt=""
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
width="44"
|
||||
height="44"
|
||||
/>
|
||||
) : (
|
||||
team_initials(g.home_team)
|
||||
)}
|
||||
</span>
|
||||
<span class="fpa-agenda__team">{g.home_team}</span>
|
||||
</div>
|
||||
|
||||
<div class="fpa-agenda__center">
|
||||
{score ? (
|
||||
<span class="fpa-agenda__score" aria-label={`${ui.fpa_col_score}: ${score}`}>
|
||||
{score}
|
||||
</span>
|
||||
) : (
|
||||
<span class="fpa-agenda__kickoff">
|
||||
<span class="fpa-agenda__kickoff-time">{g.time}</span>
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div class="fpa-agenda__side fpa-agenda__side--away">
|
||||
<span
|
||||
class:list={[
|
||||
'fpa-agenda__crest',
|
||||
g.away_logo_url && 'fpa-agenda__crest--logo',
|
||||
]}
|
||||
aria-hidden="true"
|
||||
>
|
||||
{g.away_logo_url ? (
|
||||
<img
|
||||
class="fpa-agenda__crest-img"
|
||||
src={g.away_logo_url}
|
||||
alt=""
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
width="44"
|
||||
height="44"
|
||||
/>
|
||||
) : (
|
||||
team_initials(g.away_team)
|
||||
)}
|
||||
</span>
|
||||
<span class="fpa-agenda__team">{g.away_team}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer class="fpa-agenda__meta">
|
||||
<span class="fpa-agenda__meta-item">
|
||||
<svg class="fpa-agenda__icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
|
||||
<circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/>
|
||||
</svg>
|
||||
<span>{g.time}</span>
|
||||
</span>
|
||||
{g.venue && g.venue !== '—' && (
|
||||
<span class="fpa-agenda__meta-item">
|
||||
<svg class="fpa-agenda__icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
|
||||
<path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"/><circle cx="12" cy="10" r="3"/>
|
||||
</svg>
|
||||
<span>{g.venue}</span>
|
||||
</span>
|
||||
)}
|
||||
{has_stream && (
|
||||
<a
|
||||
class="fpa-agenda__stream-link"
|
||||
href={g.stream_url!}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
{is_live ? ui.fpa_watch_live : ui.fpa_watch_stream}
|
||||
</a>
|
||||
)}
|
||||
</footer>
|
||||
</article>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</section>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{games.length > 0 && ui.fpa_source_credit ? (
|
||||
<p class="fpa-agenda__credit">{ui.fpa_source_credit}</p>
|
||||
) : null}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<style>
|
||||
.fpa-agenda {
|
||||
background: var(--color-bg);
|
||||
}
|
||||
|
||||
.fpa-agenda__masthead {
|
||||
background: linear-gradient(
|
||||
135deg,
|
||||
var(--color-primary-dark, #0f2640) 0%,
|
||||
var(--color-primary) 52%,
|
||||
color-mix(in srgb, var(--color-secondary) 80%, #000) 100%
|
||||
);
|
||||
color: #fff;
|
||||
padding: var(--space-8) 0;
|
||||
border-bottom: 4px solid color-mix(in srgb, var(--color-secondary) 65%, #fff);
|
||||
}
|
||||
|
||||
.fpa-agenda__masthead-inner {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
justify-content: space-between;
|
||||
gap: var(--space-6);
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.fpa-agenda__eyebrow {
|
||||
font-family: var(--font-heading, inherit);
|
||||
font-size: var(--text-xs);
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.14em;
|
||||
opacity: 0.82;
|
||||
margin: 0 0 var(--space-2);
|
||||
}
|
||||
|
||||
.fpa-agenda__title {
|
||||
font-family: var(--font-heading, inherit);
|
||||
font-size: clamp(1.5rem, 3.5vw, 2.25rem);
|
||||
font-weight: 900;
|
||||
line-height: 1.1;
|
||||
letter-spacing: -0.02em;
|
||||
text-transform: uppercase;
|
||||
margin: 0 0 var(--space-2);
|
||||
}
|
||||
|
||||
.fpa-agenda__lead {
|
||||
margin: 0;
|
||||
font-size: var(--text-sm);
|
||||
line-height: 1.55;
|
||||
color: rgba(255, 255, 255, 0.86);
|
||||
max-width: 36rem;
|
||||
}
|
||||
|
||||
.fpa-agenda__stat {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 5.5rem;
|
||||
padding: var(--space-3) var(--space-4);
|
||||
border-radius: var(--inst-radius-lg, 10px);
|
||||
background: rgba(255, 255, 255, 0.12);
|
||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||
backdrop-filter: blur(6px);
|
||||
}
|
||||
|
||||
.fpa-agenda__stat-value {
|
||||
font-family: var(--font-heading, inherit);
|
||||
font-size: clamp(1.75rem, 4vw, 2.5rem);
|
||||
font-weight: 900;
|
||||
line-height: 1;
|
||||
letter-spacing: -0.03em;
|
||||
}
|
||||
|
||||
.fpa-agenda__stat-label {
|
||||
margin-top: var(--space-1);
|
||||
font-size: var(--text-xs);
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.06em;
|
||||
opacity: 0.85;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.fpa-agenda__body {
|
||||
padding: var(--space-8) 0 var(--space-10);
|
||||
}
|
||||
|
||||
.fpa-agenda__empty {
|
||||
margin: 0 0 var(--space-4);
|
||||
padding: var(--space-8);
|
||||
text-align: center;
|
||||
color: var(--color-text-muted);
|
||||
font-size: var(--text-base);
|
||||
background: var(--color-bg-secondary);
|
||||
border: 1px dashed var(--color-border);
|
||||
border-radius: var(--inst-radius-lg, 8px);
|
||||
}
|
||||
|
||||
.fpa-agenda__days {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-8);
|
||||
}
|
||||
|
||||
.fpa-agenda__day-head {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
gap: var(--space-4);
|
||||
margin-bottom: var(--space-4);
|
||||
padding-bottom: var(--space-3);
|
||||
border-bottom: 2px solid var(--color-primary);
|
||||
}
|
||||
|
||||
.fpa-agenda__day-date {
|
||||
font-family: var(--font-heading, inherit);
|
||||
font-size: clamp(1rem, 2vw, 1.2rem);
|
||||
font-weight: 800;
|
||||
letter-spacing: -0.01em;
|
||||
color: var(--color-primary);
|
||||
}
|
||||
|
||||
.fpa-agenda__day-count {
|
||||
font-size: var(--text-xs);
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
|
||||
.fpa-agenda__cards {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
gap: var(--space-4);
|
||||
}
|
||||
|
||||
@media (min-width: 640px) {
|
||||
.fpa-agenda__cards {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1100px) {
|
||||
.fpa-agenda__cards {
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
.fpa-agenda__match {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
background: var(--color-bg-card);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--inst-radius-lg, 10px);
|
||||
box-shadow: var(--shadow-sm);
|
||||
overflow: hidden;
|
||||
transition:
|
||||
box-shadow 0.2s ease,
|
||||
border-color 0.15s ease,
|
||||
transform 0.2s ease;
|
||||
}
|
||||
|
||||
.fpa-agenda__match:hover {
|
||||
border-color: color-mix(in srgb, var(--color-secondary) 55%, var(--color-border));
|
||||
box-shadow: var(--inst-shadow-feature, var(--shadow-md));
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.fpa-agenda__match-head {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: var(--space-2);
|
||||
padding: var(--space-3) var(--space-4);
|
||||
background: var(--inst-surface-muted, var(--color-bg-secondary));
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
}
|
||||
|
||||
.fpa-agenda__comp {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
font-family: var(--font-heading, inherit);
|
||||
font-size: 0.65rem;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
color: var(--color-secondary);
|
||||
line-height: 1.3;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.fpa-agenda__phase {
|
||||
font-size: 0.65rem;
|
||||
font-weight: 600;
|
||||
padding: 0.15rem 0.5rem;
|
||||
border-radius: 999px;
|
||||
background: color-mix(in srgb, var(--color-primary) 10%, var(--color-bg-card));
|
||||
color: var(--color-primary);
|
||||
border: 1px solid color-mix(in srgb, var(--color-primary) 20%, transparent);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.fpa-agenda__status {
|
||||
margin-left: auto;
|
||||
font-family: var(--font-heading, inherit);
|
||||
font-size: 0.6rem;
|
||||
font-weight: 800;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.08em;
|
||||
padding: 0.2rem 0.55rem;
|
||||
border-radius: 4px;
|
||||
background: color-mix(in srgb, var(--color-secondary) 14%, var(--color-bg-card));
|
||||
color: var(--color-secondary);
|
||||
border: 1px solid color-mix(in srgb, var(--color-secondary) 25%, transparent);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.fpa-agenda__status--finished {
|
||||
background: color-mix(in srgb, var(--color-primary) 12%, var(--color-bg-card));
|
||||
color: var(--color-primary);
|
||||
border-color: color-mix(in srgb, var(--color-primary) 22%, transparent);
|
||||
}
|
||||
|
||||
.fpa-agenda__status--live {
|
||||
background: #d22018;
|
||||
color: #fff;
|
||||
border-color: #d22018;
|
||||
animation: fpa-live-pulse 2s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.fpa-agenda__status--stream {
|
||||
background: color-mix(in srgb, #a20c17 14%, var(--color-bg-card));
|
||||
color: #a20c17;
|
||||
border-color: color-mix(in srgb, #a20c17 28%, transparent);
|
||||
}
|
||||
|
||||
@keyframes fpa-live-pulse {
|
||||
0%, 100% { opacity: 1; }
|
||||
50% { opacity: 0.78; }
|
||||
}
|
||||
|
||||
.fpa-agenda__faceoff {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr auto 1fr;
|
||||
align-items: center;
|
||||
gap: var(--space-3);
|
||||
padding: var(--space-5) var(--space-4) var(--space-4);
|
||||
}
|
||||
|
||||
.fpa-agenda__side {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: var(--space-2);
|
||||
min-width: 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.fpa-agenda__crest {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 2.75rem;
|
||||
height: 2.75rem;
|
||||
border-radius: 50%;
|
||||
font-family: var(--font-heading, inherit);
|
||||
font-size: 0.8rem;
|
||||
font-weight: 800;
|
||||
letter-spacing: 0.02em;
|
||||
color: #fff;
|
||||
background: linear-gradient(
|
||||
145deg,
|
||||
var(--color-primary) 0%,
|
||||
color-mix(in srgb, var(--color-secondary) 70%, var(--color-primary)) 100%
|
||||
);
|
||||
box-shadow: 0 4px 12px color-mix(in srgb, var(--color-primary) 25%, transparent);
|
||||
flex-shrink: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.fpa-agenda__crest--logo {
|
||||
background: #fff;
|
||||
border: 1px solid color-mix(in srgb, var(--color-border) 80%, #fff);
|
||||
box-shadow: 0 2px 8px color-mix(in srgb, var(--color-primary) 12%, transparent);
|
||||
}
|
||||
|
||||
.fpa-agenda__crest-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
padding: 0.2rem;
|
||||
}
|
||||
|
||||
.fpa-agenda__side--away .fpa-agenda__crest:not(.fpa-agenda__crest--logo) {
|
||||
background: linear-gradient(
|
||||
145deg,
|
||||
var(--color-secondary) 0%,
|
||||
color-mix(in srgb, var(--color-primary) 55%, var(--color-secondary)) 100%
|
||||
);
|
||||
}
|
||||
|
||||
.fpa-agenda__team {
|
||||
font-family: var(--font-heading, inherit);
|
||||
font-size: var(--text-sm);
|
||||
font-weight: 700;
|
||||
line-height: 1.25;
|
||||
letter-spacing: -0.01em;
|
||||
color: var(--color-text);
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.fpa-agenda__center {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 4.5rem;
|
||||
}
|
||||
|
||||
.fpa-agenda__score {
|
||||
font-family: var(--font-heading, inherit);
|
||||
font-size: clamp(1.25rem, 3vw, 1.6rem);
|
||||
font-weight: 900;
|
||||
font-variant-numeric: tabular-nums;
|
||||
letter-spacing: -0.02em;
|
||||
color: var(--color-primary);
|
||||
padding: var(--space-2) var(--space-3);
|
||||
border-radius: 8px;
|
||||
background: color-mix(in srgb, var(--color-primary) 8%, var(--color-bg-card));
|
||||
border: 1px solid color-mix(in srgb, var(--color-primary) 18%, transparent);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.fpa-agenda__kickoff {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 0.15rem;
|
||||
}
|
||||
|
||||
.fpa-agenda__kickoff-time {
|
||||
font-family: var(--font-heading, inherit);
|
||||
font-size: var(--text-lg);
|
||||
font-weight: 800;
|
||||
font-variant-numeric: tabular-nums;
|
||||
color: var(--color-secondary);
|
||||
padding: var(--space-2) var(--space-3);
|
||||
border-radius: 8px;
|
||||
border: 1px dashed color-mix(in srgb, var(--color-secondary) 40%, var(--color-border));
|
||||
background: var(--color-bg);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.fpa-agenda__meta {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-3) var(--space-4);
|
||||
margin-top: auto;
|
||||
padding: var(--space-3) var(--space-4);
|
||||
border-top: 1px solid var(--color-border);
|
||||
font-size: var(--text-xs);
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
|
||||
.fpa-agenda__meta-item {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: var(--space-2);
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.fpa-agenda__meta-item span:last-child {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
max-width: 14rem;
|
||||
}
|
||||
|
||||
.fpa-agenda__icon {
|
||||
flex-shrink: 0;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.fpa-agenda__stream-link {
|
||||
margin-left: auto;
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 700;
|
||||
color: #a20c17;
|
||||
text-decoration: none;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.fpa-agenda__stream-link:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.fpa-agenda__credit {
|
||||
margin: var(--space-6) 0 0;
|
||||
font-size: var(--text-xs);
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
</style>
|
||||
@@ -30,31 +30,6 @@ export interface DomainConfig {
|
||||
analytics_id: string | null;
|
||||
/** When true, show login/register in chrome and expose /entrar + /registar → WordPress. */
|
||||
auth_links?: boolean;
|
||||
/** Homepage includes FPA fixture feed (bridge proxies ws.fpa.pt). */
|
||||
fpa_agenda_enabled?: boolean;
|
||||
}
|
||||
|
||||
/** Normalised FPA agenda row (bridge → homepage JSON). */
|
||||
export interface FpaAgendaGame {
|
||||
match_id: string;
|
||||
date: string;
|
||||
time: string;
|
||||
home_team: string;
|
||||
away_team: string;
|
||||
home_goals: number | null;
|
||||
away_goals: number | null;
|
||||
venue: string;
|
||||
competition: string;
|
||||
phase: string;
|
||||
/** Club emblem from FPA `getClube` (si.fpa.pt); null when unavailable. */
|
||||
home_logo_url?: string | null;
|
||||
away_logo_url?: string | null;
|
||||
/** AndebolTV stream page when matched from andeboltv.fpa.pt (Pixellot). */
|
||||
stream_url?: string | null;
|
||||
/** `live` or `upcoming` from AndebolTV; omitted when no stream. */
|
||||
stream_status?: 'live' | 'upcoming' | null;
|
||||
/** Convenience flag when `stream_status === 'live'`. */
|
||||
is_live?: boolean;
|
||||
}
|
||||
|
||||
export interface Article {
|
||||
@@ -125,6 +100,4 @@ export interface HomepageData {
|
||||
featured: ArticleListItem[];
|
||||
latest: ArticleListItem[];
|
||||
by_category: Record<string, ArticleListItem[]>;
|
||||
/** Omitted by older bridge versions; treat as null if missing. */
|
||||
fpa_agenda?: FpaAgendaGame[] | null;
|
||||
}
|
||||
Reference in new issue
Block a user