|
|
|
@@ -29,8 +29,10 @@ import androidx.compose.foundation.layout.fillMaxSize
|
|
|
|
|
import androidx.compose.foundation.layout.fillMaxWidth
|
|
|
|
|
import androidx.compose.foundation.layout.height
|
|
|
|
|
import androidx.compose.foundation.layout.heightIn
|
|
|
|
|
import androidx.compose.foundation.layout.navigationBarsPadding
|
|
|
|
|
import androidx.compose.foundation.layout.padding
|
|
|
|
|
import androidx.compose.foundation.layout.size
|
|
|
|
|
import androidx.compose.foundation.layout.statusBarsPadding
|
|
|
|
|
import androidx.compose.foundation.layout.width
|
|
|
|
|
import androidx.compose.foundation.lazy.LazyColumn
|
|
|
|
|
import androidx.compose.foundation.lazy.grid.GridCells
|
|
|
|
@@ -44,12 +46,10 @@ import androidx.compose.material.icons.outlined.ArrowBack
|
|
|
|
|
import androidx.compose.material.icons.outlined.CameraAlt
|
|
|
|
|
import androidx.compose.material.icons.outlined.CalendarToday
|
|
|
|
|
import androidx.compose.material.icons.outlined.LocalShipping
|
|
|
|
|
import androidx.compose.material.icons.outlined.Logout
|
|
|
|
|
import androidx.compose.material.icons.outlined.Menu
|
|
|
|
|
import androidx.compose.material.icons.outlined.Person
|
|
|
|
|
import androidx.compose.material.icons.outlined.Phone
|
|
|
|
|
import androidx.compose.material.icons.outlined.Refresh
|
|
|
|
|
import androidx.compose.material.icons.outlined.TaskAlt
|
|
|
|
|
import androidx.compose.material3.Button
|
|
|
|
|
import androidx.compose.material3.ButtonDefaults
|
|
|
|
|
import androidx.compose.material3.Card
|
|
|
|
@@ -112,7 +112,7 @@ fun DriverApp(viewModel: DriverViewModel) {
|
|
|
|
|
when (state.screen) {
|
|
|
|
|
DriverScreen.Phone -> PhoneScreen(state, viewModel::requestOtp)
|
|
|
|
|
DriverScreen.Otp -> OtpScreen(state, viewModel::updateOtpCode, viewModel::verifyOtp, viewModel::back)
|
|
|
|
|
DriverScreen.Routes -> RoutesScreen(state, viewModel::refreshRoutes, viewModel::openRoute, viewModel::logout)
|
|
|
|
|
DriverScreen.Routes -> RoutesScreen(state, viewModel::refreshRoutes, viewModel::openRoute)
|
|
|
|
|
DriverScreen.Detail -> DetailScreen(state, viewModel::back, viewModel::uploadPhoto, viewModel::openPhoto)
|
|
|
|
|
DriverScreen.Photo -> PhotoScreen(state, viewModel::back)
|
|
|
|
|
}
|
|
|
|
@@ -185,11 +185,10 @@ private fun RoutesScreen(
|
|
|
|
|
state: DriverUiState,
|
|
|
|
|
onRefresh: () -> Unit,
|
|
|
|
|
onRoute: (String) -> Unit,
|
|
|
|
|
onLogout: () -> Unit,
|
|
|
|
|
) {
|
|
|
|
|
Scaffold(
|
|
|
|
|
topBar = { StitchHeader(onRefresh = onRefresh, onLogout = onLogout) },
|
|
|
|
|
bottomBar = { StitchBottomBar(onRefresh = onRefresh, onLogout = onLogout) },
|
|
|
|
|
topBar = { StitchHeader(onRefresh = onRefresh) },
|
|
|
|
|
bottomBar = { StitchBottomBar(driverName = state.driver?.displayName.orEmpty(), onRefresh = onRefresh) },
|
|
|
|
|
containerColor = TppColors.Surface,
|
|
|
|
|
) { padding ->
|
|
|
|
|
LazyColumn(
|
|
|
|
@@ -223,8 +222,8 @@ private fun RoutesScreen(
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Composable
|
|
|
|
|
private fun StitchHeader(onRefresh: () -> Unit, onLogout: () -> Unit) {
|
|
|
|
|
Column(Modifier.fillMaxWidth().background(Color.White)) {
|
|
|
|
|
private fun StitchHeader(onRefresh: () -> Unit) {
|
|
|
|
|
Column(Modifier.fillMaxWidth().background(Color.White).statusBarsPadding()) {
|
|
|
|
|
Row(
|
|
|
|
|
Modifier.fillMaxWidth().height(104.dp).padding(horizontal = 24.dp),
|
|
|
|
|
horizontalArrangement = Arrangement.SpaceBetween,
|
|
|
|
@@ -234,7 +233,7 @@ private fun StitchHeader(onRefresh: () -> Unit, onLogout: () -> Unit) {
|
|
|
|
|
Icon(Icons.Outlined.Menu, contentDescription = "Menu", tint = TppColors.Muted, modifier = Modifier.size(32.dp))
|
|
|
|
|
}
|
|
|
|
|
TppWordmark()
|
|
|
|
|
IconButton(onClick = onLogout) {
|
|
|
|
|
IconButton(onClick = { }) {
|
|
|
|
|
Icon(Icons.Outlined.Person, contentDescription = "Profil", tint = TppColors.Muted, modifier = Modifier.size(32.dp))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@@ -357,17 +356,16 @@ private fun RouteTimeline(origin: String, destination: String) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Composable
|
|
|
|
|
private fun StitchBottomBar(onRefresh: () -> Unit, onLogout: () -> Unit) {
|
|
|
|
|
Column(Modifier.fillMaxWidth().background(Color.White)) {
|
|
|
|
|
private fun StitchBottomBar(driverName: String, onRefresh: () -> Unit) {
|
|
|
|
|
Column(Modifier.fillMaxWidth().background(Color.White).navigationBarsPadding()) {
|
|
|
|
|
HorizontalDivider(color = TppColors.Outline.copy(alpha = 0.9f), thickness = 2.dp)
|
|
|
|
|
Row(
|
|
|
|
|
Modifier.fillMaxWidth().height(82.dp),
|
|
|
|
|
horizontalArrangement = Arrangement.SpaceEvenly,
|
|
|
|
|
verticalAlignment = Alignment.CenterVertically,
|
|
|
|
|
) {
|
|
|
|
|
BottomNavItem("Zlecenia", Icons.Outlined.TaskAlt, active = true, onClick = onRefresh)
|
|
|
|
|
BottomNavItem("Trasy", Icons.Outlined.LocalShipping, active = false, onClick = onRefresh)
|
|
|
|
|
BottomNavItem("Profil", Icons.Outlined.Person, active = false, onClick = onLogout)
|
|
|
|
|
BottomNavItem("Zlecenia", Icons.Outlined.LocalShipping, active = true, onClick = onRefresh)
|
|
|
|
|
BottomNavItem(driverName.ifBlank { "Profil" }, Icons.Outlined.Person, active = false, onClick = { })
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@@ -421,6 +419,7 @@ private fun DetailScreen(
|
|
|
|
|
Scaffold(
|
|
|
|
|
topBar = {
|
|
|
|
|
TopAppBar(
|
|
|
|
|
modifier = Modifier.statusBarsPadding(),
|
|
|
|
|
title = { Text("Szczegoly kursu") },
|
|
|
|
|
navigationIcon = { IconButton(onClick = onBack) { Icon(Icons.Outlined.ArrowBack, contentDescription = "Wstecz") } },
|
|
|
|
|
colors = TopAppBarDefaults.topAppBarColors(containerColor = TppColors.Surface),
|
|
|
|
@@ -516,6 +515,7 @@ private fun PhotoScreen(state: DriverUiState, onBack: () -> Unit) {
|
|
|
|
|
Scaffold(
|
|
|
|
|
topBar = {
|
|
|
|
|
TopAppBar(
|
|
|
|
|
modifier = Modifier.statusBarsPadding(),
|
|
|
|
|
title = { Text("Podglad zdjecia") },
|
|
|
|
|
navigationIcon = { IconButton(onClick = onBack) { Icon(Icons.Outlined.ArrowBack, contentDescription = "Wstecz") } },
|
|
|
|
|
colors = TopAppBarDefaults.topAppBarColors(containerColor = Color.Black, titleContentColor = Color.White, navigationIconContentColor = Color.White),
|
|
|
|
|