Files
kangkang/体己/Features/Record/RecordSheet.swift
link2026 c050865db5 feat(ui): UI 骨架基线 — 3 Tab + RecordSheet + Quick/Archive 流程占位
替换 Xcode 默认模板:
- 删除 ContentView/Item/__App
- 新增 App/TijiApp(SwiftData ModelContainer)、RootView(3 Tab + RecordSheet)
- DesignSystem:Tokens(色板/字体/圆角)+ Components(卡片/按钮/Chip)
- Models:Indicator / Report / DiaryEntry @Model 初版
- Features:Home / Quick(A1-A3)/ Archive(B1-B5)/ Record / Trends / Me 静态 UI

W2 AI 基座工作将在此基线上叠加。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 14:49:21 +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)
}
}