| @@ -64,6 +64,7 @@ struct UsageMenuCardView: View { · 63 unmodified lines |
| 64 | } | 64 | } |
| 65 | | 65 | |
| 66 | let model: Model | 66 | let model: Model |
| | 67 | @Environment(\.menuItemHighlighted) private var isHighlighted |
| 67 | | 68 | |
| 68 | init(model: Model) { | 69 | init(model: Model) { |
| 69 | self.model = model | 70 | self.model = model |
| @@ -80,7 +81,7 @@ struct UsageMenuCardView: View { · 10 unmodified lines |
| 80 | if self.model.metrics.isEmpty { | 81 | if self.model.metrics.isEmpty { |
| 81 | if let placeholder = self.model.placeholder { | 82 | if let placeholder = self.model.placeholder { |
| 82 | Text(placeholder) | 83 | Text(placeholder) |
| 83 | .foregroundStyle(.secondary) | 84 | .foregroundStyle(MenuHighlightStyle.secondary(self.isHighlighted)) |
| 84 | .font(.subheadline) | 85 | .font(.subheadline) |
| 85 | } | 86 | } |
| 86 | } else { | 87 | } else { |
| @@ -107,13 +108,13 @@ struct UsageMenuCardView: View { · 20 unmodified lines |
| 107 | if let reset = metric.resetText { | 108 | if let reset = metric.resetText { |
| 108 | Text(reset) | 109 | Text(reset) |
| 109 | .font(.footnote) | 110 | .font(.footnote) |
| 110 | .foregroundStyle(.secondary) | 111 | .foregroundStyle(MenuHighlightStyle.secondary(self.isHighlighted)) |
| 111 | } | 112 | } |
| 112 | } | 113 | } |
| 113 | if let detail = metric.detailText { | 114 | if let detail = metric.detailText { |
| 114 | Text(detail) | 115 | Text(detail) |
| 115 | .font(.footnote) | 116 | .font(.footnote) |
| 116 | .foregroundStyle(.secondary) | 117 | .foregroundStyle(MenuHighlightStyle.secondary(self.isHighlighted)) |
| 117 | .lineLimit(1) | 118 | .lineLimit(1) |
| 118 | } | 119 | } |
| 119 | } | 120 | } |
| @@ -145,14 +146,14 @@ struct UsageMenuCardView: View { · 25 unmodified lines |
| 145 | if let hint = tokenUsage.hintLine, !hint.isEmpty { | 146 | if let hint = tokenUsage.hintLine, !hint.isEmpty { |
| 146 | Text(hint) | 147 | Text(hint) |
| 147 | .font(.footnote) | 148 | .font(.footnote) |
| 148 | .foregroundStyle(.secondary) | 149 | .foregroundStyle(MenuHighlightStyle.secondary(self.isHighlighted)) |
| 149 | .lineLimit(2) | 150 | .lineLimit(2) |
| 150 | .fixedSize(horizontal: false, vertical: true) | 151 | .fixedSize(horizontal: false, vertical: true) |
| 151 | } | 152 | } |
| 152 | if let error = tokenUsage.errorLine, !error.isEmpty { | 153 | if let error = tokenUsage.errorLine, !error.isEmpty { |
| 153 | Text(error) | 154 | Text(error) |
| 154 | .font(.footnote) | 155 | .font(.footnote) |
| 155 | .foregroundStyle(Color(nsColor: .systemRed)) | 156 | .foregroundStyle(MenuHighlightStyle.error(self.isHighlighted)) |
| 156 | .lineLimit(2) | 157 | .lineLimit(2) |
| 157 | .fixedSize(horizontal: false, vertical: true) | 158 | .fixedSize(horizontal: false, vertical: true) |
| 158 | } | 159 | } |
| @@ -175,6 +176,7 @@ struct UsageMenuCardView: View { · 16 unmodified lines |
| 175 | | 176 | |
| 176 | private struct UsageMenuCardHeaderView: View { | 177 | private struct UsageMenuCardHeaderView: View { |
| 177 | let model: UsageMenuCardView.Model | 178 | let model: UsageMenuCardView.Model |
| | 179 | @Environment(\.menuItemHighlighted) private var isHighlighted |
| 178 | | 180 | |
| 179 | var body: some View { | 181 | var body: some View { |
| 180 | VStack(alignment: .leading, spacing: 3) { | 182 | VStack(alignment: .leading, spacing: 3) { |
| @@ -185,7 +187,7 @@ private struct UsageMenuCardHeaderView: View { · 4 unmodified lines |
| 185 | Spacer() | 187 | Spacer() |
| 186 | Text(self.model.email) | 188 | Text(self.model.email) |
| 187 | .font(.subheadline) | 189 | .font(.subheadline) |
| 188 | .foregroundStyle(.secondary) | 190 | .foregroundStyle(MenuHighlightStyle.secondary(self.isHighlighted)) |
| 189 | } | 191 | } |
| 190 | HStack(alignment: .firstTextBaseline) { | 192 | HStack(alignment: .firstTextBaseline) { |
| 191 | Text(self.model.subtitleText) | 193 | Text(self.model.subtitleText) |
| @@ -198,7 +200,7 @@ private struct UsageMenuCardHeaderView: View { · 6 unmodified lines |
| 198 | if let plan = self.model.planText { | 200 | if let plan = self.model.planText { |
| 199 | Text(plan) | 201 | Text(plan) |
| 200 | .font(.footnote) | 202 | .font(.footnote) |
| 201 | .foregroundStyle(.secondary) | 203 | .foregroundStyle(MenuHighlightStyle.secondary(self.isHighlighted)) |
| 202 | .lineLimit(1) | 204 | .lineLimit(1) |
| 203 | } | 205 | } |
| 204 | } | 206 | } |
| @@ -207,9 +209,9 @@ private struct UsageMenuCardHeaderView: View { · 2 unmodified lines |
| 207 | | 209 | |
| 208 | private var subtitleColor: Color { | 210 | private var subtitleColor: Color { |
| 209 | switch self.model.subtitleStyle { | 211 | switch self.model.subtitleStyle { |
| 210 | case .info: .secondary | 212 | case .info: MenuHighlightStyle.secondary(self.isHighlighted) |
| 211 | case .loading: .secondary | 213 | case .loading: MenuHighlightStyle.secondary(self.isHighlighted) |
| 212 | case .error: Color(nsColor: .systemRed) | 214 | case .error: MenuHighlightStyle.error(self.isHighlighted) |
| 213 | } | 215 | } |
| 214 | } | 216 | } |
| 215 | } | 217 | } |
| @@ -236,13 +238,14 @@ struct UsageMenuCardUsageSectionView: View { · 20 unmodified lines |
| 236 | let model: UsageMenuCardView.Model | 238 | let model: UsageMenuCardView.Model |
| 237 | let showBottomDivider: Bool | 239 | let showBottomDivider: Bool |
| 238 | let bottomPadding: CGFloat | 240 | let bottomPadding: CGFloat |
| | 241 | @Environment(\.menuItemHighlighted) private var isHighlighted |
| 239 | | 242 | |
| 240 | var body: some View { | 243 | var body: some View { |
| 241 | VStack(alignment: .leading, spacing: 12) { | 244 | VStack(alignment: .leading, spacing: 12) { |
| 242 | if self.model.metrics.isEmpty { | 245 | if self.model.metrics.isEmpty { |
| 243 | if let placeholder = self.model.placeholder { | 246 | if let placeholder = self.model.placeholder { |
| 244 | Text(placeholder) | 247 | Text(placeholder) |
| 245 | .foregroundStyle(.secondary) | 248 | .foregroundStyle(MenuHighlightStyle.secondary(self.isHighlighted)) |
| 246 | .font(.subheadline) | 249 | .font(.subheadline) |
| 247 | } | 250 | } |
| 248 | } else { | 251 | } else { |
| @@ -262,13 +265,13 @@ struct UsageMenuCardUsageSectionView: View { · 13 unmodified lines |
| 262 | if let reset = metric.resetText { | 265 | if let reset = metric.resetText { |
| 263 | Text(reset) | 266 | Text(reset) |
| 264 | .font(.footnote) | 267 | .font(.footnote) |
| 265 | .foregroundStyle(.secondary) | 268 | .foregroundStyle(MenuHighlightStyle.secondary(self.isHighlighted)) |
| 266 | } | 269 | } |
| 267 | } | 270 | } |
| 268 | if let detail = metric.detailText { | 271 | if let detail = metric.detailText { |
| 269 | Text(detail) | 272 | Text(detail) |
| 270 | .font(.footnote) | 273 | .font(.footnote) |
| 271 | .foregroundStyle(.secondary) | 274 | .foregroundStyle(MenuHighlightStyle.secondary(self.isHighlighted)) |
| 272 | .lineLimit(1) | 275 | .lineLimit(1) |
| 273 | } | 276 | } |
| 274 | } | 277 | } |
| @@ -330,6 +333,7 @@ private struct CreditsBarContent: View { · 55 unmodified lines |
| 330 | let creditsRemaining: Double? | 333 | let creditsRemaining: Double? |
| 331 | let hintText: String? | 334 | let hintText: String? |
| 332 | let progressColor: Color | 335 | let progressColor: Color |
| | 336 | @Environment(\.menuItemHighlighted) private var isHighlighted |
| 333 | | 337 | |
| 334 | private var percentLeft: Double? { | 338 | private var percentLeft: Double? { |
| 335 | guard let creditsRemaining else { return nil } | 339 | guard let creditsRemaining else { return nil } |
| @@ -358,7 +362,7 @@ private struct CreditsBarContent: View { · 22 unmodified lines |
| 358 | Spacer() | 362 | Spacer() |
| 359 | Text(self.scaleText) | 363 | Text(self.scaleText) |
| 360 | .font(.caption) | 364 | .font(.caption) |
| 361 | .foregroundStyle(.secondary) | 365 | .foregroundStyle(MenuHighlightStyle.secondary(self.isHighlighted)) |
| 362 | } | 366 | } |
| 363 | } else { | 367 | } else { |
| 364 | Text(self.creditsText) | 368 | Text(self.creditsText) |
| @@ -367,7 +371,7 @@ private struct CreditsBarContent: View { · 2 unmodified lines |
| 367 | if let hintText, !hintText.isEmpty { | 371 | if let hintText, !hintText.isEmpty { |
| 368 | Text(hintText) | 372 | Text(hintText) |
| 369 | .font(.footnote) | 373 | .font(.footnote) |
| 370 | .foregroundStyle(.secondary) | 374 | .foregroundStyle(MenuHighlightStyle.secondary(self.isHighlighted)) |
| 371 | .lineLimit(2) | 375 | .lineLimit(2) |
| 372 | .fixedSize(horizontal: false, vertical: true) | 376 | .fixedSize(horizontal: false, vertical: true) |
| 373 | } | 377 | } |
| @@ -379,6 +383,7 @@ struct UsageMenuCardCostSectionView: View { · 5 unmodified lines |
| 379 | let model: UsageMenuCardView.Model | 383 | let model: UsageMenuCardView.Model |
| 380 | let topPadding: CGFloat | 384 | let topPadding: CGFloat |
| 381 | let bottomPadding: CGFloat | 385 | let bottomPadding: CGFloat |
| | 386 | @Environment(\.menuItemHighlighted) private var isHighlighted |
| 382 | | 387 | |
| 383 | var body: some View { | 388 | var body: some View { |
| 384 | if let tokenUsage = self.model.tokenUsage { | 389 | if let tokenUsage = self.model.tokenUsage { |
| @@ -393,14 +398,14 @@ struct UsageMenuCardCostSectionView: View { · 8 unmodified lines |
| 393 | if let hint = tokenUsage.hintLine, !hint.isEmpty { | 398 | if let hint = tokenUsage.hintLine, !hint.isEmpty { |
| 394 | Text(hint) | 399 | Text(hint) |
| 395 | .font(.footnote) | 400 | .font(.footnote) |
| 396 | .foregroundStyle(.secondary) | 401 | .foregroundStyle(MenuHighlightStyle.secondary(self.isHighlighted)) |
| 397 | .lineLimit(2) | 402 | .lineLimit(2) |
| 398 | .fixedSize(horizontal: false, vertical: true) | 403 | .fixedSize(horizontal: false, vertical: true) |
| 399 | } | 404 | } |
| 400 | if let error = tokenUsage.errorLine, !error.isEmpty { | 405 | if let error = tokenUsage.errorLine, !error.isEmpty { |
| 401 | Text(error) | 406 | Text(error) |
| 402 | .font(.footnote) | 407 | .font(.footnote) |
| 403 | .foregroundStyle(Color(nsColor: .systemRed)) | 408 | .foregroundStyle(MenuHighlightStyle.error(self.isHighlighted)) |
| 404 | .lineLimit(2) | 409 | .lineLimit(2) |
| 405 | .fixedSize(horizontal: false, vertical: true) | 410 | .fixedSize(horizontal: false, vertical: true) |
| 406 | } | 411 | } |