Skip to content

Commit

Permalink
feat: detail navigation 설계 #35
Browse files Browse the repository at this point in the history
  • Loading branch information
easyhz committed Aug 1, 2024
1 parent 3f940d7 commit 53f6809
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 5 deletions.
6 changes: 5 additions & 1 deletion app/src/main/java/com/easyhz/noffice/NofficeApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import com.easyhz.noffice.core.design_system.component.bottomBar.HomeBottomBar
import com.easyhz.noffice.core.design_system.component.button.HomeAddButton
import com.easyhz.noffice.core.design_system.component.scaffold.NofficeScaffold
import com.easyhz.noffice.navigation.announcement.announcementScreen
import com.easyhz.noffice.navigation.announcement.navigateToAnnouncementDetail
import com.easyhz.noffice.navigation.announcement.navigateToAnnouncementNofficeSelection
import com.easyhz.noffice.navigation.home.homeScreen
import com.easyhz.noffice.navigation.home.navigateToHome
Expand Down Expand Up @@ -77,7 +78,10 @@ fun NofficeApp() {
NavHost(
navController = navController, startDestination = Home
) {
homeScreen(modifier = Modifier.padding(it))
homeScreen(
modifier = Modifier.padding(it),
navigateToAnnouncementDetail = navController::navigateToAnnouncementDetail
)
organizationScreen(
modifier = Modifier.padding(it),
navigateToCreation = navController::navigateToOrganizationCreation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,22 @@ import com.easyhz.noffice.feature.announcement.screen.creation.place.PlaceScreen
import com.easyhz.noffice.feature.announcement.screen.creation.remind.RemindScreen
import com.easyhz.noffice.navigation.announcement.screen.AnnouncementCreation
import com.easyhz.noffice.feature.announcement.screen.creation.task.TaskScreen
import com.easyhz.noffice.feature.announcement.screen.detail.AnnouncementDetailScreen
import com.easyhz.noffice.navigation.announcement.screen.AnnouncementDetail
import com.easyhz.noffice.navigation.util.DURATION
import com.easyhz.noffice.navigation.util.sharedViewModel

internal fun NavGraphBuilder.announcementScreen(
navController: NavController,
) {
composable<AnnouncementDetail> {
val args = it.toRoute<AnnouncementDetail>()
AnnouncementDetailScreen(
id = args.id,
title = args.title,
navigateToUp = navController::navigateUp
)
}
navigation<AnnouncementCreation>(
startDestination = AnnouncementCreation.NofficeSelection,
enterTransition = { slideIntoContainer(AnimatedContentTransitionScope.SlideDirection.Start, tween(DURATION)) },
Expand Down Expand Up @@ -92,6 +102,14 @@ internal fun NavGraphBuilder.announcementScreen(
}
}
}

internal fun NavController.navigateToAnnouncementDetail(
id: Int,
title: String
) {
navigate(route = AnnouncementDetail(id, title))
}

internal fun NavController.navigateToAnnouncementNofficeSelection() {
navigate(
route = AnnouncementCreation.NofficeSelection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ import com.easyhz.noffice.feature.home.screen.home.HomeScreen
import com.easyhz.noffice.navigation.home.screen.Home

internal fun NavGraphBuilder.homeScreen(
modifier: Modifier
modifier: Modifier,
navigateToAnnouncementDetail: (Int, String) -> Unit
) {
composable<Home> {
HomeScreen(modifier = modifier)
HomeScreen(
modifier = modifier,
navigateToAnnouncementDetail = navigateToAnnouncementDetail
)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.easyhz.noffice.core.design_system.component.banner.Banner
import com.easyhz.noffice.core.design_system.component.card.ItemCard
import com.easyhz.noffice.core.design_system.extension.screenHorizonPadding
import com.easyhz.noffice.core.design_system.R
import com.easyhz.noffice.core.design_system.util.card.CardDetailInfo
import com.easyhz.noffice.core.design_system.util.card.CardExceptionType
import com.easyhz.noffice.feature.home.component.common.OrganizationHeader

@Composable
fun NoticeView(
modifier: Modifier = Modifier,
navigateToAnnouncementDetail: (Int, String) -> Unit
) {
Column(modifier = modifier) {
Banner(userName = "푸바옹", date = "금요일")
Expand All @@ -36,6 +40,25 @@ fun NoticeView(
horizontalArrangement = Arrangement.spacedBy(12.dp),
contentPadding = PaddingValues(horizontal = 16.dp),
) {
item {
ItemCard(
title = "5차 세션 : 최종 팀 빌딩 ~ 제목이 두 줄 일 때",
detailItems = listOf(
CardDetailInfo(
iconId = R.drawable.ic_calendar,
text = "2024.06.29(토) 14:00",
description = "date"
),
CardDetailInfo(
iconId = R.drawable.ic_mappin,
text = "ZEP",
description = "place"
)
)
) {
navigateToAnnouncementDetail(1, "5차 세션 : 최종 팀 빌딩 ~ 제목이 두 줄 일 때")
}
}
exceptionItem(CardExceptionType.NO_RESULT)
exceptionItem(CardExceptionType.ACCEPT_WAIT)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ import com.easyhz.noffice.feature.home.util.HomeTopBarMenu
@Composable
fun HomeScreen(
modifier: Modifier = Modifier,
viewModel: HomeViewModel = hiltViewModel()
viewModel: HomeViewModel = hiltViewModel(),
navigateToAnnouncementDetail: (Int, String) -> Unit,
) {
val uiState by viewModel.uiState.collectAsStateWithLifecycle()
NofficeScaffold(
Expand All @@ -40,7 +41,10 @@ fun HomeScreen(
) { screen ->
when (screen) {
HomeTopBarMenu.NOTICE -> {
NoticeView(modifier = Modifier.padding(top = paddingValues.calculateTopPadding()))
NoticeView(
modifier = Modifier.padding(top = paddingValues.calculateTopPadding()),
navigateToAnnouncementDetail = navigateToAnnouncementDetail
)
}

HomeTopBarMenu.TASK -> {
Expand Down

0 comments on commit 53f6809

Please sign in to comment.