mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-10-14 05:46:17 +00:00
macos: ax for update info
This commit is contained in:
@@ -14,6 +14,12 @@ struct UpdateBadge: View {
|
|||||||
@State private var rotationAngle: Double = 0
|
@State private var rotationAngle: Double = 0
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
|
badgeContent
|
||||||
|
.accessibilityLabel(model.text)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
|
private var badgeContent: some View {
|
||||||
switch model.state {
|
switch model.state {
|
||||||
case .downloading(let download):
|
case .downloading(let download):
|
||||||
if let expectedLength = download.expectedLength, expectedLength > 0 {
|
if let expectedLength = download.expectedLength, expectedLength > 0 {
|
||||||
@@ -38,11 +44,15 @@ struct UpdateBadge: View {
|
|||||||
.onDisappear {
|
.onDisappear {
|
||||||
rotationAngle = 0
|
rotationAngle = 0
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
EmptyView()
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if let iconName = model.iconName {
|
if let iconName = model.iconName {
|
||||||
Image(systemName: iconName)
|
Image(systemName: iconName)
|
||||||
|
} else {
|
||||||
|
EmptyView()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -53,6 +53,7 @@ struct UpdatePill: View {
|
|||||||
Text(model.text)
|
Text(model.text)
|
||||||
.font(Font(textFont))
|
.font(Font(textFont))
|
||||||
.lineLimit(1)
|
.lineLimit(1)
|
||||||
|
.truncationMode(.tail)
|
||||||
.frame(width: textWidth)
|
.frame(width: textWidth)
|
||||||
}
|
}
|
||||||
.padding(.horizontal, 8)
|
.padding(.horizontal, 8)
|
||||||
@@ -66,6 +67,7 @@ struct UpdatePill: View {
|
|||||||
}
|
}
|
||||||
.buttonStyle(.plain)
|
.buttonStyle(.plain)
|
||||||
.help(model.text)
|
.help(model.text)
|
||||||
|
.accessibilityLabel(model.text)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Calculated width for the text to prevent resizing during progress updates
|
/// Calculated width for the text to prevent resizing during progress updates
|
||||||
|
Reference in New Issue
Block a user