-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
830 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/components/LessonPlayAllButton/LessonPlayAllButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { OakTertiaryButton } from "@oaknational/oak-components"; | ||
import React, { FC } from "react"; | ||
|
||
import { resolveOakHref } from "@/common-lib/urls"; | ||
|
||
type LessonPlayAllButtonProps = { | ||
lessonSlug: string; | ||
programmeSlug: string | null; | ||
unitSlug: string | null; | ||
}; | ||
|
||
const LessonPlayAllButton: FC<LessonPlayAllButtonProps> = ({ | ||
unitSlug, | ||
lessonSlug, | ||
programmeSlug, | ||
}) => { | ||
return ( | ||
<OakTertiaryButton | ||
element="a" | ||
href={ | ||
programmeSlug && unitSlug | ||
? resolveOakHref({ | ||
page: "lesson-media", | ||
lessonSlug: lessonSlug, | ||
programmeSlug: programmeSlug, | ||
unitSlug: unitSlug, | ||
}) | ||
: resolveOakHref({ | ||
page: "lesson-media-canonical", | ||
lessonSlug: lessonSlug, | ||
}) | ||
} | ||
isTrailingIcon | ||
iconName="arrow-right" | ||
> | ||
Play all | ||
</OakTertiaryButton> | ||
); | ||
}; | ||
|
||
export default LessonPlayAllButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from "./LessonPlayAllButton"; |
27 changes: 27 additions & 0 deletions
27
src/components/SharedComponents/VideoPlayer/useMediaClipThumbnailsUrl.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { PlaybackPolicy, useSignedThumbnailToken } from "./useSignedVideoToken"; | ||
|
||
interface UseThumbnailImageProps { | ||
playbackId: string; | ||
playbackPolicy: PlaybackPolicy; | ||
isLegacy?: boolean; | ||
} | ||
|
||
const useMediaClipThumbnailUrl = ({ | ||
playbackId, | ||
playbackPolicy, | ||
isLegacy = false, | ||
}: UseThumbnailImageProps) => { | ||
const thumbnailToken = useSignedThumbnailToken({ | ||
playbackId, | ||
playbackPolicy, | ||
isLegacy, | ||
}); | ||
|
||
if (thumbnailToken.playbackToken) { | ||
return `https://image.mux.com/${playbackId}/thumbnail.png?token=${thumbnailToken.playbackToken}`; | ||
} else { | ||
return undefined; | ||
} | ||
}; | ||
|
||
export default useMediaClipThumbnailUrl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...components/TeacherComponents/LessonOverviewMediaClips/LessonOverviewClipWithThumbnail.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { FC } from "react"; | ||
import { | ||
OakMediaClipStackListItem, | ||
OakMediaClipStackListItemProps, | ||
} from "@oaknational/oak-components"; | ||
|
||
import { PlaybackPolicy } from "@/components/SharedComponents/VideoPlayer/useSignedVideoToken"; | ||
import useMediaClipThumbnailUrl from "@/components/SharedComponents/VideoPlayer/useMediaClipThumbnailsUrl"; | ||
|
||
export type LessonOverviewClipWithThumbnail = Omit< | ||
OakMediaClipStackListItemProps, | ||
"imageUrl" | "imageAltText" | ||
> & { | ||
playbackId: string; | ||
playbackPolicy: PlaybackPolicy; | ||
numberOfClips: number; | ||
}; | ||
|
||
const LessonOverviewClipWithThumbnail: FC<LessonOverviewClipWithThumbnail> = ({ | ||
title, | ||
playbackId, | ||
playbackPolicy, | ||
numberOfClips, | ||
href, | ||
}: LessonOverviewClipWithThumbnail) => { | ||
const thumbnailImage = useMediaClipThumbnailUrl({ | ||
playbackId, | ||
playbackPolicy, | ||
isLegacy: false, | ||
}); | ||
|
||
return ( | ||
<OakMediaClipStackListItem | ||
title={title} | ||
imageUrl={thumbnailImage} | ||
imageAltText="" | ||
href={href} | ||
numberOfClips={numberOfClips} | ||
/> | ||
); | ||
}; | ||
|
||
export default LessonOverviewClipWithThumbnail; |
Oops, something went wrong.