From 908a223e3629aa550f290ca0ebbbba1fc2186ea9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=86=A1=ED=98=84=EC=84=9C?= Date: Tue, 6 Feb 2024 20:45:30 +0900 Subject: [PATCH 1/9] :lipstick: :: Add bottom sheet header --- .../bottomsheet/BottomSheetHeader.kt | 45 +++++++++++++++++++ .../bottomsheet/SelectorBottomSheet.kt | 24 +++------- 2 files changed, 50 insertions(+), 19 deletions(-) create mode 100644 core/design-system/src/main/java/com/goms/design_system/component/bottomsheet/BottomSheetHeader.kt diff --git a/core/design-system/src/main/java/com/goms/design_system/component/bottomsheet/BottomSheetHeader.kt b/core/design-system/src/main/java/com/goms/design_system/component/bottomsheet/BottomSheetHeader.kt new file mode 100644 index 00000000..f062de3d --- /dev/null +++ b/core/design-system/src/main/java/com/goms/design_system/component/bottomsheet/BottomSheetHeader.kt @@ -0,0 +1,45 @@ +package com.goms.design_system.component.bottomsheet + +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.dp +import com.goms.design_system.component.modifier.gomsClickable +import com.goms.design_system.icon.CloseIcon +import com.goms.design_system.theme.GomsTheme + +@Composable +fun BottomSheetHeader( + modifier: Modifier, + title: String, + closeSheet: () -> Unit +) { + GomsTheme { colors, typography -> + Row( + modifier = modifier + .fillMaxWidth() + .height(32.dp), + horizontalArrangement = Arrangement.SpaceBetween, + verticalAlignment = Alignment.CenterVertically + ) { + Text( + text = title, + style = typography.titleSmall, + fontWeight = FontWeight.Bold, + color = colors.WHITE + ) + CloseIcon( + modifier = Modifier.gomsClickable { closeSheet() }, + tint = colors.WHITE + ) + } + Spacer(modifier = Modifier.height(16.dp)) + } +} \ No newline at end of file diff --git a/core/design-system/src/main/java/com/goms/design_system/component/bottomsheet/SelectorBottomSheet.kt b/core/design-system/src/main/java/com/goms/design_system/component/bottomsheet/SelectorBottomSheet.kt index de6ed5de..60d0b555 100644 --- a/core/design-system/src/main/java/com/goms/design_system/component/bottomsheet/SelectorBottomSheet.kt +++ b/core/design-system/src/main/java/com/goms/design_system/component/bottomsheet/SelectorBottomSheet.kt @@ -65,25 +65,11 @@ fun SelectorBottomSheet( } } ) { - Row( - modifier = Modifier - .fillMaxWidth() - .height(32.dp), - horizontalArrangement = Arrangement.SpaceBetween, - verticalAlignment = Alignment.CenterVertically - ) { - Text( - text = title, - style = typography.titleSmall, - fontWeight = FontWeight.Bold, - color = colors.WHITE - ) - CloseIcon( - modifier = Modifier.gomsClickable { closeSheet() }, - tint = colors.WHITE - ) - } - Spacer(modifier = Modifier.height(16.dp)) + BottomSheetHeader( + modifier = Modifier, + title = title, + closeSheet = closeSheet + ) LazyRow( modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(16.dp) From c00c015840963c05ba21e773153745cc7c30dde3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=86=A1=ED=98=84=EC=84=9C?= Date: Tue, 6 Feb 2024 20:45:49 +0900 Subject: [PATCH 2/9] :lipstick: :: Add DatePickerBottomSheet --- .../bottomsheet/DatePickerBottomSheet.kt | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 core/design-system/src/main/java/com/goms/design_system/component/bottomsheet/DatePickerBottomSheet.kt diff --git a/core/design-system/src/main/java/com/goms/design_system/component/bottomsheet/DatePickerBottomSheet.kt b/core/design-system/src/main/java/com/goms/design_system/component/bottomsheet/DatePickerBottomSheet.kt new file mode 100644 index 00000000..fe1e28b6 --- /dev/null +++ b/core/design-system/src/main/java/com/goms/design_system/component/bottomsheet/DatePickerBottomSheet.kt @@ -0,0 +1,67 @@ +package com.goms.design_system.component.bottomsheet + +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.BottomSheetDefaults +import androidx.compose.material3.DatePicker +import androidx.compose.material3.DatePickerDefaults +import androidx.compose.material3.DatePickerState +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.ModalBottomSheet +import androidx.compose.material3.rememberModalBottomSheetState +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.unit.dp +import com.goms.design_system.theme.GomsTheme + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun DatePickerBottomSheet( + state: DatePickerState, + closeSheet: () -> Unit +) { + val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true) + + GomsTheme { colors, typography -> + ModalBottomSheet( + onDismissRequest = closeSheet, + sheetState = sheetState, + shape = RoundedCornerShape(topStart = 12.dp, topEnd = 12.dp), + containerColor = colors.G1, + dragHandle = { BottomSheetDefaults.DragHandle() }, + ) { + Column(modifier = Modifier.fillMaxWidth()) { + BottomSheetHeader( + modifier = Modifier.padding(horizontal = 20.dp), + title = "날짜 선택", + closeSheet = closeSheet + ) + DatePicker( + state = state, + showModeToggle = false, + title = null, + headline = null, + colors = DatePickerDefaults.colors( + containerColor = colors.G1, + weekdayContentColor = colors.G4, + navigationContentColor = colors.WHITE, + yearContentColor = colors.WHITE, + disabledYearContentColor = colors.WHITE, + currentYearContentColor = colors.WHITE, + selectedYearContentColor = colors.WHITE, + dayContentColor = colors.WHITE, + disabledDayContentColor = colors.WHITE, + selectedDayContentColor = Color.White, + disabledSelectedDayContentColor = colors.WHITE, + selectedDayContainerColor = colors.A7, + disabledSelectedDayContainerColor = colors.G1, + todayDateBorderColor = colors.A7 + ) + ) + } + } + } +} \ No newline at end of file From d07448e70c5b913ba3079caad39183289e3cf629 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=86=A1=ED=98=84=EC=84=9C?= Date: Tue, 6 Feb 2024 20:46:02 +0900 Subject: [PATCH 3/9] :lipstick: :: Add LateListText --- .../com/goms/main/component/LateListText.kt | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 feature/main/src/main/java/com/goms/main/component/LateListText.kt diff --git a/feature/main/src/main/java/com/goms/main/component/LateListText.kt b/feature/main/src/main/java/com/goms/main/component/LateListText.kt new file mode 100644 index 00000000..40ab35d9 --- /dev/null +++ b/feature/main/src/main/java/com/goms/main/component/LateListText.kt @@ -0,0 +1,20 @@ +package com.goms.main.component + +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.text.font.FontWeight +import com.goms.design_system.theme.GomsTheme + +@Composable +fun LateListText(modifier: Modifier) { + GomsTheme { colors, typography -> + Text( + modifier = modifier, + text = "외출 현황", + style = typography.titleLarge, + fontWeight = FontWeight.Bold, + color = colors.WHITE + ) + } +} \ No newline at end of file From 1b3e49b96e230da7e1eb03ff44b9a8666f1dc9ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=86=A1=ED=98=84=EC=84=9C?= Date: Tue, 6 Feb 2024 21:08:46 +0900 Subject: [PATCH 4/9] :lipstick: :: Add FilterText --- .../com/goms/main/component/FilterText.kt | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 feature/main/src/main/java/com/goms/main/component/FilterText.kt diff --git a/feature/main/src/main/java/com/goms/main/component/FilterText.kt b/feature/main/src/main/java/com/goms/main/component/FilterText.kt new file mode 100644 index 00000000..92484802 --- /dev/null +++ b/feature/main/src/main/java/com/goms/main/component/FilterText.kt @@ -0,0 +1,31 @@ +package com.goms.main.component + +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.height +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.dp +import com.goms.design_system.component.modifier.gomsClickable +import com.goms.design_system.theme.GomsTheme + +@Composable +fun FilterText(onFilterTextClick: () -> Unit) { + GomsTheme { colors, typography -> + Box( + modifier = Modifier + .height(40.dp) + .gomsClickable { onFilterTextClick() } + ) { + Text( + modifier = Modifier.align(Alignment.Center), + text = "필터", + style = typography.buttonLarge, + fontWeight = FontWeight.Normal, + color = colors.I5 + ) + } + } +} \ No newline at end of file From 16bfc2d721217e4f192887458999b3353cc032d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=86=A1=ED=98=84=EC=84=9C?= Date: Tue, 6 Feb 2024 21:09:03 +0900 Subject: [PATCH 5/9] :lipstick: :: Modify LateListText text --- .../main/src/main/java/com/goms/main/component/LateListText.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature/main/src/main/java/com/goms/main/component/LateListText.kt b/feature/main/src/main/java/com/goms/main/component/LateListText.kt index 40ab35d9..7c41c3c1 100644 --- a/feature/main/src/main/java/com/goms/main/component/LateListText.kt +++ b/feature/main/src/main/java/com/goms/main/component/LateListText.kt @@ -11,7 +11,7 @@ fun LateListText(modifier: Modifier) { GomsTheme { colors, typography -> Text( modifier = modifier, - text = "외출 현황", + text = "지각자 명단", style = typography.titleLarge, fontWeight = FontWeight.Bold, color = colors.WHITE From 600e2bff76a6fd25da30eda3146850648180dc1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=86=A1=ED=98=84=EC=84=9C?= Date: Tue, 6 Feb 2024 21:09:44 +0900 Subject: [PATCH 6/9] :lipstick: :: Add LateList --- .../java/com/goms/main/component/LateList.kt | 122 ++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 feature/main/src/main/java/com/goms/main/component/LateList.kt diff --git a/feature/main/src/main/java/com/goms/main/component/LateList.kt b/feature/main/src/main/java/com/goms/main/component/LateList.kt new file mode 100644 index 00000000..93a2e236 --- /dev/null +++ b/feature/main/src/main/java/com/goms/main/component/LateList.kt @@ -0,0 +1,122 @@ +package com.goms.main.component + +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.heightIn +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.material3.Divider +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.layout.ContentScale +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.dp +import coil.compose.AsyncImage +import com.goms.design_system.R +import com.goms.design_system.theme.GomsTheme +import com.goms.design_system.util.formatTime +import com.goms.model.response.outing.OutingResponse +import com.goms.ui.toText + +@Composable +fun LateList( + modifier: Modifier = Modifier, + onBottomSheetOpenClick: () -> Unit +) { + GomsTheme { colors, typography -> + Column( + modifier = modifier.fillMaxWidth(), + verticalArrangement = Arrangement.spacedBy(16.dp) + ) { + Row( + modifier = modifier.fillMaxWidth(), + horizontalArrangement = Arrangement.SpaceBetween, + verticalAlignment = Alignment.CenterVertically + ) { + SearchResultText(modifier = Modifier) + FilterText(onFilterTextClick = onBottomSheetOpenClick) + } + LazyColumn( + modifier = Modifier + .fillMaxWidth() + .heightIn(max = 10000.dp) + ) { +// items(list.size) { +// LateListItem( +// modifier = Modifier.fillMaxWidth(), +// list = list[it] +// ) +// Divider( +// modifier = Modifier.fillMaxWidth(), +// color = colors.WHITE.copy(0.15f) +// ) +// } + } + } + } +} + +@Composable +fun LateListItem( + modifier: Modifier = Modifier, + list: OutingResponse +) { + GomsTheme { colors, typography -> + Row( + modifier = modifier.padding(horizontal = 16.dp, vertical = 12.dp), + horizontalArrangement = Arrangement.spacedBy(16.dp), + verticalAlignment = Alignment.CenterVertically, + ) { + if (list.profileUrl.isNullOrEmpty()) { + Image( + painter = painterResource(R.drawable.ic_profile), + contentDescription = "Default Profile Image", + modifier = Modifier.size(48.dp) + ) + } else { + AsyncImage( + model = list.profileUrl, + modifier = Modifier.size(48.dp), + contentScale = ContentScale.Crop, + contentDescription = "Profile Image", + ) + } + Column(verticalArrangement = Arrangement.spacedBy(4.dp)) { + Text( + text = list.name, + style = typography.textMedium, + fontWeight = FontWeight.SemiBold, + color = colors.G7 + ) + Row( + horizontalArrangement = Arrangement.spacedBy(4.dp), + verticalAlignment = Alignment.CenterVertically + ) { + Text( + text = "${list.grade}기 | ${list.major.toText()}", + style = typography.caption, + fontWeight = FontWeight.Normal, + color = colors.G4 + ) + Divider( + modifier = Modifier.size(1.dp, 8.dp), + color = colors.WHITE.copy(0.15f) + ) + Text( + text = "${list.createdTime.formatTime()}에 외출", + style = typography.caption, + fontWeight = FontWeight.Normal, + color = colors.G4 + ) + } + } + } + } +} \ No newline at end of file From 6a7a3e947a6b5afd278c89ba4edb2ba30d7e36de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=86=A1=ED=98=84=EC=84=9C?= Date: Tue, 6 Feb 2024 21:10:11 +0900 Subject: [PATCH 7/9] :sparkles: :: Add getDefaultWednesday function --- .../design_system/util/getDefaultWednesday.kt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 core/design-system/src/main/java/com/goms/design_system/util/getDefaultWednesday.kt diff --git a/core/design-system/src/main/java/com/goms/design_system/util/getDefaultWednesday.kt b/core/design-system/src/main/java/com/goms/design_system/util/getDefaultWednesday.kt new file mode 100644 index 00000000..beae13e2 --- /dev/null +++ b/core/design-system/src/main/java/com/goms/design_system/util/getDefaultWednesday.kt @@ -0,0 +1,18 @@ +package com.goms.design_system.util + +import java.time.DayOfWeek +import java.time.Instant +import java.time.LocalDate +import java.time.ZoneId +import java.time.temporal.TemporalAdjusters + +fun getDefaultWednesday(): Instant { + val currentDate = LocalDate.now() + + return if (currentDate.dayOfWeek != DayOfWeek.WEDNESDAY) { + val lastWednesday = currentDate.with(TemporalAdjusters.previous(DayOfWeek.WEDNESDAY)) + lastWednesday.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant() + } else { + currentDate.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant() + } +} \ No newline at end of file From b94b4c82a1f2fe6dd08b4dc8675f52f849db59ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=86=A1=ED=98=84=EC=84=9C?= Date: Tue, 6 Feb 2024 21:10:31 +0900 Subject: [PATCH 8/9] :lipstick: :: Add LateListScreen --- .../main/java/com/goms/main/LateListScreen.kt | 107 ++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 feature/main/src/main/java/com/goms/main/LateListScreen.kt diff --git a/feature/main/src/main/java/com/goms/main/LateListScreen.kt b/feature/main/src/main/java/com/goms/main/LateListScreen.kt new file mode 100644 index 00000000..9f59464f --- /dev/null +++ b/feature/main/src/main/java/com/goms/main/LateListScreen.kt @@ -0,0 +1,107 @@ +package com.goms.main + +import androidx.compose.foundation.background +import androidx.compose.foundation.gestures.detectTapGestures +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.navigationBarsPadding +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.statusBarsPadding +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.text.KeyboardOptions +import androidx.compose.foundation.verticalScroll +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.rememberDatePickerState +import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.input.pointer.pointerInput +import androidx.compose.ui.platform.LocalFocusManager +import androidx.compose.ui.text.input.KeyboardType +import androidx.compose.ui.unit.dp +import com.goms.design_system.component.bottomsheet.DatePickerBottomSheet +import com.goms.design_system.component.button.GomsBackButton +import com.goms.design_system.component.modifier.gomsClickable +import com.goms.design_system.component.textfield.GomsSearchTextField +import com.goms.design_system.theme.GomsTheme +import com.goms.design_system.util.getDefaultWednesday +import com.goms.design_system.util.keyboardAsState +import com.goms.main.component.LateList +import com.goms.main.component.LateListText +import java.time.Instant +import java.time.ZoneId + +@Composable +fun LateListRoute( + onBackClick: () -> Unit +) { + LateListScreen( + onBackClick = onBackClick + ) +} + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun LateListScreen( + onBackClick: () -> Unit, +) { + val scrollState = rememberScrollState() + val focusManager = LocalFocusManager.current + val isKeyboardOpen by keyboardAsState() + val datePickerState = rememberDatePickerState() + var onDatePickerBottomSheetOpenClick by remember { mutableStateOf(false) } + val selectedDate = Instant.ofEpochMilli(datePickerState.selectedDateMillis ?: getDefaultWednesday().toEpochMilli()) + .atZone(ZoneId.systemDefault()) + .toLocalDate() + + LaunchedEffect(isKeyboardOpen) { + if (!isKeyboardOpen) { + focusManager.clearFocus() + } + } + + GomsTheme { colors, typography -> + Column( + modifier = Modifier + .fillMaxSize() + .background(colors.BLACK) + .statusBarsPadding() + .navigationBarsPadding() + .pointerInput(Unit) { + detectTapGestures { + focusManager.clearFocus() + } + } + ) { + GomsBackButton { + onBackClick() + } + Column( + modifier = Modifier + .verticalScroll(scrollState) + .padding(horizontal = 20.dp), + horizontalAlignment = Alignment.CenterHorizontally + ) { + LateListText(modifier = Modifier.align(Alignment.Start)) + Spacer(modifier = Modifier.height(8.dp)) + LateList( + onBottomSheetOpenClick = { onDatePickerBottomSheetOpenClick = true } + ) + } + } + if (onDatePickerBottomSheetOpenClick) { + DatePickerBottomSheet( + state = datePickerState, + closeSheet = { onDatePickerBottomSheetOpenClick = false } + ) + } + } +} \ No newline at end of file From b73d4afb312bbad197a1b23caeeed1f008a27ff1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=86=A1=ED=98=84=EC=84=9C?= Date: Tue, 6 Feb 2024 21:11:09 +0900 Subject: [PATCH 9/9] :sparkles: :: Connect late list navigation --- .../goms_android_v2/navigation/GomsNavHost.kt | 8 ++++++- .../src/main/java/com/goms/main/MainScreen.kt | 11 +++++++--- .../goms/main/navigation/MainNavigation.kt | 22 +++++++++++++++++-- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/goms/goms_android_v2/navigation/GomsNavHost.kt b/app/src/main/java/com/goms/goms_android_v2/navigation/GomsNavHost.kt index 2d2f7f9c..a8f1057c 100644 --- a/app/src/main/java/com/goms/goms_android_v2/navigation/GomsNavHost.kt +++ b/app/src/main/java/com/goms/goms_android_v2/navigation/GomsNavHost.kt @@ -10,7 +10,9 @@ import com.goms.login.navigation.loginRoute import com.goms.login.navigation.loginScreen import com.goms.login.navigation.navigateToInputLogin import com.goms.login.navigation.navigateToLogin +import com.goms.main.navigation.lateListScreen import com.goms.main.navigation.mainScreen +import com.goms.main.navigation.navigateToLateList import com.goms.main.navigation.navigateToMain import com.goms.main.navigation.navigateToOutingStatus import com.goms.main.navigation.outingStatusScreen @@ -59,11 +61,15 @@ fun GomsNavHost( ) mainScreen( viewModelStoreOwner = viewModelStoreOwner, - onOutingStatusClick = navController::navigateToOutingStatus + onOutingStatusClick = navController::navigateToOutingStatus, + onLateListClick = navController::navigateToLateList ) outingStatusScreen( viewModelStoreOwner = viewModelStoreOwner, onBackClick = navController::popBackStack ) + lateListScreen( + onBackClick = navController::popBackStack + ) } } \ No newline at end of file diff --git a/feature/main/src/main/java/com/goms/main/MainScreen.kt b/feature/main/src/main/java/com/goms/main/MainScreen.kt index c3132a07..58f622c0 100644 --- a/feature/main/src/main/java/com/goms/main/MainScreen.kt +++ b/feature/main/src/main/java/com/goms/main/MainScreen.kt @@ -35,7 +35,8 @@ import com.goms.main.viewmodel.MainViewModelProvider @Composable fun MainRoute( viewModelStoreOwner: ViewModelStoreOwner, - onOutingStatusClick: () -> Unit + onOutingStatusClick: () -> Unit, + onLateListClick: () -> Unit ) { MainViewModelProvider(viewModelStoreOwner = viewModelStoreOwner) { viewModel -> val role by viewModel.role.collectAsStateWithLifecycle(initialValue = "") @@ -55,7 +56,8 @@ fun MainRoute( viewModel.getLateRankList() viewModel.getOutingCount() }, - onOutingStatusClick = onOutingStatusClick + onOutingStatusClick = onOutingStatusClick, + onLateListClick = onLateListClick ) } } @@ -69,6 +71,7 @@ fun MainScreen( getOutingCountUiState: GetOutingCountUiState, getData: () -> Unit, onOutingStatusClick: () -> Unit, + onLateListClick: () -> Unit ) { LaunchedEffect(true) { getData() @@ -105,7 +108,9 @@ fun MainScreen( MainLateCard( role = role, getLateRankListUiState = getLateRankListUiState - ) {} + ) { + onLateListClick() + } MainOutingCard( role = role, getOutingListUiState = getOutingListUiState, diff --git a/feature/main/src/main/java/com/goms/main/navigation/MainNavigation.kt b/feature/main/src/main/java/com/goms/main/navigation/MainNavigation.kt index ffe7e016..0bbd3142 100644 --- a/feature/main/src/main/java/com/goms/main/navigation/MainNavigation.kt +++ b/feature/main/src/main/java/com/goms/main/navigation/MainNavigation.kt @@ -5,11 +5,13 @@ import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.NavOptions import androidx.navigation.compose.composable +import com.goms.main.LateListRoute import com.goms.main.MainRoute import com.goms.main.OutingStatusRoute const val mainRoute = "main_route" const val outingStatusRoute = "outing_status_route" +const val lateListRoute = "late_list_route" fun NavController.navigateToMain(navOptions: NavOptions? = null) { this.navigate(mainRoute, navOptions) @@ -17,12 +19,14 @@ fun NavController.navigateToMain(navOptions: NavOptions? = null) { fun NavGraphBuilder.mainScreen( viewModelStoreOwner: ViewModelStoreOwner, - onOutingStatusClick: () -> Unit + onOutingStatusClick: () -> Unit, + onLateListClick: () -> Unit ) { composable(route = mainRoute) { MainRoute( viewModelStoreOwner = viewModelStoreOwner, - onOutingStatusClick = onOutingStatusClick + onOutingStatusClick = onOutingStatusClick, + onLateListClick = onLateListClick ) } } @@ -41,4 +45,18 @@ fun NavGraphBuilder.outingStatusScreen( onBackClick = onBackClick ) } +} + +fun NavController.navigateToLateList(navOptions: NavOptions? = null) { + this.navigate(lateListRoute, navOptions) +} + +fun NavGraphBuilder.lateListScreen( + onBackClick: () -> Unit +) { + composable(route = lateListRoute) { + LateListRoute( + onBackClick = onBackClick + ) + } } \ No newline at end of file