feat(mac): compact context session rows

This commit is contained in:
Peter Steinberger
2025-12-13 02:15:28 +00:00
parent 594315d90b
commit f466f1bf46

View File

@@ -271,7 +271,7 @@ struct MenuContent: View {
@ViewBuilder @ViewBuilder
private var contextCardView: some View { private var contextCardView: some View {
VStack(alignment: .leading, spacing: 10) { VStack(alignment: .leading, spacing: 8) {
HStack(alignment: .firstTextBaseline) { HStack(alignment: .firstTextBaseline) {
Text("Context") Text("Context")
.font(.caption.weight(.semibold)) .font(.caption.weight(.semibold))
@@ -287,7 +287,7 @@ struct MenuContent: View {
.font(.caption) .font(.caption)
.foregroundStyle(.secondary) .foregroundStyle(.secondary)
} else { } else {
VStack(alignment: .leading, spacing: 10) { VStack(alignment: .leading, spacing: 8) {
ForEach(self.contextSessions) { row in ForEach(self.contextSessions) { row in
self.contextSessionRow(row) self.contextSessionRow(row)
} }
@@ -316,22 +316,27 @@ struct MenuContent: View {
private func contextSessionRow(_ row: SessionRow) -> some View { private func contextSessionRow(_ row: SessionRow) -> some View {
let width = self.contextPillWidth let width = self.contextPillWidth
VStack(alignment: .leading, spacing: 4) { VStack(alignment: .leading, spacing: 4) {
ContextUsageBar( HStack(alignment: .firstTextBaseline, spacing: 8) {
usedTokens: row.tokens.total,
contextTokens: row.tokens.contextTokens,
width: width,
height: self.contextBarHeight)
HStack(spacing: 8) {
Text(row.key) Text(row.key)
.font(.caption2.weight(row.key == "main" ? .semibold : .regular)) .font(.caption.weight(row.key == "main" ? .semibold : .regular))
.lineLimit(1) .lineLimit(1)
.truncationMode(.middle) .truncationMode(.middle)
.layoutPriority(1) .layoutPriority(1)
Spacer(minLength: 8) Spacer(minLength: 8)
Text(row.tokens.contextSummaryShort) Text(row.tokens.contextSummaryShort)
.font(.caption2.monospacedDigit()) .font(.caption.monospacedDigit())
.foregroundStyle(.secondary) .foregroundStyle(.secondary)
.lineLimit(1)
.fixedSize(horizontal: true, vertical: false)
.layoutPriority(2)
} }
.frame(width: width)
ContextUsageBar(
usedTokens: row.tokens.total,
contextTokens: row.tokens.contextTokens,
width: width,
height: self.contextBarHeight)
} }
.frame(width: width) .frame(width: width)
} }