Skip to content

Commit

Permalink
[MERGE] #236 -> develop
Browse files Browse the repository at this point in the history
[FIX/#236] ํ™ˆ ๋ทฐ / 1์ฐจ QA ๋ฐ˜์˜
  • Loading branch information
Hyobeen-Park authored Sep 13, 2024
2 parents 096461d + cbd87a2 commit 5f590c8
Show file tree
Hide file tree
Showing 18 changed files with 127 additions and 131 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import androidx.compose.ui.unit.dp
import coil.compose.AsyncImage
import coil.request.ImageRequest
import com.terning.core.R
import com.terning.core.designsystem.theme.Grey300
import com.terning.core.designsystem.theme.Grey400
import com.terning.core.designsystem.theme.TerningMain
import com.terning.core.designsystem.theme.TerningPointTheme
Expand Down Expand Up @@ -86,7 +87,7 @@ fun InternItem(
Text(
text = dateDeadline,
style = TerningTheme.typography.detail0,
color = TerningMain,
color = if (dateDeadline == stringResource(id = R.string.intern_apply_closed)) Grey300 else TerningMain,
)
TwoLineHeightText(
text = title,
Expand Down
15 changes: 8 additions & 7 deletions core/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,19 @@
<string name="intern_item_working_period_month">%s๊ฐœ์›”</string>
<string name="intern_item_d_day">D-%s</string>
<string name="intern_item_scrap">์Šคํฌ๋žฉ</string>
<string name="intern_apply_closed">์ง€์›๋งˆ๊ฐ</string>

<!--Calendar-->
<string name="calendar_button_description_previous">previous</string>
<string name="calendar_button_description_next">next</string>
<string name="calendar_button_description_list">list</string>

<!--SortByBottom-->
<string name="sort_by_earliest">์ฑ„์šฉ ๋งˆ๊ฐ ์ด๋ฅธ์ˆœ</string>
<string name="sort_by_shortest">์งง์€ ๊ทผ๋ฌด ๊ธฐ๊ฐ„์ˆœ</string>
<string name="sort_by_longest">๊ธด ๊ทผ๋ฌด ๊ธฐ๊ฐ„์ˆœ</string>
<string name="sort_by_scrap">์Šคํฌ๋žฉ ๋งŽ์€์ˆœ</string>
<string name="sort_by_view_count">์กฐํšŒ์ˆ˜ ๋งŽ์€์ˆœ</string>
<string name="sort_by_earliest">์ฑ„์šฉ ๋งˆ๊ฐ ์ด๋ฅธ ์ˆœ</string>
<string name="sort_by_shortest">์งง์€ ๊ทผ๋ฌด ๊ธฐ๊ฐ„ ์ˆœ</string>
<string name="sort_by_longest">๊ธด ๊ทผ๋ฌด ๊ธฐ๊ฐ„ ์ˆœ</string>
<string name="sort_by_scrap">์Šคํฌ๋žฉ ๋งŽ์€ ์ˆœ</string>
<string name="sort_by_view_count">์กฐํšŒ์ˆ˜ ๋งŽ์€ ์ˆœ</string>
<string name="sort_button_description">์ •๋ ฌ ๊ธฐ์ค€</string>
<string name="sort_bottom_sheet_title">๊ณต๊ณ  ์ •๋ ฌ ์ˆœ์„œ</string>

Expand Down Expand Up @@ -76,8 +77,8 @@
<string name="change_filter_grade_3">3ํ•™๋…„</string>
<string name="change_filter_grade_4">4ํ•™๋…„</string>
<string name="change_filter_period_title">ํฌ๋ง ๊ทผ๋ฌด ๊ธฐ๊ฐ„</string>
<string name="change_filter_period_1">1๊ฐœ์›” ~ 3๊ฐœ์›”</string>
<string name="change_filter_period_2">4๊ฐœ์›” ~ 6๊ฐœ์›”</string>
<string name="change_filter_period_1">1 ~ 3๊ฐœ์›”</string>
<string name="change_filter_period_2">4 ~ 6๊ฐœ์›”</string>
<string name="change_filter_period_3">7๊ฐœ์›” ์ด์ƒ</string>
<string name="change_filter_start_work_title">๊ทผ๋ฌด ์‹œ์ž‘ ์‹œ๊ธฐ</string>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import kotlinx.serialization.Serializable
@Serializable
data class ChangeFilterRequestDto(
@SerialName("grade")
val grade: Int,
val grade: String,
@SerialName("workingPeriod")
val workingPeriod: Int,
val workingPeriod: String,
@SerialName("startYear")
val startYear: Int,
@SerialName("startMonth")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import kotlinx.serialization.Serializable
@Serializable
data class HomeFilteringInfoResponseDto(
@SerialName("grade")
val grade: Int?,
val grade: String?,
@SerialName("workingPeriod")
val workingPeriod: Int?,
val workingPeriod: String?,
@SerialName("startYear")
val startYear: Int?,
@SerialName("startMonth")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ data class HomeUpcomingInternResponseDto(
val color: String,
@SerialName("startYearMonth")
val startYearMonth: String,
)
@SerialName("companyInfo")
val companyInfo: String,
)
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ fun HomeUpcomingInternResponseDto.toHomeUpcomingInternList(): HomeUpcomingIntern
isScrapped = this.isScrapped,
startYearMonth = this.startYearMonth,
color = this.color,
)
companyInfo = this.companyInfo,
)
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.terning.domain.entity.home

data class HomeFilteringInfo(
val grade: Int?,
val workingPeriod: Int?,
val grade: String?,
val workingPeriod: String?,
val startYear: Int?,
val startMonth: Int?,
)
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ data class HomeUpcomingIntern(
val isScrapped: Boolean,
val color: String,
val startYearMonth: String,
val companyInfo: String,
)
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.terning.domain.entity.request

data class ChangeFilteringRequestModel(
val grade: Int,
val workingPeriod: Int,
val grade: String,
val workingPeriod: String,
val startYear: Int,
val startMonth: Int,
)
114 changes: 57 additions & 57 deletions feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ fun HomeRoute(
val context = LocalContext.current

LaunchedEffect(key1 = true) {
viewModel.getProfile()
viewModel.getFilteringInfo()
}

Expand Down Expand Up @@ -158,9 +159,9 @@ fun HomeScreen(

if (changeFilteringSheetState) {
HomeFilteringBottomSheet(
defaultGrade = homeFilteringInfo.grade?.let { Grade.entries[it] },
defaultGrade = homeFilteringInfo.grade?.let { Grade.fromString(it) },
defaultWorkingPeriod = homeFilteringInfo.workingPeriod?.let {
WorkingPeriod.entries[it]
WorkingPeriod.fromString(it)
},
defaultStartYear = homeFilteringInfo.startYear,
defaultStartMonth = homeFilteringInfo.startMonth,
Expand All @@ -178,18 +179,48 @@ fun HomeScreen(
}
}

LaunchedEffect(
homeState.homeRecommendDialogVisibility,
homeState.homeUpcomingDialogVisibility
) {
with(homeState) {
if (!homeRecommendDialogVisibility && !homeUpcomingDialogVisibility) {
viewModel.getRecommendInternsData(
sortBy = sortBy.ordinal,
startYear = homeFilteringInfo.startYear ?: Calendar.getInstance().currentYear,
startMonth = homeFilteringInfo.startMonth
?: Calendar.getInstance().currentMonth,
)
if (homeState.homeRecommendDialogVisibility) {
with(homeState.homeInternModel) {
if (this != null) {
if (isScrapped) {
ScrapCancelDialog(
internshipAnnouncementId = internshipAnnouncementId,
onDismissRequest = {
viewModel.updateRecommendDialogVisibility(false)
viewModel.getHomeUpcomingInternList()
viewModel.getRecommendInternsData(
sortBy = homeState.sortBy.ordinal,
startYear = homeFilteringInfo.startYear ?: Calendar.getInstance().currentYear,
startMonth = homeFilteringInfo.startMonth
?: Calendar.getInstance().currentMonth,
)
}
)
} else {
ScrapDialog(
title = title,
scrapColor = CalRed,
deadline = deadline,
startYearMonth = startYearMonth,
workingPeriod = workingPeriod,
internshipAnnouncementId = internshipAnnouncementId,
companyImage = companyImage,
isScrapped = isScrapped,
onDismissRequest = {
viewModel.updateRecommendDialogVisibility(
false
)
viewModel.getHomeUpcomingInternList()
viewModel.getRecommendInternsData(
sortBy = homeState.sortBy.ordinal,
startYear = homeFilteringInfo.startYear ?: Calendar.getInstance().currentYear,
startMonth = homeFilteringInfo.startMonth
?: Calendar.getInstance().currentMonth,
)
},
onClickNavigateButton = navigateToIntern
)
}
}
}
}
Expand All @@ -216,10 +247,7 @@ fun HomeScreen(
.fillMaxWidth(),
) {
item {
Column(
modifier = Modifier
.padding(bottom = 16.dp)
) {
Column {
ShowMainTitleWithName(homeUserName)
ShowUpcomingIntern(
homeUpcomingInternState = homeState.homeUpcomingInternState,
Expand Down Expand Up @@ -300,41 +328,6 @@ fun HomeScreen(
}
}
)

if (homeState.homeRecommendDialogVisibility) {
with(homeState.homeInternModel) {
if (this != null) {
if (isScrapped) {
ScrapCancelDialog(
internshipAnnouncementId = internshipAnnouncementId,
onDismissRequest = {
viewModel.updateRecommendDialogVisibility(false)
viewModel.getHomeUpcomingInternList()
}
)
} else {
ScrapDialog(
title = title,
scrapColor = CalRed,
deadline = deadline,
startYearMonth = startYearMonth,
workingPeriod = workingPeriod,
internshipAnnouncementId = internshipAnnouncementId,
companyImage = companyImage,
isScrapped = isScrapped,
onDismissRequest = {
viewModel.updateRecommendDialogVisibility(
false
)
viewModel.getHomeUpcomingInternList()
},
onClickChangeColor = { /*TODO*/ },
onClickNavigateButton = navigateToIntern
)
}
}
}
}
}
} else {
item {
Expand Down Expand Up @@ -382,8 +375,12 @@ private fun ShowMainTitleWithName(userName: String) {
else userName
),
modifier = Modifier
.padding(top = 11.dp, bottom = 19.dp)
.padding(horizontal = 24.dp),
.padding(
top = 2.dp,
bottom = 20.dp,
start = 24.dp,
end = 24.dp,
),
style = TerningTheme.typography.title1,
color = Black,
)
Expand Down Expand Up @@ -422,8 +419,11 @@ private fun ShowRecommendTitle() {
style = TerningTheme.typography.title1,
color = Black,
modifier = Modifier
.padding(top = 5.dp)
.padding(horizontal = 24.dp),
.padding(
top = 22.dp,
start = 24.dp,
end = 24.dp,
),
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ class HomeViewModel @Inject constructor(
private val _homeSideEffect = MutableSharedFlow<HomeSideEffect>()
val homeSideEffect get() = _homeSideEffect.asSharedFlow()

init {
getProfile()
getFilteringInfo()
}

fun getRecommendInternsData(sortBy: Int, startYear: Int?, startMonth: Int?) {
viewModelScope.launch {
homeRepository.getRecommendIntern(
Expand Down Expand Up @@ -94,15 +89,15 @@ class HomeViewModel @Inject constructor(
}
}

fun putFilteringInfo(grade: Int, workingPeriod: Int, year: Int, month: Int) {
fun putFilteringInfo(grade: String, workingPeriod: String, year: Int, month: Int) {
viewModelScope.launch {
homeRepository.putFilteringInfo(
ChangeFilteringRequestModel(grade, workingPeriod, year, month)
)
}
}

private fun getProfile() {
fun getProfile() {
viewModelScope.launch {
myPageRepository.getProfile().onSuccess { response ->
_homeState.value = _homeState.value.copy(
Expand Down Expand Up @@ -138,6 +133,7 @@ class HomeViewModel @Inject constructor(
isScrapped: Boolean,
color: String?,
startYearMonth: String,
companyInfo: String = "",
) {
_homeState.update {
it.copy(
Expand All @@ -152,6 +148,7 @@ class HomeViewModel @Inject constructor(
isScrapped = isScrapped,
color = color ?: "",
startYearMonth = startYearMonth,
companyInfo = companyInfo,
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fun HomeFilteringBottomSheet(
defaultStartYear: Int?,
defaultStartMonth: Int?,
onDismiss: () -> Unit,
onChangeButtonClick: (Int, Int, Int, Int) -> Unit,
onChangeButtonClick: (String, String, Int, Int) -> Unit,
) {
val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true)

Expand Down Expand Up @@ -126,8 +126,8 @@ fun HomeFilteringBottomSheet(

YearMonthPicker(
chosenYear = defaultStartYear ?: Calendar.getInstance().currentYear,
chosenMonth = defaultStartMonth?.minus(1)
?: Calendar.getInstance().currentMonth.minus(1),
chosenMonth = defaultStartMonth
?: Calendar.getInstance().currentMonth,
onYearChosen = { currentStartYear = it },
onMonthChosen = { currentStartMonth = it }
)
Expand All @@ -142,8 +142,8 @@ fun HomeFilteringBottomSheet(
currentGrade?.let { grade ->
currentPeriod?.let { workingPeriod ->
onChangeButtonClick(
grade.ordinal,
workingPeriod.ordinal,
grade.stringValue,
workingPeriod.stringValue,
currentStartYear,
currentStartMonth,
)
Expand Down Expand Up @@ -184,7 +184,7 @@ fun ChangeFilteringRadioGroup(

LazyVerticalGrid(
columns = GridCells.Fixed(optionList.size),
horizontalArrangement = Arrangement.spacedBy(12.dp),
horizontalArrangement = Arrangement.spacedBy(13.dp),
modifier = modifier
.fillMaxWidth()
.wrapContentHeight()
Expand Down
Loading

0 comments on commit 5f590c8

Please sign in to comment.