Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.shadow
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.IntOffset
Expand All @@ -39,7 +40,11 @@ fun <Tab : BottomTab> TnTBottomBar(
enter = fadeIn(animationSpec = tween(700)) + slideIn { IntOffset(0, it.height) },
exit = fadeOut(animationSpec = tween(700)) + slideOut { IntOffset(0, it.height) },
) {
Row(modifier = modifier.background(TnTTheme.colors.commonColors.Common0)) {
Row(
modifier = modifier
.shadow(elevation = 10.dp)
.background(TnTTheme.colors.commonColors.Common0),
) {
bottomTabs.forEach { tab ->
Button(
onClick = { onClickTab(tab) },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ sealed interface Route {
data object TrainerNotification : Route

@Serializable
data object AddPtSession : Route
data class AddPtSession(val selectedDate: String) : Route

@Serializable
data class TraineeMealRecord(val selectedDate: String) : Route
Expand Down
5 changes: 5 additions & 0 deletions feature/main/src/main/java/co/kr/tnt/main/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package co.kr.tnt.main

import android.annotation.SuppressLint
import android.content.pm.ActivityInfo
import android.os.Bundle
import android.widget.Toast
import androidx.activity.ComponentActivity
Expand Down Expand Up @@ -30,9 +32,12 @@ class MainActivity : ComponentActivity() {

private val viewModel: MainViewModel by viewModels()

@SuppressLint("SourceLockedOrientationActivity")
override fun onCreate(savedInstanceState: Bundle?) {
val splashScreen = installSplashScreen()
super.onCreate(savedInstanceState)
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)

enableEdgeToEdge()

getMessagingToken()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -61,16 +65,26 @@ fun RoleSelectionScreen(
var selectedRole by remember { mutableStateOf(RoleState.fromDomain(UserType.TRAINER)) }

Scaffold(
bottomBar = {
TnTBottomButton(
text = stringResource(uiResource.string.next),
enabled = true,
onClick = { onNextClick(selectedRole) },
modifier = Modifier.navigationBarsPadding(),
)
},
modifier = Modifier.fillMaxSize(),
containerColor = TnTTheme.colors.commonColors.Common0,
) { innerPadding ->
Column(
verticalArrangement = Arrangement.SpaceBetween,
modifier = Modifier
.fillMaxSize()
.padding(innerPadding),
verticalArrangement = Arrangement.SpaceBetween,
.padding(innerPadding)
.verticalScroll(rememberScrollState()),
) {
Column(modifier = Modifier.padding(start = 24.dp, top = 60.dp)) {
Column(modifier = Modifier.padding(horizontal = 24.dp)) {
Spacer(Modifier.height(60.dp))
Text(
text = stringResource(R.string.select_role),
color = TnTTheme.colors.neutralColors.Neutral950,
Expand Down Expand Up @@ -113,11 +127,7 @@ fun RoleSelectionScreen(
},
)
}
TnTBottomButton(
text = stringResource(uiResource.string.next),
enabled = true,
onClick = { onNextClick(selectedRole) },
)
Spacer(Modifier.height(60.dp))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ internal class TraineeMealRecordContract {
return copy(
isMealRecordValid = selectedDateTime != null && selectedDateTime <= now &&
mealType.isNotBlank() &&
memo.isNotBlank(),
memo.isNotBlank() &&
memo.length < 100,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.consumeWindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
Expand Down Expand Up @@ -249,6 +250,7 @@ private fun TraineeMealRecordScreen(
Column(
modifier = Modifier
.padding(horizontal = 20.dp)
.consumeWindowInsets(innerPadding)
.imePadding()
.verticalScroll(rememberScrollState()),
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.consumeWindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.imePadding
Expand Down Expand Up @@ -63,6 +64,7 @@ internal fun TraineeBasicInfoPage(
Column(
modifier = Modifier
.fillMaxSize()
.consumeWindowInsets(innerPadding)
.imePadding()
.verticalScroll(rememberScrollState()),
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import androidx.activity.compose.BackHandler
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.consumeWindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.imePadding
import androidx.compose.foundation.layout.padding
Expand Down Expand Up @@ -45,6 +46,7 @@ internal fun TraineeNoteForTrainerPage(
Column(
modifier = Modifier
.fillMaxSize()
.consumeWindowInsets(innerPadding)
.imePadding()
.verticalScroll(rememberScrollState()),
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import androidx.activity.result.contract.ActivityResultContracts.PickVisualMedia
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.consumeWindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.imePadding
Expand Down Expand Up @@ -73,6 +74,7 @@ internal fun TraineeProfileSetupPage(
Column(
modifier = Modifier
.fillMaxSize()
.consumeWindowInsets(innerPadding)
.imePadding()
.verticalScroll(rememberScrollState()),
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.consumeWindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
Expand Down Expand Up @@ -86,16 +87,22 @@ import co.kr.tnt.core.ui.R as coreR

@Composable
internal fun AddPtSessionRoute(
selectedDate: String,
viewModel: AddPtSessionViewModel = hiltViewModel(),
navigateToPrevious: () -> Unit,
) {
val snackbar = LocalSnackbar.current

val state by viewModel.uiState.collectAsStateWithLifecycle()
var showBottomSheet by rememberSaveable { mutableStateOf(false) }
val dateFormatter = remember { DateFormatter() }

BackHandler { viewModel.setEvent(AddPtSessionUiEvent.OnClickBack) }

LaunchedEffect(selectedDate) {
viewModel.setEvent(AddPtSessionUiEvent.OnSelectDate(dateFormatter.parse(selectedDate)))
}

AddPtSessionScreen(
state = state,
onClickBack = { viewModel.setEvent(AddPtSessionUiEvent.OnClickBack) },
Expand Down Expand Up @@ -216,6 +223,7 @@ private fun AddPtSessionScreen(
Column(
modifier = Modifier
.fillMaxSize()
.consumeWindowInsets(innerPadding)
.imePadding()
.verticalScroll(state = rememberScrollState()),
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,27 @@ import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavOptionsBuilder
import androidx.navigation.compose.composable
import androidx.navigation.toRoute
import co.kr.tnt.navigation.Route
import co.kr.tnt.trainer.addptsession.AddPtSessionRoute

fun NavController.navigateToAddPtSession(
selectedDate: String,
navOptions: NavOptionsBuilder.() -> Unit = {},
) = navigate(
route = Route.AddPtSession,
route = Route.AddPtSession(selectedDate),
builder = navOptions,
)

fun NavGraphBuilder.addPtSession(
navigateToPrevious: () -> Unit,
) {
composable<Route.AddPtSession> {
AddPtSessionRoute(navigateToPrevious = navigateToPrevious)
composable<Route.AddPtSession> { backstackEntry ->
backstackEntry.toRoute<Route.AddPtSession>().apply {
AddPtSessionRoute(
selectedDate = selectedDate,
navigateToPrevious = navigateToPrevious,
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ internal fun TrainerHomeRoute(
viewModel: TrainerHomeViewModel = hiltViewModel(),
padding: PaddingValues,
navigateToNotification: () -> Unit,
navigateToAddPtSession: () -> Unit,
navigateToAddPtSession: (selectedDate: String) -> Unit,
navigateToInvite: (ScreenMode) -> Unit,
) {
val toast = LocalSnackbar.current
Expand All @@ -92,7 +92,7 @@ internal fun TrainerHomeRoute(
viewModel.effect.collect { effect ->
when (effect) {
TrainerHomeSideEffect.NavigateToNotification -> navigateToNotification()
TrainerHomeSideEffect.NavigateToAddPtSession -> navigateToAddPtSession()
TrainerHomeSideEffect.NavigateToAddPtSession -> navigateToAddPtSession(state.selectedDay.toString())
TrainerHomeSideEffect.NavigateToInvite -> navigateToInvite(ScreenMode.CLOSE)
is TrainerHomeSideEffect.ShowToast -> toast.show(effect.message)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fun NavController.navigateToTrainerHome(
fun NavGraphBuilder.trainerHomeNavGraph(
padding: PaddingValues,
navigateToNotification: () -> Unit,
navigateToAddPtSession: () -> Unit,
navigateToAddPtSession: (selectedDate: String) -> Unit,
navigateToInvite: (ScreenMode) -> Unit,
homeDestination: NavGraphBuilder.() -> Unit = { },
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import androidx.activity.result.contract.ActivityResultContracts.PickVisualMedia
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.consumeWindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.imePadding
Expand Down Expand Up @@ -74,6 +75,7 @@ internal fun TrainerProfileSetupPage(
Column(
modifier = Modifier
.fillMaxSize()
.consumeWindowInsets(innerPadding)
.imePadding()
.verticalScroll(rememberScrollState()),
) {
Expand Down