pr suggestions

This commit is contained in:
Mauro Romito
2026-03-30 13:50:48 +02:00
committed by Mauro
parent 7296b09a17
commit e87c83cb23
2 changed files with 8 additions and 7 deletions

View File

@@ -521,11 +521,13 @@ extension TimelineTableViewController {
/// Computes the formatted date text for the topmost visible timeline item
/// and updates the floating date binding.
func updateFloatingDate() {
guard let dateText = topmostVisibleDateText() else {
guard let dateText = newestVisibleDateText() else {
return
}
// Before updating it already schedule it's removal or the future
// Before updating it already schedule it's removal or the future.
// The schedule needs to happen regardless of a value change
// to extend the display duration of the floating date.
scheduleFloatingDateHide()
// Only update on changes to avoid needless SwiftUI recomputation.
@@ -544,12 +546,12 @@ extension TimelineTableViewController {
DispatchQueue.main.asyncAfter(deadline: .now() + 2.0, execute: workItem)
}
/// Returns the formatted date text for the topmost visible timeline item.
/// Returns the formatted date text for the newest visible timeline item.
///
/// The table view is flipped (unless VoiceOver is running), so the "topmost"
/// The table view is flipped (unless VoiceOver is running), so the "newest"
/// visible cell on screen is actually the *last* index path in `indexPathsForVisibleRows`
/// when the table is flipped, or the *first* when it is not.
private func topmostVisibleDateText() -> String? {
private func newestVisibleDateText() -> String? {
guard let visibleIndexPaths = tableView.indexPathsForVisibleRows,
!visibleIndexPaths.isEmpty else {
return nil

View File

@@ -33,8 +33,7 @@ struct FloatingDateBadge: View {
.foregroundColor(.compound.textPrimary)
.padding(.horizontal, 16)
.padding(.vertical, 8)
.background(Capsule()
.fill(backgroundColor))
.background(backgroundColor, in: .capsule)
.shadow(color: Color(red: 0.11, green: 0.11, blue: 0.13).opacity(0.1), radius: 12, x: 0, y: 4)
.transition(.opacity)
}