import { Navigate, useLocation } from 'react-router-dom'
import { brandIdFromSearch } from '../lib/placementFlow'
import { PersonaOutreachPage } from '../pages/PersonaOutreachPage'

/** /outreach 僅為找 TA 留言工作台，需 ?brand=；否則導向置入主題列表 */
export function OutreachEntryRoute() {
  const { search } = useLocation()
  const brandId = brandIdFromSearch(search)
  if (!brandId) {
    return <Navigate to="/placement/topics" replace />
  }
  return <PersonaOutreachPage />
}