feat(home): 添加首页卡通形象卡片入口

- 新增 onTapCompanion 回调属性用于处理点击卡通形象卡片事件
- 在首页添加 companionCard 视图组件,显示"和康康聊聊"功能入口
- 实现卡通形象卡片样式,包含头像、标题和描述文本
- 集成 HealthChatView 全屏覆盖页面用于健康记录问答功能
- 添加相关国际化字符串支持

BREAKING CHANGE: 新增首页功能模块,改变原有界面布局结构
```
This commit is contained in:
link2026
2026-07-19 19:40:02 +08:00
parent 198570186e
commit ef5364d8c3
10 changed files with 1736 additions and 1 deletions

View File

@@ -4,6 +4,8 @@ import SwiftData
struct HomeView: View {
/// ; filter chip( `.report`,)
var onTapArchive: (TimelineKind?) -> Void = { _ in }
///
var onTapCompanion: () -> Void = {}
@Query(sort: \Indicator.capturedAt, order: .reverse)
private var indicators: [Indicator]
@@ -45,6 +47,9 @@ struct HomeView: View {
.padding(.top, 4)
.padding(.bottom, 18)
companionCard
.padding(.bottom, 18)
HomeCalendarCard()
.padding(.bottom, 18)
@@ -152,6 +157,38 @@ struct HomeView: View {
}
}
// MARK: - ()
private var companionCard: some View {
Button(action: onTapCompanion) {
HStack(spacing: 14) {
// ,
CompanionAvatarView(mood: .idle, size: 54)
VStack(alignment: .leading, spacing: 3) {
Text("和康康聊聊")
.font(.tjScaled( 15, weight: .semibold))
.foregroundStyle(Tj.Palette.text)
Text("问问你的健康记录 · 全程在本机")
.font(.tjScaled( 11))
.foregroundStyle(Tj.Palette.text3)
.lineLimit(1)
.minimumScaleFactor(0.85)
}
Spacer(minLength: 8)
Image(systemName: "chevron.right")
.font(.tjScaled( 14, weight: .medium))
.foregroundStyle(Tj.Palette.text3)
}
.padding(14)
.tjCard(bordered: true)
.contentShape(Rectangle())
}
.buttonStyle(.plain)
}
// MARK: - (2×2, + ,)
private var overviewSection: some View {