Skip to content

Commit 9e88428

Browse files
committed
Simplify usePaths function
1 parent 7e7771d commit 9e88428

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/components/tracks/OverviewTimeline.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,8 @@ const usePaths = (chapters, track, trackPosition) => {
1212
.flatMap((chapter) => chapter.videos)
1313
.flatMap((video) =>
1414
video.parts?.length > 0
15-
? video.parts.map((_, partIndex) => ({
16-
slug: video.slug,
17-
partIndex,
18-
isMultiPart: true
19-
}))
20-
: [{ slug: video.slug, partIndex: 0, isMultiPart: false }]
15+
? video.parts.map((_, partIndex) => ({ slug: video.slug, partIndex }))
16+
: [{ slug: video.slug, partIndex: 0 }]
2117
);
2218
const currentVideo =
2319
chapters[trackPosition.chapterIndex].videos[trackPosition.videoIndex];
@@ -30,7 +26,7 @@ const usePaths = (chapters, track, trackPosition) => {
3026
const nextVideo = flatTrack[currentIndex + 1];
3127
const computePath = (video) => {
3228
if (video) {
33-
const hash = video.isMultiPart ? buildPartHash(video.partIndex) : '';
29+
const hash = buildPartHash(video.partIndex);
3430
return {
3531
...video,
3632
path: `/tracks/${track.slug}/${video.slug}${hash}`

0 commit comments

Comments
 (0)