Always show full model description instead of a fragile truncate/expand toggle
The description Text sits inside ModelInfoView's ScrollView, where Text with a lineLimit doesn't reliably compute wrapping/truncation (a documented SwiftUI/AppKit quirk). Without a fixedSize hint it hard-clipped mid-word with no ellipsis; adding one fixed that but silently broke the "More…" button below it in the same VStack. Removed the whole toggle instead of chasing further edge cases — the modal already scrolls, so a long description just means more scrolling. Separately confirmed via OpenRouter's public API that at least one model's description is truncated server-side with no fuller version available through any endpoint, so this was never going to fully solve "show the complete description" for every model regardless.
This commit is contained in:
@@ -28,7 +28,6 @@ struct ModelInfoView: View {
|
|||||||
|
|
||||||
@Environment(\.dismiss) var dismiss
|
@Environment(\.dismiss) var dismiss
|
||||||
@Bindable private var settings = SettingsService.shared
|
@Bindable private var settings = SettingsService.shared
|
||||||
@State private var isDescriptionExpanded = false
|
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
VStack(spacing: 0) {
|
VStack(spacing: 0) {
|
||||||
@@ -73,6 +72,13 @@ struct ModelInfoView: View {
|
|||||||
infoRow("Released", releaseDate.formatted(date: .abbreviated, time: .omitted))
|
infoRow("Released", releaseDate.formatted(date: .abbreviated, time: .omitted))
|
||||||
}
|
}
|
||||||
if let desc = model.description {
|
if let desc = model.description {
|
||||||
|
// Always shown in full, no truncate/expand toggle — Text with a lineLimit
|
||||||
|
// nested inside this view's ScrollView doesn't reliably compute wrapping/
|
||||||
|
// truncation (a well-documented SwiftUI/AppKit quirk: without a fixedSize
|
||||||
|
// hint it hard-clips mid-word with no ellipsis; with one, sibling views in
|
||||||
|
// the same VStack — like the former "More…" button — can silently fail to
|
||||||
|
// lay out). The modal itself already scrolls, so a long description just
|
||||||
|
// means more scrolling, which sidesteps the whole bug class.
|
||||||
VStack(alignment: .leading, spacing: 6) {
|
VStack(alignment: .leading, spacing: 6) {
|
||||||
Text("Description")
|
Text("Description")
|
||||||
.font(.subheadline.weight(.medium))
|
.font(.subheadline.weight(.medium))
|
||||||
@@ -80,18 +86,7 @@ struct ModelInfoView: View {
|
|||||||
Text(desc)
|
Text(desc)
|
||||||
.font(.body)
|
.font(.body)
|
||||||
.foregroundColor(.primary)
|
.foregroundColor(.primary)
|
||||||
.lineLimit(isDescriptionExpanded ? nil : 4)
|
|
||||||
.textSelection(.enabled)
|
.textSelection(.enabled)
|
||||||
if desc.count > 250 {
|
|
||||||
Button(isDescriptionExpanded ? "Less" : "More…") {
|
|
||||||
withAnimation(.easeInOut(duration: 0.2)) {
|
|
||||||
isDescriptionExpanded.toggle()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.font(.callout)
|
|
||||||
.foregroundStyle(.blue)
|
|
||||||
.buttonStyle(.plain)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.padding(.leading, 4)
|
.padding(.leading, 4)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user