fix(chat): extract SLIDE_ORDER to shared module for server-side import

useSlideNavigation.ts has 'use client' — server API routes can't import
from it. Move SLIDE_ORDER to lib/slide-order.ts (no 'use client') and
re-export from useSlideNavigation for backwards compat.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-03-20 15:02:06 +01:00
parent 9da9b323fc
commit fa4027d027
3 changed files with 30 additions and 26 deletions

View File

@@ -1,6 +1,6 @@
import { NextRequest, NextResponse } from 'next/server' import { NextRequest, NextResponse } from 'next/server'
import pool from '@/lib/db' import pool from '@/lib/db'
import { SLIDE_ORDER } from '@/lib/hooks/useSlideNavigation' import { SLIDE_ORDER } from '@/lib/slide-order'
const LITELLM_URL = process.env.LITELLM_URL || 'https://llm-dev.meghsakha.com' const LITELLM_URL = process.env.LITELLM_URL || 'https://llm-dev.meghsakha.com'
const LITELLM_MODEL = process.env.LITELLM_MODEL || 'gpt-oss-120b' const LITELLM_MODEL = process.env.LITELLM_MODEL || 'gpt-oss-120b'

View File

@@ -1,32 +1,10 @@
'use client' 'use client'
import { useState, useCallback } from 'react' import { useState, useCallback } from 'react'
import { SlideId } from '../types' import { SLIDE_ORDER, TOTAL_SLIDES } from '../slide-order'
export const SLIDE_ORDER: SlideId[] = [ // Re-export for backwards compatibility
'intro-presenter', export { SLIDE_ORDER, TOTAL_SLIDES }
'cover',
'problem',
'solution',
'product',
'how-it-works',
'market',
'business-model',
'traction',
'competition',
'team',
'financials',
'the-ask',
'ai-qa',
'annex-assumptions',
'annex-architecture',
'annex-gtm',
'annex-regulatory',
'annex-engineering',
'annex-aipipeline',
]
export const TOTAL_SLIDES = SLIDE_ORDER.length
export function useSlideNavigation() { export function useSlideNavigation() {
const [currentIndex, setCurrentIndex] = useState(0) const [currentIndex, setCurrentIndex] = useState(0)

View File

@@ -0,0 +1,26 @@
import { SlideId } from './types'
export const SLIDE_ORDER: SlideId[] = [
'intro-presenter',
'cover',
'problem',
'solution',
'product',
'how-it-works',
'market',
'business-model',
'traction',
'competition',
'team',
'financials',
'the-ask',
'ai-qa',
'annex-assumptions',
'annex-architecture',
'annex-gtm',
'annex-regulatory',
'annex-engineering',
'annex-aipipeline',
]
export const TOTAL_SLIDES = SLIDE_ORDER.length