Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import team.aliens.dms.android.core.designsystem.DmsTheme
import team.aliens.dms.android.core.designsystem.bodyB
import team.aliens.dms.android.core.designsystem.endPadding
import team.aliens.dms.android.core.designsystem.foundation.DmsIcon
import team.aliens.dms.android.core.designsystem.labelB
import team.aliens.dms.android.core.designsystem.labelM
import team.aliens.dms.android.core.designsystem.util.clickable

Expand Down Expand Up @@ -158,10 +158,12 @@ private fun AppliedTitleText(
color = backgroundColor,
shape = RoundedCornerShape(6.dp),
)
.padding(horizontal = 22.dp, vertical = 8.dp),
.padding(horizontal = 12.dp, vertical = 6.dp),
text = appliedTitle,
style = DmsTheme.typography.labelB,
style = DmsTheme.typography.labelM,
color = textColor,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,23 @@ fun LateStudyScreen(

val studyTypes = viewModel.studyTypes
val teachers = viewModel.teachers

val isSubmitEnabled = isSubmitEnabled(
selectedTeacherId = selectedTeacherId,
selectedTypeId = selectedTypeId,
startDate = startDate,
reason = reason,
)

val filteredTeachers = remember(teacherKeyword, teachers) {
if (teacherKeyword.isBlank()) {
emptyList()
} else {
teachers.filter { teacher ->
teacher.name.contains(teacherKeyword)
teacher.name.contains(
other = teacherKeyword,
ignoreCase = true,
)
}
}
}
Expand Down Expand Up @@ -149,12 +154,22 @@ fun LateStudyScreen(
currentMonth = currentMonth,
startDate = startDate,
endDate = endDate,
onPrevMonthClick = { currentMonth = currentMonth.minusMonths(1) },
onNextMonthClick = { currentMonth = currentMonth.plusMonths(1) },
onPrevMonthClick = {
currentMonth = currentMonth.minusMonths(1)
},
onNextMonthClick = {
currentMonth = currentMonth.plusMonths(1)
},
onDateClick = { clickedDate ->
when {
startDate == null -> startDate = clickedDate
endDate == null && !clickedDate.isBefore(startDate) -> endDate = clickedDate
startDate == null -> {
startDate = clickedDate
}

endDate == null && !clickedDate.isBefore(startDate) -> {
endDate = clickedDate
}

else -> {
startDate = clickedDate
endDate = null
Expand Down Expand Up @@ -187,7 +202,6 @@ fun LateStudyScreen(
resultKey = "late_study_application_result",
result = "μ‹ μ²­ 쀑",
)

onBack()
},
onFailure = { message ->
Expand Down Expand Up @@ -254,15 +268,16 @@ private fun TeacherSearchSection(
}
}
}

@Composable
private fun TeacherDropdown(
teachers: List<TeacherResponse>,
keyword: String,
onTeacherClick: (TeacherResponse) -> Unit,
) {
val dropdownShadowColor = DmsTheme.colorScheme.scrim
val highlightColor = DmsTheme.colorScheme.primary
val shape = RoundedCornerShape(28.dp)
val highlightColor = DmsTheme.colorScheme.onPrimaryContainer
val iconColor = DmsTheme.colorScheme.primaryContainer
val shadowColor = DmsTheme.colorScheme.primaryContainer

Box(
modifier = Modifier
Expand All @@ -274,26 +289,35 @@ private fun TeacherDropdown(
Box(
modifier = Modifier
.matchParentSize()
.offset(y = 10.dp)
.offset(y = 3.dp)
.shadow(
elevation = 8.dp,
shape = shape,
clip = false,
ambientColor = shadowColor.copy(alpha = 0.3f),
spotColor = shadowColor.copy(alpha = 0.3f),
)
.background(
color = dropdownShadowColor,
shape = RoundedCornerShape(28.dp),
color = shadowColor.copy(alpha = 0.3f),
shape = shape,
),
)

Column(
modifier = Modifier
.fillMaxWidth()
.shadow(
elevation = 12.dp,
shape = RoundedCornerShape(28.dp),
elevation = 2.dp,
shape = shape,
clip = false,
ambientColor = Color.Black.copy(alpha = 0.05f),
spotColor = Color.Black.copy(alpha = 0.05f),
)
.background(
color = DmsTheme.colorScheme.surfaceVariant,
shape = RoundedCornerShape(28.dp),
color = DmsTheme.colorScheme.surface,
shape = shape,
)
.heightIn(max = 220.dp)
.heightIn(max = 300.dp)
.verticalScroll(rememberScrollState())
.padding(vertical = 12.dp),
) {
Expand All @@ -302,6 +326,7 @@ private fun TeacherDropdown(
teacher = teacher,
keyword = keyword,
highlightColor = highlightColor,
iconColor = iconColor,
onClick = { onTeacherClick(teacher) },
)
}
Expand All @@ -314,20 +339,24 @@ private fun TeacherDropdownItem(
teacher: TeacherResponse,
keyword: String,
highlightColor: Color,
iconColor: Color,
onClick: () -> Unit,
) {
Row(
modifier = Modifier
.fillMaxWidth()
.clickable(onClick = onClick)
.padding(horizontal = 20.dp, vertical = 14.dp),
.padding(
horizontal = 20.dp,
vertical = 14.dp,
),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(10.dp),
) {
Icon(
imageVector = Icons.Outlined.Search,
contentDescription = "검색",
tint = DmsTheme.colorScheme.onSurfaceVariant,
tint = iconColor,
modifier = Modifier.size(20.dp),
)

Expand All @@ -352,7 +381,10 @@ private fun StudyTypeSection(
LateStudySectionCard {
Text(
text = "μœ ν˜•",
modifier = Modifier.padding(horizontal = 16.dp, vertical = 12.dp),
modifier = Modifier.padding(
horizontal = 16.dp,
vertical = 12.dp,
),
color = DmsTheme.colorScheme.onBackground,
style = DmsTheme.typography.bodyB,
)
Expand Down Expand Up @@ -420,13 +452,25 @@ private fun highlightText(
keyword: String,
highlightColor: Color,
) = buildAnnotatedString {
val startIndex = text.indexOf(keyword)
val startIndex = text.indexOf(
string = keyword,
ignoreCase = true,
)

if (startIndex >= 0 && keyword.isNotEmpty()) {
append(text.substring(0, startIndex))
withStyle(style = SpanStyle(color = highlightColor)) {
append(text.substring(startIndex, startIndex + keyword.length))

withStyle(
style = SpanStyle(color = highlightColor),
) {
append(
text.substring(
startIndex,
startIndex + keyword.length,
),
)
}

append(text.substring(startIndex + keyword.length))
} else {
append(text)
Expand Down
Loading