Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | import { getPageSpotGroup } from './spotDefinitions' import { loadPageSpotConfig, loadSpotHtml, spotImageExists, spotImageUrl } from './loadSpotConfig' import type { ResolvedSpot } from './types' /** * Resolve all spots for a page — loads config, HTML, and image URLs so that * a server component can pass fully-resolved data to client components. */ export function resolvePageSpots( pageId: string ): Array<{ spotId: string; resolved: ResolvedSpot | null }> { const group = getPageSpotGroup(pageId) if (!group) return [] const configMap = loadPageSpotConfig(pageId) return group.spots.map((def) => { const config = configMap[def.id] if (!config) return { spotId: def.id, resolved: null } switch (config.type) { case 'generated': return { spotId: def.id, resolved: { type: 'generated', config, imageUrl: spotImageExists(pageId, def.id) ? spotImageUrl(pageId, def.id) : null, }, } case 'component': return { spotId: def.id, resolved: { type: 'component', config }, } case 'html': return { spotId: def.id, resolved: { type: 'html', config, html: loadSpotHtml(pageId, def.id), }, } } }) } |