Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions macos/Onit/UI/Prompt/Generated/GeneratedContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import SwiftUI
struct GeneratedContentView: View {
@Environment(\.windowState) private var state
@Environment(\.openURL) var openURL
@Environment(\.colorScheme) var colorScheme

@Default(.fontSize) var fontSize
@Default(.lineHeight) var lineHeight
Expand All @@ -27,7 +28,10 @@ struct GeneratedContentView: View {

var configuration: LLMStreamConfiguration {
let font = FontConfiguration(size: fontSize, lineHeight: lineHeight)
let color = ColorConfiguration(textColor: .S_0,

let textColor = colorScheme == .dark ? Color.white : Color.black
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider using the existing semantic colors (Color.S_0) instead of hardcoded black/white. The S_0 color is already configured to be black in light mode and white in dark mode in the Assets catalog.


let color = ColorConfiguration(textColor: textColor,
citationBackgroundColor: Color.S_6,
citationHoverBackgroundColor: Color.S_4,
citationTextColor: Color.S_1)
Expand All @@ -47,7 +51,7 @@ struct GeneratedContentView: View {
configuration: configuration,
onUrlClicked: onUrlClicked,
onCodeAction: codeAction)
.id("\(fontSize)-\(lineHeight)") // Force recreation when font settings change
.id("\(fontSize)-\(lineHeight)-\(colorScheme.hashValue)") // Force recreation when font settings change
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Using colorScheme.hashValue could cause unnecessary view recreations if hashValue implementation changes. Consider using a more stable identifier like colorScheme.rawValue or a string representation.

Suggested change
.id("\(fontSize)-\(lineHeight)-\(colorScheme.hashValue)") // Force recreation when font settings change
.id("\(fontSize)-\(lineHeight)-\(colorScheme == .dark ? "dark" : "light")") // Force recreation when font settings change

.padding(.horizontal, 12)

if let response = prompt.currentResponse, response.hasToolCall {
Expand Down
8 changes: 6 additions & 2 deletions macos/Onit/UI/QuickEdit/QuickEditResponseView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ struct ViewOffsetKey: @preconcurrency PreferenceKey {
struct QuickEditResponseView: View {
@Environment(\.windowState) private var state
@Environment(\.openURL) var openURL
@Environment(\.colorScheme) var colorScheme

@State private var previousViewOffset: CGFloat = 0
@State private var hasUserManuallyScrolled: Bool = false
Expand Down Expand Up @@ -54,7 +55,10 @@ struct QuickEditResponseView: View {

private var configuration: LLMStreamConfiguration {
let font = FontConfiguration(size: fontSize, lineHeight: lineHeight)
let color = ColorConfiguration(textColor: .S_0,

let textColor = colorScheme == .dark ? Color.white : Color.black
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Using Color.white/Color.black conflicts with the custom rule that text should use .FG or low gray colors (.gray100, .gray200, .gray300) since the app only has dark mode

Suggested change
let textColor = colorScheme == .dark ? Color.white : Color.black
let textColor = colorScheme == .dark ? Color.FG : Color.gray100


let color = ColorConfiguration(textColor: textColor,
citationBackgroundColor: Color.S_6,
citationHoverBackgroundColor: Color.S_4,
citationTextColor: Color.S_1)
Expand Down Expand Up @@ -168,7 +172,7 @@ extension QuickEditResponseView {
configuration: configuration,
onUrlClicked: onUrlClicked,
onCodeAction: codeAction)
.id("\(fontSize)-\(lineHeight)") // Force recreation when font settings change
.id("\(fontSize)-\(lineHeight)-\(colorScheme.hashValue)") // Force recreation when font settings change
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider using a more stable identifier than colorScheme.hashValue - perhaps colorScheme == .dark for better predictability

.frame(maxWidth: .infinity, alignment: .leading)
.padding(.vertical, 8)
.id("content")
Expand Down