All files / web/src/lib/page-spots spotDefinitions.ts

0% Statements 0/85
0% Branches 0/1
0% Functions 0/1
0% Lines 0/85

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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86                                                                                                                                                                           
/**
 * Spot definition registry — declares which spots exist on which pages.
 *
 * Definitions are static metadata; config (prompt, component choice, etc.)
 * lives in content/page-spots/{pageId}.json and is managed via the admin UI.
 */

export interface SpotDefinition {
  /** Unique spot ID within its page (kebab-case) */
  id: string
  /** Human-readable label for admin UI */
  label: string
  /** Description of where/how the spot is used */
  description: string
  /** Suggested aspect ratio for rendering (CSS string, e.g. "16 / 9") */
  aspectRatio?: string
}

export interface PageSpotGroup {
  /** Unique page ID (kebab-case, e.g. "home") */
  pageId: string
  /** Human-readable page name */
  label: string
  /** Spots declared for this page */
  spots: SpotDefinition[]
}

// ---------------------------------------------------------------------------
// Registry
// ---------------------------------------------------------------------------

const PAGE_SPOT_GROUPS: PageSpotGroup[] = [
  {
    pageId: 'home',
    label: 'Home Page',
    spots: [
      {
        id: 'hero',
        label: 'Hero',
        description: 'Main hero area at the top of the home page',
        aspectRatio: '2.4 / 1',
      },
      {
        id: 'feature-1',
        label: 'Feature 1',
        description: 'First feature showcase section',
        aspectRatio: '16 / 9',
      },
      {
        id: 'feature-2',
        label: 'Feature 2',
        description: 'Second feature showcase section',
        aspectRatio: '16 / 9',
      },
      {
        id: 'feature-3',
        label: 'Feature 3',
        description: 'Third feature showcase section',
        aspectRatio: '16 / 9',
      },
      {
        id: 'cta',
        label: 'Call to Action',
        description: 'Visual content for the call-to-action section',
        aspectRatio: '3 / 1',
      },
    ],
  },
]

// ---------------------------------------------------------------------------
// Helpers
// ---------------------------------------------------------------------------

export function getAllPageSpotGroups(): PageSpotGroup[] {
  return PAGE_SPOT_GROUPS
}

export function getPageSpotGroup(pageId: string): PageSpotGroup | undefined {
  return PAGE_SPOT_GROUPS.find((g) => g.pageId === pageId)
}

export function getSpotDefinition(pageId: string, spotId: string): SpotDefinition | undefined {
  return getPageSpotGroup(pageId)?.spots.find((s) => s.id === spotId)
}