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.presentation.R
|
||||
import com.nto.presentation.theme.NTOTheme
|
||||
import com.nto.presentation.theme.raleway
|
||||
import java.text.SimpleDateFormat
|
||||
import java.time.format.DateTimeFormatter
|
||||
|
||||
@ -46,29 +47,30 @@ fun VisitCard(data: VisitCardDTO, modifier: Modifier = Modifier) {
|
||||
Column(horizontalAlignment = Alignment.Start) {
|
||||
Text(
|
||||
text = data.name,
|
||||
style = NTOTheme.typography.displaySmall,
|
||||
fontSize = 12.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
fontSize = 14.sp,
|
||||
fontFamily = raleway,
|
||||
fontWeight = FontWeight.Medium,
|
||||
color = NTOTheme.colors.primaryText
|
||||
)
|
||||
Spacer(modifier = Modifier.height(10.dp))
|
||||
Spacer(modifier = Modifier.height(6.dp))
|
||||
Text(
|
||||
text = data.id.toString(),
|
||||
style = NTOTheme.typography.displaySmall,
|
||||
fontSize = 12.sp,
|
||||
fontWeight = FontWeight.Thin
|
||||
fontFamily = raleway,
|
||||
color = NTOTheme.colors.primaryText
|
||||
)
|
||||
}
|
||||
Column(horizontalAlignment = Alignment.End) {
|
||||
Text(
|
||||
text = SimpleDateFormat.getDateInstance().format(data.date),
|
||||
style = NTOTheme.typography.displaySmall,
|
||||
fontSize = 12.sp,
|
||||
fontSize = 14.sp,
|
||||
fontFamily = raleway,
|
||||
color = NTOTheme.colors.disabledText
|
||||
)
|
||||
Spacer(modifier = Modifier.height(10.dp))
|
||||
Spacer(modifier = Modifier.height(6.dp))
|
||||
Text(
|
||||
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,
|
||||
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.theme.NTOTheme
|
||||
import com.nto.presentation.theme.TextGray
|
||||
import com.nto.presentation.theme.playfair
|
||||
import com.nto.presentation.theme.raleway
|
||||
|
||||
@Composable
|
||||
fun ProfileScreen(
|
||||
@ -91,8 +93,9 @@ fun ProfileScreen(
|
||||
) {
|
||||
Text(
|
||||
stringResource(R.string.title_profile),
|
||||
style = NTOTheme.typography.titleLarge,
|
||||
fontSize = 36.sp,
|
||||
fontFamily = playfair,
|
||||
color = NTOTheme.colors.primaryText,
|
||||
fontSize = 32.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
@ -156,7 +159,10 @@ fun ProfileScreen(
|
||||
|
||||
}
|
||||
Spacer(modifier = Modifier.height(50.dp))
|
||||
Row(modifier = Modifier.fillMaxWidth()) {
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Image(
|
||||
painter = painterResource(R.drawable.logo_placeholder_user),
|
||||
modifier = Modifier
|
||||
@ -176,23 +182,34 @@ fun ProfileScreen(
|
||||
) {
|
||||
Text(
|
||||
state.secondName,
|
||||
style = NTOTheme.typography.displaySmall,
|
||||
fontWeight = FontWeight.Bold
|
||||
fontFamily = raleway,
|
||||
color = NTOTheme.colors.primaryText,
|
||||
fontSize = 16.sp,
|
||||
fontWeight = FontWeight.SemiBold,
|
||||
lineHeight = 16.sp
|
||||
)
|
||||
Text(
|
||||
state.firstName,
|
||||
style = NTOTheme.typography.displaySmall,
|
||||
fontWeight = FontWeight.Bold
|
||||
fontFamily = raleway,
|
||||
color = NTOTheme.colors.primaryText,
|
||||
fontSize = 16.sp,
|
||||
fontWeight = FontWeight.SemiBold,
|
||||
lineHeight = 16.sp
|
||||
)
|
||||
Text(
|
||||
state.thirdName,
|
||||
style = NTOTheme.typography.displaySmall,
|
||||
fontWeight = FontWeight.Bold
|
||||
fontFamily = raleway,
|
||||
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(
|
||||
state.job,
|
||||
style = NTOTheme.typography.placeholder,
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontFamily = raleway,
|
||||
fontSize = 14.sp,
|
||||
color = TextGray
|
||||
)
|
||||
}
|
||||
@ -210,18 +227,26 @@ fun ProfileScreen(
|
||||
) {
|
||||
Text(
|
||||
stringResource(R.string.label_last_visit),
|
||||
style = NTOTheme.typography.placeholder,
|
||||
fontSize = 12.sp
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontFamily = raleway,
|
||||
color = NTOTheme.colors.primaryText,
|
||||
fontSize = 14.sp
|
||||
)
|
||||
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))
|
||||
Text(
|
||||
stringResource(R.string.label_visits),
|
||||
style = NTOTheme.typography.displaySmall,
|
||||
fontWeight = FontWeight.Bold
|
||||
fontWeight = FontWeight.SemiBold,
|
||||
fontSize = 20.sp,
|
||||
fontFamily = raleway,
|
||||
color = NTOTheme.colors.primaryText
|
||||
)
|
||||
Spacer(modifier = Modifier.height(10.dp))
|
||||
|
||||
|
@ -5,6 +5,9 @@ import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import androidx.navigation.NavController
|
||||
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.domain.usecase.ProfileUseCase
|
||||
import com.nto.presentation.R
|
||||
@ -15,13 +18,23 @@ import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
import kotlinx.coroutines.launch
|
||||
import java.time.LocalDateTime
|
||||
import javax.inject.Inject
|
||||
|
||||
@HiltViewModel
|
||||
class ProfileViewModel @Inject constructor(
|
||||
private val useCase: ProfileUseCase, @ApplicationContext private val context: Context
|
||||
) : 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>
|
||||
get() = _state.asStateFlow()
|
||||
|
Loading…
x
Reference in New Issue
Block a user