diff --git a/core/src/main/java/com/terning/core/designsystem/component/dialog/ScrapCancelDialogContent.kt b/core/src/main/java/com/terning/core/designsystem/component/dialog/ScrapCancelDialogContent.kt index a615f8e34..2eb518859 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/dialog/ScrapCancelDialogContent.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/dialog/ScrapCancelDialogContent.kt @@ -52,7 +52,9 @@ fun ScrapCancelDialogContent( ) { TerningLottieAnimation( jsonString = "terning_scrap_cancel.json", - modifier = Modifier.fillMaxWidth().aspectRatio(1f) + modifier = Modifier + .fillMaxWidth() + .aspectRatio(1f) ) Text( @@ -69,19 +71,14 @@ fun ScrapCancelDialogContent( top = 5.dp ) ) - Box( - modifier = Modifier.fillMaxSize(), - contentAlignment = Alignment.BottomCenter - ) { - RoundButton( - style = TerningTheme.typography.button3, - paddingVertical = 12.dp, - cornerRadius = 8.dp, - text = R.string.dialog_scrap_cancel_button, - onButtonClick = onClickScrapCancel, - modifier = Modifier.padding(bottom = 8.dp) - ) - } + RoundButton( + style = TerningTheme.typography.button3, + paddingVertical = 12.dp, + cornerRadius = 8.dp, + text = R.string.dialog_scrap_cancel_button, + onButtonClick = onClickScrapCancel, + modifier = Modifier.padding(bottom = 8.dp, top = 40.dp) + ) } } } \ No newline at end of file diff --git a/core/src/main/java/com/terning/core/designsystem/component/dialog/TerningBasicDialog.kt b/core/src/main/java/com/terning/core/designsystem/component/dialog/TerningBasicDialog.kt index a4a3331e4..2264c1cf0 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/dialog/TerningBasicDialog.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/dialog/TerningBasicDialog.kt @@ -11,6 +11,7 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.wrapContentHeight +import androidx.compose.foundation.layout.wrapContentSize import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Icon import androidx.compose.material3.IconButton @@ -47,7 +48,8 @@ fun TerningBasicDialog( ) { Box( modifier = Modifier - .size(width = 300.dp, height = 472.dp) + .wrapContentSize() + .padding(horizontal = 27.dp) .background( color = White, shape = RoundedCornerShape(20.dp) diff --git a/core/src/main/java/com/terning/core/extension/LocalDateExt.kt b/core/src/main/java/com/terning/core/extension/LocalDateExt.kt index 1f8d4355f..efdad9462 100644 --- a/core/src/main/java/com/terning/core/extension/LocalDateExt.kt +++ b/core/src/main/java/com/terning/core/extension/LocalDateExt.kt @@ -11,6 +11,8 @@ fun LocalDate.getStringAsTitle(): String = fun LocalDate.getDateStringInKorean(): String = "${monthValue}월 ${dayOfMonth}일 ${dayOfWeek.getDisplayName(TextStyle.FULL, Locale.KOREAN)}" +fun LocalDate.getFullDateStringInKorean(): String = "${year}년 ${monthValue}월 ${dayOfMonth}일" + fun LocalDate.getDateAsMapString(): String { val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd") return format(formatter) diff --git a/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarRoute.kt b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarRoute.kt index a353dfb3e..8e7b01e5b 100644 --- a/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarRoute.kt +++ b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarRoute.kt @@ -19,6 +19,7 @@ import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope +import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.runtime.snapshotFlow import androidx.compose.ui.Modifier @@ -62,6 +63,17 @@ private fun CalendarScreen( val lifecycleOwner = LocalLifecycleOwner.current val calendarUiState by viewModel.uiState.collectAsStateWithLifecycle(lifecycleOwner = lifecycleOwner) + + + val state by remember { mutableStateOf(CalendarState()) } + + val listState = rememberLazyListState( + initialFirstVisibleItemIndex = state.getInitialPage() + ) + + var currentDate by rememberSaveable { mutableStateOf(YearMonth.now()) } + var currentPage by rememberSaveable { mutableIntStateOf(listState.firstVisibleItemIndex) } + LaunchedEffect(viewModel.calendarSideEffect, lifecycleOwner) { viewModel.calendarSideEffect.flowWithLifecycle(lifecycle = lifecycleOwner.lifecycle) .collect { sideEffect -> @@ -71,15 +83,6 @@ private fun CalendarScreen( } } - val state by remember { mutableStateOf(CalendarState()) } - - val listState = rememberLazyListState( - initialFirstVisibleItemIndex = state.getInitialPage() - ) - - var currentDate by remember { mutableStateOf(YearMonth.now()) } - var currentPage by remember { mutableIntStateOf(listState.firstVisibleItemIndex) } - LaunchedEffect(key1 = listState) { snapshotFlow { listState.firstVisibleItemIndex } .distinctUntilChanged() diff --git a/feature/src/main/java/com/terning/feature/calendar/calendar/component/CalendarDetailDialog.kt b/feature/src/main/java/com/terning/feature/calendar/calendar/component/CalendarDetailDialog.kt index e76719ccd..dc25232c2 100644 --- a/feature/src/main/java/com/terning/feature/calendar/calendar/component/CalendarDetailDialog.kt +++ b/feature/src/main/java/com/terning/feature/calendar/calendar/component/CalendarDetailDialog.kt @@ -1,6 +1,5 @@ package com.terning.feature.calendar.calendar.component -import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.border import androidx.compose.foundation.layout.Arrangement @@ -9,13 +8,13 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.aspectRatio -import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.size 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 import androidx.compose.material3.Icon @@ -36,18 +35,14 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp -import androidx.compose.ui.window.DialogProperties import coil.compose.AsyncImage import coil.request.ImageRequest import com.terning.core.R import com.terning.core.designsystem.component.button.RoundButton import com.terning.core.designsystem.component.dialog.TerningBasicDialog import com.terning.core.designsystem.component.item.ColorPalette -import com.terning.core.designsystem.theme.CalBlue2 -import com.terning.core.designsystem.theme.CalGreen2 import com.terning.core.designsystem.theme.CalRed import com.terning.core.designsystem.theme.Grey200 -import com.terning.core.designsystem.theme.Grey300 import com.terning.core.designsystem.theme.Grey350 import com.terning.core.designsystem.theme.Grey500 import com.terning.core.designsystem.theme.TerningMain @@ -57,26 +52,21 @@ import com.terning.core.designsystem.theme.White import com.terning.core.extension.noRippleClickable import com.terning.domain.entity.response.CalendarScrapDetailModel import com.terning.feature.intern.component.InternInfoRow -import com.terning.feature.intern.model.InternViewState import java.time.LocalDate @Composable fun CalendarDetailDialog( + deadline: String, scrapDetailModel: CalendarScrapDetailModel?, onDismissRequest: () -> Unit, onClickChangeColorButton: (Color) -> Unit, onClickNavigateButton: (Long) -> Unit, ) { TerningBasicDialog( - onDismissRequest = onDismissRequest, - properties = DialogProperties( - usePlatformDefaultWidth = false, - decorFitsSystemWindows = true, - dismissOnBackPress = true, - dismissOnClickOutside = false, - ) + onDismissRequest = onDismissRequest ) { InternDialogContent( + deadline = deadline, scrapDetailModel = scrapDetailModel, onClickChangeColorButton = onClickChangeColorButton, onClickNavigateButton = onClickNavigateButton @@ -87,22 +77,30 @@ fun CalendarDetailDialog( @Composable private fun InternDialogContent( + deadline: String, scrapDetailModel: CalendarScrapDetailModel?, onClickChangeColorButton: (Color) -> Unit, onClickNavigateButton: (Long) -> Unit ) { var isPaletteOpen by remember { mutableStateOf(false) } - var selectedColor by remember {mutableStateOf(Color(android.graphics.Color.parseColor(scrapDetailModel?.color)))} + var selectedColor by remember { + mutableStateOf( + Color( + android.graphics.Color.parseColor( + scrapDetailModel?.color + ) + ) + ) + } Box( modifier = Modifier - .fillMaxSize() + .wrapContentSize() .padding(top = 32.dp), contentAlignment = Alignment.TopCenter ) { Column( modifier = Modifier - .fillMaxSize() .padding(horizontal = 11.dp), horizontalAlignment = Alignment.CenterHorizontally ) { @@ -115,11 +113,11 @@ private fun InternDialogContent( modifier = Modifier .width(80.dp) .aspectRatio(1f) - .clip(RoundedCornerShape(5.dp)) + .clip(RoundedCornerShape(15.dp)) .border( width = 1.dp, color = TerningMain, - shape = RoundedCornerShape(size = 5.dp) + shape = RoundedCornerShape(size = 15.dp) ) ) Text( @@ -221,7 +219,7 @@ private fun InternDialogContent( ) { InternInfoRow( title = stringResource(id = com.terning.feature.R.string.intern_info_d_day), - value = scrapDetailModel?.deadLine.toString() + value = deadline ) InternInfoRow( title = stringResource(id = com.terning.feature.R.string.intern_info_working), @@ -229,58 +227,29 @@ private fun InternDialogContent( ) InternInfoRow( title = stringResource(id = com.terning.feature.R.string.intern_info_start_date), - value = "${scrapDetailModel?.startYear?:LocalDate.now().year}년 " + - "${scrapDetailModel?.startMonth?:LocalDate.now().monthValue}월" + value = "${scrapDetailModel?.startYear ?: LocalDate.now().year}년 " + + "${scrapDetailModel?.startMonth ?: LocalDate.now().monthValue}월" ) } } } - Box( - modifier = Modifier.fillMaxSize(), - contentAlignment = Alignment.BottomCenter - ) { - RoundButton( - style = TerningTheme.typography.button3, - paddingVertical = 12.dp, - cornerRadius = 8.dp, - text = if (isPaletteOpen) R.string.dialog_content_calendar_color_change - else R.string.dialog_scrap_move_to_intern, - onButtonClick = { - if (isPaletteOpen) { - onClickChangeColorButton(selectedColor) - isPaletteOpen = false - } else { - onClickNavigateButton(scrapDetailModel?.internshipAnnouncementId?:0) - } - }, - modifier = Modifier.padding(bottom = 8.dp) - ) - } - } - } -} - -@Preview(showBackground = true) -@Composable -fun InternDialogContentPreview() { - TerningPointTheme { - CalendarDetailDialog( - onDismissRequest = {}, - onClickChangeColorButton = {}, - onClickNavigateButton = {}, - scrapDetailModel = CalendarScrapDetailModel( - scrapId = 123, - internshipAnnouncementId = 123, - title = "테스트", - dDay = "asdas", - workingPeriod = "asdas", - startYear = 2023, - startMonth = 1, - isScrapped = true, - color = "0xFF4c3552", - companyImage = "", - deadLine = "sads" + RoundButton( + style = TerningTheme.typography.button3, + paddingVertical = 12.dp, + cornerRadius = 8.dp, + text = if (isPaletteOpen) R.string.dialog_content_calendar_color_change + else R.string.dialog_scrap_move_to_intern, + onButtonClick = { + if (isPaletteOpen) { + onClickChangeColorButton(selectedColor) + isPaletteOpen = false + } else { + onClickNavigateButton(scrapDetailModel?.internshipAnnouncementId ?: 0) + } + }, + modifier = Modifier.padding(bottom = 8.dp) ) - ) + + } } } diff --git a/feature/src/main/java/com/terning/feature/calendar/calendar/component/CalendarDialog.kt b/feature/src/main/java/com/terning/feature/calendar/calendar/component/CalendarDialog.kt index ec902815a..6e2078db3 100644 --- a/feature/src/main/java/com/terning/feature/calendar/calendar/component/CalendarDialog.kt +++ b/feature/src/main/java/com/terning/feature/calendar/calendar/component/CalendarDialog.kt @@ -7,6 +7,7 @@ import androidx.lifecycle.compose.LocalLifecycleOwner import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.navigation.NavController import androidx.navigation.compose.rememberNavController +import com.terning.core.extension.getFullDateStringInKorean import com.terning.feature.calendar.calendar.CalendarViewModel import com.terning.feature.intern.navigation.navigateIntern @@ -30,6 +31,7 @@ fun CalendarDialog( if (uiState.isInternshipClicked) { CalendarDetailDialog( + deadline = uiState.selectedDate.getFullDateStringInKorean(), scrapDetailModel = uiState.internshipModel, onDismissRequest = {viewModel.updateInternDialogVisible(false)}, onClickChangeColorButton = { newColor -> diff --git a/feature/src/main/java/com/terning/feature/calendar/month/CalendarMonth.kt b/feature/src/main/java/com/terning/feature/calendar/month/CalendarMonth.kt index e69cecce0..9af122bc1 100644 --- a/feature/src/main/java/com/terning/feature/calendar/month/CalendarMonth.kt +++ b/feature/src/main/java/com/terning/feature/calendar/month/CalendarMonth.kt @@ -14,6 +14,7 @@ import com.terning.core.designsystem.theme.Grey150 import com.terning.core.designsystem.theme.TerningPointTheme import com.terning.core.extension.getDateAsMapString import com.terning.core.extension.isToday +import com.terning.core.extension.noRippleClickable import com.terning.domain.entity.response.CalendarScrapModel import com.terning.feature.calendar.calendar.CalendarUiState import com.terning.feature.calendar.month.component.CalendarDay @@ -44,6 +45,12 @@ fun CalendarMonth( Column( modifier = Modifier .weight(1f) + .fillMaxSize() + .noRippleClickable { + if(!day.isOutDate) { + onDateSelected(day.date) + } + } .padding(top = 15.dp), horizontalAlignment = Alignment.CenterHorizontally ) { diff --git a/feature/src/main/java/com/terning/feature/calendar/month/component/CalendarDay.kt b/feature/src/main/java/com/terning/feature/calendar/month/component/CalendarDay.kt index bb7788ea6..48e6060d6 100644 --- a/feature/src/main/java/com/terning/feature/calendar/month/component/CalendarDay.kt +++ b/feature/src/main/java/com/terning/feature/calendar/month/component/CalendarDay.kt @@ -22,6 +22,7 @@ import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningPointTheme import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.designsystem.theme.White +import com.terning.core.extension.noRippleClickable import com.terning.feature.calendar.month.model.DayClass import java.time.LocalDate @@ -31,7 +32,7 @@ fun CalendarDay( dayData: DayClass, isSelected: Boolean, isToday: Boolean, - onDateSelected: (LocalDate) -> Unit + onDateSelected: (LocalDate) -> Unit = {} ) { val backgroundColor = if (isSelected) TerningMain else if (isToday) Grey200 else Color.Transparent @@ -52,15 +53,11 @@ fun CalendarDay( Box( modifier = Modifier .size(22.dp) - .clickable( - interactionSource = remember { MutableInteractionSource() }, - indication = null, - onClick = { - if (!dayData.isOutDate) { - onDateSelected(dayData.date) - } + .noRippleClickable { + if (!dayData.isOutDate) { + onDateSelected(dayData.date) } - ) + } .background( color = backgroundColor, shape = CircleShape diff --git a/feature/src/main/java/com/terning/feature/calendar/scrap/CalendarListScreen.kt b/feature/src/main/java/com/terning/feature/calendar/scrap/CalendarListScreen.kt index 878c6b3ea..8fbb66409 100644 --- a/feature/src/main/java/com/terning/feature/calendar/scrap/CalendarListScreen.kt +++ b/feature/src/main/java/com/terning/feature/calendar/scrap/CalendarListScreen.kt @@ -2,9 +2,11 @@ package com.terning.feature.calendar.scrap import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyListState @@ -25,6 +27,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.navigation.NavController import androidx.navigation.compose.rememberNavController import com.terning.core.designsystem.theme.Back +import com.terning.core.designsystem.theme.Grey200 import com.terning.core.designsystem.theme.Grey400 import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.designsystem.theme.White @@ -125,8 +128,16 @@ fun CalendarListScreen( viewModel.updateInternshipModel(scrapDetailModel) viewModel.updateInternDialogVisible(true) }, - isFromList = true, - noScrapScreen = {}) + isFromList = true + ) + + Spacer( + modifier = Modifier + .padding(top = 4.dp) + .fillMaxWidth() + .height(4.dp) + .background(Grey200) + ) } } } diff --git a/feature/src/main/java/com/terning/feature/calendar/scrap/CalendarMonthScrap.kt b/feature/src/main/java/com/terning/feature/calendar/scrap/CalendarMonthScrap.kt index 089a9f654..88ed1928b 100644 --- a/feature/src/main/java/com/terning/feature/calendar/scrap/CalendarMonthScrap.kt +++ b/feature/src/main/java/com/terning/feature/calendar/scrap/CalendarMonthScrap.kt @@ -28,11 +28,11 @@ fun CalendarMonthScrap( items(scrapLists.subList(0, MAX_SCRAP_COUNT.coerceAtMost(scrapLists.size))) { scrap -> Text( text = scrap.title, - style = TerningTheme.typography.body5, + style = TerningTheme.typography.button5, textAlign = TextAlign.Center, color = White, maxLines = 1, - overflow = TextOverflow.Ellipsis, + overflow = TextOverflow.Clip, modifier = Modifier .padding(top = 2.dp) .padding(horizontal = 2.dp) diff --git a/feature/src/main/java/com/terning/feature/calendar/scrap/component/CalendarScrapList.kt b/feature/src/main/java/com/terning/feature/calendar/scrap/component/CalendarScrapList.kt index d988d1eae..5d8b85984 100644 --- a/feature/src/main/java/com/terning/feature/calendar/scrap/component/CalendarScrapList.kt +++ b/feature/src/main/java/com/terning/feature/calendar/scrap/component/CalendarScrapList.kt @@ -1,5 +1,6 @@ package com.terning.feature.calendar.scrap.component +import androidx.compose.foundation.border import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth @@ -22,21 +23,11 @@ import java.time.LocalDate fun CalendarScrapList( selectedDate: LocalDate, scrapList: List, - onScrapButtonClicked:(Long) -> Unit, - onInternshipClicked:(CalendarScrapDetailModel) -> Unit, - isFromList: Boolean = false, - noScrapScreen: @Composable () -> Unit = {} + onScrapButtonClicked: (Long) -> Unit, + onInternshipClicked: (CalendarScrapDetailModel) -> Unit, + isFromList: Boolean = false ) { val scrollState = rememberScrollState() - - if (scrapList.isListNotEmpty()) { - Text( - text = selectedDate.getDateStringInKorean(), - style = TerningTheme.typography.title5, - color = Black, - modifier = Modifier.padding(start = 24.dp, top = 16.dp, bottom = 15.dp) - ) - } val topModifier = if (!isFromList) { Modifier .fillMaxWidth() @@ -48,22 +39,28 @@ fun CalendarScrapList( .padding(horizontal = 24.dp) } - if (!scrapList.isListNotEmpty()) { - noScrapScreen() - } else { - Column( - modifier = topModifier - ) { - for (scrap in scrapList) { - CalendarScrap( - scrap = scrap, - onScrapButtonClicked = onScrapButtonClicked, - onInternshipClicked = onInternshipClicked - ) - Spacer( - modifier = Modifier.height(12.dp) - ) - } + if (scrapList.isListNotEmpty()) { + Text( + text = selectedDate.getDateStringInKorean(), + style = TerningTheme.typography.title5, + color = Black, + modifier = Modifier + .padding(start = 24.dp, top = 16.dp, bottom = 15.dp) + ) + } + + Column( + modifier = topModifier + ) { + for (scrap in scrapList) { + CalendarScrap( + scrap = scrap, + onScrapButtonClicked = onScrapButtonClicked, + onInternshipClicked = onInternshipClicked + ) + Spacer( + modifier = Modifier.height(12.dp) + ) } } } \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayInternDialog.kt b/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayInternDialog.kt index 81380c9fa..8fc621816 100644 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayInternDialog.kt +++ b/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayInternDialog.kt @@ -12,6 +12,7 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size +import androidx.compose.foundation.layout.wrapContentSize import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon @@ -78,184 +79,171 @@ fun HomeTodayInternDialog( CalPurple, CalPink, ) - - Box( + Column( modifier = Modifier - .fillMaxSize() - .padding(top = 32.dp), - contentAlignment = Alignment.TopCenter + .wrapContentSize() + .padding(start = 11.dp, end = 11.dp, top = 32.dp), + horizontalAlignment = Alignment.CenterHorizontally ) { + AsyncImage( + model = ImageRequest.Builder(LocalContext.current) + .data(homeTodayInternModel.companyImage) + .build(), + contentDescription = stringResource(R.string.image_content_descriptin), + modifier = Modifier + .size(80.dp) + .border( + width = 1.dp, + color = TerningMain, + shape = RoundedCornerShape(size = 15.dp) + ) + .clip(RoundedCornerShape(size = 15.dp)), + contentScale = ContentScale.Fit, + alignment = Alignment.Center + ) + + Text( + text = homeTodayInternModel.title, + textAlign = TextAlign.Center, + style = TerningTheme.typography.title4, + color = Grey500, + modifier = Modifier.padding(top = 20.dp), + maxLines = 3, + overflow = TextOverflow.Ellipsis + ) + Text( + text = stringResource( + id = R.string.dialog_today_deadline + ), + style = TerningTheme.typography.body5, + color = Grey350, + modifier = Modifier.padding( + top = 4.dp + ) + ) + Spacer(modifier = Modifier.height(26.dp)) Column( + horizontalAlignment = Alignment.Start, + verticalArrangement = Arrangement.Top, modifier = Modifier - .fillMaxSize() - .padding(horizontal = 11.dp), - horizontalAlignment = Alignment.CenterHorizontally + .fillMaxWidth() + .padding(horizontal = 13.dp) ) { - AsyncImage( - model = ImageRequest.Builder(LocalContext.current) - .data(homeTodayInternModel.companyImage) - .build(), - contentDescription = stringResource(R.string.image_content_descriptin), + Row( modifier = Modifier - .size(80.dp) - .border( - width = 1.dp, - color = TerningMain, - shape = RoundedCornerShape(size = 15.dp) + .background( + color = state.selectedColor, + shape = RoundedCornerShape(14.dp) ) - .clip(RoundedCornerShape(size = 15.dp)), - contentScale = ContentScale.Fit, - alignment = Alignment.Center - ) - - Text( - text = homeTodayInternModel.title, - textAlign = TextAlign.Center, - style = TerningTheme.typography.title4, - color = Grey500, - modifier = Modifier.padding(top = 20.dp), - maxLines = 3, - overflow = TextOverflow.Ellipsis - ) - Text( - text = stringResource( - id = R.string.dialog_today_deadline - ), - style = TerningTheme.typography.body5, - color = Grey350, + .noRippleClickable { + viewModel.updatePaletteOpen(!state.isPaletteOpen) + }, + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.Start + ) { + Text( + text = stringResource(id = R.string.dialog_content_color_button), + style = TerningTheme.typography.body5, + color = White, + modifier = Modifier.padding( + start = 13.dp, + top = 5.dp, + bottom = 5.dp + ) + ) + Icon( + painter = painterResource( + id = if (state.isPaletteOpen) R.drawable.ic_up_22 + else R.drawable.ic_down_22 + ), + contentDescription = stringResource( + id = R.string.dialog_content_color_button + ), + tint = White, + modifier = Modifier.padding( + end = 7.dp + ) + ) + } + HorizontalDivider( + thickness = 1.dp, + color = Grey200, modifier = Modifier.padding( - top = 4.dp + top = 11.dp, + bottom = 8.dp ) ) - Spacer(modifier = Modifier.height(26.dp)) - Column( - horizontalAlignment = Alignment.Start, - verticalArrangement = Arrangement.Top, - modifier = Modifier - .fillMaxWidth() - .padding(horizontal = 13.dp) - ) { - Row( + if (state.isPaletteOpen) { + Box( modifier = Modifier - .background( - color = state.selectedColor, - shape = RoundedCornerShape(14.dp) - ) - .noRippleClickable { - viewModel.updatePaletteOpen(!state.isPaletteOpen) - }, - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.Start - ) { - Text( - text = stringResource(id = R.string.dialog_content_color_button), - style = TerningTheme.typography.body5, - color = White, - modifier = Modifier.padding( - start = 13.dp, - top = 5.dp, - bottom = 5.dp - ) - ) - Icon( - painter = painterResource( - id = if (state.isPaletteOpen) R.drawable.ic_up_22 - else R.drawable.ic_down_22 - ), - contentDescription = stringResource( - id = R.string.dialog_content_color_button + .fillMaxWidth() + .padding( + top = 12.dp, + bottom = 23.dp, ), - tint = White, - modifier = Modifier.padding( - end = 7.dp - ) + contentAlignment = Alignment.Center + ) { + ColorPalette( + initialColor = CalRed, + onColorSelected = { newColor -> + viewModel.updateSelectColor(newColor) + } ) } - HorizontalDivider( - thickness = 1.dp, - color = Grey200, - modifier = Modifier.padding( - top = 11.dp, - bottom = 8.dp - ) + } else { + Text( + text = homeTodayInternModel.dDay, + style = TerningTheme.typography.body5, + color = TerningMain, + modifier = Modifier.padding(bottom = 9.dp) ) - if (state.isPaletteOpen) { - Box( - modifier = Modifier - .fillMaxWidth() - .padding( - top = 12.dp, - bottom = 23.dp, - ), - contentAlignment = Alignment.Center - ) { - ColorPalette( - initialColor = CalRed, - onColorSelected = { newColor -> - viewModel.updateSelectColor(newColor) - } + Column( + modifier = Modifier.padding(bottom = 29.dp), + verticalArrangement = Arrangement.spacedBy( + 5.dp, + Alignment.CenterVertically + ), + horizontalAlignment = Alignment.Start, + ) { + internInfoList.forEach { + InternInfoRow( + title = it.first, + value = it.second ) } - } else { - Text( - text = homeTodayInternModel.dDay, - style = TerningTheme.typography.body5, - color = TerningMain, - modifier = Modifier.padding(bottom = 9.dp) - ) - Column( - modifier = Modifier.padding(bottom = 29.dp), - verticalArrangement = Arrangement.spacedBy( - 5.dp, - Alignment.CenterVertically - ), - horizontalAlignment = Alignment.Start, - ) { - internInfoList.forEach { - InternInfoRow( - title = it.first, - value = it.second - ) - } - } } } - Spacer(modifier = Modifier.weight(1f)) - Box( - modifier = Modifier.fillMaxWidth(), - contentAlignment = Alignment.BottomCenter - ) { - val selectedColorIndex = - colorList.indexOf(state.selectedColor).takeIf { it >= 0 } ?: 0 - - RoundButton( - style = TerningTheme.typography.button3, - paddingVertical = 12.dp, - cornerRadius = 8.dp, - text = if (state.isPaletteOpen) R.string.dialog_content_calendar_color_change else R.string.dialog_scrap_move_to_intern, - onButtonClick = { - if (state.isPaletteOpen) { - viewModel.updatePaletteOpen(false) - viewModel.updateColorChange(false) - viewModel.patchScrap( - scrapId = homeTodayInternModel.scrapId, - colorIndex = selectedColorIndex, - ) - } else { - if (state.isColorChange) { - viewModel.updateColorChange(false) - viewModel.patchScrap( - scrapId = homeTodayInternModel.scrapId, - colorIndex = selectedColorIndex, - ) - } - viewModel.updateScrapDialogVisible(false) - navigateTo() - } - }, - modifier = Modifier.padding(bottom = 8.dp) - ) - } } + val selectedColorIndex = + colorList.indexOf(state.selectedColor).takeIf { it >= 0 } ?: 0 + + RoundButton( + style = TerningTheme.typography.button3, + paddingVertical = 12.dp, + cornerRadius = 8.dp, + text = if (state.isPaletteOpen) R.string.dialog_content_calendar_color_change else R.string.dialog_scrap_move_to_intern, + onButtonClick = { + if (state.isPaletteOpen) { + viewModel.updatePaletteOpen(false) + viewModel.updateColorChange(false) + viewModel.patchScrap( + scrapId = homeTodayInternModel.scrapId, + colorIndex = selectedColorIndex, + ) + } else { + if (state.isColorChange) { + viewModel.updateColorChange(false) + viewModel.patchScrap( + scrapId = homeTodayInternModel.scrapId, + colorIndex = selectedColorIndex, + ) + } + viewModel.updateScrapDialogVisible(false) + navigateTo() + } + }, + modifier = Modifier.padding(bottom = 8.dp) + ) } -} \ No newline at end of file +} + diff --git a/feature/src/main/java/com/terning/feature/intern/component/ScrapDialogContent.kt b/feature/src/main/java/com/terning/feature/intern/component/ScrapDialogContent.kt index 1490b72d3..c09836368 100644 --- a/feature/src/main/java/com/terning/feature/intern/component/ScrapDialogContent.kt +++ b/feature/src/main/java/com/terning/feature/intern/component/ScrapDialogContent.kt @@ -12,6 +12,8 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size +import androidx.compose.foundation.layout.wrapContentHeight +import androidx.compose.foundation.layout.wrapContentSize import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon @@ -80,177 +82,171 @@ fun ScrapDialogContent( CalPink ) - Box( + Column( modifier = Modifier - .fillMaxSize() + .wrapContentSize() + .padding(horizontal = 11.dp) .padding(top = 32.dp), - contentAlignment = Alignment.TopCenter + horizontalAlignment = Alignment.CenterHorizontally ) { + AsyncImage( + model = ImageRequest.Builder(LocalContext.current) + .data(companyImage) + .build(), + contentDescription = stringResource(R.string.image_content_descriptin), + modifier = Modifier + .size(80.dp) + .border( + width = 1.dp, + color = TerningMain, + shape = RoundedCornerShape(size = 15.dp) + ) + .clip(RoundedCornerShape(size = 15.dp)), + contentScale = ContentScale.Fit, + alignment = Alignment.Center + ) + + Text( + text = title, + textAlign = TextAlign.Center, + style = TerningTheme.typography.title4, + color = Grey500, + modifier = Modifier.padding(top = 20.dp), + maxLines = 3, + overflow = TextOverflow.Ellipsis + ) + Text( + text = stringResource(id = R.string.dialog_content_scrap_sub_title), + style = TerningTheme.typography.body5, + color = Grey350, + modifier = Modifier.padding( + top = 4.dp + ) + ) + Spacer(modifier = Modifier.height(26.dp)) Column( + horizontalAlignment = Alignment.Start, + verticalArrangement = Arrangement.Top, modifier = Modifier - .fillMaxSize() - .padding(horizontal = 11.dp), - horizontalAlignment = Alignment.CenterHorizontally + .fillMaxWidth() + .padding(horizontal = 13.dp) ) { - AsyncImage( - model = ImageRequest.Builder(LocalContext.current) - .data(companyImage) - .build(), - contentDescription = stringResource(R.string.image_content_descriptin), + Row( modifier = Modifier - .size(80.dp) - .border( - width = 1.dp, - color = TerningMain, - shape = RoundedCornerShape(size = 15.dp) + .background( + color = state.selectedColor, + shape = RoundedCornerShape(14.dp) ) - .clip(RoundedCornerShape(size = 15.dp)), - contentScale = ContentScale.Fit, - alignment = Alignment.Center - ) - - Text( - text = title, - textAlign = TextAlign.Center, - style = TerningTheme.typography.title4, - color = Grey500, - modifier = Modifier.padding(top = 20.dp), - maxLines = 3, - overflow = TextOverflow.Ellipsis - ) - Text( - text = stringResource(id = R.string.dialog_content_scrap_sub_title), - style = TerningTheme.typography.body5, - color = Grey350, + .noRippleClickable { + viewModel.updatePaletteOpen(!state.isPaletteOpen) + }, + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.Start + ) { + Text( + text = stringResource(id = R.string.dialog_content_color_button), + style = TerningTheme.typography.body5, + color = White, + modifier = Modifier.padding( + start = 13.dp, + top = 5.dp, + bottom = 5.dp + ) + ) + Icon( + painter = painterResource( + id = if (state.isPaletteOpen) R.drawable.ic_up_22 + else R.drawable.ic_down_22 + ), + contentDescription = stringResource( + id = R.string.dialog_content_color_button + ), + tint = White, + modifier = Modifier.padding( + end = 7.dp + ) + ) + } + HorizontalDivider( + thickness = 1.dp, + color = Grey200, modifier = Modifier.padding( - top = 4.dp + top = 11.dp, + bottom = 8.dp ) ) - Spacer(modifier = Modifier.height(26.dp)) - Column( - horizontalAlignment = Alignment.Start, - verticalArrangement = Arrangement.Top, - modifier = Modifier - .fillMaxWidth() - .padding(horizontal = 13.dp) - ) { - Row( + if (state.isPaletteOpen) { + Box( modifier = Modifier - .background( - color = state.selectedColor, - shape = RoundedCornerShape(14.dp) - ) - .noRippleClickable { - viewModel.updatePaletteOpen(!state.isPaletteOpen) - }, - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.Start - ) { - Text( - text = stringResource(id = R.string.dialog_content_color_button), - style = TerningTheme.typography.body5, - color = White, - modifier = Modifier.padding( - start = 13.dp, - top = 5.dp, - bottom = 5.dp - ) - ) - Icon( - painter = painterResource( - id = if (state.isPaletteOpen) R.drawable.ic_up_22 - else R.drawable.ic_down_22 - ), - contentDescription = stringResource( - id = R.string.dialog_content_color_button + .fillMaxWidth() + .padding( + top = 12.dp, + bottom = 23.dp, ), - tint = White, - modifier = Modifier.padding( - end = 7.dp - ) + contentAlignment = Alignment.Center + ) { + ColorPalette( + initialColor = state.selectedColor, + onColorSelected = { newColor -> + viewModel.updateSelectColor(newColor) + } ) } - HorizontalDivider( - thickness = 1.dp, - color = Grey200, - modifier = Modifier.padding( - top = 11.dp, - bottom = 8.dp - ) + } else { + Text( + text = dDay, + style = TerningTheme.typography.body5, + color = TerningMain, + modifier = Modifier.padding(bottom = 9.dp) ) - if (state.isPaletteOpen) { - Box( - modifier = Modifier - .fillMaxWidth() - .padding( - top = 12.dp, - bottom = 23.dp, - ), - contentAlignment = Alignment.Center - ) { - ColorPalette( - initialColor = state.selectedColor, - onColorSelected = { newColor -> - viewModel.updateSelectColor(newColor) - } + Column( + modifier = Modifier.padding(bottom = 29.dp), + verticalArrangement = Arrangement.spacedBy( + 5.dp, + Alignment.CenterVertically + ), + horizontalAlignment = Alignment.Start, + ) { + internInfoList.forEach { + InternInfoRow( + title = it.first, + value = it.second ) } - } else { - Text( - text = dDay, - style = TerningTheme.typography.body5, - color = TerningMain, - modifier = Modifier.padding(bottom = 9.dp) - ) - Column( - modifier = Modifier.padding(bottom = 29.dp), - verticalArrangement = Arrangement.spacedBy( - 5.dp, - Alignment.CenterVertically - ), - horizontalAlignment = Alignment.Start, - ) { - internInfoList.forEach { - InternInfoRow( - title = it.first, - value = it.second - ) - } - } } } - Spacer(modifier = Modifier.weight(1f)) - Box( - modifier = Modifier.fillMaxWidth(), - contentAlignment = Alignment.BottomCenter - ) { - val selectedColorIndex = - colorList.indexOf(state.selectedColor).takeIf { it >= 0 } ?: 0 + } + Box( + modifier = Modifier.fillMaxWidth(), + contentAlignment = Alignment.BottomCenter + ) { + val selectedColorIndex = + colorList.indexOf(state.selectedColor).takeIf { it >= 0 } ?: 0 - RoundButton( - style = TerningTheme.typography.button3, - paddingVertical = 12.dp, - cornerRadius = 8.dp, - text = R.string.dialog_scrap_button, - onButtonClick = { - if (state.isPaletteOpen) { - viewModel.updatePaletteOpen(false) + RoundButton( + style = TerningTheme.typography.button3, + paddingVertical = 12.dp, + cornerRadius = 8.dp, + text = R.string.dialog_scrap_button, + onButtonClick = { + if (state.isPaletteOpen) { + viewModel.updatePaletteOpen(false) + viewModel.postScrap(announcementId, selectedColorIndex) + viewModel.updateColorChange(false) + viewModel.updateScrapDialogVisible(false) + } else { + if (state.isColorChange) { viewModel.postScrap(announcementId, selectedColorIndex) viewModel.updateColorChange(false) - viewModel.updateScrapDialogVisible(false) } else { - if (state.isColorChange) { - viewModel.postScrap(announcementId, selectedColorIndex) - viewModel.updateColorChange(false) - } else { - viewModel.postScrap(announcementId, 0) - } - viewModel.updateScrapDialogVisible(false) + viewModel.postScrap(announcementId, 0) } - }, - modifier = Modifier.padding(bottom = 8.dp) - ) - } + viewModel.updateScrapDialogVisible(false) + } + }, + modifier = Modifier.padding(bottom = 8.dp) + ) } } + } \ No newline at end of file