Преглед на файлове

Fix AI Companion notes sheet light-mode styling refresh.

Ensure reused notes sheets update outer container colors and heading text so light mode no longer shows stale dark backgrounds.

Co-authored-by: Cursor <cursoragent@cursor.com>
huzaifahayat12 преди 2 месеца
родител
ревизия
a75d4d9e10
променени са 1 файла, в които са добавени 16 реда и са изтрити 3 реда
  1. 16 3
      meetings_app/ViewController.swift

+ 16 - 3
meetings_app/ViewController.swift

@@ -335,6 +335,9 @@ final class ViewController: NSViewController {
     private var aiCompanionNotesStatusLabelByView = [ObjectIdentifier: NSTextField]()
     private var aiCompanionNotesCurrentRequestId: UUID?
     private var aiCompanionNotesPanel: NSPanel?
+    private weak var aiCompanionNotesRootView: NSView?
+    private weak var aiCompanionNotesHeaderView: NSView?
+    private weak var aiCompanionNotesTitleLabel: NSTextField?
     private weak var aiCompanionNotesTextView: NSTextView?
     private weak var aiCompanionNotesCopyButton: NSButton?
     private weak var aiCompanionNotesCloseButton: NSButton?
@@ -3525,9 +3528,9 @@ private extension ViewController {
     @MainActor
     private func aiCompanionPresentNotesWindow(meetingTitle: String, initialText: String) {
         guard let hostWindow = view.window else { return }
-        let hostIsDarkMode = hostWindow.effectiveAppearance.bestMatch(from: [.darkAqua, .aqua]) == .darkAqua
+        let hostIsDarkMode = darkModeEnabled
         let panelAppearanceName: NSAppearance.Name = hostIsDarkMode ? .darkAqua : .aqua
-        let outerBackgroundColor: NSColor = hostIsDarkMode ? .windowBackgroundColor : NSColor(calibratedWhite: 0.96, alpha: 1.0)
+        let outerBackgroundColor: NSColor = hostIsDarkMode ? .windowBackgroundColor : NSColor(calibratedWhite: 0.98, alpha: 1.0)
         let headerBackgroundColor: NSColor = hostIsDarkMode ? .controlBackgroundColor : NSColor(calibratedWhite: 0.93, alpha: 1.0)
 
         if let panel = aiCompanionNotesPanel, let textView = aiCompanionNotesTextView {
@@ -3535,6 +3538,9 @@ private extension ViewController {
             panel.appearance = NSAppearance(named: panelAppearanceName)
             panel.backgroundColor = outerBackgroundColor
             textView.string = initialText
+            aiCompanionNotesRootView?.layer?.backgroundColor = outerBackgroundColor.cgColor
+            aiCompanionNotesHeaderView?.layer?.backgroundColor = headerBackgroundColor.cgColor
+            aiCompanionNotesTitleLabel?.textColor = hostIsDarkMode ? .labelColor : .black
             if hostWindow.attachedSheet !== panel {
                 hostWindow.beginSheet(panel, completionHandler: nil)
             }
@@ -3572,7 +3578,8 @@ private extension ViewController {
         header.layer?.backgroundColor = headerBackgroundColor.cgColor
         header.layer?.cornerRadius = 10
 
-        let titleLabel = textLabel("Meeting Notes", font: NSFont.systemFont(ofSize: 15, weight: .semibold), color: .labelColor)
+        let headingColor: NSColor = hostIsDarkMode ? .labelColor : .black
+        let titleLabel = textLabel("Meeting Notes", font: NSFont.systemFont(ofSize: 15, weight: .semibold), color: headingColor)
         titleLabel.translatesAutoresizingMaskIntoConstraints = false
         let subtitleLabel = textLabel(meetingTitle, font: NSFont.systemFont(ofSize: 12, weight: .regular), color: .secondaryLabelColor)
         subtitleLabel.translatesAutoresizingMaskIntoConstraints = false
@@ -3644,6 +3651,9 @@ private extension ViewController {
         NSApp.activate(ignoringOtherApps: true)
 
         aiCompanionNotesPanel = panel
+        aiCompanionNotesRootView = root
+        aiCompanionNotesHeaderView = header
+        aiCompanionNotesTitleLabel = titleLabel
         aiCompanionNotesTextView = textView
         aiCompanionNotesCopyButton = copyButton
         aiCompanionNotesCloseButton = closeButton
@@ -6607,6 +6617,9 @@ extension ViewController: NSWindowDelegate {
         guard let closingWindow = notification.object as? NSWindow else { return }
         if closingWindow === aiCompanionNotesPanel {
             aiCompanionNotesPanel = nil
+            aiCompanionNotesRootView = nil
+            aiCompanionNotesHeaderView = nil
+            aiCompanionNotesTitleLabel = nil
             aiCompanionNotesTextView = nil
             aiCompanionNotesCopyButton = nil
             aiCompanionNotesCloseButton = nil