Merge remote-tracking branch 'origin/nikolays'
This commit is contained in:
commit
07637a734f
@ -24,6 +24,7 @@ import com.nto.data.models.cards.VisitCardDTO
|
|||||||
import com.nto.data.models.cards.VisitType
|
import com.nto.data.models.cards.VisitType
|
||||||
import com.nto.presentation.R
|
import com.nto.presentation.R
|
||||||
import com.nto.presentation.theme.NTOTheme
|
import com.nto.presentation.theme.NTOTheme
|
||||||
|
import com.nto.presentation.theme.raleway
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.time.format.DateTimeFormatter
|
import java.time.format.DateTimeFormatter
|
||||||
|
|
||||||
@ -46,29 +47,30 @@ fun VisitCard(data: VisitCardDTO, modifier: Modifier = Modifier) {
|
|||||||
Column(horizontalAlignment = Alignment.Start) {
|
Column(horizontalAlignment = Alignment.Start) {
|
||||||
Text(
|
Text(
|
||||||
text = data.name,
|
text = data.name,
|
||||||
style = NTOTheme.typography.displaySmall,
|
fontSize = 14.sp,
|
||||||
fontSize = 12.sp,
|
fontFamily = raleway,
|
||||||
fontWeight = FontWeight.Bold
|
fontWeight = FontWeight.Medium,
|
||||||
|
color = NTOTheme.colors.primaryText
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.height(10.dp))
|
Spacer(modifier = Modifier.height(6.dp))
|
||||||
Text(
|
Text(
|
||||||
text = data.id.toString(),
|
text = data.id.toString(),
|
||||||
style = NTOTheme.typography.displaySmall,
|
|
||||||
fontSize = 12.sp,
|
fontSize = 12.sp,
|
||||||
fontWeight = FontWeight.Thin
|
fontFamily = raleway,
|
||||||
|
color = NTOTheme.colors.primaryText
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Column(horizontalAlignment = Alignment.End) {
|
Column(horizontalAlignment = Alignment.End) {
|
||||||
Text(
|
Text(
|
||||||
text = SimpleDateFormat.getDateInstance().format(data.date),
|
text = SimpleDateFormat.getDateInstance().format(data.date),
|
||||||
style = NTOTheme.typography.displaySmall,
|
fontSize = 14.sp,
|
||||||
fontSize = 12.sp,
|
fontFamily = raleway,
|
||||||
color = NTOTheme.colors.disabledText
|
color = NTOTheme.colors.disabledText
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.height(10.dp))
|
Spacer(modifier = Modifier.height(6.dp))
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(if (data.visitType == VisitType.PHONE_ENTRY) R.string.label_qr_login else R.string.label_card_login),
|
text = stringResource(if (data.visitType == VisitType.PHONE_ENTRY) R.string.label_qr_login else R.string.label_card_login),
|
||||||
style = NTOTheme.typography.displaySmall,
|
fontFamily = raleway,
|
||||||
fontSize = 12.sp,
|
fontSize = 12.sp,
|
||||||
color = NTOTheme.colors.disabledText
|
color = NTOTheme.colors.disabledText
|
||||||
)
|
)
|
||||||
|
@ -48,6 +48,8 @@ import com.nto.presentation.composable.DecoratedButton
|
|||||||
import com.nto.presentation.composable.cards.VisitCard
|
import com.nto.presentation.composable.cards.VisitCard
|
||||||
import com.nto.presentation.theme.NTOTheme
|
import com.nto.presentation.theme.NTOTheme
|
||||||
import com.nto.presentation.theme.TextGray
|
import com.nto.presentation.theme.TextGray
|
||||||
|
import com.nto.presentation.theme.playfair
|
||||||
|
import com.nto.presentation.theme.raleway
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ProfileScreen(
|
fun ProfileScreen(
|
||||||
@ -91,8 +93,9 @@ fun ProfileScreen(
|
|||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
stringResource(R.string.title_profile),
|
stringResource(R.string.title_profile),
|
||||||
style = NTOTheme.typography.titleLarge,
|
fontFamily = playfair,
|
||||||
fontSize = 36.sp,
|
color = NTOTheme.colors.primaryText,
|
||||||
|
fontSize = 32.sp,
|
||||||
fontWeight = FontWeight.Bold
|
fontWeight = FontWeight.Bold
|
||||||
)
|
)
|
||||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||||
@ -156,7 +159,10 @@ fun ProfileScreen(
|
|||||||
|
|
||||||
}
|
}
|
||||||
Spacer(modifier = Modifier.height(50.dp))
|
Spacer(modifier = Modifier.height(50.dp))
|
||||||
Row(modifier = Modifier.fillMaxWidth()) {
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
Image(
|
Image(
|
||||||
painter = painterResource(R.drawable.logo_placeholder_user),
|
painter = painterResource(R.drawable.logo_placeholder_user),
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@ -176,23 +182,34 @@ fun ProfileScreen(
|
|||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
state.secondName,
|
state.secondName,
|
||||||
style = NTOTheme.typography.displaySmall,
|
fontFamily = raleway,
|
||||||
fontWeight = FontWeight.Bold
|
color = NTOTheme.colors.primaryText,
|
||||||
|
fontSize = 16.sp,
|
||||||
|
fontWeight = FontWeight.SemiBold,
|
||||||
|
lineHeight = 16.sp
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
state.firstName,
|
state.firstName,
|
||||||
style = NTOTheme.typography.displaySmall,
|
fontFamily = raleway,
|
||||||
fontWeight = FontWeight.Bold
|
color = NTOTheme.colors.primaryText,
|
||||||
|
fontSize = 16.sp,
|
||||||
|
fontWeight = FontWeight.SemiBold,
|
||||||
|
lineHeight = 16.sp
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
state.thirdName,
|
state.thirdName,
|
||||||
style = NTOTheme.typography.displaySmall,
|
fontFamily = raleway,
|
||||||
fontWeight = FontWeight.Bold
|
color = NTOTheme.colors.primaryText,
|
||||||
|
fontSize = 16.sp,
|
||||||
|
fontWeight = FontWeight.SemiBold,
|
||||||
|
lineHeight = 16.sp
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.height(10.dp))
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
Text(
|
Text(
|
||||||
state.job,
|
state.job,
|
||||||
style = NTOTheme.typography.placeholder,
|
fontWeight = FontWeight.Medium,
|
||||||
|
fontFamily = raleway,
|
||||||
|
fontSize = 14.sp,
|
||||||
color = TextGray
|
color = TextGray
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -210,18 +227,26 @@ fun ProfileScreen(
|
|||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
stringResource(R.string.label_last_visit),
|
stringResource(R.string.label_last_visit),
|
||||||
style = NTOTheme.typography.placeholder,
|
fontWeight = FontWeight.Medium,
|
||||||
fontSize = 12.sp
|
fontFamily = raleway,
|
||||||
|
color = NTOTheme.colors.primaryText,
|
||||||
|
fontSize = 14.sp
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
state.lastOpen, style = NTOTheme.typography.placeholder, fontSize = 12.sp
|
state.lastOpen,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
fontFamily = raleway,
|
||||||
|
color = NTOTheme.colors.primaryText,
|
||||||
|
fontSize = 14.sp
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Spacer(modifier = Modifier.height(20.dp))
|
Spacer(modifier = Modifier.height(20.dp))
|
||||||
Text(
|
Text(
|
||||||
stringResource(R.string.label_visits),
|
stringResource(R.string.label_visits),
|
||||||
style = NTOTheme.typography.displaySmall,
|
fontWeight = FontWeight.SemiBold,
|
||||||
fontWeight = FontWeight.Bold
|
fontSize = 20.sp,
|
||||||
|
fontFamily = raleway,
|
||||||
|
color = NTOTheme.colors.primaryText
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.height(10.dp))
|
Spacer(modifier = Modifier.height(10.dp))
|
||||||
|
|
||||||
|
@ -5,6 +5,9 @@ import androidx.lifecycle.ViewModel
|
|||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
import androidx.navigation.NavController
|
import androidx.navigation.NavController
|
||||||
import com.nto.data.models.Position
|
import com.nto.data.models.Position
|
||||||
|
import com.nto.data.models.QRDTO
|
||||||
|
import com.nto.data.models.cards.VisitCardDTO
|
||||||
|
import com.nto.data.models.cards.VisitType
|
||||||
import com.nto.data.utils.Destinations
|
import com.nto.data.utils.Destinations
|
||||||
import com.nto.domain.usecase.ProfileUseCase
|
import com.nto.domain.usecase.ProfileUseCase
|
||||||
import com.nto.presentation.R
|
import com.nto.presentation.R
|
||||||
@ -15,13 +18,23 @@ import kotlinx.coroutines.flow.MutableStateFlow
|
|||||||
import kotlinx.coroutines.flow.StateFlow
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
import kotlinx.coroutines.flow.asStateFlow
|
import kotlinx.coroutines.flow.asStateFlow
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import java.time.LocalDateTime
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@HiltViewModel
|
@HiltViewModel
|
||||||
class ProfileViewModel @Inject constructor(
|
class ProfileViewModel @Inject constructor(
|
||||||
private val useCase: ProfileUseCase, @ApplicationContext private val context: Context
|
private val useCase: ProfileUseCase, @ApplicationContext private val context: Context
|
||||||
) : ViewModel() {
|
) : ViewModel() {
|
||||||
private val _state = MutableStateFlow(ProfileState())
|
private val _state = MutableStateFlow(
|
||||||
|
ProfileState(
|
||||||
|
"Николай",
|
||||||
|
"Одегов",
|
||||||
|
"Алексеевич",
|
||||||
|
"20 января 2024 20:21",
|
||||||
|
"Senior UI/UX designer",
|
||||||
|
visits = listOf(VisitCardDTO("Кабинет 207", 10020, LocalDateTime.now(), VisitType.CARD_ENTRY, qrCode = QRDTO(12032, "Кобинет 52")))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
val state: StateFlow<ProfileState>
|
val state: StateFlow<ProfileState>
|
||||||
get() = _state.asStateFlow()
|
get() = _state.asStateFlow()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user