Skip to content

Commit

Permalink
fix/#208 : 에피소드 상세화면에서 편집 화면 이동 네비게이션 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
TaewoongR committed Dec 3, 2024
1 parent d925665 commit 1b77511
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import com.boostcamp.mapisode.home.component.MapisodeChip
internal fun EpisodeDetailRoute(
episodeId: String,
viewModel: EpisodeDetailViewModel = hiltViewModel(),
onEpisodeEditClick: (String) -> Unit,
onBackClick: () -> Unit = {},
) {
val uiState by viewModel.uiState.collectAsStateWithLifecycle()
Expand Down Expand Up @@ -93,7 +94,11 @@ internal fun EpisodeDetailRoute(
MapisodeCircularLoadingIndicator()
}
} else {
EpisodeDetailScreen(state = uiState, onBackClick = onBackClick)
EpisodeDetailScreen(
state = uiState,
onEpisodeEditClick = { onEpisodeEditClick(episodeId) },
onBackClick = onBackClick,
)
}
}

Expand All @@ -102,6 +107,7 @@ internal fun EpisodeDetailRoute(
internal fun EpisodeDetailScreen(
state: EpisodeDetailState,
modifier: Modifier = Modifier,
onEpisodeEditClick: () -> Unit,
onBackClick: () -> Unit = {},
) {
val context = LocalContext.current
Expand All @@ -125,7 +131,7 @@ internal fun EpisodeDetailScreen(
},
actions = {
MapisodeIconButton(
onClick = {},
onClick = { onEpisodeEditClick() },
) {
MapisodeIcon(
id = R.drawable.ic_edit,
Expand All @@ -150,7 +156,7 @@ internal fun EpisodeDetailScreen(
modifier = Modifier
.wrapContentWidth()
.horizontalScroll(rememberScrollState()),
horizontalArrangement = Arrangement.spacedBy(4.dp),
horizontalArrangement = Arrangement.spacedBy(10.dp),
verticalAlignment = Alignment.CenterVertically,
) {
imageUrls.forEach { imageUrl ->
Expand All @@ -160,6 +166,7 @@ internal fun EpisodeDetailScreen(
modifier = Modifier
.size(110.dp)
.clip(RoundedCornerShape(16.dp)),
contentScale = ContentScale.Crop,
)
}
}
Expand Down Expand Up @@ -304,6 +311,6 @@ fun EpisodeDetailScreenPreview(
}

CompositionLocalProvider(LocalAsyncImagePreviewHandler provides previewHandler) {
EpisodeDetailScreen(state = state)
EpisodeDetailScreen(state = state, onEpisodeEditClick = {})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ fun NavController.navigateEpisodeEdit(

fun NavGraphBuilder.addHomeNavGraph(
onTextMarkerClick: (EpisodeLatLng) -> Unit,
onEpisodeEditClick: (String) -> Unit,
onEpisodeClick: (String) -> Unit,
onListFabClick: (String) -> Unit,
onBackClick: () -> Unit,
Expand All @@ -56,7 +57,11 @@ fun NavGraphBuilder.addHomeNavGraph(

composable<HomeRoute.Detail> { backStackEntry ->
val episodeId = backStackEntry.toRoute<HomeRoute.Detail>().episodeId
EpisodeDetailRoute(episodeId = episodeId, onBackClick = onBackClick)
EpisodeDetailRoute(
episodeId = episodeId,
onEpisodeEditClick = onEpisodeEditClick,
onBackClick = onBackClick,
)
}

composable<HomeRoute.List> { backStackEntry ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ internal fun MainNavHost(
onTextMarkerClick = { latLng ->
navigator.navigate(MainNavTab.EPISODE, latLng)
},
onEpisodeEditClick = navigator::navigateToEpisodeEdit,
onEpisodeClick = navigator::navigateToEpisodeDetail,
onListFabClick = navigator::navigateToEpisodeList,
onBackClick = navigator::popBackStackIfNotHome,
Expand Down

0 comments on commit 1b77511

Please sign in to comment.