Skip to content

Commit 795c43e

Browse files
fix: changes according designer review
1 parent 5f23bf3 commit 795c43e

File tree

4 files changed

+33
-49
lines changed

4 files changed

+33
-49
lines changed

course/src/main/java/org/openedx/course/presentation/home/VideosHomePagerCardContent.kt

Lines changed: 14 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.openedx.course.presentation.home
22

3-
import androidx.compose.foundation.BorderStroke
43
import androidx.compose.foundation.layout.Column
54
import androidx.compose.foundation.layout.Row
65
import androidx.compose.foundation.layout.Spacer
@@ -10,7 +9,6 @@ import androidx.compose.foundation.layout.padding
109
import androidx.compose.foundation.layout.size
1110
import androidx.compose.foundation.layout.width
1211
import androidx.compose.foundation.shape.CircleShape
13-
import androidx.compose.material.Card
1412
import androidx.compose.material.Icon
1513
import androidx.compose.material.LinearProgressIndicator
1614
import androidx.compose.material.MaterialTheme
@@ -26,9 +24,7 @@ import androidx.compose.ui.semantics.semantics
2624
import androidx.compose.ui.text.font.FontWeight
2725
import androidx.compose.ui.unit.dp
2826
import org.openedx.core.domain.model.Block
29-
import org.openedx.core.extension.getUnitChapter
3027
import org.openedx.core.ui.theme.appColors
31-
import org.openedx.core.ui.theme.appShapes
3228
import org.openedx.core.ui.theme.appTypography
3329
import org.openedx.course.R
3430
import org.openedx.course.presentation.contenttab.CourseContentVideoEmptyState
@@ -131,42 +127,21 @@ fun VideosHomePagerCardContent(
131127
Spacer(modifier = Modifier.height(8.dp))
132128

133129
// Video card using CourseVideoItem
134-
Card(
130+
CourseVideoItem(
135131
modifier = Modifier
136-
.fillMaxWidth(),
137-
backgroundColor = MaterialTheme.appColors.cardViewBackground,
138-
shape = MaterialTheme.appShapes.videoPreviewShape,
139-
elevation = 0.dp,
140-
border = BorderStroke(
141-
width = 1.dp,
142-
color = MaterialTheme.appColors.cardViewBorder
143-
)
144-
) {
145-
Column {
146-
CourseVideoItem(
147-
modifier = Modifier
148-
.fillMaxWidth()
149-
.height(180.dp),
150-
videoBlock = firstIncompleteVideo,
151-
preview = uiState.videoPreview,
152-
progress = videoProgress,
153-
onClick = {
154-
onVideoClick(firstIncompleteVideo)
155-
},
156-
titleStyle = MaterialTheme.appTypography.titleMedium,
157-
contentModifier = Modifier
158-
.padding(horizontal = 16.dp, vertical = 8.dp),
159-
progressModifier = Modifier.height(8.dp),
160-
)
161-
Text(
162-
modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp),
163-
text = uiState.courseStructure.blockData
164-
.getUnitChapter(firstIncompleteVideo.id)?.displayName ?: "",
165-
style = MaterialTheme.appTypography.labelMedium,
166-
color = MaterialTheme.appColors.textPrimary,
167-
)
168-
}
169-
}
132+
.fillMaxWidth()
133+
.height(180.dp),
134+
videoBlock = firstIncompleteVideo,
135+
preview = uiState.videoPreview,
136+
progress = videoProgress,
137+
onClick = {
138+
onVideoClick(firstIncompleteVideo)
139+
},
140+
titleStyle = MaterialTheme.appTypography.titleMedium,
141+
contentModifier = Modifier
142+
.padding(horizontal = 16.dp, vertical = 8.dp),
143+
progressModifier = Modifier.height(8.dp),
144+
)
170145
} else {
171146
CaughtUpMessage(
172147
message = stringResource(R.string.course_videos_caught_up)

course/src/main/java/org/openedx/course/presentation/ui/CourseUI.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,8 @@ fun CourseVideoItem(
721721
contentModifier: Modifier = Modifier.padding(8.dp),
722722
progressModifier: Modifier = Modifier.height(4.dp),
723723
playButtonSize: Dp = 32.dp,
724-
borderColor: Color? = null
724+
borderColor: Color? = null,
725+
borderWidth: Dp = 3.dp,
725726
) {
726727
val borderColor = borderColor ?: if (videoBlock.isCompleted()) {
727728
MaterialTheme.appColors.successGreen
@@ -732,7 +733,7 @@ fun CourseVideoItem(
732733
modifier = modifier
733734
.clip(MaterialTheme.appShapes.videoPreviewShape)
734735
.border(
735-
width = 3.dp,
736+
width = borderWidth,
736737
color = borderColor,
737738
shape = MaterialTheme.appShapes.videoPreviewShape
738739
)
@@ -783,7 +784,7 @@ fun CourseVideoItem(
783784
style = titleStyle,
784785
modifier = Modifier
785786
.align(Alignment.TopStart),
786-
maxLines = 2,
787+
maxLines = 1,
787788
overflow = TextOverflow.Ellipsis
788789
)
789790

course/src/main/java/org/openedx/course/presentation/unit/container/CourseUnitContainerFragment.kt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -612,19 +612,29 @@ class CourseUnitContainerFragment : Fragment(R.layout.fragment_course_unit_conta
612612
} else {
613613
null
614614
}
615+
val borderWidth = if (isSelectedBlock) {
616+
3.dp
617+
} else {
618+
1.dp
619+
}
615620
CourseVideoItem(
616621
modifier = Modifier
617622
.width(112.dp)
618623
.height(63.dp),
619624
videoBlock = block,
620625
preview = videoPreview[block.id],
621-
progress = videoProgress[block.id] ?: 0f,
626+
progress = if (isSelectedBlock) {
627+
0f
628+
} else {
629+
videoProgress[block.id] ?: 0f
630+
},
622631
onClick = {
623632
onVideoClick(block)
624633
},
625634
titleStyle = MaterialTheme.appTypography.labelSmall,
626635
playButtonSize = playButtonSize,
627-
borderColor = borderColor
636+
borderColor = borderColor,
637+
borderWidth = borderWidth
628638
)
629639
}
630640
}

course/src/main/java/org/openedx/course/presentation/unit/container/CourseUnitContainerViewModel.kt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class CourseUnitContainerViewModel(
9393
private val _currentBlock = MutableStateFlow<Block?>(null)
9494
val currentBlock = _currentBlock.asStateFlow()
9595

96-
private val _hierarchyPath = MutableStateFlow<String>("")
96+
private val _hierarchyPath = MutableStateFlow("")
9797
val hierarchyPath = _hierarchyPath.asStateFlow()
9898

9999
var nextButtonText = ""
@@ -422,12 +422,10 @@ class CourseUnitContainerViewModel(
422422
private fun buildHierarchyPath(block: Block): String {
423423
val pathComponents = mutableListOf<String>()
424424

425-
// Find the current block (Unit)
426-
pathComponents.add(block.displayName)
427-
428-
// Find the parent Vertical block (but don't add it to path)
429425
val verticalBlock = findParentBlock(block.id)
430426
verticalBlock?.let { vertical ->
427+
// Vertical name
428+
pathComponents.add(0, vertical.displayName)
431429
// Find the parent Sequential block (Subsection)
432430
val sequentialBlock = findParentBlock(vertical.id)
433431
sequentialBlock?.let { sequential ->

0 commit comments

Comments
 (0)