diff --git a/workspaces/website/src/blocks/VideoSectionBlock.tsx b/workspaces/website/src/blocks/VideoSectionBlock.tsx index 54886c5d24..a1efe25bde 100644 --- a/workspaces/website/src/blocks/VideoSectionBlock.tsx +++ b/workspaces/website/src/blocks/VideoSectionBlock.tsx @@ -5,7 +5,7 @@ import { Box, Show } from "@chakra-ui/react"; import { VideoSectionBlock as VideoSectionProps, - ChapterInfo + ChapterInfo, } from "@starknet-io/cms-data/src/pages"; import { CategoryTabs } from "@ui/CategoryTabs/CategoryTabs"; @@ -30,15 +30,19 @@ export default function VideoSectionBlock(props: VideoSectionProps) { const normalizedPlaylist = useMemo(() => { return playlist.map((chapter) => { - const chapterInfo = props[chapter.id as keyof VideoSectionProps] as ChapterInfo; - return ({ + const chapterInfo = props[ + chapter.id as keyof VideoSectionProps + ] as ChapterInfo; + return { ...chapter, - ...chapterInfo - }) as ChapterType; + ...chapterInfo, + } as ChapterType; }); - }, [props, playlist]) + }, [props, playlist]); - const [currentChapter, setCurrentChapter] = useState(normalizedPlaylist[0]); + const [currentChapter, setCurrentChapter] = useState( + normalizedPlaylist[0] + ); return ( @@ -54,18 +58,25 @@ export default function VideoSectionBlock(props: VideoSectionProps) { - setCurrentChapter(normalizedPlaylist.find((p) => p.id === id) ?? normalizedPlaylist[0]) + onChapterChange={(id) => + setCurrentChapter( + normalizedPlaylist.find((p) => p.id === id) ?? normalizedPlaylist[0] + ) } playlistOnBottom={playlistOnBottom} /> - - + + - setCurrentChapter(normalizedPlaylist.find((p) => p.id === id) ?? normalizedPlaylist[0]) + onChapterChange={(id) => + setCurrentChapter( + normalizedPlaylist.find((p) => p.id === id) ?? + normalizedPlaylist[0] + ) } items={normalizedPlaylist.map((p) => ({ id: p.id, @@ -77,9 +88,18 @@ export default function VideoSectionBlock(props: VideoSectionProps) { - + {normalizedPlaylist.map((chapter) => ( + + ))} diff --git a/workspaces/website/src/components/CategoryTabs/CategoryTabs.tsx b/workspaces/website/src/components/CategoryTabs/CategoryTabs.tsx index ea422b6a68..618245f5eb 100644 --- a/workspaces/website/src/components/CategoryTabs/CategoryTabs.tsx +++ b/workspaces/website/src/components/CategoryTabs/CategoryTabs.tsx @@ -1,4 +1,3 @@ - /** * Module dependencies */ @@ -35,7 +34,6 @@ export const CategoryTabs = ({ currentChapter, onChapterChange, }: CategoryTabsProps) => { - return ( {items.map((item, index) => { return ( - - - + ); })}