-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: breadcrumb buttons, german activity related content, user resear…
…ch banner (#1298)
- Loading branch information
1 parent
19cf466
commit e6898b2
Showing
20 changed files
with
325 additions
and
232 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
'use client'; | ||
|
||
import Header from '@/components/layout/Header'; | ||
import { ResourceConversationAudio } from '@/components/resources/ResourceConversationAudio'; | ||
import { Link as i18nLink } from '@/i18n/routing'; | ||
import { PROGRESS_STATUS } from '@/lib/constants/enums'; | ||
import { RichTextOptions } from '@/lib/utils/richText'; | ||
import illustrationCourses from '@/public/illustration_courses.svg'; | ||
import { breadcrumbButtonStyle } from '@/styles/common'; | ||
import { Box, Button } from '@mui/material'; | ||
import { ISbRichtext } from '@storyblok/react/rsc'; | ||
import { useTranslations } from 'next-intl'; | ||
import { render } from 'storyblok-rich-text-react-renderer'; | ||
|
||
const audioContainerStyle = { | ||
mt: { xs: 4, md: 6 }, | ||
mb: 3, | ||
} as const; | ||
|
||
interface ResourceConversationHeaderProps { | ||
storyId: number; | ||
name: string; | ||
description: ISbRichtext; | ||
header_image: { filename: string; alt: string }; | ||
resourceProgress: PROGRESS_STATUS; | ||
audio: { filename: string }; | ||
audio_transcript: ISbRichtext; | ||
eventData: { [key: string]: any }; | ||
} | ||
|
||
export const ResourceConversationHeader = (props: ResourceConversationHeaderProps) => { | ||
const { | ||
storyId, | ||
name, | ||
description, | ||
header_image, | ||
resourceProgress, | ||
audio, | ||
audio_transcript, | ||
eventData, | ||
} = props; | ||
const t = useTranslations('Resources'); | ||
|
||
return ( | ||
<Header | ||
title={name} | ||
introduction={ | ||
<Box display="flex" flexDirection="column" gap={3}> | ||
{render(description, RichTextOptions)} | ||
<Box sx={audioContainerStyle}> | ||
<ResourceConversationAudio | ||
eventData={eventData} | ||
resourceProgress={resourceProgress} | ||
name={name} | ||
storyId={storyId} | ||
audio={audio.filename} | ||
audio_transcript={audio_transcript} | ||
/> | ||
</Box> | ||
</Box> | ||
} | ||
imageSrc={header_image ? header_image.filename : illustrationCourses} | ||
progressStatus={resourceProgress} | ||
> | ||
<Button | ||
variant="contained" | ||
sx={breadcrumbButtonStyle} | ||
href="/courses?section=conversations" | ||
component={i18nLink} | ||
size="small" | ||
> | ||
{t('backToConversations')} | ||
</Button> | ||
</Header> | ||
); | ||
}; |
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,119 @@ | ||
'use client'; | ||
|
||
import ProgressStatus from '@/components/common/ProgressStatus'; | ||
import { ResourceShortVideo } from '@/components/resources/ResourceShortVideo'; | ||
import { Link as i18nLink } from '@/i18n/routing'; | ||
import { COURSE_CATEGORIES, PROGRESS_STATUS } from '@/lib/constants/enums'; | ||
import { RESOURCE_SHORT_VIDEO_VISIT_SESSION } from '@/lib/constants/events'; | ||
import { getDefaultFullSlug } from '@/lib/utils/getDefaultFullSlug'; | ||
import logEvent from '@/lib/utils/logEvent'; | ||
import { breadcrumbButtonStyle, columnStyle, rowStyle } from '@/styles/common'; | ||
import theme from '@/styles/theme'; | ||
import { Box, Button, Container, Typography } from '@mui/material'; | ||
import { ISbRichtext, ISbStoryData } from '@storyblok/react/rsc'; | ||
import { useLocale, useTranslations } from 'next-intl'; | ||
|
||
const headerStyle = { ...rowStyle, flexWrap: { xs: 'wrap', md: 'no-wrap' }, gap: 5 } as const; | ||
const headerRightStyle = { | ||
...columnStyle, | ||
justifyContent: 'flex-end', | ||
flex: { md: 1 }, | ||
width: { md: '100%' }, | ||
height: { md: 290 }, | ||
} as const; | ||
|
||
const headerLeftStyles = { | ||
width: 514, // >515px enables the "watch on youtube" button | ||
maxWidth: '100%', | ||
} as const; | ||
|
||
interface ResourceShortHeaderProps { | ||
storyId: number; | ||
name: string; | ||
resourceProgress: PROGRESS_STATUS; | ||
relatedSession: ISbStoryData; | ||
relatedCourse: ISbStoryData; | ||
video: { url: string }; | ||
video_transcript: ISbRichtext; | ||
eventData: { [key: string]: any }; | ||
} | ||
|
||
export const ResourceShortHeader = (props: ResourceShortHeaderProps) => { | ||
const { | ||
storyId, | ||
name, | ||
relatedSession, | ||
relatedCourse, | ||
resourceProgress, | ||
video, | ||
video_transcript, | ||
eventData, | ||
} = props; | ||
const t = useTranslations('Resources'); | ||
const locale = useLocale(); | ||
|
||
const redirectToSession = () => { | ||
logEvent(RESOURCE_SHORT_VIDEO_VISIT_SESSION, { | ||
...eventData, | ||
shorts_name: name, | ||
session_name: relatedSession?.name, | ||
}); | ||
}; | ||
|
||
return ( | ||
<Container sx={{ background: theme.palette.bloomGradient }}> | ||
<Button | ||
variant="contained" | ||
sx={{ ...breadcrumbButtonStyle, mb: 4 }} | ||
href="/courses?section=shorts" | ||
component={i18nLink} | ||
size="small" | ||
> | ||
{t('backToShorts')} | ||
</Button> | ||
<Typography variant="h1" maxWidth={600}> | ||
{name} | ||
</Typography> | ||
<Box sx={headerStyle}> | ||
<Box sx={headerLeftStyles}> | ||
<ResourceShortVideo | ||
eventData={eventData} | ||
resourceProgress={resourceProgress} | ||
name={name} | ||
storyId={storyId} | ||
video={video} | ||
video_transcript={video_transcript} | ||
/> | ||
{resourceProgress && <ProgressStatus status={resourceProgress} />} | ||
</Box> | ||
{relatedSession && ( | ||
<Box sx={headerRightStyle}> | ||
{/* Description field is not currently displayed */} | ||
{/* {render(description, RichTextOptions)} */} | ||
|
||
<Typography component="h2" mb={2}> | ||
{t('sessionDetail', { | ||
sessionNumber: | ||
relatedSession.content.component === COURSE_CATEGORIES.COURSE | ||
? 0 | ||
: relatedSession.position / 10 - 1, | ||
sessionName: relatedSession.content.name, | ||
courseName: relatedCourse?.content.name, | ||
})} | ||
</Typography> | ||
<Button | ||
href={getDefaultFullSlug(relatedSession.full_slug, locale)} | ||
component={i18nLink} | ||
onClick={redirectToSession} | ||
variant="contained" | ||
color="secondary" | ||
sx={{ mr: 'auto' }} | ||
> | ||
{t('sessionButtonLabel')} | ||
</Button> | ||
</Box> | ||
)} | ||
</Box> | ||
</Container> | ||
); | ||
}; |
Oops, something went wrong.