Skip to content

Commit

Permalink
[MERGE] #150 -> develop
Browse files Browse the repository at this point in the history
[FIX/#150] 스크랩 1차 QA 해결
  • Loading branch information
arinming authored Jul 19, 2024
2 parents 73a7b2e + 1939061 commit df8a5b0
Show file tree
Hide file tree
Showing 17 changed files with 275 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ val Grey500 = Color(0xFF373737)
val Black = Color(0xFF171717)

// Main Color
val TerningMain = Color(0xFF1EA65E)
val TerningMain = Color(0xFF1EAC61)
val TerningMain2 = Color(0xFF179653)

// Sub Color
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ data class SearchResultResponseDto(
val title: String,
@SerialName("workingPeriod")
val workingPeriod: String,
@SerialName("startYearMonth")
val startYearMonth: String,
@SerialName("color")
val color: String?,
@SerialName("deadline")
val deadline: String,
)

fun toSearchResultEntity(): List<SearchResultModel> {
Expand All @@ -38,6 +44,9 @@ data class SearchResultResponseDto(
workingPeriod = it.workingPeriod,
companyImage = it.companyImage,
scrapId = it.scrapId,
deadline = it.deadline,
startYearMonth = it.startYearMonth,
color = it.color
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ data class SearchResultModel(
val workingPeriod: String,
val companyImage: String,
val scrapId: Long?,
val deadline: String,
val startYearMonth: String,
val color: String?,
)
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ private fun InternDialogContent(
contentAlignment = Alignment.Center
) {
ColorPalette(
initialColor = CalRed,
initialColor = selectedColor,
onColorSelected = { newColor ->
selectedColor = newColor
}
Expand All @@ -221,7 +221,7 @@ private fun InternDialogContent(
) {
InternInfoRow(
title = stringResource(id = com.terning.feature.R.string.intern_info_d_day),
value = scrapDetailModel?.title.orEmpty()
value = scrapDetailModel?.deadLine.toString()
)
InternInfoRow(
title = stringResource(id = com.terning.feature.R.string.intern_info_working),
Expand Down
35 changes: 22 additions & 13 deletions feature/src/main/java/com/terning/feature/intern/InternRoute.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.wrapContentWidth
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Icon
Expand All @@ -19,6 +18,7 @@ import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
Expand All @@ -36,6 +36,7 @@ import com.terning.core.designsystem.theme.Grey400
import com.terning.core.designsystem.theme.TerningMain
import com.terning.core.designsystem.theme.TerningTheme
import com.terning.core.extension.customShadow
import com.terning.core.extension.toast
import com.terning.core.state.UiState
import com.terning.domain.entity.response.InternInfoModel
import com.terning.feature.R
Expand All @@ -53,6 +54,7 @@ fun InternRoute(
announcementId: Long = 0,
viewModel: InternViewModel = hiltViewModel(),
) {
val context = LocalContext.current
val lifecycleOwner = LocalLifecycleOwner.current

val state by viewModel.internState.collectAsStateWithLifecycle(lifecycleOwner = lifecycleOwner)
Expand All @@ -65,9 +67,7 @@ fun InternRoute(
viewModel.sideEffect.flowWithLifecycle(lifecycle = lifecycleOwner.lifecycle)
.collect { sideEffect ->
when (sideEffect) {
is InternViewSideEffect.Toast -> {
sideEffect.message
}
is InternViewSideEffect.Toast -> context.toast(sideEffect.message)
}
}
}
Expand Down Expand Up @@ -172,10 +172,11 @@ fun InternScreen(
) {
Text(
text = internInfoModel.dDay,
style = TerningTheme.typography.body0,
style = TerningTheme.typography.title5,
color = TerningMain,
modifier = Modifier.padding(
start = 14.dp, end = 15.dp
horizontal = 12.dp,
vertical = 2.dp
)
)
}
Expand Down Expand Up @@ -225,7 +226,7 @@ fun InternScreen(
)
Text(
text = "${decimal.format(internInfoModel.viewCount)}",
style = TerningTheme.typography.button3,
style = TerningTheme.typography.button4,
color = Grey400,
)
}
Expand Down Expand Up @@ -269,8 +270,8 @@ fun InternScreen(
) {
Row(
modifier = modifier
.padding(end = 17.dp),
verticalAlignment = Alignment.CenterVertically,
.weight(1f),
verticalAlignment = Alignment.Top,
) {
Icon(
painter = painterResource(id = R.drawable.ic_first_info_20),
Expand All @@ -284,6 +285,9 @@ fun InternScreen(
}

Column(
modifier = modifier
.weight(4f)
.padding(start = 8.dp),
verticalArrangement = Arrangement.spacedBy(4.dp, Alignment.Top),
) {
qualificationList.forEach { qualification ->
Expand Down Expand Up @@ -313,10 +317,9 @@ fun InternScreen(
) {
Row(
modifier = modifier
.padding(end = 40.dp)
.wrapContentWidth(),
.weight(1f),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.SpaceBetween
horizontalArrangement = Arrangement.Start
) {
Icon(
painter = painterResource(id = R.drawable.ic_second_info_20),
Expand All @@ -330,6 +333,9 @@ fun InternScreen(
}

Column(
modifier = modifier
.weight(4f)
.padding(start = 8.dp),
verticalArrangement = Arrangement.spacedBy(4.dp, Alignment.Top),
) {
jobTypeList.forEach { jobType ->
Expand Down Expand Up @@ -381,8 +387,11 @@ fun InternScreen(

else -> ScrapDialogContent(
internInfoList = internInfoList,
internInfoModel = internInfoModel,
dDay = internInfoModel.dDay,
title = internInfoModel.title,
companyImage = internInfoModel.companyImage,
announcementId = announcementId,
type = 0
)
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import com.terning.domain.repository.ScrapRepository
import com.terning.feature.R
import com.terning.feature.intern.model.InternScrapState
import com.terning.feature.intern.model.InternViewState
import com.terning.feature.search.searchprocess.SearchProcessSideEffect
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.MutableStateFlow
Expand Down Expand Up @@ -64,6 +65,9 @@ class InternViewModel @Inject constructor(
}
getInternInfo(id)
updateScrapDialogVisible(false)
_sideEffect.emit(
InternViewSideEffect.Toast(R.string.intern_scrap_add_toast_message)
)
}.onFailure {
_sideEffect.emit(
InternViewSideEffect.Toast(R.string.server_failure)
Expand All @@ -86,6 +90,7 @@ class InternViewModel @Inject constructor(
}
getInternInfo(announcementId)
updateScrapDialogVisible(false)
_sideEffect.emit(InternViewSideEffect.Toast(R.string.intern_scrap_delete_toast_message))
}.onFailure {
_sideEffect.emit(
InternViewSideEffect.Toast(R.string.server_failure)
Expand All @@ -107,12 +112,6 @@ class InternViewModel @Inject constructor(
}
}

fun updateScrapped(scrapped: Boolean) {
_internState.update {
it.copy(isScrappedState = scrapped)
}
}

fun updatePaletteOpen(open: Boolean) {
_internState.update {
it.copy(isPaletteOpen = open)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ package com.terning.feature.intern
import androidx.annotation.StringRes

sealed class InternViewSideEffect {
data class Toast(@StringRes val message: Int) : InternViewSideEffect()
data class Toast(@StringRes val message: Int) :
InternViewSideEffect()
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,18 @@ import com.terning.core.designsystem.theme.TerningMain
import com.terning.core.designsystem.theme.TerningTheme
import com.terning.core.designsystem.theme.White
import com.terning.core.extension.noRippleClickable
import com.terning.domain.entity.response.InternInfoModel
import com.terning.feature.intern.InternViewModel


@Composable
fun ScrapDialogContent(
internInfoList: List<Pair<String, String>>,
viewModel: InternViewModel = hiltViewModel(),
internInfoModel: InternInfoModel,
dDay: String,
companyImage: String,
title: String,
announcementId: Long,
type: Int,
) {
val state by viewModel.internState.collectAsStateWithLifecycle()

Expand Down Expand Up @@ -92,7 +94,7 @@ fun ScrapDialogContent(
) {
AsyncImage(
model = ImageRequest.Builder(LocalContext.current)
.data(internInfoModel.companyImage)
.data(companyImage)
.build(),
contentDescription = stringResource(R.string.image_content_descriptin),
modifier = Modifier
Expand All @@ -108,7 +110,7 @@ fun ScrapDialogContent(
)

Text(
text = internInfoModel.title,
text = title,
textAlign = TextAlign.Center,
style = TerningTheme.typography.title4,
color = Grey500,
Expand Down Expand Up @@ -187,15 +189,15 @@ fun ScrapDialogContent(
contentAlignment = Alignment.Center
) {
ColorPalette(
initialColor = CalRed,
initialColor = state.selectedColor,
onColorSelected = { newColor ->
viewModel.updateSelectColor(newColor)
}
)
}
} else {
Text(
text = internInfoModel.dDay,
text = dDay,
style = TerningTheme.typography.body5,
color = TerningMain,
modifier = Modifier.padding(bottom = 9.dp)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.terning.feature.search.search.component

import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.HorizontalDivider
Expand All @@ -15,9 +15,12 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
Expand All @@ -26,6 +29,7 @@ import coil.compose.AsyncImage
import coil.request.ImageRequest
import com.terning.core.designsystem.theme.Black
import com.terning.core.designsystem.theme.Grey100
import com.terning.core.designsystem.theme.Grey150
import com.terning.core.designsystem.theme.TerningTheme
import com.terning.core.designsystem.theme.White
import com.terning.core.extension.noRippleClickable
Expand All @@ -47,6 +51,16 @@ fun SearchIntern(
color = White,
shape = RoundedCornerShape(size = 5.dp)
)
.border(
width = 1.dp,
shape = RoundedCornerShape(size = 5.dp),
brush = Brush.horizontalGradient(
colors = listOf(
Grey150,
Grey150
)
)
)
.padding(top = 8.dp)
.noRippleClickable {
navController.navigateIntern(announcementId = announcementId)
Expand Down Expand Up @@ -74,22 +88,40 @@ fun SearchIntern(
modifier = Modifier.padding(0.dp),
thickness = 2.dp
)
Text(
text = title,
modifier = Modifier
.padding(
start = 8.dp,
bottom = 9.dp,
top = 10.dp,
end = 8.dp
)
.fillMaxWidth()
.wrapContentHeight(),
textAlign = TextAlign.Start,
style = TerningTheme.typography.body6,
color = Black,
overflow = TextOverflow.Ellipsis,
maxLines = 3
)
Column {
ThreeLineHeightText(
text = title,
style = TerningTheme.typography.body6
)
}
}
}


@Composable
fun ThreeLineHeightText(
text: String,
style: TextStyle,
) {
val threeLineHeight = with(LocalDensity.current) {
(style.lineHeight.toDp() * 4) - style.fontSize.toDp()
}

Text(
text = text,
modifier = Modifier
.padding(
start = 8.dp,
bottom = 9.dp,
top = 10.dp,
end = 8.dp
)
.height(threeLineHeight)
.fillMaxWidth(),
textAlign = TextAlign.Start,
style = style,
color = Black,
overflow = TextOverflow.Ellipsis,
maxLines = 3
)
}
Loading

0 comments on commit df8a5b0

Please sign in to comment.