DFWatchFigmaDetailViews.swift
10.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
import SwiftUI
struct DFTodayStatusOverviewFigmaView: View {
var hasData: Bool = true
private var rows: [DFStatusOverviewRow] {
[
.init(title: "平均HRV", value: hasData ? "29" : "-", unit: "ms", icon: "waveform.path.ecg", tint: DFWatchFigmaColor.blue),
.init(title: "最新心率", value: hasData ? "79" : "-", unit: "次/分", icon: "heart.fill", tint: DFWatchFigmaColor.red),
.init(title: "步数", value: hasData ? "11198" : "-", unit: "步", icon: "figure.walk", tint: DFWatchFigmaColor.green),
.init(title: "活动记录", value: hasData ? "400" : "-", unit: "大卡", icon: "flame.fill", tint: DFWatchFigmaColor.orange)
]
}
var body: some View {
ZStack{
HStack{
Spacer()
}
VStack(alignment: .trailing){
Text(.now, style: .time)
.font(.system(size: 14, weight: .medium))
.foregroundColor(.white)
Text("我的今日状态")
.lineLimit(1)
.font(.system(size: 16, weight: .medium))
.minimumScaleFactor(0.7)
.foregroundColor(.white)
ScrollView {
ForEach(rows) { row in
DFStatusOverviewCard(row: row)
.padding(.bottom, 4)
}
Spacer()
.frame(height: 24)
}
}.padding(EdgeInsets(top: 10, leading: 10, bottom: 0, trailing: 10))
}
}
}
private struct DFStatusOverviewRow: Identifiable {
let id = UUID()
let title: String
let value: String
let unit: String
let icon: String
let tint: Color
}
private struct DFStatusOverviewCard: View {
let row: DFStatusOverviewRow
var body: some View {
HStack(spacing: 0) {
Image(systemName: row.icon)
.frame(width: 18, height: 18)
.foregroundColor(row.tint)
Spacer()
.frame(width: 6)
Text(row.title)
.font(.system(size: 12, weight: .medium))
.lineLimit(1)
.minimumScaleFactor(0.7)
.foregroundColor(.white)
Spacer(minLength: 0)
Text(row.value)
.font(.system(size: 12, weight: .medium))
.lineLimit(1)
.minimumScaleFactor(0.7)
.foregroundColor(.white)
Spacer()
.frame(width: 2)
Text(row.unit)
.font(.system(size: 12, weight: .regular))
.lineLimit(1)
.minimumScaleFactor(0.7)
.foregroundColor(.white.opacity(0.5))
}
.padding(.horizontal, 8)
.padding(.vertical, 10)
.background(Color.white.opacity(0.10))
.clipShape(RoundedRectangle(cornerRadius: 10))
}
}
struct DFWatchSettingsFigmaView: View {
var body: some View {
ZStack(alignment: .topTrailing){
HStack{
Spacer()
}
VStack(alignment: .leading){
Spacer()
.frame(height: 14)
DFWatchCloseView {
}
Spacer()
.frame(height: 6)
HStack{
Text("刷新模式")
.font(.system(size: 16, weight: .medium))
.foregroundColor(.white)
DFWatchFigmaProBadge()
Spacer()
}.padding(.leading, 16)
ScrollView {
VStack(alignment: .leading, spacing: 8) {
DFSettingOption(title: "HRV", accessory: .check)
DFSettingOption(title: "实时压力", accessory: .lock)
Text("刷新模式说明")
.font(.system(size: 9, weight: .regular))
.underline()
.foregroundColor(DFWatchFigmaColor.purpleText)
.padding(.leading, 8)
}.padding(.horizontal, 10)
.padding(.bottom, 24)
}
}
Text(.now, style: .time)
.font(.system(size: 14, weight: .medium))
.foregroundColor(.white)
.padding(.trailing, 14)
.padding(.top, 10)
}
}
}
private enum DFSettingAccessory {
case check
case lock
}
private struct DFSettingOption: View {
let title: String
let accessory: DFSettingAccessory
var body: some View {
HStack {
Text(title)
.font(.system(size: 12, weight: .medium))
.foregroundColor(.white)
Spacer()
switch accessory {
case .check:
Image(systemName: "checkmark")
.font(.system(size: 15, weight: .bold))
.foregroundColor(.white)
case .lock:
Image(systemName: "lock.fill")
.font(.system(size: 15, weight: .medium))
.foregroundColor(.white.opacity(0.84))
}
}
.frame(height: 38)
.padding(.horizontal, 8)
.background(Color.white.opacity(0.10))
.clipShape(RoundedRectangle(cornerRadius: 10))
}
}
struct DFProRequiredInfoFigmaView: View {
var body: some View {
ZStack(alignment: .topTrailing){
HStack{
Spacer()
}
VStack(alignment: .center){
Spacer()
.frame(height: 14)
HStack{
DFWatchCloseView {
}
Spacer()
}
Spacer()
.frame(height: 6)
DFWatchFigmaProBadge()
Spacer()
.frame(height: 10)
ScrollView {
VStack(alignment: .leading, spacing: 11) {
Text("该功能需要DoubleFeel Pro会员才可使用。你可以前往手机App开通会员。")
Text("如果已经开通会员,但手表端还没有显示,可以先退出当前页面,再重新进入,会员状态通常会自动更新。")
}
.font(.system(size: 11, weight: .regular))
.foregroundColor(.white)
.lineSpacing(2)
.padding(.horizontal, 12)
.padding(.bottom, 24)
}
}
Text(.now, style: .time)
.font(.system(size: 14, weight: .medium))
.foregroundColor(.white)
.padding(.trailing, 14)
.padding(.top, 10)
}
}
}
struct DFRefreshModeInfoFigmaView: View {
var body: some View {
ZStack(alignment: .topTrailing){
HStack{
Spacer()
}
VStack(alignment: .leading){
Spacer()
.frame(height: 14)
DFWatchCloseView {
}
Spacer()
.frame(height: 8)
ScrollView {
VStack(alignment: .leading){
Text("HRV")
.font(.system(size: 14, weight: .medium))
.foregroundColor(.white)
Spacer()
.frame(height: 4)
Text("""
一般情况下,Apple Watch 会每隔一段时间自动采集一次 HRV 数据。
在佩戴稳定、身体静止或放松状态下,系统更容易获取有效 HRV 数据。
剧烈运动、频繁活动、手表佩戴不稳定或刚解锁 Apple Watch 后,数据同步可能会延迟。
Apple Watch 与 iPhone 的健康数据同步由 Apple Health 系统完成,因此并不会始终实时更新。
""")
.font(.system(size: 9, weight: .regular))
.foregroundColor(.white.opacity(0.8))
Spacer()
.frame(height: 14)
Text("实时压力")
.font(.system(size: 14, weight: .medium))
.foregroundColor(.white)
Spacer()
.frame(height: 4)
Text("""
实时压力会结合当前 HRV、心率状态与个人历史数据动态变化。
通常情况下:
· 手机 App 会自动刷新当天综合压力状态
· Apple Watch 会显示最近一次的实时压力变化
由于 Apple Health 数据同步存在延迟,实时压力可能不会立即更新。
""")
.font(.system(size: 9, weight: .regular))
.foregroundColor(.white.opacity(0.8))
Spacer()
.frame(height: 14)
Divider()
.overlay(Color.white.opacity(0.25))
Spacer()
.frame(height: 14)
Text("""
以下情况可能导致数据延迟或暂时不可用:
· Apple Watch 处于低电量模式
· Apple Health 权限未开启
· 长时间未佩戴 Apple Watch
· 正在运动或身体频繁活动
· 手表刚解锁或刚重新佩戴
· 系统尚未完成数据同步
""")
.font(.system(size: 8, weight: .regular))
.foregroundColor(.white.opacity(0.8))
}.padding(.horizontal, 10)
.padding(.bottom, 24)
}
}
VStack(alignment: .trailing){
Text(.now, style: .time)
.font(.system(size: 14, weight: .medium))
.foregroundColor(.white)
Text("HRV")
.font(.system(size: 12, weight: .medium))
.foregroundColor(.white)
.opacity(0.6)
}
.padding(.trailing, 14)
.padding(.top, 10)
}
}
}
struct DFWatchFigmaDetailPreviewGallery: View {
var body: some View {
TabView {
DFTodayStatusOverviewFigmaView(hasData: true)
DFTodayStatusOverviewFigmaView(hasData: false)
DFWatchSettingsFigmaView()
DFProRequiredInfoFigmaView()
DFRefreshModeInfoFigmaView()
}
#if os(watchOS)
.tabViewStyle(.verticalPage)
#else
.tabViewStyle(.page)
#endif
}
}
#Preview("Figma watch detail states") {
DFWatchFigmaDetailPreviewGallery()
}