Skip to content

Commit

Permalink
added multiple youtube video support
Browse files Browse the repository at this point in the history
  • Loading branch information
FearsomeRover authored and Isti01 committed Oct 23, 2024
1 parent 6161860 commit d505850
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class HomeComponent(

displayGroup,
welcomeMessage,
youtubeVideoId,
youtubeVideoIds,
content,
showEvents,

Expand Down Expand Up @@ -78,9 +78,9 @@ class HomeComponent(
fieldName = "Üdvözlő üzenet", description = "Ha üres akkor nincs, a {} pedig ki van cserélve az oldal nevére"
)

val youtubeVideoId = SettingProxy(componentSettingService, component,
"youtubeVideoId", "", type = SettingType.TEXT,
fieldName = "Promó videó", description = "Ha üres akkor nincs, csak youtube videó id-vel működik," +
val youtubeVideoIds = SettingProxy(componentSettingService, component,
"youtubeVideoIds", "", type = SettingType.TEXT,
fieldName = "Promó videó(k)", description = "Ha üres akkor nincs, csak youtube videó id-vel működik, ha többet szeretnél, vesszővel felsorolva tudod ezt megtenni" +
" pl: '8PhToFtwKvY' (A '?controls=0' az opcionális)"
)

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/api/contexts/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export interface Home {
title: string
welcomeMessage: string
content: string
youtubeVideoId: string
youtubeVideoIds: string
showEvents: boolean
showNews: boolean
}
Expand Down
12 changes: 11 additions & 1 deletion frontend/src/pages/home/home.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ const HomePage = () => {

const eventsToday = events?.filter((ev) => isToday(ev.timestampStart)) || []
const eventsLater = events?.filter((ev) => !isToday(ev.timestampStart)).slice(0, 3) || []
const videoIds = homeConfig?.youtubeVideoIds
?.split(',')
?.map((videoId) => videoId.trim())
?.filter(Boolean)

return (
<CmschPage>
Expand Down Expand Up @@ -80,7 +84,13 @@ const HomePage = () => {
</>
)}

{homeConfig?.youtubeVideoId && <EmbeddedVideo key={homeConfig?.youtubeVideoId} id={homeConfig?.youtubeVideoId} />}
{videoIds?.length > 0 && (
<>
{videoIds.map((videoId) => (
<EmbeddedVideo key={videoId} id={videoId} />
))}
</>
)}

{homeConfig?.content && (
<Box mt={10}>
Expand Down

0 comments on commit d505850

Please sign in to comment.