({ params }: { params: { trackIds: string[] } })
| 68 | |
| 69 | export default async function TrackComponent({ params }: { params: { trackIds: string[] } }) { |
| 70 | const trackId: string = params.trackIds[0] || ""; |
| 71 | const problemId = params.trackIds[1]; |
| 72 | let notionRecordMap = null; |
| 73 | if (trackId === "43XrfL4n0LgSnTkSB4rO") { |
| 74 | redirect("/tracks/oAjvkeRNZThPMxZf4aX5"); |
| 75 | } |
| 76 | |
| 77 | const [problemDetails, trackDetails] = await Promise.all([getProblem(problemId || null), getTrack(trackId)]); |
| 78 | |
| 79 | if (trackDetails && !problemId) { |
| 80 | return <RedirectToLastSolved trackId={trackId} />; |
| 81 | } |
| 82 | |
| 83 | if (problemDetails?.notionDocId) { |
| 84 | notionRecordMap = await fetchNotionPage(notion, problemDetails.notionDocId); |
| 85 | } |
| 86 | |
| 87 | if (trackDetails && problemDetails) { |
| 88 | return ( |
| 89 | <LessonView |
| 90 | showAppBar |
| 91 | showPagination |
| 92 | track={trackDetails} |
| 93 | problem={{ |
| 94 | ...problemDetails, |
| 95 | notionRecordMap, |
| 96 | }} |
| 97 | /> |
| 98 | ); |
| 99 | } else { |
| 100 | notFound(); |
| 101 | } |
| 102 | } |
nothing calls this directly
no test coverage detected