-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
홈과 보관함 폴더 생성/이름 변경 UI 및 navigation 추가 #67
Changes from 15 commits
98d27bd
0f2dcb1
fab70fa
59a9d3b
f7d407a
4f4141e
5a5d642
47f7320
b0e0a0e
b39c6f8
637e0e6
bcdb5b8
fd66fbc
2f80adf
776d6b6
b087a47
c749480
2e35cb8
af5835a
ff0bd1a
bb8d8ea
a8dac49
66093bb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package com.mashup.dorabangs.feature.createfolder | ||
|
||
import androidx.compose.foundation.background | ||
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.padding | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.unit.dp | ||
import com.mashup.dorabangs.core.designsystem.component.buttons.DoraButtons | ||
import com.mashup.dorabangs.core.designsystem.component.textfield.DoraTextField | ||
import com.mashup.dorabangs.core.designsystem.component.topbar.DoraTopBar | ||
import com.mashup.dorabangs.core.designsystem.theme.LinkSaveColorTokens | ||
import com.mashup.dorabangs.home.R | ||
|
||
@Composable | ||
fun HomeCreateFolderRoute( | ||
onClickBackIcon: () -> Unit, | ||
) { | ||
HomeCreateFolderScreen( | ||
onClickBackIcon = onClickBackIcon, | ||
onClickSaveButton = {}, | ||
) | ||
} | ||
|
||
@Composable | ||
fun HomeCreateFolderScreen( | ||
onClickBackIcon: () -> Unit, | ||
onClickSaveButton: () -> Unit, | ||
modifier: Modifier = Modifier, | ||
) { | ||
Column( | ||
modifier = modifier | ||
.fillMaxSize() | ||
.background(color = LinkSaveColorTokens.ContainerColor), | ||
) { | ||
DoraTopBar.BackNavigationTopBar( | ||
modifier = Modifier, | ||
title = stringResource(id = R.string.home_create_folder_title), | ||
isTitleCenter = true, | ||
onClickBackIcon = onClickBackIcon, | ||
) | ||
Spacer(modifier = Modifier.height(height = 24.dp)) | ||
Column( | ||
modifier = modifier | ||
.fillMaxSize() | ||
.padding(horizontal = 20.dp), | ||
) { | ||
DoraTextField( | ||
text = "", | ||
hintText = stringResource(id = R.string.home_create_folder_hint), | ||
labelText = stringResource(id = R.string.home_create_folder_label), | ||
helperText = stringResource(id = R.string.home_create_folder_helper), | ||
helperEnabled = true, | ||
counterEnabled = true, | ||
onValueChanged = {}, | ||
) | ||
Spacer(modifier = Modifier.height(20.dp)) | ||
DoraButtons.DoraBtnMaxFull( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(vertical = 20.dp), | ||
buttonText = stringResource(id = R.string.home_create_folder_save), | ||
enabled = true, | ||
onClickButton = onClickSaveButton, | ||
) | ||
Spacer(modifier = Modifier.height(20.dp)) | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ import androidx.compose.material3.SnackbarDuration | |
import androidx.compose.material3.SnackbarHostState | ||
import androidx.compose.material3.Text | ||
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 | ||
|
@@ -50,17 +51,26 @@ import org.orbitmvi.orbit.compose.collectSideEffect | |
|
||
@Composable | ||
fun HomeRoute( | ||
isVisibleBottomSheet: Boolean, | ||
modifier: Modifier = Modifier, | ||
view: View = LocalView.current, | ||
clipboardManager: ClipboardManager = LocalClipboardManager.current, | ||
viewModel: HomeViewModel = hiltViewModel(), | ||
navigateToClassification: () -> Unit = {}, | ||
navigateToSaveScreenWithLink: (String) -> Unit = {}, | ||
navigateToSaveScreenWithoutLink: () -> Unit = {}, | ||
navigateToCreateFolder: () -> Unit, | ||
) { | ||
val snackBarHostState by remember { mutableStateOf(SnackbarHostState()) } | ||
val state by viewModel.collectAsState() | ||
val scope = rememberCoroutineScope() | ||
|
||
LaunchedEffect(key1 = Unit) { | ||
if (isVisibleBottomSheet) { | ||
viewModel.setVisibleMovingFolderBottomSheet(true) | ||
} | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ddyeon |
||
viewModel.collectSideEffect { sideEffect -> | ||
when (sideEffect) { | ||
is HomeSideEffect.ShowSnackBar -> { | ||
|
@@ -71,10 +81,10 @@ fun HomeRoute( | |
) | ||
} | ||
} | ||
|
||
HomeSideEffect.HideSnackBar -> { | ||
is HomeSideEffect.HideSnackBar -> { | ||
snackBarHostState.currentSnackbarData?.dismiss() | ||
} | ||
is HomeSideEffect.NavigateToCreateFolder -> navigateToCreateFolder() | ||
} | ||
} | ||
|
||
|
@@ -115,6 +125,8 @@ fun HomeRoute( | |
DoraBottomSheet.MoreButtonBottomSheet( | ||
modifier = Modifier.height(320.dp), | ||
isShowSheet = state.isShowMoreButtonSheet, | ||
firstItemName = R.string.more_button_bottom_sheet_remove_link, | ||
secondItemName = R.string.more_button_bottom_sheet_moving_folder, | ||
onClickDeleteLinkButton = { | ||
viewModel.setVisibleMoreButtonBottomSheet(false) | ||
viewModel.setVisibleDialog(true) | ||
|
@@ -131,6 +143,8 @@ fun HomeRoute( | |
isShowSheet = state.isShowMovingFolderSheet, | ||
folderList = testFolderListData, | ||
onDismissRequest = { viewModel.setVisibleMovingFolderBottomSheet(false) }, | ||
onClickCreateFolder = { viewModel.setVisibleMovingFolderBottomSheet(visible = false, isNavigate = true) }, | ||
onClickMoveFolder = {}, | ||
) | ||
|
||
DoraDialog( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.mashup.dorabangs.feature.navigation | ||
|
||
import androidx.navigation.NavController | ||
import androidx.navigation.NavGraphBuilder | ||
import androidx.navigation.NavOptions | ||
import androidx.navigation.compose.composable | ||
import com.mashup.core.navigation.NavigationRoute | ||
import com.mashup.dorabangs.feature.createfolder.HomeCreateFolderRoute | ||
|
||
fun NavController.navigateToHomeCrateFolder(navOptions: NavOptions? = null) = | ||
navigate(NavigationRoute.HomeScreen.HomeCreateFolder.route, navOptions) | ||
|
||
fun NavGraphBuilder.homeCreateFolderNavigation( | ||
onClickBackIcon: () -> Unit, | ||
) { | ||
composable( | ||
route = NavigationRoute.HomeScreen.HomeCreateFolder.route, | ||
) { | ||
HomeCreateFolderRoute( | ||
onClickBackIcon = onClickBackIcon, | ||
) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
package com.mashup.dorabangs.feature.navigation | ||
|
||
import androidx.compose.runtime.collectAsState | ||
import androidx.navigation.NavController | ||
import androidx.navigation.NavGraphBuilder | ||
import androidx.navigation.NavOptions | ||
import androidx.navigation.NavType | ||
import androidx.navigation.compose.composable | ||
import androidx.navigation.navArgument | ||
import com.mashup.core.navigation.NavigationRoute | ||
import com.mashup.dorabangs.feature.home.HomeRoute | ||
|
||
|
@@ -14,14 +17,28 @@ fun NavGraphBuilder.homeNavigation( | |
navigateToClassification: () -> Unit = {}, | ||
navigateToSaveScreenWithLink: (String) -> Unit, | ||
navigateToSaveScreenWithoutLink: () -> Unit, | ||
navigateToCreateFolder: () -> Unit, | ||
) { | ||
composable( | ||
route = NavigationRoute.HomeScreen.route, | ||
) { | ||
arguments = listOf( | ||
navArgument(name = "isVisibleMovingBottomSheet") { | ||
type = NavType.BoolType | ||
defaultValue = false | ||
}, | ||
), | ||
) { backStackEntry -> | ||
|
||
val isVisibleBottomSheet = backStackEntry.savedStateHandle.getStateFlow( | ||
"isVisibleMovingBottomSheet", | ||
initialValue = false, | ||
).collectAsState().value | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ddyeon There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 없는 것 같습니다. viewmodel에서 collect할 일이 없을 것 같아소 get으로 변경하겠숨당~ |
||
HomeRoute( | ||
isVisibleBottomSheet = isVisibleBottomSheet, | ||
navigateToClassification = navigateToClassification, | ||
navigateToSaveScreenWithLink = navigateToSaveScreenWithLink, | ||
navigateToSaveScreenWithoutLink = navigateToSaveScreenWithoutLink, | ||
navigateToCreateFolder = navigateToCreateFolder, | ||
) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ddyeon
리소스 어노테이션 붙이면 더 좋을듯 ~~