mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-29 08:04:32 +00:00
Fix UI Issues
This commit is contained in:
parent
4e4623532f
commit
00c5774433
2 changed files with 16 additions and 10 deletions
|
|
@ -478,10 +478,10 @@ struct ContentView: View {
|
||||||
.fill(chipColor)
|
.fill(chipColor)
|
||||||
.frame(width: 8, height: 12)
|
.frame(width: 8, height: 12)
|
||||||
MarqueeText(
|
MarqueeText(
|
||||||
.constant(reminderSneakPeekText(for: reminder)),
|
.constant(reminderSneakPeekText(for: reminder, now: reminderManager.currentDate)),
|
||||||
textColor: reminderColor(for: reminder, now: reminderManager.currentDate),
|
textColor: reminderColor(for: reminder, now: reminderManager.currentDate),
|
||||||
minDuration: 1,
|
minDuration: 1,
|
||||||
frameWidth: max(0, geo.size.width - 18)
|
frameWidth: max(0, geo.size.width - 14)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -537,18 +537,24 @@ struct ContentView: View {
|
||||||
return Color(nsColor: reminder.event.calendar.color).ensureMinimumBrightness(factor: 0.7)
|
return Color(nsColor: reminder.event.calendar.color).ensureMinimumBrightness(factor: 0.7)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func reminderSneakPeekText(for entry: ReminderLiveActivityManager.ReminderEntry) -> String {
|
private func reminderSneakPeekText(for entry: ReminderLiveActivityManager.ReminderEntry, now: Date) -> String {
|
||||||
let title = entry.event.title.isEmpty ? "Upcoming Reminder" : entry.event.title
|
let title = entry.event.title.isEmpty ? "Upcoming Reminder" : entry.event.title
|
||||||
let remaining = max(entry.event.start.timeIntervalSince(reminderManager.currentDate), 0)
|
let remaining = max(entry.event.start.timeIntervalSince(now), 0)
|
||||||
|
let window = TimeInterval(Defaults[.reminderSneakPeekDuration])
|
||||||
|
|
||||||
|
if window > 0 && remaining <= window {
|
||||||
|
return "\(title) • now"
|
||||||
|
}
|
||||||
|
|
||||||
let minutes = Int(ceil(remaining / 60))
|
let minutes = Int(ceil(remaining / 60))
|
||||||
let timeString = reminderTimeFormatter.string(from: entry.event.start)
|
let timeString = reminderTimeFormatter.string(from: entry.event.start)
|
||||||
|
|
||||||
if minutes <= 0 {
|
if minutes <= 0 {
|
||||||
return "\(title) • starts now @ \(timeString)"
|
return "\(title) • now • \(timeString)"
|
||||||
} else if minutes == 1 {
|
} else if minutes == 1 {
|
||||||
return "\(title) • in 1 min @ \(timeString)"
|
return "\(title) • in 1 min • \(timeString)"
|
||||||
} else {
|
} else {
|
||||||
return "\(title) • in \(minutes) min @ \(timeString)"
|
return "\(title) • in \(minutes) min • \(timeString)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ struct ReminderLiveActivity: View {
|
||||||
|
|
||||||
@Default(.reminderPresentationStyle) private var presentationStyle
|
@Default(.reminderPresentationStyle) private var presentationStyle
|
||||||
|
|
||||||
private let wingPadding: CGFloat = 22
|
private let wingPadding: CGFloat = 16
|
||||||
private let ringStrokeWidth: CGFloat = 3
|
private let ringStrokeWidth: CGFloat = 3
|
||||||
|
|
||||||
private var notchContentHeight: CGFloat {
|
private var notchContentHeight: CGFloat {
|
||||||
|
|
@ -181,11 +181,11 @@ struct ReminderLiveActivity: View {
|
||||||
}
|
}
|
||||||
|
|
||||||
private var iconDiameter: CGFloat {
|
private var iconDiameter: CGFloat {
|
||||||
max(notchContentHeight - 6, 28)
|
max(notchContentHeight - 8, 26)
|
||||||
}
|
}
|
||||||
|
|
||||||
private var ringDiameter: CGFloat {
|
private var ringDiameter: CGFloat {
|
||||||
max(min(notchContentHeight - 10, 24), 18)
|
max(min(notchContentHeight - 12, 22), 16)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func measureTextWidth(_ text: String, font: ReminderFont) -> CGFloat {
|
private func measureTextWidth(_ text: String, font: ReminderFont) -> CGFloat {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue