feat: 引入共享会话状态与未登录占位组件

This commit is contained in:
AndyChen1024
2026-09-09 22:15:46 +08:00
parent c80fb31eb1
commit c41c04ff23
4 changed files with 72 additions and 0 deletions

View File

@@ -1,9 +1,11 @@
package com.mingyuan.android_client.core.designsystem.component
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
@@ -21,6 +23,7 @@ import com.mingyuan.android_client.core.designsystem.theme.ErrorBackground
import com.mingyuan.android_client.core.designsystem.theme.FaintText
import com.mingyuan.android_client.core.designsystem.theme.MutedText
import com.mingyuan.android_client.core.designsystem.theme.NeutralChip
import com.mingyuan.android_client.core.designsystem.theme.PrimaryText
@Composable
fun EmptyState(
@@ -65,3 +68,30 @@ fun ErrorState(
MingyuanButton(text = "重新加载", onClick = onRetry)
}
}
@Composable
fun LoggedOutState(
onLogin: (() -> Unit)? = null,
modifier: Modifier = Modifier,
) {
Column(
modifier = modifier.fillMaxSize(),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally,
) {
Box(
modifier = Modifier.size(72.dp).background(NeutralChip, CircleShape),
contentAlignment = Alignment.Center,
) {
Text("🔒", fontSize = 32.sp)
}
Spacer(Modifier.height(12.dp))
Text("未登录", color = PrimaryText, fontSize = 15.sp, fontWeight = FontWeight.SemiBold)
Spacer(Modifier.height(4.dp))
Text("登录后即可查看", color = FaintText, fontSize = 13.sp)
if (onLogin != null) {
Spacer(Modifier.height(16.dp))
MingyuanButton(text = "登录", onClick = onLogin)
}
}
}