diff --git a/src/pages/break-dk/menu/[confDay].tsx b/src/pages/break-dk/menu/[confDay].tsx index af71f0d..b85cc28 100644 --- a/src/pages/break-dk/menu/[confDay].tsx +++ b/src/pages/break-dk/menu/[confDay].tsx @@ -1,7 +1,7 @@ import { useGetTalksAndTracksForMenu } from '@/components/hooks/useGetTalksAndTracks' import { MenuView } from '@/components/models/talkView' import config, { extendConfig } from '@/config' -import { Talk } from '@/generated/dreamkast-api.generated' +import type { Talk } from '@/data/types' import { getTimeStr } from '@/utils/time' import { Optional } from '@/utils/types' import Link from 'next/link' diff --git a/src/pages/break/menu/[confDay].tsx b/src/pages/break/menu/[confDay].tsx index f1de896..e50dfec 100644 --- a/src/pages/break/menu/[confDay].tsx +++ b/src/pages/break/menu/[confDay].tsx @@ -1,12 +1,14 @@ -import { useGetTalksAndTracksForMenu } from '@/components/hooks/useGetTalksAndTracks' import { MenuView } from '@/components/models/talkView' import config, { extendConfig } from '@/config' -import { Talk } from '@/generated/dreamkast-api.generated' +import type { Talk } from '@/data/types' import { getTimeStr } from '@/utils/time' import { Optional } from '@/utils/types' import Link from 'next/link' import { useRouter } from 'next/router' import { useEffect } from 'react' +import { talks } from '@/data/talks' +import { tracks } from '@/data/tracks' +import { speakers } from '@/data/speakers' export default function Index() { const router = useRouter() @@ -16,14 +18,8 @@ export default function Index() { }, [router.query]) const { eventAbbr } = config - const { isLoading, view } = useGetTalksAndTracksForMenu( - eventAbbr as Optional, - confDay as Optional - ) + const view = MenuView.withoutDk(confDay as string, talks, tracks, speakers) - if (isLoading) { - return
Loading...
- } return (
diff --git a/src/pages/break/talks/[talkId].tsx b/src/pages/break/talks/[talkId].tsx index e44463e..1a25651 100644 --- a/src/pages/break/talks/[talkId].tsx +++ b/src/pages/break/talks/[talkId].tsx @@ -3,11 +3,14 @@ import Page1 from '@/components/Page1' import Page2, { AvatarPreLoader } from '@/components/Page2' import Page3 from '@/components/Page3' import Page4 from '@/components/Page4' -import { useGetTalksAndTracks } from '@/components/hooks/useGetTalksAndTracks' import { PageCtx, PageCtxProvider } from '@/components/models/pageContext' +import { TalkView } from '@/components/models/talkView' import config, { extendConfig } from '@/config' +import { speakers } from '@/data/speakers' +import { talks } from '@/data/talks' +import { tracks } from '@/data/tracks' import { useRouter } from 'next/router' -import { useContext, useEffect } from 'react' +import { useContext, useEffect, useMemo } from 'react' function updateCache() { if (navigator.serviceWorker && navigator.serviceWorker.controller) { @@ -23,7 +26,13 @@ function Pages() { }, [router.query]) const { current, setTotalPage, goNextPage } = useContext(PageCtx) - const { isLoading, view } = useGetTalksAndTracks(talkId as string | null) + + const view = useMemo(() => { + if (!talkId) { + return null + } + return TalkView.withoutDk(talkId as string, talks, tracks, speakers) + }, [talkId]) const pages = [ , @@ -38,7 +47,7 @@ function Pages() { const audioSrc = '/cnds2024/cnds2024_intermission.mp3' const shouldPlayAudio = current !== pages.length - 1 - if (isLoading) { + if (!view) { return
Loading...
} return (