离线或倒计时未进入提醒窗口时不再弹出超时提醒;全局 Loading 支持按需展示定位文案,提前提醒选项抽成共用组件。 Co-authored-by: Cursor <cursoragent@cursor.com>
30 lines
710 B
Swift
30 lines
710 B
Swift
//
|
||
// ReminderTimeOptionsMenu.swift
|
||
// suixinkan
|
||
//
|
||
// Created by Codex on 2026/6/29.
|
||
//
|
||
|
||
import SwiftUI
|
||
|
||
/// 提前提醒时间选择控件。
|
||
/// 使用 `Menu` 而非 `confirmationDialog`,避免 ScrollView 内 popover 箭头锚点偏移。
|
||
struct ReminderTimeOptionsMenu<Label: View>: View {
|
||
let onSelect: (Int) -> Void
|
||
@ViewBuilder let label: () -> Label
|
||
|
||
private let options = [0, 5, 10, 15, 30]
|
||
|
||
var body: some View {
|
||
Menu {
|
||
ForEach(options, id: \.self) { minute in
|
||
Button(minute == 0 ? "不提醒" : "\(minute)分钟") {
|
||
onSelect(minute)
|
||
}
|
||
}
|
||
} label: {
|
||
label()
|
||
}
|
||
}
|
||
}
|