@modoitaliano/giorgia 0.1.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +129 -0
- package/dist/assets/default-og.jpg +0 -0
- package/dist/assets/default-og.png +0 -0
- package/dist/assets/giorgia-navigation.js +1123 -0
- package/dist/assets/mi.svg +6 -0
- package/dist/carousels.d.ts +1 -0
- package/dist/carousels.js +65 -0
- package/dist/components/live-program/LiveProgram.d.ts +9 -0
- package/dist/components/live-program/LiveProgram.js +751 -0
- package/dist/components/live-program/assets.d.ts +14 -0
- package/dist/components/live-program/assets.js +14 -0
- package/dist/components/live-program/components/Marquee.d.ts +16 -0
- package/dist/components/live-program/components/Marquee.js +88 -0
- package/dist/components/live-program/components/MarqueeCurtain.d.ts +5 -0
- package/dist/components/live-program/components/MarqueeCurtain.js +30 -0
- package/dist/components/live-program/components/WorldClocks.d.ts +19 -0
- package/dist/components/live-program/components/WorldClocks.js +101 -0
- package/dist/components/live-program/components/slides/ArticleSlide.d.ts +14 -0
- package/dist/components/live-program/components/slides/ArticleSlide.js +32 -0
- package/dist/components/live-program/components/slides/CallsignSlide.d.ts +6 -0
- package/dist/components/live-program/components/slides/CallsignSlide.js +49 -0
- package/dist/components/live-program/components/slides/LiveEventSlide.d.ts +9 -0
- package/dist/components/live-program/components/slides/LiveEventSlide.js +86 -0
- package/dist/components/live-program/components/slides/slideStyles.d.ts +1 -0
- package/dist/components/live-program/components/slides/slideStyles.js +64 -0
- package/dist/components/live-program/events.d.ts +34 -0
- package/dist/components/live-program/events.js +167 -0
- package/dist/components/live-program/hooks/useSSE.d.ts +11 -0
- package/dist/components/live-program/hooks/useSSE.js +107 -0
- package/dist/components/live-program/i18n.d.ts +4 -0
- package/dist/components/live-program/i18n.js +305 -0
- package/dist/components/live-program/segments/ArticlesSegment.d.ts +6 -0
- package/dist/components/live-program/segments/ArticlesSegment.js +160 -0
- package/dist/components/live-program/segments/EarthquakeSegment.d.ts +16 -0
- package/dist/components/live-program/segments/EarthquakeSegment.js +130 -0
- package/dist/components/live-program/segments/LiveEventSegment.d.ts +4 -0
- package/dist/components/live-program/segments/LiveEventSegment.js +27 -0
- package/dist/components/live-program/segments/MarketsSegment.d.ts +12 -0
- package/dist/components/live-program/segments/MarketsSegment.js +76 -0
- package/dist/components/live-program/segments/WeatherSegment.d.ts +15 -0
- package/dist/components/live-program/segments/WeatherSegment.js +119 -0
- package/dist/components/live-program/segments/fetchLiveEvents.d.ts +20 -0
- package/dist/components/live-program/segments/fetchLiveEvents.js +76 -0
- package/dist/components/live-program/segments/index.d.ts +8 -0
- package/dist/components/live-program/segments/index.js +8 -0
- package/dist/components/live-program/segments/types.d.ts +23 -0
- package/dist/components/live-program/segments/types.js +1 -0
- package/dist/components/live-program/segments/usePlaylistEngine.d.ts +9 -0
- package/dist/components/live-program/segments/usePlaylistEngine.js +108 -0
- package/dist/components/live-program/utils/broadcastTime.d.ts +12 -0
- package/dist/components/live-program/utils/broadcastTime.js +33 -0
- package/dist/cronkite-manifest.d.ts +70 -0
- package/dist/cronkite-manifest.js +134 -0
- package/dist/cronkite-manifest.json +149 -0
- package/dist/fonts/barlow-condensed-latin-300-normal.woff2 +0 -0
- package/dist/fonts/barlow-condensed-latin-400-normal.woff2 +0 -0
- package/dist/fonts/barlow-condensed-latin-500-normal.woff2 +0 -0
- package/dist/fonts/barlow-condensed-latin-600-normal.woff2 +0 -0
- package/dist/fonts/barlow-condensed-latin-700-normal.woff2 +0 -0
- package/dist/fonts/barlow-condensed-latin-800-normal.woff2 +0 -0
- package/dist/fonts/barlow-latin-400-normal.woff2 +0 -0
- package/dist/fonts/barlow-latin-500-normal.woff2 +0 -0
- package/dist/fonts/barlow-latin-600-normal.woff2 +0 -0
- package/dist/fonts/barlow-latin-700-normal.woff2 +0 -0
- package/dist/fonts/barlow-latin-800-normal.woff2 +0 -0
- package/dist/fonts/fonts.css +18 -0
- package/dist/fonts/outfit-latin-400-normal.woff2 +0 -0
- package/dist/fonts/outfit-latin-500-normal.woff2 +0 -0
- package/dist/fonts/outfit-latin-600-normal.woff2 +0 -0
- package/dist/fonts/outfit-latin-700-normal.woff2 +0 -0
- package/dist/fonts/outfit-latin-800-normal.woff2 +0 -0
- package/dist/homepage-distributor.d.ts +55 -0
- package/dist/homepage-distributor.js +68 -0
- package/dist/instagram-image-template.d.ts +9 -0
- package/dist/instagram-image-template.js +51 -0
- package/dist/json-schema-formats.d.ts +2 -0
- package/dist/json-schema-formats.js +24 -0
- package/dist/layouts.d.ts +14 -0
- package/dist/layouts.js +13 -0
- package/dist/live-program/main.d.ts +1 -0
- package/dist/live-program/main.js +10 -0
- package/dist/live-program-page/index.html +16 -0
- package/dist/live-program-page/live-program.css +3 -0
- package/dist/live-program-page/live-program.js +76 -0
- package/dist/live-program-page/modoitaliano/audio/pipes.ogg +0 -0
- package/dist/live-program-page/modoitaliano/images/berlin.jpg +0 -0
- package/dist/live-program-page/modoitaliano/images/modoitaliano.png +0 -0
- package/dist/live-program-page/modoitaliano/images/nyc.jpg +0 -0
- package/dist/live-program-page/modoitaliano/images/nyse.jpg +0 -0
- package/dist/live-program-page/modoitaliano/images/santiago.jpg +0 -0
- package/dist/live-program-page/modoitaliano/images/seismograph.jpg +0 -0
- package/dist/live-program-page/modoitaliano/images/tokyo.jpg +0 -0
- package/dist/manifest-validation.d.ts +10 -0
- package/dist/manifest-validation.js +27 -0
- package/dist/outlet-config.d.ts +28 -0
- package/dist/outlet-config.js +28 -0
- package/dist/renderer.browser.d.ts +2 -0
- package/dist/renderer.browser.js +140 -0
- package/dist/renderer.core.d.ts +10 -0
- package/dist/renderer.core.js +403 -0
- package/dist/renderer.d.ts +8 -0
- package/dist/renderer.js +5 -0
- package/dist/renderer.node.d.ts +22 -0
- package/dist/renderer.node.js +184 -0
- package/dist/schemas/canonical-document.schema.json +1071 -0
- package/dist/schemas/cronkite-manifest.schema.json +501 -0
- package/dist/schemas/feed-renderable-input.schema.json +13 -0
- package/dist/schemas/search-index.schema.json +27 -0
- package/dist/schemas/search-manifest.schema.json +34 -0
- package/dist/types/canonical-article.d.ts +7 -0
- package/dist/types/canonical-article.js +21 -0
- package/dist/types/canonical-document-schema.generated.d.ts +1634 -0
- package/dist/types/canonical-document-schema.generated.js +1730 -0
- package/dist/types/canonical-document.generated.d.ts +541 -0
- package/dist/types/canonical-document.generated.js +3 -0
- package/dist/types/cronkite-manifest.generated.d.ts +339 -0
- package/dist/types/cronkite-manifest.generated.js +3 -0
- package/dist/utils/sofascore.d.ts +3 -0
- package/dist/utils/sofascore.js +31 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +4 -0
- package/dist/video/Root.d.ts +1 -0
- package/dist/video/Root.js +40 -0
- package/dist/video/ShortVideo.d.ts +3 -0
- package/dist/video/ShortVideo.js +92 -0
- package/dist/video/index.d.ts +2 -0
- package/dist/video/index.js +4 -0
- package/dist/video/types.d.ts +37 -0
- package/dist/video/types.js +1 -0
- package/package.json +121 -0
- package/src/partial-deps.json +53 -0
- package/src/styles/compiled.css +2 -0
- package/src/templates/assets/default-og.jpg +0 -0
- package/src/templates/assets/default-og.png +0 -0
- package/src/templates/assets/mi.svg +6 -0
- package/src/templates/layouts/404.hbs +7 -0
- package/src/templates/layouts/article-page.hbs +7 -0
- package/src/templates/layouts/category-page.hbs +7 -0
- package/src/templates/layouts/coming-soon.hbs +7 -0
- package/src/templates/layouts/homepage.hbs +7 -0
- package/src/templates/layouts/link-in-bio.hbs +228 -0
- package/src/templates/layouts/live-story.hbs +7 -0
- package/src/templates/layouts/media-page.hbs +7 -0
- package/src/templates/layouts/search-page.hbs +7 -0
- package/src/templates/layouts/standalone-page.hbs +7 -0
- package/src/templates/partials/blocks/audio.hbs +12 -0
- package/src/templates/partials/blocks/data-table.hbs +23 -0
- package/src/templates/partials/blocks/divider.hbs +1 -0
- package/src/templates/partials/blocks/heading.hbs +9 -0
- package/src/templates/partials/blocks/image.hbs +6 -0
- package/src/templates/partials/blocks/info-box.hbs +8 -0
- package/src/templates/partials/blocks/instagram.hbs +28 -0
- package/src/templates/partials/blocks/key-points.hbs +8 -0
- package/src/templates/partials/blocks/list.hbs +13 -0
- package/src/templates/partials/blocks/live-update.hbs +24 -0
- package/src/templates/partials/blocks/pull-quote.hbs +6 -0
- package/src/templates/partials/blocks/rich-text.hbs +1 -0
- package/src/templates/partials/blocks/spotify.hbs +14 -0
- package/src/templates/partials/blocks/tiktok.hbs +15 -0
- package/src/templates/partials/blocks/x.hbs +74 -0
- package/src/templates/partials/blocks/youtube.hbs +12 -0
- package/src/templates/partials/components/article-main.hbs +159 -0
- package/src/templates/partials/components/breaking-news/live-updates-column.hbs +29 -0
- package/src/templates/partials/components/breaking-news.hbs +56 -0
- package/src/templates/partials/components/category/header.hbs +5 -0
- package/src/templates/partials/components/category/main-grid.hbs +55 -0
- package/src/templates/partials/components/category/main.hbs +7 -0
- package/src/templates/partials/components/category/more-grid.hbs +26 -0
- package/src/templates/partials/components/coming-soon/main.hbs +14 -0
- package/src/templates/partials/components/editorial-hero.hbs +73 -0
- package/src/templates/partials/components/headline.hbs +15 -0
- package/src/templates/partials/components/hero-editorial.hbs +1 -0
- package/src/templates/partials/components/hero.hbs +1 -0
- package/src/templates/partials/components/home/landing.hbs +111 -0
- package/src/templates/partials/components/home/main.hbs +59 -0
- package/src/templates/partials/components/home/more-stories.hbs +23 -0
- package/src/templates/partials/components/home/must-read.hbs +77 -0
- package/src/templates/partials/components/live-story/main.hbs +229 -0
- package/src/templates/partials/components/media/main.hbs +228 -0
- package/src/templates/partials/components/not-found/main.hbs +28 -0
- package/src/templates/partials/components/search/main.hbs +424 -0
- package/src/templates/partials/components/snack.hbs +92 -0
- package/src/templates/partials/components/spotlight-hero.hbs +59 -0
- package/src/templates/partials/components/standalone-main.hbs +28 -0
- package/src/templates/partials/components/stream-player.hbs +40 -0
- package/src/templates/partials/components/trending.hbs +14 -0
- package/src/templates/partials/components/ui/accordion.hbs +30 -0
- package/src/templates/partials/components/ui/breadcrumb.hbs +16 -0
- package/src/templates/partials/components/ui/icon-button.hbs +19 -0
- package/src/templates/partials/components/ui/loading-spinner.hbs +27 -0
- package/src/templates/partials/components/ui/pagination.hbs +56 -0
- package/src/templates/partials/components/ui/scroll-area.hbs +12 -0
- package/src/templates/partials/components/ui/status-badge.hbs +21 -0
- package/src/templates/partials/footers/footer-full.hbs +73 -0
- package/src/templates/partials/headers/header-main.hbs +477 -0
- package/src/templates/partials/nav/nav-categories.hbs +5 -0
- package/src/templates/partials/shell/doc-end.hbs +637 -0
- package/src/templates/partials/shell/doc-start-404.hbs +42 -0
- package/src/templates/partials/shell/doc-start-standard.hbs +96 -0
- package/src/templates/templates/instagram-image.hbs +177 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
function extractUpdatesFromAuburnaleEvent(updates) {
|
|
2
|
+
if (!updates || updates.length === 0)
|
|
3
|
+
return [];
|
|
4
|
+
return updates.map((u) => {
|
|
5
|
+
let text = '';
|
|
6
|
+
try {
|
|
7
|
+
const parsed = typeof u.content === 'string' ? JSON.parse(u.content) : u.content;
|
|
8
|
+
text = parsed?.root?.children?.[0]?.children?.[0]?.text || '';
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
text = String(u.content || '');
|
|
12
|
+
}
|
|
13
|
+
return {
|
|
14
|
+
timestamp: u.timestamp,
|
|
15
|
+
text: text || 'Actualización disponible',
|
|
16
|
+
};
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
async function fetchFromAuburnale(language) {
|
|
20
|
+
const baseUrl = typeof window !== 'undefined' ? `http://${window.location.hostname}:3000` : 'http://127.0.0.1:3000';
|
|
21
|
+
try {
|
|
22
|
+
const res = await fetch(`${baseUrl}/events?status=published&limit=1&sort=-eventDate&language=${language}`, {
|
|
23
|
+
signal: AbortSignal.timeout(3000),
|
|
24
|
+
});
|
|
25
|
+
if (!res.ok)
|
|
26
|
+
return null;
|
|
27
|
+
const body = await res.json();
|
|
28
|
+
const items = body.data || [];
|
|
29
|
+
const event = items.find((e) => typeof e.sofascore_id === 'number' && e.sofascore_id > 0);
|
|
30
|
+
if (!event)
|
|
31
|
+
return null;
|
|
32
|
+
return {
|
|
33
|
+
category: event.categories?.[0]?.name || 'EVENTO',
|
|
34
|
+
title: event.title,
|
|
35
|
+
excerpt: '',
|
|
36
|
+
image: event.featuredImage?.url || '',
|
|
37
|
+
alt: event.featuredImage?.alt || event.title,
|
|
38
|
+
url: `/${event.slug}`,
|
|
39
|
+
sofascore_id: event.sofascore_id,
|
|
40
|
+
updatedAt: event.eventDate || new Date().toISOString(),
|
|
41
|
+
updates: extractUpdatesFromAuburnaleEvent(event.updates),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export async function fetchLiveEvent(language = 'es') {
|
|
49
|
+
try {
|
|
50
|
+
const response = await fetch(`https://cdn.modoitaliano.fm/content/homepage-current-${language}.json?_=${Date.now()}`, { cache: 'no-store' });
|
|
51
|
+
if (!response.ok) {
|
|
52
|
+
return fetchFromAuburnale(language);
|
|
53
|
+
}
|
|
54
|
+
const data = await response.json();
|
|
55
|
+
const main = data.breakingNews?.main;
|
|
56
|
+
if (!main || !main.title) {
|
|
57
|
+
return fetchFromAuburnale(language);
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
category: main.category || 'EN VIVO',
|
|
61
|
+
title: main.title,
|
|
62
|
+
excerpt: main.excerpt,
|
|
63
|
+
image: main.image || '',
|
|
64
|
+
alt: main.alt || main.title,
|
|
65
|
+
url: main.url || '/',
|
|
66
|
+
liveUrl: main.liveUrl,
|
|
67
|
+
sofascore_id: main.sofascore_id,
|
|
68
|
+
updatedAt: data.updatedAt || new Date().toISOString(),
|
|
69
|
+
updates: data.breakingNews?.updates || [],
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
console.error('Error fetching live event:', error);
|
|
74
|
+
return fetchFromAuburnale(language);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './types.js';
|
|
2
|
+
export * from './usePlaylistEngine.js';
|
|
3
|
+
export { createArticlesSegment, fetchArticles, type NewsItem } from './ArticlesSegment.js';
|
|
4
|
+
export { createWeatherSegment, fetchWeatherData, type WeatherRegionData, type WeatherCityData } from './WeatherSegment.js';
|
|
5
|
+
export { createEarthquakeSegment, fetchEarthquakes, type EarthquakeData } from './EarthquakeSegment.js';
|
|
6
|
+
export * from './MarketsSegment.js';
|
|
7
|
+
export { createLiveEventSegment } from './LiveEventSegment.js';
|
|
8
|
+
export { fetchLiveEvent, type LiveEventData, type LiveEventUpdate } from './fetchLiveEvents.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './types.js';
|
|
2
|
+
export * from './usePlaylistEngine.js';
|
|
3
|
+
export { createArticlesSegment, fetchArticles } from './ArticlesSegment.js';
|
|
4
|
+
export { createWeatherSegment, fetchWeatherData } from './WeatherSegment.js';
|
|
5
|
+
export { createEarthquakeSegment, fetchEarthquakes } from './EarthquakeSegment.js';
|
|
6
|
+
export * from './MarketsSegment.js';
|
|
7
|
+
export { createLiveEventSegment } from './LiveEventSegment.js';
|
|
8
|
+
export { fetchLiveEvent } from './fetchLiveEvents.js';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
export interface Segment {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
itemCount: number;
|
|
6
|
+
durationMsPerItem: number;
|
|
7
|
+
render(itemIndex: number, progress: number): React.ReactNode;
|
|
8
|
+
onEnter?(): void;
|
|
9
|
+
onExit?(): void;
|
|
10
|
+
prefetch?(): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export interface PlaylistState {
|
|
13
|
+
currentSegmentIndex: number;
|
|
14
|
+
currentItemIndex: number;
|
|
15
|
+
progress: number;
|
|
16
|
+
isPaused: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface PlaylistConfig {
|
|
19
|
+
segments: Segment[];
|
|
20
|
+
defaultDurationMs?: number;
|
|
21
|
+
updateIntervalMs?: number;
|
|
22
|
+
onPlaylistLoop?: () => void;
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PlaylistConfig, PlaylistState, Segment } from './types.js';
|
|
2
|
+
export declare function usePlaylistEngine(config: PlaylistConfig): {
|
|
3
|
+
state: PlaylistState;
|
|
4
|
+
currentSegment: Segment | null;
|
|
5
|
+
pause: () => void;
|
|
6
|
+
resume: () => void;
|
|
7
|
+
reset: () => void;
|
|
8
|
+
advanceToNext: () => void;
|
|
9
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { useState, useEffect, useCallback, useRef } from 'react';
|
|
2
|
+
const DEFAULT_DURATION_MS = 10000;
|
|
3
|
+
const DEFAULT_UPDATE_INTERVAL_MS = 100;
|
|
4
|
+
export function usePlaylistEngine(config) {
|
|
5
|
+
const { segments, defaultDurationMs = DEFAULT_DURATION_MS, updateIntervalMs = DEFAULT_UPDATE_INTERVAL_MS, onPlaylistLoop } = config;
|
|
6
|
+
const [state, setState] = useState({
|
|
7
|
+
currentSegmentIndex: 0,
|
|
8
|
+
currentItemIndex: 0,
|
|
9
|
+
progress: 0,
|
|
10
|
+
isPaused: false
|
|
11
|
+
});
|
|
12
|
+
const prevSegmentIndexRef = useRef(0);
|
|
13
|
+
const getCurrentSegment = useCallback(() => {
|
|
14
|
+
if (segments.length === 0)
|
|
15
|
+
return null;
|
|
16
|
+
return segments[state.currentSegmentIndex] || null;
|
|
17
|
+
}, [segments, state.currentSegmentIndex]);
|
|
18
|
+
const pause = useCallback(() => {
|
|
19
|
+
setState((prev) => ({ ...prev, isPaused: true }));
|
|
20
|
+
}, []);
|
|
21
|
+
const resume = useCallback(() => {
|
|
22
|
+
setState((prev) => ({ ...prev, isPaused: false }));
|
|
23
|
+
}, []);
|
|
24
|
+
const reset = useCallback(() => {
|
|
25
|
+
setState({
|
|
26
|
+
currentSegmentIndex: 0,
|
|
27
|
+
currentItemIndex: 0,
|
|
28
|
+
progress: 0,
|
|
29
|
+
isPaused: false
|
|
30
|
+
});
|
|
31
|
+
}, []);
|
|
32
|
+
const calculateNextState = useCallback((prevState) => {
|
|
33
|
+
const currentSegment = segments[prevState.currentSegmentIndex];
|
|
34
|
+
if (!currentSegment) {
|
|
35
|
+
return prevState;
|
|
36
|
+
}
|
|
37
|
+
const nextItemIndex = prevState.currentItemIndex + 1;
|
|
38
|
+
if (nextItemIndex >= currentSegment.itemCount) {
|
|
39
|
+
const nextSegmentIndex = (prevState.currentSegmentIndex + 1) % segments.length;
|
|
40
|
+
return {
|
|
41
|
+
...prevState,
|
|
42
|
+
currentSegmentIndex: nextSegmentIndex,
|
|
43
|
+
currentItemIndex: 0,
|
|
44
|
+
progress: 0
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
...prevState,
|
|
49
|
+
currentItemIndex: nextItemIndex,
|
|
50
|
+
progress: 0
|
|
51
|
+
};
|
|
52
|
+
}, [segments]);
|
|
53
|
+
const advanceToNext = useCallback(() => {
|
|
54
|
+
setState((prevState) => calculateNextState(prevState));
|
|
55
|
+
}, [calculateNextState]);
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
const currentSegmentIndex = state.currentSegmentIndex;
|
|
58
|
+
const previousSegmentIndex = prevSegmentIndexRef.current;
|
|
59
|
+
if (currentSegmentIndex !== previousSegmentIndex) {
|
|
60
|
+
const previousSegment = segments[previousSegmentIndex];
|
|
61
|
+
previousSegment?.onExit?.();
|
|
62
|
+
const currentSegment = segments[currentSegmentIndex];
|
|
63
|
+
currentSegment?.onEnter?.();
|
|
64
|
+
const nextSegmentIndex = (currentSegmentIndex + 1) % segments.length;
|
|
65
|
+
const nextSegment = segments[nextSegmentIndex];
|
|
66
|
+
nextSegment?.prefetch?.().catch((error) => {
|
|
67
|
+
console.error(`[Playlist] Failed to prefetch ${nextSegment.label}:`, error);
|
|
68
|
+
});
|
|
69
|
+
if (currentSegmentIndex === 0 &&
|
|
70
|
+
previousSegmentIndex === segments.length - 1 &&
|
|
71
|
+
segments.length > 0) {
|
|
72
|
+
onPlaylistLoop?.();
|
|
73
|
+
}
|
|
74
|
+
prevSegmentIndexRef.current = currentSegmentIndex;
|
|
75
|
+
}
|
|
76
|
+
}, [state.currentSegmentIndex, segments, onPlaylistLoop]);
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
if (state.isPaused || segments.length === 0) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const currentSegment = segments[state.currentSegmentIndex];
|
|
82
|
+
if (!currentSegment) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const duration = currentSegment.durationMsPerItem || defaultDurationMs;
|
|
86
|
+
const progressIncrement = (updateIntervalMs / duration) * 100;
|
|
87
|
+
const timer = setInterval(() => {
|
|
88
|
+
setState((prevState) => {
|
|
89
|
+
if (prevState.progress >= 100) {
|
|
90
|
+
return calculateNextState(prevState);
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
...prevState,
|
|
94
|
+
progress: prevState.progress + progressIncrement
|
|
95
|
+
};
|
|
96
|
+
});
|
|
97
|
+
}, updateIntervalMs);
|
|
98
|
+
return () => clearInterval(timer);
|
|
99
|
+
}, [state.isPaused, state.currentSegmentIndex, segments, defaultDurationMs, updateIntervalMs, calculateNextState]);
|
|
100
|
+
return {
|
|
101
|
+
state,
|
|
102
|
+
currentSegment: getCurrentSegment(),
|
|
103
|
+
pause,
|
|
104
|
+
resume,
|
|
105
|
+
reset,
|
|
106
|
+
advanceToNext
|
|
107
|
+
};
|
|
108
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface GlobalTimeOverride {
|
|
2
|
+
startTime: string;
|
|
3
|
+
startedAt: string;
|
|
4
|
+
}
|
|
5
|
+
interface ClockParts {
|
|
6
|
+
hours: number;
|
|
7
|
+
minutes: number;
|
|
8
|
+
seconds: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function getOverrideClockParts(override: GlobalTimeOverride, now?: Date): ClockParts | null;
|
|
11
|
+
export declare function formatClockParts(parts: ClockParts): string;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
function parseStartTime(startTime) {
|
|
2
|
+
const match = /^([01]\d|2[0-3]):([0-5]\d)$/.exec(startTime.trim());
|
|
3
|
+
if (!match) {
|
|
4
|
+
return null;
|
|
5
|
+
}
|
|
6
|
+
return {
|
|
7
|
+
hours: Number(match[1]),
|
|
8
|
+
minutes: Number(match[2]),
|
|
9
|
+
seconds: 0,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export function getOverrideClockParts(override, now = new Date()) {
|
|
13
|
+
const parsed = parseStartTime(override.startTime);
|
|
14
|
+
if (!parsed) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
const startedAtMillis = new Date(override.startedAt).getTime();
|
|
18
|
+
if (!Number.isFinite(startedAtMillis)) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
const startSeconds = parsed.hours * 3600 + parsed.minutes * 60;
|
|
22
|
+
const elapsedSeconds = Math.max(0, Math.floor((now.getTime() - startedAtMillis) / 1000));
|
|
23
|
+
const totalSeconds = (startSeconds + elapsedSeconds) % 86400;
|
|
24
|
+
const hours = Math.floor(totalSeconds / 3600);
|
|
25
|
+
const minutes = Math.floor((totalSeconds % 3600) / 60);
|
|
26
|
+
const seconds = totalSeconds % 60;
|
|
27
|
+
return { hours, minutes, seconds };
|
|
28
|
+
}
|
|
29
|
+
export function formatClockParts(parts) {
|
|
30
|
+
const hours = String(parts.hours).padStart(2, '0');
|
|
31
|
+
const minutes = String(parts.minutes).padStart(2, '0');
|
|
32
|
+
return `${hours}:${minutes}`;
|
|
33
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export declare const cronkiteManifest: {
|
|
2
|
+
readonly contract: "cronkite.cls";
|
|
3
|
+
readonly contractVersion: 1;
|
|
4
|
+
readonly package: "@modoitaliano/giorgia";
|
|
5
|
+
readonly version: string;
|
|
6
|
+
readonly layouts: ["article-page" | "homepage" | "category-page" | "search-page" | "404" | "coming-soon" | "live-story" | "link-in-bio" | "media-page" | "standalone-page", ...("article-page" | "homepage" | "category-page" | "search-page" | "404" | "coming-soon" | "live-story" | "link-in-bio" | "media-page" | "standalone-page")[]];
|
|
7
|
+
readonly languages: ["es", "en", "it"];
|
|
8
|
+
readonly collections: {
|
|
9
|
+
readonly "article-page": "json/articles";
|
|
10
|
+
readonly "standalone-page": "json/pages";
|
|
11
|
+
};
|
|
12
|
+
readonly systemPages: import("./types/cronkite-manifest.generated.js").SystemPage[];
|
|
13
|
+
readonly renderables: {
|
|
14
|
+
readonly homepage: {
|
|
15
|
+
readonly engine: "handlebars";
|
|
16
|
+
readonly export: "render";
|
|
17
|
+
readonly contentType: "text/html; charset=utf-8";
|
|
18
|
+
readonly inputSchema: "dist/schemas/feed-renderable-input.schema.json";
|
|
19
|
+
};
|
|
20
|
+
readonly "category-page": {
|
|
21
|
+
readonly engine: "handlebars";
|
|
22
|
+
readonly export: "render";
|
|
23
|
+
readonly contentType: "text/html; charset=utf-8";
|
|
24
|
+
readonly inputSchema: "dist/schemas/feed-renderable-input.schema.json";
|
|
25
|
+
};
|
|
26
|
+
readonly "search-page": {
|
|
27
|
+
readonly engine: "handlebars";
|
|
28
|
+
readonly export: "render";
|
|
29
|
+
readonly outputMode: "single";
|
|
30
|
+
readonly lifecycle: "request";
|
|
31
|
+
readonly contentType: "text/html; charset=utf-8";
|
|
32
|
+
readonly inputSchema: "dist/schemas/feed-renderable-input.schema.json";
|
|
33
|
+
readonly resources: {
|
|
34
|
+
readonly "search-manifest": {
|
|
35
|
+
readonly key: "search-manifest-{language}.json";
|
|
36
|
+
readonly schema: "dist/schemas/search-manifest.schema.json";
|
|
37
|
+
readonly contentType: "application/json";
|
|
38
|
+
readonly perLanguage: true;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
readonly "link-in-bio": {
|
|
43
|
+
readonly engine: "handlebars";
|
|
44
|
+
readonly export: "render";
|
|
45
|
+
readonly contentType: "text/html; charset=utf-8";
|
|
46
|
+
readonly inputSchema: "dist/schemas/feed-renderable-input.schema.json";
|
|
47
|
+
};
|
|
48
|
+
readonly "social-image": {
|
|
49
|
+
readonly engine: "html-raster";
|
|
50
|
+
readonly export: "buildInstagramImageHtml";
|
|
51
|
+
readonly contentType: "image/jpeg";
|
|
52
|
+
readonly width: 1080;
|
|
53
|
+
readonly height: 1350;
|
|
54
|
+
};
|
|
55
|
+
readonly "short-video": {
|
|
56
|
+
readonly engine: "remotion";
|
|
57
|
+
readonly entry: "dist/video/index.js";
|
|
58
|
+
readonly compositionId: "ModoItalianoShort";
|
|
59
|
+
readonly contentType: "video/mp4";
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
readonly capabilities: {
|
|
63
|
+
readonly fonts: {
|
|
64
|
+
readonly export: "fontFiles";
|
|
65
|
+
};
|
|
66
|
+
readonly assets: {
|
|
67
|
+
readonly export: "assetFiles";
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
};
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { layoutNames } from "./layouts.js";
|
|
2
|
+
import { outletConfig } from "./outlet-config.js";
|
|
3
|
+
import { version } from "./version.js";
|
|
4
|
+
const systemPages = [
|
|
5
|
+
{
|
|
6
|
+
layout: "404",
|
|
7
|
+
route: "/{language}/404",
|
|
8
|
+
key: "html/{language}/404/index.html",
|
|
9
|
+
cacheControl: "public, max-age=0, must-revalidate",
|
|
10
|
+
perLanguage: true,
|
|
11
|
+
copy: {
|
|
12
|
+
es: {
|
|
13
|
+
title: "Página no encontrada",
|
|
14
|
+
description: "La página que buscas no existe.",
|
|
15
|
+
},
|
|
16
|
+
en: {
|
|
17
|
+
title: "Page Not Found",
|
|
18
|
+
description: "The page you are looking for does not exist.",
|
|
19
|
+
},
|
|
20
|
+
it: {
|
|
21
|
+
title: "Pagina non trovata",
|
|
22
|
+
description: "La pagina che stai cercando non esiste.",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
layout: "search-page",
|
|
28
|
+
route: "/{language}/search",
|
|
29
|
+
key: "html/{language}/search/index.html",
|
|
30
|
+
cacheControl: "public, max-age=0, must-revalidate",
|
|
31
|
+
perLanguage: true,
|
|
32
|
+
copy: {
|
|
33
|
+
es: {
|
|
34
|
+
title: "Buscar",
|
|
35
|
+
description: outletConfig.searchDescriptions.es,
|
|
36
|
+
},
|
|
37
|
+
en: {
|
|
38
|
+
title: "Search",
|
|
39
|
+
description: outletConfig.searchDescriptions.en,
|
|
40
|
+
},
|
|
41
|
+
it: {
|
|
42
|
+
title: "Cerca",
|
|
43
|
+
description: outletConfig.searchDescriptions.it,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
layout: "coming-soon",
|
|
49
|
+
route: "/{language}/coming-soon",
|
|
50
|
+
key: "html/{language}/coming-soon/index.html",
|
|
51
|
+
cacheControl: "public, max-age=0, must-revalidate",
|
|
52
|
+
perLanguage: true,
|
|
53
|
+
copy: {
|
|
54
|
+
es: {
|
|
55
|
+
title: "Próximamente",
|
|
56
|
+
description: "Estamos preparando algo especial. Vuelve pronto para descubrirlo.",
|
|
57
|
+
},
|
|
58
|
+
en: {
|
|
59
|
+
title: "Coming soon",
|
|
60
|
+
description: "We are preparing something special. Come back soon.",
|
|
61
|
+
},
|
|
62
|
+
it: {
|
|
63
|
+
title: "Prossimamente",
|
|
64
|
+
description: "Stiamo preparando qualcosa di speciale. Torna presto.",
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
];
|
|
69
|
+
export const cronkiteManifest = {
|
|
70
|
+
contract: "cronkite.cls",
|
|
71
|
+
contractVersion: 1,
|
|
72
|
+
package: "@modoitaliano/giorgia",
|
|
73
|
+
version,
|
|
74
|
+
layouts: [...layoutNames],
|
|
75
|
+
languages: [...outletConfig.supportedLanguages],
|
|
76
|
+
collections: {
|
|
77
|
+
"article-page": "json/articles",
|
|
78
|
+
"standalone-page": "json/pages",
|
|
79
|
+
},
|
|
80
|
+
systemPages,
|
|
81
|
+
renderables: {
|
|
82
|
+
homepage: {
|
|
83
|
+
engine: "handlebars",
|
|
84
|
+
export: "render",
|
|
85
|
+
contentType: "text/html; charset=utf-8",
|
|
86
|
+
inputSchema: "dist/schemas/feed-renderable-input.schema.json",
|
|
87
|
+
},
|
|
88
|
+
"category-page": {
|
|
89
|
+
engine: "handlebars",
|
|
90
|
+
export: "render",
|
|
91
|
+
contentType: "text/html; charset=utf-8",
|
|
92
|
+
inputSchema: "dist/schemas/feed-renderable-input.schema.json",
|
|
93
|
+
},
|
|
94
|
+
"search-page": {
|
|
95
|
+
engine: "handlebars",
|
|
96
|
+
export: "render",
|
|
97
|
+
outputMode: "single",
|
|
98
|
+
lifecycle: "request",
|
|
99
|
+
contentType: "text/html; charset=utf-8",
|
|
100
|
+
inputSchema: "dist/schemas/feed-renderable-input.schema.json",
|
|
101
|
+
resources: {
|
|
102
|
+
"search-manifest": {
|
|
103
|
+
key: "search-manifest-{language}.json",
|
|
104
|
+
schema: "dist/schemas/search-manifest.schema.json",
|
|
105
|
+
contentType: "application/json",
|
|
106
|
+
perLanguage: true,
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
"link-in-bio": {
|
|
111
|
+
engine: "handlebars",
|
|
112
|
+
export: "render",
|
|
113
|
+
contentType: "text/html; charset=utf-8",
|
|
114
|
+
inputSchema: "dist/schemas/feed-renderable-input.schema.json",
|
|
115
|
+
},
|
|
116
|
+
"social-image": {
|
|
117
|
+
engine: "html-raster",
|
|
118
|
+
export: "buildInstagramImageHtml",
|
|
119
|
+
contentType: "image/jpeg",
|
|
120
|
+
width: 1080,
|
|
121
|
+
height: 1350,
|
|
122
|
+
},
|
|
123
|
+
"short-video": {
|
|
124
|
+
engine: "remotion",
|
|
125
|
+
entry: "dist/video/index.js",
|
|
126
|
+
compositionId: "ModoItalianoShort",
|
|
127
|
+
contentType: "video/mp4",
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
capabilities: {
|
|
131
|
+
fonts: { export: "fontFiles" },
|
|
132
|
+
assets: { export: "assetFiles" },
|
|
133
|
+
},
|
|
134
|
+
};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
{
|
|
2
|
+
"contract": "cronkite.cls",
|
|
3
|
+
"contractVersion": 1,
|
|
4
|
+
"package": "@modoitaliano/giorgia",
|
|
5
|
+
"version": "0.1.100",
|
|
6
|
+
"layouts": [
|
|
7
|
+
"404",
|
|
8
|
+
"article-page",
|
|
9
|
+
"homepage",
|
|
10
|
+
"category-page",
|
|
11
|
+
"search-page",
|
|
12
|
+
"coming-soon",
|
|
13
|
+
"live-story",
|
|
14
|
+
"link-in-bio",
|
|
15
|
+
"media-page",
|
|
16
|
+
"standalone-page"
|
|
17
|
+
],
|
|
18
|
+
"languages": [
|
|
19
|
+
"es",
|
|
20
|
+
"en",
|
|
21
|
+
"it"
|
|
22
|
+
],
|
|
23
|
+
"collections": {
|
|
24
|
+
"article-page": "json/articles",
|
|
25
|
+
"standalone-page": "json/pages"
|
|
26
|
+
},
|
|
27
|
+
"systemPages": [
|
|
28
|
+
{
|
|
29
|
+
"layout": "404",
|
|
30
|
+
"route": "/{language}/404",
|
|
31
|
+
"key": "html/{language}/404/index.html",
|
|
32
|
+
"cacheControl": "public, max-age=0, must-revalidate",
|
|
33
|
+
"perLanguage": true,
|
|
34
|
+
"copy": {
|
|
35
|
+
"es": {
|
|
36
|
+
"title": "Página no encontrada",
|
|
37
|
+
"description": "La página que buscas no existe."
|
|
38
|
+
},
|
|
39
|
+
"en": {
|
|
40
|
+
"title": "Page Not Found",
|
|
41
|
+
"description": "The page you are looking for does not exist."
|
|
42
|
+
},
|
|
43
|
+
"it": {
|
|
44
|
+
"title": "Pagina non trovata",
|
|
45
|
+
"description": "La pagina che stai cercando non esiste."
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"layout": "search-page",
|
|
51
|
+
"route": "/{language}/search",
|
|
52
|
+
"key": "html/{language}/search/index.html",
|
|
53
|
+
"cacheControl": "public, max-age=0, must-revalidate",
|
|
54
|
+
"perLanguage": true,
|
|
55
|
+
"copy": {
|
|
56
|
+
"es": {
|
|
57
|
+
"title": "Buscar",
|
|
58
|
+
"description": "Busca noticias de ModoItaliano."
|
|
59
|
+
},
|
|
60
|
+
"en": {
|
|
61
|
+
"title": "Search",
|
|
62
|
+
"description": "Search ModoItaliano news."
|
|
63
|
+
},
|
|
64
|
+
"it": {
|
|
65
|
+
"title": "Cerca",
|
|
66
|
+
"description": "Cerca le notizie di ModoItaliano."
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"layout": "coming-soon",
|
|
72
|
+
"route": "/{language}/coming-soon",
|
|
73
|
+
"key": "html/{language}/coming-soon/index.html",
|
|
74
|
+
"cacheControl": "public, max-age=0, must-revalidate",
|
|
75
|
+
"perLanguage": true,
|
|
76
|
+
"copy": {
|
|
77
|
+
"es": {
|
|
78
|
+
"title": "Próximamente",
|
|
79
|
+
"description": "Estamos preparando algo especial. Vuelve pronto para descubrirlo."
|
|
80
|
+
},
|
|
81
|
+
"en": {
|
|
82
|
+
"title": "Coming soon",
|
|
83
|
+
"description": "We are preparing something special. Come back soon."
|
|
84
|
+
},
|
|
85
|
+
"it": {
|
|
86
|
+
"title": "Prossimamente",
|
|
87
|
+
"description": "Stiamo preparando qualcosa di speciale. Torna presto."
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
],
|
|
92
|
+
"renderables": {
|
|
93
|
+
"homepage": {
|
|
94
|
+
"engine": "handlebars",
|
|
95
|
+
"export": "render",
|
|
96
|
+
"contentType": "text/html; charset=utf-8",
|
|
97
|
+
"inputSchema": "dist/schemas/feed-renderable-input.schema.json"
|
|
98
|
+
},
|
|
99
|
+
"category-page": {
|
|
100
|
+
"engine": "handlebars",
|
|
101
|
+
"export": "render",
|
|
102
|
+
"contentType": "text/html; charset=utf-8",
|
|
103
|
+
"inputSchema": "dist/schemas/feed-renderable-input.schema.json"
|
|
104
|
+
},
|
|
105
|
+
"search-page": {
|
|
106
|
+
"engine": "handlebars",
|
|
107
|
+
"export": "render",
|
|
108
|
+
"outputMode": "single",
|
|
109
|
+
"lifecycle": "request",
|
|
110
|
+
"contentType": "text/html; charset=utf-8",
|
|
111
|
+
"inputSchema": "dist/schemas/feed-renderable-input.schema.json",
|
|
112
|
+
"resources": {
|
|
113
|
+
"search-manifest": {
|
|
114
|
+
"key": "search-manifest-{language}.json",
|
|
115
|
+
"schema": "dist/schemas/search-manifest.schema.json",
|
|
116
|
+
"contentType": "application/json",
|
|
117
|
+
"perLanguage": true
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"link-in-bio": {
|
|
122
|
+
"engine": "handlebars",
|
|
123
|
+
"export": "render",
|
|
124
|
+
"contentType": "text/html; charset=utf-8",
|
|
125
|
+
"inputSchema": "dist/schemas/feed-renderable-input.schema.json"
|
|
126
|
+
},
|
|
127
|
+
"social-image": {
|
|
128
|
+
"engine": "html-raster",
|
|
129
|
+
"export": "buildInstagramImageHtml",
|
|
130
|
+
"contentType": "image/jpeg",
|
|
131
|
+
"width": 1080,
|
|
132
|
+
"height": 1350
|
|
133
|
+
},
|
|
134
|
+
"short-video": {
|
|
135
|
+
"engine": "remotion",
|
|
136
|
+
"entry": "dist/video/index.js",
|
|
137
|
+
"compositionId": "ModoItalianoShort",
|
|
138
|
+
"contentType": "video/mp4"
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
"capabilities": {
|
|
142
|
+
"fonts": {
|
|
143
|
+
"export": "fontFiles"
|
|
144
|
+
},
|
|
145
|
+
"assets": {
|
|
146
|
+
"export": "assetFiles"
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|