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