diff --git a/data/study-reminders.json b/data/study-reminders.json index caa9aa5..f997697 100644 --- a/data/study-reminders.json +++ b/data/study-reminders.json @@ -1,4 +1,4 @@ { "users": {}, - "updatedAt": "2026-06-08T20:46:20.016Z" + "updatedAt": "2026-06-09T13:41:20.565Z" } \ No newline at end of file diff --git a/src/components/GlobalSearch.tsx b/src/components/GlobalSearch.tsx index da98da9..7deef6b 100644 --- a/src/components/GlobalSearch.tsx +++ b/src/components/GlobalSearch.tsx @@ -52,7 +52,7 @@ export function GlobalSearch({ query, setQuery, results }: Props) { function handleSelect(result: SearchResult) { setOpen(false) setQuery('') - if (result.type === 'episode' && result.href.startsWith('http')) { + if (result.href.startsWith('http')) { window.open(result.href, '_blank', 'noreferrer') } else { navigate(result.href) diff --git a/src/hooks/useGlobalSearch.ts b/src/hooks/useGlobalSearch.ts index 90b2273..2d319ae 100644 --- a/src/hooks/useGlobalSearch.ts +++ b/src/hooks/useGlobalSearch.ts @@ -53,18 +53,27 @@ export function useGlobalSearch(content: SiteContent) { fetch('/api/episodes/all') .then(r => r.ok ? r.json() : Promise.reject()) .then((data: { episodes?: Array<{ title: string; link: string; description?: string; episode?: string }> }) => { - const eps: SearchResult[] = (data.episodes ?? []).map(ep => ({ - id: `episode-${ep.episode ?? ep.title}`, - type: 'episode' as const, - title: ep.title, - subtitle: ep.episode ? `Episode ${ep.episode}` : 'Episode', - description: ep.description, - href: ep.link || '/episodes', - })) + const eps: SearchResult[] = (data.episodes ?? []).map(ep => { + // Check if there's a matching podcastFeaturedLink highlight page for this episode number + const highlight = content.podcastFeaturedLinks?.find( + f => f.episodeNumber && ep.episode && String(f.episodeNumber) === String(ep.episode) + ) + const hasRichPage = highlight && !!( + highlight.embedUrl || highlight.showNotes || (highlight.discussionQuestions ?? []).length > 0 + ) + return { + id: `episode-${ep.episode ?? ep.title}`, + type: 'episode' as const, + title: ep.title, + subtitle: ep.episode ? `Episode ${ep.episode}` : 'Episode', + description: ep.description, + href: hasRichPage ? `/episodes/${highlight!.id}` : (ep.link || '/episodes'), + } + }) setEpisodeItems(eps) }) .catch(() => {}) - }, []) + }, [content.podcastFeaturedLinks]) // Debounced server-side script search — runs whenever query changes useEffect(() => { @@ -104,7 +113,7 @@ export function useGlobalSearch(content: SiteContent) { title: link.label, subtitle: link.placement === 'resources' ? 'Download' : 'Resource', description: link.description, - href: `/downloads/${link.id}`, + href: `/downloads/custom--${link.id}`, }) } }