Files
kangkang/康康/Features/Record/RecordSheet.swift
link2026 44ed01acf4 ```
refactor: 重命名项目名称从"体己"到"康康"

将整个项目的目录结构从"体己"重命名为"康康",包括所有源代码文件、
资源文件、测试文件以及Xcode项目配置文件。此更改涉及项目中所有的
文件路径和应用入口点(App/TijiApp.swift → App/KangkangApp.swift)。
```
2026-05-25 19:01:16 +08:00

107 lines
3.7 KiB
Swift

import SwiftUI
enum RecordKind: String, Identifiable, CaseIterable {
case quick, archive, diary
var id: String { rawValue }
var title: String {
switch self {
case .quick: return "异常项快拍"
case .archive: return "关键报告归档"
case .diary: return "文字日记"
}
}
var subtitle: String {
switch self {
case .quick: return "只记录单个或几项异常指标"
case .archive: return "完整保存整份报告(可多页)"
case .diary: return "记录症状、心情、用药"
}
}
var icon: String {
switch self {
case .quick: return "camera.fill"
case .archive: return "doc.fill"
case .diary: return "pencil"
}
}
var accent: Color {
switch self {
case .quick: return Tj.Palette.brick
case .archive: return Tj.Palette.ink
case .diary: return Tj.Palette.leaf
}
}
}
struct RecordSheet: View {
var onPick: (RecordKind) -> Void
var body: some View {
VStack(spacing: 0) {
Capsule()
.fill(Tj.Palette.line)
.frame(width: 40, height: 4)
.padding(.top, 10)
.padding(.bottom, 16)
HStack {
Text("记录什么?")
.font(.tjH2())
.foregroundStyle(Tj.Palette.text)
Spacer()
Text("本地处理 · 永不上传")
.font(.system(size: 12))
.foregroundStyle(Tj.Palette.text3)
}
.padding(.bottom, 14)
VStack(spacing: 10) {
ForEach(RecordKind.allCases) { kind in
Button {
onPick(kind)
} label: {
HStack(spacing: 14) {
ZStack {
RoundedRectangle(cornerRadius: Tj.Radius.sm, style: .continuous)
.fill(kind.accent)
Image(systemName: kind.icon)
.font(.system(size: 18, weight: .medium))
.foregroundStyle(Tj.Palette.paper)
}
.frame(width: 44, height: 44)
VStack(alignment: .leading, spacing: 2) {
Text(kind.title)
.font(.system(size: 15, weight: .semibold))
.foregroundStyle(Tj.Palette.text)
Text(kind.subtitle)
.font(.system(size: 12))
.foregroundStyle(Tj.Palette.text3)
}
Spacer()
Image(systemName: "chevron.right")
.font(.system(size: 14, weight: .medium))
.foregroundStyle(Tj.Palette.text3)
}
.padding(16)
.tjCard()
}
.buttonStyle(.plain)
}
}
.padding(.bottom, 22)
}
.padding(.horizontal, 18)
.background(
Tj.Palette.sand
.clipShape(RoundedRectangle(cornerRadius: Tj.Radius.xl, style: .continuous))
.ignoresSafeArea(edges: .bottom)
)
.presentationDetents([.fraction(0.55)])
.presentationDragIndicator(.hidden)
.presentationBackground(Tj.Palette.sand)
.presentationCornerRadius(Tj.Radius.xl)
}
}