Skip to content

Commit

Permalink
Merge pull request #68 from mash-up-kr/feature/classification-complet…
Browse files Browse the repository at this point in the history
…e-ui

AI분류 다됐을 때 UI 개발
  • Loading branch information
ddyeon authored Jul 11, 2024
2 parents 38cc469 + 301698f commit ab1ab42
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ fun MainNavHost(
onBoardingNavigation { appState.navController.navigateToHome() }
storageNavigation(appState.navController)
storageDetailNavigation(appState.navController)
classificationNavigation(appState.navController)
classificationNavigation(
onClickBackIcon = { appState.navController.popBackStack() },
navigateToHome = { appState.navController.popBackStack() },
)
saveLinkNavigation(
onClickBackIcon = { appState.navController.popBackStack() },
onClickSaveButton = { appState.navController.navigateToSaveLinkSelectFolder(copiedUrl = it) },
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package com.mashup.feature.classification

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.wrapContentWidth
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
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.theme.DoraColorTokens
import com.mashup.dorabangs.core.designsystem.theme.DoraTypoTokens

@Composable
fun ClassificationCompleteScreen(
navigateToHome: () -> Unit,
modifier: Modifier = Modifier,
) {
Column(
modifier = modifier.fillMaxSize(),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally,
) {
Image(
modifier = Modifier.size(252.dp),
painter = painterResource(id = R.drawable.ic_launcher),
contentDescription = "completeImage",
)
Text(
text = stringResource(id = R.string.ai_classification_complete),
style = DoraTypoTokens.Subtitle2Medium,
color = DoraColorTokens.G9,
)
Spacer(modifier = Modifier.height(16.dp))
DoraButtons.DoraSmallConfirmBtn(
modifier = Modifier
.align(Alignment.CenterHorizontally)
.padding(horizontal = 30.dp, vertical = 8.dp)
.wrapContentWidth(),
buttonText = stringResource(id = R.string.ai_classification_navigate_home),
onClickButton = { navigateToHome() },
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import org.orbitmvi.orbit.compose.collectAsState
@Composable
fun ClassificationRoute(
onClickBackIcon: () -> Unit,
navigateToHome: () -> Unit,
classificationViewModel: ClassificationViewModel = hiltViewModel(),
) {
val state by classificationViewModel.collectAsState()
Expand All @@ -28,18 +29,20 @@ fun ClassificationRoute(
onClickMoveButton = classificationViewModel::moveSelectedItem,
onClickAllItemMoveButton = classificationViewModel::moveAllItems,
onClickBackIcon = onClickBackIcon,
navigateToHome = navigateToHome,
)
}

@Composable
fun ClassificationScreen(
state: ClassificationState,
modifier: Modifier = Modifier,
onClickChip: () -> Unit = {},
onClickDeleteButton: (Int) -> Unit = {},
onClickMoveButton: (Int) -> Unit = {},
onClickAllItemMoveButton: () -> Unit = {},
onClickChip: () -> Unit,
onClickDeleteButton: (Int) -> Unit,
onClickMoveButton: (Int) -> Unit,
onClickAllItemMoveButton: () -> Unit,
onClickBackIcon: () -> Unit,
navigateToHome: () -> Unit,
modifier: Modifier = Modifier,
) {
Column(
modifier = modifier.fillMaxSize(),
Expand All @@ -65,17 +68,29 @@ fun ClassificationScreen(
selectedIndex = 0,
onClickChip = { onClickChip() },
)
ClassificationListScreen(
state = state,
onClickDeleteButton = onClickDeleteButton,
onClickMoveButton = onClickMoveButton,
onClickAllItemMoveButton = onClickAllItemMoveButton,
)
if (state.isClassificationComplete) {
ClassificationCompleteScreen(navigateToHome = navigateToHome)
} else {
ClassificationListScreen(
state = state,
onClickDeleteButton = onClickDeleteButton,
onClickMoveButton = onClickMoveButton,
onClickAllItemMoveButton = onClickAllItemMoveButton,
)
}
}
}

@Preview
@Composable
fun PreviewClassificationScreen() {
ClassificationScreen(state = ClassificationState(), onClickBackIcon = {})
ClassificationScreen(
state = ClassificationState(),
onClickChip = {},
onClickDeleteButton = {},
onClickMoveButton = {},
onClickAllItemMoveButton = {},
onClickBackIcon = {},
navigateToHome = {},
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.mashup.dorabangs.core.designsystem.component.card.FeedCardUiModel

data class ClassificationState(
val folderList: List<String> = listOf(),
val selectedFolder: String = "디자인",
val selectedFolder: String = "디자인", // TODO- 수정 예정
val cardInfoList: List<FeedCardUiModel> = FeedCardUiModel.getDefaultFeedCard(),
val isClassificationComplete: Boolean = false,
)
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ import com.mashup.feature.classification.ClassificationRoute

fun NavController.navigateToClassification() = navigate(NavigationRoute.ClassificationScreen.route)

fun NavGraphBuilder.classificationNavigation(navController: NavController) {
fun NavGraphBuilder.classificationNavigation(
onClickBackIcon: () -> Unit,
navigateToHome: () -> Unit,
) {
composable(
route = NavigationRoute.ClassificationScreen.route,
) {
ClassificationRoute(
onClickBackIcon = { navController.popBackStack() },
onClickBackIcon = onClickBackIcon,
navigateToHome = navigateToHome,
)
}
}
Binary file not shown.
2 changes: 2 additions & 0 deletions feature/classification/src/main/res/values/string.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
<resources>
<string name="ai_classification_title">AI분류</string>
<string name="ai_classification_all_move">모두 이동</string>
<string name="ai_classification_navigate_home">홈으로 이동</string>
<string name="ai_classification_complete">분류한 링크를 모두 확인했어요!</string>
</resources>

0 comments on commit ab1ab42

Please sign in to comment.