Skip to content

Commit

Permalink
TIQR-476: Better loading state on Your profile screen
Browse files Browse the repository at this point in the history
  • Loading branch information
dzolnai committed Oct 25, 2024
1 parent 42297d8 commit 5dd094d
Showing 1 changed file with 66 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,72 +185,78 @@ fun PersonalInfoScreen(
style = MaterialTheme.typography.bodyLarge,
text = stringResource(R.string.Profile_Info_COPY),
)
if (!uiState.personalInfo.isVerified) {
NotVerifiedIdentity(
selfAssertedName = uiState.personalInfo.seflAssertedName,
isLoading = isLoading,
addLinkToAccount = addLinkToAccount,
onNameClicked = onNameClicked
)
} else {
VerifiedIdentity(
personalInfo = uiState.personalInfo,
isLoading = isLoading,
onNameClicked = onNameClicked,
openVerifiedInformation = openVerifiedInformation
)
}
if (!isLoading) {
if (!uiState.personalInfo.isVerified) {
NotVerifiedIdentity(
selfAssertedName = uiState.personalInfo.seflAssertedName,
isLoading = isLoading,
addLinkToAccount = addLinkToAccount,
onNameClicked = onNameClicked
)
} else {
VerifiedIdentity(
personalInfo = uiState.personalInfo,
isLoading = isLoading,
onNameClicked = onNameClicked,
openVerifiedInformation = openVerifiedInformation
)
}

Text(
style = MaterialTheme.typography.titleLarge.copy(color = MaterialTheme.colorScheme.onSecondary),
text = stringResource(R.string.Profile_ContactDetails_COPY),
modifier = Modifier.padding(top = 16.dp)
)
InfoField(title = uiState.personalInfo.email,
subtitle = stringResource(R.string.Profile_Email_COPY),
modifier = Modifier.clickable {
onEmailClicked()
})
Text(
style = MaterialTheme.typography.titleLarge.copy(color = MaterialTheme.colorScheme.onSecondary),
text = stringResource(R.string.Profile_ContactDetails_COPY),
modifier = Modifier.padding(top = 16.dp)
)
InfoField(title = uiState.personalInfo.email,
subtitle = stringResource(R.string.Profile_Email_COPY),
modifier = Modifier.clickable {
onEmailClicked()
})

if (uiState.personalInfo.institutionAccounts.isNotEmpty()) {
RoleAndInstitutions(openVerifiedInformation, uiState.personalInfo.institutionAccounts)
}
if (uiState.personalInfo.institutionAccounts.isNotEmpty()) {
RoleAndInstitutions(openVerifiedInformation, uiState.personalInfo.institutionAccounts)
}

LinkAccountCard(
title = R.string.Profile_AddRoleAndInstitution_COPY,
subtitle = R.string.Profile_AddViaSurfconext_COPY,
enabled = !isLoading,
addLinkToAccount = addLinkToAccount
)
val configuration = LocalConfiguration.current
Surface(
modifier = Modifier
.requiredWidth(configuration.screenWidthDp.dp)
.background(MaterialTheme.colorScheme.tertiaryContainer)
.padding(vertical = 12.dp, horizontal = 24.dp),
) {
OutlinedButton(
onClick = onManageAccountClicked,
shape = RoundedCornerShape(CornerSize(6.dp)),
LinkAccountCard(
title = R.string.Profile_AddRoleAndInstitution_COPY,
subtitle = R.string.Profile_AddViaSurfconext_COPY,
enabled = !isLoading,
addLinkToAccount = addLinkToAccount
)
val configuration = LocalConfiguration.current
Surface(
modifier = Modifier
.sizeIn(minHeight = 48.dp)
.fillMaxWidth()
.requiredWidth(configuration.screenWidthDp.dp)
.background(MaterialTheme.colorScheme.tertiaryContainer)
.padding(vertical = 12.dp, horizontal = 24.dp),
) {
Image(
painter = painterResource(R.drawable.cog_icon),
alignment = CenterStart,
contentDescription = "",
modifier = Modifier.padding(horizontal = 24.dp)
)
Text(
text = stringResource(R.string.Profile_ManageYourAccount_COPY),
style = MaterialTheme.typography.bodyLarge.copy(
textAlign = TextAlign.Start,
fontWeight = FontWeight.SemiBold,
color = MaterialTheme.colorScheme.onSurfaceVariant
),
)
OutlinedButton(
onClick = onManageAccountClicked,
shape = RoundedCornerShape(CornerSize(6.dp)),
modifier = Modifier
.sizeIn(minHeight = 48.dp)
.fillMaxWidth()
) {
Image(
painter = painterResource(R.drawable.cog_icon),
alignment = CenterStart,
contentDescription = "",
modifier = Modifier.padding(horizontal = 24.dp)
)
Text(
text = stringResource(R.string.Profile_ManageYourAccount_COPY),
style = MaterialTheme.typography.bodyLarge.copy(
textAlign = TextAlign.Start,
fontWeight = FontWeight.SemiBold,
color = MaterialTheme.colorScheme.onSurfaceVariant
),
)
}
}
} else {
LinearProgressIndicator(
modifier = Modifier.fillMaxWidth()
)
}
}
}
Expand Down Expand Up @@ -362,12 +368,6 @@ private fun ColumnScope.VerifiedIdentity(
)
}
}

if (isLoading) {
LinearProgressIndicator(
modifier = Modifier.fillMaxWidth()
)
}
InfoField(title = personalInfo.seflAssertedName.chosenName.orEmpty(),
subtitle = stringResource(R.string.Profile_FirstName_COPY),
modifier = Modifier.clickable {
Expand Down

0 comments on commit 5dd094d

Please sign in to comment.