根据提供的code differences信息,由于没有具体的代码变更内容,我将生成一个通用的commit message模板:

```
docs(readme): 更新文档说明

- 添加了项目使用指南
- 完善了API接口说明
- 修正了一些文字错误
```

注:由于未提供具体的代码差异信息,以上为示例格式。请提供具体的代码变更内容以便生成准确的commit message。
This commit is contained in:
link2026
2026-06-17 08:35:59 +08:00
parent b3777d508d
commit de19d7abcd
23 changed files with 364 additions and 154 deletions

View File

@@ -18,11 +18,16 @@ struct CustomMetricsListView: View {
if metrics.isEmpty {
emptyState
} else {
// seriesKey 使(O(indicators)), O(1) ,
// O(metrics × indicators) N+1
let usageCounts: [String: Int] = indicators.reduce(into: [:]) { acc, ind in
if let key = ind.seriesKey, !key.isEmpty { acc[key, default: 0] += 1 }
}
ForEach(metrics) { m in
Button {
editingTarget = CustomMetricEditTarget(metric: m)
} label: {
row(m)
row(m, usage: usageCounts[m.seriesKey] ?? 0)
}
.buttonStyle(.plain)
}
@@ -82,9 +87,8 @@ struct CustomMetricsListView: View {
.frame(maxWidth: .infinity)
}
private func row(_ m: CustomMonitorMetric) -> some View {
let count = usageCount(for: m)
return HStack(spacing: 12) {
private func row(_ m: CustomMonitorMetric, usage count: Int) -> some View {
HStack(spacing: 12) {
ZStack {
Circle().fill(Tj.Palette.leafSoft)
Image(systemName: m.icon)
@@ -137,9 +141,6 @@ struct CustomMetricsListView: View {
)
}
private func usageCount(for m: CustomMonitorMetric) -> Int {
indicators.filter { $0.seriesKey == m.seriesKey }.count
}
}
#Preview {

View File

@@ -27,6 +27,7 @@ struct CustomReminderEditSheet: View {
@State private var month = 1
@State private var hydrated = false
@State private var showAuthDeniedAlert = false
@State private var showDeleteConfirm = false
/// (, ): / / /
private let timePresets: [(h: Int, m: Int)] = [(8, 0), (12, 0), (18, 0), (22, 0)]
@@ -79,7 +80,7 @@ struct CustomReminderEditSheet: View {
if isEditing {
Section {
Button(role: .destructive) { deleteReminder() } label: {
Button(role: .destructive) { showDeleteConfirm = true } label: {
Label(String(appLoc: "删除提醒"), systemImage: "trash")
}
}
@@ -110,6 +111,12 @@ struct CustomReminderEditSheet: View {
} message: {
Text("提醒已保存,但系统通知权限未开启,到点不会弹出。请在「设置 · 通知 · 康康」中允许。")
}
.alert(String(appLoc: "删除这条提醒?"), isPresented: $showDeleteConfirm) {
Button(String(appLoc: "删除"), role: .destructive) { deleteReminder() }
Button(String(appLoc: "取消"), role: .cancel) { }
} message: {
Text("删除后该提醒不再触发。")
}
}
}