Skip to content

Commit eff352c

Browse files
authored
feat: video resources updates incl next button (#1567)
* card tweaks * next resource button
1 parent e2aa74e commit eff352c

19 files changed

+82
-33
lines changed

components/cards/CourseCard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ const cardActionsStyle = {
7575

7676
const imageContainerStyle = {
7777
position: 'relative',
78-
width: { xs: 100, md: 100, lg: 120 },
79-
height: { xs: 100, md: 100, lg: 120 },
78+
width: 100,
79+
height: 100,
8080
};
8181

8282
interface CourseCardProps {

components/layout/Header.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ const headerContainerStyle = {
4040

4141
const imageContainerStyle = {
4242
position: 'relative',
43-
width: { xs: 150, md: 250 },
44-
height: { xs: 150, md: 250 },
43+
width: { xs: 150, md: 210 },
44+
height: { xs: 150, md: 210 },
4545
marginLeft: { xs: 'auto', md: 0 },
4646
marginRight: { xs: '1rem', md: '8%' },
4747
marginTop: 0,
@@ -117,7 +117,7 @@ const Header = (props: HeaderProps) => {
117117
</IconButton>
118118
{children && <Box sx={childrenContentStyle}>{children}</Box>}
119119
<Box sx={textContentStyle}>
120-
<Typography variant="h1" component="h1" marginBottom={{ md: '2.5rem' }}>
120+
<Typography variant="h1" component="h1">
121121
{title}
122122
</Typography>
123123
{getIntroduction()}

components/pages/MessagingPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export default function MessagingPage({ story }: Props) {
5252
<Header {...headerProps} />
5353
{userId ? (
5454
<>
55-
<Container sx={{ backgroundColor: 'secondary.light', pt: 2 }}>
55+
<Container sx={{ backgroundColor: 'secondary.light', pt: 0 }}>
5656
<Typography variant="h2" sx={{ mb: { xs: 4, md: 8 } }}>
5757
{t('messageHeading')}
5858
</Typography>

components/resources/ResourceConversationHeader.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@ import Header from '@/components/layout/Header';
44
import { ResourceConversationAudio } from '@/components/resources/ResourceConversationAudio';
55
import { Link as i18nLink } from '@/i18n/routing';
66
import { PROGRESS_STATUS } from '@/lib/constants/enums';
7+
import getNextResourceButtonLabel from '@/lib/utils/getNextResourceButtonLabel';
78
import { RichTextOptions } from '@/lib/utils/richText';
89
import illustrationCourses from '@/public/illustration_courses.svg';
910
import { breadcrumbButtonStyle } from '@/styles/common';
11+
import { ArrowForward } from '@mui/icons-material';
1012
import { Box, Button } from '@mui/material';
1113
import { useTranslations } from 'next-intl';
1214
import { render, StoryblokRichtext } from 'storyblok-rich-text-react-renderer';
1315

1416
const audioContainerStyle = {
1517
mt: { xs: 4, md: 6 },
16-
mb: 3,
1718
} as const;
1819

1920
interface ResourceConversationHeaderProps {
@@ -24,6 +25,7 @@ interface ResourceConversationHeaderProps {
2425
resourceProgress: PROGRESS_STATUS;
2526
audio: { filename: string };
2627
audio_transcript: StoryblokRichtext;
28+
nextResourceHref: string | undefined;
2729
eventData: { [key: string]: any };
2830
}
2931

@@ -36,6 +38,7 @@ export const ResourceConversationHeader = (props: ResourceConversationHeaderProp
3638
resourceProgress,
3739
audio,
3840
audio_transcript,
41+
nextResourceHref,
3942
eventData,
4043
} = props;
4144
const t = useTranslations('Resources');
@@ -56,6 +59,18 @@ export const ResourceConversationHeader = (props: ResourceConversationHeaderProp
5659
audio_transcript={audio_transcript}
5760
/>
5861
</Box>
62+
{nextResourceHref && (
63+
<Button
64+
variant="contained"
65+
color="secondary"
66+
sx={{ width: 'fit-content', ml: 'auto' }}
67+
href={nextResourceHref}
68+
endIcon={<ArrowForward />}
69+
component={i18nLink}
70+
>
71+
{t(getNextResourceButtonLabel(nextResourceHref))}
72+
</Button>
73+
)}
5974
</Box>
6075
}
6176
imageSrc={header_image?.filename || illustrationCourses}

components/resources/ResourceShortsHeader.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ import { Link as i18nLink } from '@/i18n/routing';
66
import { PROGRESS_STATUS } from '@/lib/constants/enums';
77
import { RESOURCE_SHORT_VIDEO_VISIT_SESSION } from '@/lib/constants/events';
88
import { getDefaultFullSlug } from '@/lib/utils/getDefaultFullSlug';
9+
import getNextResourceButtonLabel from '@/lib/utils/getNextResourceButtonLabel';
910
import logEvent from '@/lib/utils/logEvent';
1011
import { breadcrumbButtonStyle, columnStyle, rowStyle } from '@/styles/common';
1112
import theme from '@/styles/theme';
13+
import { ArrowForward } from '@mui/icons-material';
1214
import { Box, Button, Container, Typography } from '@mui/material';
1315
import { ISbStoryData } from '@storyblok/react/rsc';
1416
import { useLocale, useTranslations } from 'next-intl';
@@ -36,6 +38,7 @@ interface ResourceShortHeaderProps {
3638
relatedCourse?: ISbStoryData;
3739
video: { url: string };
3840
video_transcript: StoryblokRichtext;
41+
nextResourceHref: string | undefined;
3942
eventData: { [key: string]: any };
4043
}
4144

@@ -48,6 +51,7 @@ export const ResourceShortHeader = (props: ResourceShortHeaderProps) => {
4851
resourceProgress,
4952
video,
5053
video_transcript,
54+
nextResourceHref,
5155
eventData,
5256
} = props;
5357
const t = useTranslations('Resources');
@@ -132,6 +136,18 @@ export const ResourceShortHeader = (props: ResourceShortHeaderProps) => {
132136
</Button>
133137
</Box>
134138
)}
139+
{!relatedCourse && !relatedSession && nextResourceHref && (
140+
<Button
141+
variant="contained"
142+
color="secondary"
143+
sx={{ width: 'fit-content' }}
144+
href={nextResourceHref}
145+
endIcon={<ArrowForward />}
146+
component={i18nLink}
147+
>
148+
{t(getNextResourceButtonLabel(nextResourceHref))}
149+
</Button>
150+
)}
135151
</Box>
136152
</Container>
137153
);

components/resources/ResourceSingleVideoHeader.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import ProgressStatus from '@/components/common/ProgressStatus';
44
import { ResourceSingleVideo } from '@/components/resources/ResourceSingleVideo';
55
import { Link as i18nLink } from '@/i18n/routing';
66
import { PROGRESS_STATUS, STORYBLOK_TAGS } from '@/lib/constants/enums';
7+
import getNextResourceButtonLabel from '@/lib/utils/getNextResourceButtonLabel';
78
import { RichTextOptions } from '@/lib/utils/richText';
89
import { breadcrumbButtonStyle, columnStyle, rowStyle } from '@/styles/common';
910
import theme from '@/styles/theme';
@@ -127,7 +128,7 @@ export const ResourceSingleVideoHeader = (props: ResourceSingleVideoHeaderProps)
127128
endIcon={<ArrowForward />}
128129
component={i18nLink}
129130
>
130-
{t('nextVideoButtonLabel')}
131+
{t(getNextResourceButtonLabel(nextResourceHref))}
131132
</Button>
132133
)}
133134
</Box>

components/storyblok/StoryblokAccordion.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ const StoryblokAccordion = (props: StoryblokAccordionProps) => {
102102
id={ai.accordion_id ?? undefined}
103103
ref={ai.accordion_id === accordionInUrl ? scrollRef : undefined}
104104
key={`panel${i}`}
105-
defaultExpanded={false}
105+
defaultExpanded={accordionInUrl === ai.accordion_id}
106106
onChange={handleChange(ai.title)}
107107
sx={themes[theme]}
108108
>

components/storyblok/StoryblokResourceConversationPage.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ const StoryblokResourceConversationPage = (props: StoryblokResourceConversationP
109109
logEvent(RESOURCE_CONVERSATION_VIEWED, eventData);
110110
}, []);
111111

112+
const nextResourceHref = useMemo(() => {
113+
const nextResourceSlug = related_content[0]?.full_slug;
114+
return nextResourceSlug ? `/${nextResourceSlug}` : undefined;
115+
}, [related_content]);
116+
112117
if (userAccess === undefined) return <LoadingContainer />;
113118
if (!userAccess) return <ContentUnavailable />;
114119

@@ -135,6 +140,7 @@ const StoryblokResourceConversationPage = (props: StoryblokResourceConversationP
135140
resourceProgress,
136141
audio,
137142
audio_transcript,
143+
nextResourceHref,
138144
eventData,
139145
}}
140146
/>

components/storyblok/StoryblokResourceShortPage.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,11 @@ const StoryblokResourceShortPage = (props: StoryblokResourceShortPageProps) => {
125125
logEvent(RESOURCE_SHORT_VIDEO_VIEWED, eventData);
126126
}, []);
127127

128+
const nextResourceHref = useMemo(() => {
129+
const nextResourceSlug = related_content[0]?.full_slug;
130+
return nextResourceSlug ? `/${nextResourceSlug}` : undefined;
131+
}, [related_content]);
132+
128133
if (userAccess === undefined) return <LoadingContainer />;
129134
if (!userAccess) return <ContentUnavailable />;
130135

@@ -154,6 +159,7 @@ const StoryblokResourceShortPage = (props: StoryblokResourceShortPageProps) => {
154159
relatedCourse: related_course,
155160
video,
156161
video_transcript,
162+
nextResourceHref,
157163
eventData,
158164
}}
159165
/>

components/storyblok/StoryblokTeamMemberCard.tsx

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,6 @@ const iconRowStyles = {
7373
position: 'relative',
7474
} as const;
7575

76-
const fadeOut = {
77-
':after': {
78-
content: '""',
79-
background: 'linear-gradient(90deg,rgba(254, 246, 242, 0) 0%, rgba(254, 246, 242, 1) 100%)',
80-
opacity: 0.9,
81-
position: 'absolute',
82-
right: 0,
83-
top: 0,
84-
width: 20,
85-
height: '100%',
86-
},
87-
};
88-
8976
const iconStyles = {
9077
mt: { xs: 0.25, md: 0 },
9178
width: { xs: 20, md: 24 },
@@ -136,7 +123,7 @@ const StoryblokTeamMemberCard = (props: StoryblokTeamMemberCardProps) => {
136123
website,
137124
website_title,
138125
team_page_section,
139-
cardExpandable = false,
126+
cardExpandable = true,
140127
} = props;
141128

142129
const [expanded, setExpanded] = useState<boolean>(!cardExpandable);
@@ -204,13 +191,13 @@ const StoryblokTeamMemberCard = (props: StoryblokTeamMemberCardProps) => {
204191
</Box>
205192
)}
206193
{show_short_bio && website?.url && (
207-
<Box sx={{ ...iconRowStyles }}>
194+
<Box sx={iconRowStyles}>
208195
<LinkIcon color="error" sx={iconStyles} />
209196
<Link
210197
id="website-link"
211198
variant="body2"
212199
href={website.url}
213-
sx={{ ...websiteHeaderLinkStyle, ...fadeOut }}
200+
sx={websiteHeaderLinkStyle}
214201
>
215202
{websiteTitle}
216203
</Link>

0 commit comments

Comments
 (0)