pref: 未登录时隐藏需要登录才可访问的项目

This commit is contained in:
HuanCheng65 2023-03-12 15:31:39 +08:00
parent 54765a02df
commit 83a855b2d4
No known key found for this signature in database
GPG Key ID: E9031EF91A805148
1 changed files with 27 additions and 23 deletions

View File

@ -121,11 +121,11 @@ private fun StatCard(
@Composable
private fun InfoCard(
modifier: Modifier = Modifier,
userName: String = "",
userIntro: String = "",
avatar: String? = null,
isPlaceholder: Boolean = false,
modifier: Modifier = Modifier
isPlaceholder: Boolean = false
) {
Row(
modifier = modifier,
@ -264,9 +264,6 @@ fun UserPage(
) {
if (account != null) {
InfoCard(
userName = account!!.nameShow ?: account!!.name,
userIntro = account!!.intro ?: stringResource(id = R.string.tip_no_intro),
avatar = StringUtil.getAvatarUrl(account!!.portrait),
modifier = Modifier
.padding(top = 8.dp)
.clickable {
@ -277,6 +274,9 @@ fun UserPage(
)
}
.padding(horizontal = 16.dp, vertical = 16.dp),
userName = account!!.nameShow ?: account!!.name,
userIntro = account!!.intro ?: stringResource(id = R.string.tip_no_intro),
avatar = StringUtil.getAvatarUrl(account!!.portrait),
)
StatCard(
account = account!!,
@ -288,10 +288,10 @@ fun UserPage(
)
} else if (isLoading) {
InfoCard(
isPlaceholder = true,
modifier = Modifier
.padding(horizontal = 16.dp, vertical = 16.dp)
.padding(top = 8.dp),
isPlaceholder = true,
)
StatCardPlaceholder(
modifier = Modifier
@ -308,6 +308,7 @@ fun UserPage(
)
}
val navigator = LocalNavigator.current
if (account != null) {
ListMenuItem(
icon = ImageVector.vectorResource(id = R.drawable.ic_favorite),
text = stringResource(id = R.string.title_my_collect),
@ -315,6 +316,7 @@ fun UserPage(
navigator.navigate(ThreadStorePageDestination)
}
)
}
ListMenuItem(
icon = ImageVector.vectorResource(id = R.drawable.ic_outline_watch_later_24),
text = stringResource(id = R.string.title_history),
@ -340,6 +342,7 @@ fun UserPage(
onCheckedChange = { ThemeUtil.switchNightMode() }
)
}
if (account != null) {
ListMenuItem(
icon = ImageVector.vectorResource(id = R.drawable.ic_help_outline_black_24),
text = stringResource(id = R.string.my_info_service_center),
@ -350,6 +353,7 @@ fun UserPage(
)
},
)
}
VerticalDivider(
modifier = Modifier.padding(vertical = 8.dp, horizontal = 16.dp)
)