Skip to content

Commit 4737375

Browse files
authored
Set card link on org dashboard pages to courseware url (#2239)
* Allow specifying the title and button links on DashboardCard and set them both to the coursewareUrl on org pages * check if run exists before setting on dashboardcard
1 parent a36180d commit 4737375

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

frontends/main/src/app-pages/DashboardPage/CoursewareDisplay/DashboardCard.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,8 @@ type DashboardCardProps = {
263263
offerUpgrade?: boolean
264264
contextMenuItems?: SimpleMenuItem[]
265265
isLoading?: boolean
266+
titleHref?: string | null
267+
buttonHref?: string | null
266268
}
267269
const DashboardCard: React.FC<DashboardCardProps> = ({
268270
dashboardResource,
@@ -273,6 +275,8 @@ const DashboardCard: React.FC<DashboardCardProps> = ({
273275
offerUpgrade = true,
274276
contextMenuItems = [],
275277
isLoading = false,
278+
titleHref,
279+
buttonHref,
276280
}) => {
277281
const { title, marketingUrl, enrollment, run } = dashboardResource
278282
const titleSection = isLoading ? (
@@ -283,7 +287,11 @@ const DashboardCard: React.FC<DashboardCardProps> = ({
283287
</>
284288
) : (
285289
<>
286-
<TitleLink size="medium" color="black" href={marketingUrl}>
290+
<TitleLink
291+
size="medium"
292+
color="black"
293+
href={titleHref ? titleHref : marketingUrl}
294+
>
287295
{title}
288296
</TitleLink>
289297
{enrollment?.status === EnrollmentStatus.Completed ? (
@@ -313,7 +321,7 @@ const DashboardCard: React.FC<DashboardCardProps> = ({
313321
<CoursewareButton
314322
data-testid="courseware-button"
315323
startDate={run.startDate}
316-
href={run.coursewareUrl}
324+
href={buttonHref ? buttonHref : run.coursewareUrl}
317325
endDate={run.endDate}
318326
courseNoun={courseNoun}
319327
/>

frontends/main/src/app-pages/DashboardPage/OrganizationContent.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ const OrgProgramDisplay: React.FC<{
153153
dashboardResource={course}
154154
courseNoun="Module"
155155
offerUpgrade={false}
156+
titleHref={course.run?.coursewareUrl}
157+
buttonHref={course.run?.coursewareUrl}
156158
/>
157159
))}
158160
</PlainList>

0 commit comments

Comments
 (0)