Skip to content

Commit

Permalink
Merge pull request #321 from raccoongang/feature/course_home_certificate
Browse files Browse the repository at this point in the history
feat: [FC-0047] move the certificate view from the banner to the message section
  • Loading branch information
volodymyr-chekyrta authored May 20, 2024
2 parents ae777dd + 4d78460 commit f7d4d5f
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 279 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ import org.openedx.course.presentation.CourseRouter
import org.openedx.course.presentation.ui.CourseDatesBanner
import org.openedx.course.presentation.ui.CourseDatesBannerTablet
import org.openedx.course.presentation.ui.CourseExpandableChapterCard
import org.openedx.course.presentation.ui.CourseMessage
import org.openedx.course.presentation.ui.CourseSectionCard
import org.openedx.course.presentation.ui.CourseSubSectionItem
import java.io.File
Expand Down Expand Up @@ -272,6 +273,28 @@ private fun CourseOutlineUI(
}
}
}

val certificate = uiState.courseStructure.certificate
if (certificate?.isCertificateEarned() == true) {
item {
CourseMessage(
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 12.dp)
.then(listPadding),
icon = painterResource(R.drawable.ic_course_certificate),
message = stringResource(
R.string.course_you_earned_certificate,
uiState.courseStructure.name
),
action = stringResource(R.string.course_view_certificate),
onActionClick = {
onCertificateClick(certificate.certificateURL ?: "")
}
)
}
}

if (uiState.resumeComponent != null) {
item {
Box(listPadding) {
Expand Down
Loading

0 comments on commit f7d4d5f

Please sign in to comment.