ProfileScreen UI done
This commit is contained in:
parent
7e6f01351d
commit
8f347d2dc8
@ -6,7 +6,6 @@ import androidx.compose.foundation.layout.Column
|
|||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.width
|
import androidx.compose.foundation.layout.width
|
||||||
@ -65,7 +64,7 @@ fun VisitCard(data: VisitCardDTO, modifier: Modifier = Modifier) {
|
|||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.height(10.dp))
|
Spacer(modifier = Modifier.height(10.dp))
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(if (data.isCode) R.string.qr_login_label else R.string.card_login_label),
|
text = stringResource(if (data.isCode) R.string.label_qr_login else R.string.label_card_login),
|
||||||
style = NTOTheme.typography.displaySmall,
|
style = NTOTheme.typography.displaySmall,
|
||||||
fontSize = 12.sp,
|
fontSize = 12.sp,
|
||||||
color = NTOTheme.colors.disabledText
|
color = NTOTheme.colors.disabledText
|
||||||
|
@ -6,7 +6,6 @@ import androidx.compose.foundation.border
|
|||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
@ -19,12 +18,11 @@ import androidx.compose.foundation.lazy.LazyColumn
|
|||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.foundation.shape.CircleShape
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material.icons.Icons
|
|
||||||
import androidx.compose.material.icons.automirrored.filled.ExitToApp
|
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.IconButton
|
import androidx.compose.material3.IconButton
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.collectAsState
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
@ -37,7 +35,6 @@ import androidx.compose.ui.unit.sp
|
|||||||
import androidx.hilt.navigation.compose.hiltViewModel
|
import androidx.hilt.navigation.compose.hiltViewModel
|
||||||
import androidx.navigation.NavController
|
import androidx.navigation.NavController
|
||||||
import androidx.navigation.compose.rememberNavController
|
import androidx.navigation.compose.rememberNavController
|
||||||
import com.nto.data.models.cards.VisitCardDTO
|
|
||||||
import com.nto.presentation.R
|
import com.nto.presentation.R
|
||||||
import com.nto.presentation.composable.DecoratedButton
|
import com.nto.presentation.composable.DecoratedButton
|
||||||
import com.nto.presentation.composable.cards.VisitCard
|
import com.nto.presentation.composable.cards.VisitCard
|
||||||
@ -50,6 +47,8 @@ fun ProfileScreen(
|
|||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
viewModel: ProfileViewModel = hiltViewModel<ProfileViewModel>(),
|
viewModel: ProfileViewModel = hiltViewModel<ProfileViewModel>(),
|
||||||
) {
|
) {
|
||||||
|
val state = viewModel.state.collectAsState().value
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
modifier = modifier.background(NTOTheme.colors.primaryBackground)
|
modifier = modifier.background(NTOTheme.colors.primaryBackground)
|
||||||
) {
|
) {
|
||||||
@ -80,7 +79,7 @@ fun ProfileScreen(
|
|||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
) {
|
) {
|
||||||
IconButton(modifier = Modifier.size(25.dp), onClick = {
|
IconButton(modifier = Modifier.size(25.dp), onClick = {
|
||||||
//TODO
|
viewModel.admin(navController)
|
||||||
}) {
|
}) {
|
||||||
Icon(
|
Icon(
|
||||||
painter = painterResource(R.drawable.icon_admin),
|
painter = painterResource(R.drawable.icon_admin),
|
||||||
@ -99,7 +98,7 @@ fun ProfileScreen(
|
|||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
) {
|
) {
|
||||||
IconButton(modifier = Modifier.size(25.dp), onClick = {
|
IconButton(modifier = Modifier.size(25.dp), onClick = {
|
||||||
//TODO
|
viewModel.option(navController)
|
||||||
}) {
|
}) {
|
||||||
Icon(
|
Icon(
|
||||||
painter = painterResource(R.drawable.icon_options),
|
painter = painterResource(R.drawable.icon_options),
|
||||||
@ -118,7 +117,7 @@ fun ProfileScreen(
|
|||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
) {
|
) {
|
||||||
IconButton(modifier = Modifier.size(25.dp), onClick = {
|
IconButton(modifier = Modifier.size(25.dp), onClick = {
|
||||||
//TODO
|
viewModel.logout(navController)
|
||||||
}) {
|
}) {
|
||||||
Icon(
|
Icon(
|
||||||
painter = painterResource(R.drawable.icon_logout),
|
painter = painterResource(R.drawable.icon_logout),
|
||||||
@ -151,23 +150,23 @@ fun ProfileScreen(
|
|||||||
.padding(10.dp)
|
.padding(10.dp)
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
"Левченко",
|
state.secondName,
|
||||||
style = NTOTheme.typography.displaySmall,
|
style = NTOTheme.typography.displaySmall,
|
||||||
fontWeight = FontWeight.Bold
|
fontWeight = FontWeight.Bold
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
"Егор",
|
state.firstName,
|
||||||
style = NTOTheme.typography.displaySmall,
|
style = NTOTheme.typography.displaySmall,
|
||||||
fontWeight = FontWeight.Bold
|
fontWeight = FontWeight.Bold
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
"Ростиславович",
|
state.thirdName,
|
||||||
style = NTOTheme.typography.displaySmall,
|
style = NTOTheme.typography.displaySmall,
|
||||||
fontWeight = FontWeight.Bold
|
fontWeight = FontWeight.Bold
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.height(10.dp))
|
Spacer(modifier = Modifier.height(10.dp))
|
||||||
Text(
|
Text(
|
||||||
"Senior UI/UX Designer",
|
state.job,
|
||||||
style = NTOTheme.typography.placeholder,
|
style = NTOTheme.typography.placeholder,
|
||||||
color = TextGray
|
color = TextGray
|
||||||
)
|
)
|
||||||
@ -185,32 +184,30 @@ fun ProfileScreen(
|
|||||||
horizontalArrangement = Arrangement.SpaceBetween
|
horizontalArrangement = Arrangement.SpaceBetween
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
"Последний вход:", style = NTOTheme.typography.placeholder, fontSize = 12.sp
|
stringResource(R.string.lablel_last_visit),
|
||||||
|
style = NTOTheme.typography.placeholder,
|
||||||
|
fontSize = 12.sp
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
"24 января 20:01", style = NTOTheme.typography.placeholder, fontSize = 12.sp
|
state.lastOpen, style = NTOTheme.typography.placeholder, fontSize = 12.sp
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Spacer(modifier = Modifier.height(20.dp))
|
Spacer(modifier = Modifier.height(20.dp))
|
||||||
Text(
|
Text(
|
||||||
"Посещения",
|
stringResource(R.string.lablel_visits),
|
||||||
style = NTOTheme.typography.displaySmall,
|
style = NTOTheme.typography.displaySmall,
|
||||||
fontWeight = FontWeight.Bold
|
fontWeight = FontWeight.Bold
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.height(10.dp))
|
Spacer(modifier = Modifier.height(10.dp))
|
||||||
val test = mutableListOf(
|
|
||||||
VisitCardDTO("Кабинет 207", "id: 129008", "24 января 20:01"),
|
|
||||||
VisitCardDTO("Кабинет 207", "id: 129008", "24 января 20:01"),
|
|
||||||
VisitCardDTO("Кабинет 207", "id: 129008", "24 января 20:01")
|
|
||||||
)
|
|
||||||
LazyColumn(verticalArrangement = Arrangement.spacedBy(10.dp)) {
|
LazyColumn(verticalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||||
items(test) { item ->
|
items(state.visits) { item ->
|
||||||
VisitCard(item)
|
VisitCard(item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DecoratedButton(
|
DecoratedButton(
|
||||||
"Сканировать код",
|
stringResource(R.string.lablel_scan),
|
||||||
false,
|
false,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(10.dp)
|
.padding(10.dp)
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
package com.nto.presentation.screens.profileScreen
|
package com.nto.presentation.screens.profileScreen
|
||||||
|
|
||||||
|
import com.nto.data.models.cards.VisitCardDTO
|
||||||
|
|
||||||
data class ProfileState(
|
data class ProfileState(
|
||||||
val firstName: String,
|
val firstName: String = "",
|
||||||
val secondName: String,
|
val secondName: String = "",
|
||||||
val thirdName: String,
|
val thirdName: String = "",
|
||||||
val lastOpen: String
|
val lastOpen: String = "",
|
||||||
|
val job: String = "",
|
||||||
|
val visits: List<VisitCardDTO> = listOf()
|
||||||
)
|
)
|
||||||
|
@ -3,10 +3,30 @@ package com.nto.presentation.screens.profileScreen
|
|||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.navigation.NavController
|
import androidx.navigation.NavController
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
|
import kotlinx.coroutines.flow.asStateFlow
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@HiltViewModel
|
@HiltViewModel
|
||||||
class ProfileViewModel @Inject constructor() : ViewModel() {
|
class ProfileViewModel @Inject constructor() : ViewModel() {
|
||||||
|
private val _state = MutableStateFlow(ProfileState())
|
||||||
|
|
||||||
|
val state: StateFlow<ProfileState>
|
||||||
|
get() = _state.asStateFlow()
|
||||||
|
|
||||||
|
fun admin(navController: NavController){
|
||||||
|
//TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
fun option(navController: NavController){
|
||||||
|
//TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
fun logout(navController: NavController){
|
||||||
|
//TODO
|
||||||
|
}
|
||||||
|
|
||||||
fun scan(navController: NavController) {
|
fun scan(navController: NavController) {
|
||||||
//TODO
|
//TODO
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,9 @@
|
|||||||
<string name="placholder_email" translatable="false">example@mail.com</string>
|
<string name="placholder_email" translatable="false">example@mail.com</string>
|
||||||
<string name="placeholder_password" translatable="false">**********</string>
|
<string name="placeholder_password" translatable="false">**********</string>
|
||||||
<string name="title_profile">Профиль</string>
|
<string name="title_profile">Профиль</string>
|
||||||
<string name="qr_login_label">Вход по коду</string>
|
<string name="label_qr_login">Вход по коду</string>
|
||||||
<string name="card_login_label">Вход по карте</string>
|
<string name="label_card_login">Вход по карте</string>
|
||||||
|
<string name="lablel_last_visit">Последний вход:</string>
|
||||||
|
<string name="lablel_visits">Посещения</string>
|
||||||
|
<string name="lablel_scan">Сканировать код</string>
|
||||||
</resources>
|
</resources>
|
Loading…
x
Reference in New Issue
Block a user