瀏覽代碼

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 1 月之前
父節點
當前提交
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 {
335 335
     private var aiCompanionNotesStatusLabelByView = [ObjectIdentifier: NSTextField]()
336 336
     private var aiCompanionNotesCurrentRequestId: UUID?
337 337
     private var aiCompanionNotesPanel: NSPanel?
338
+    private weak var aiCompanionNotesRootView: NSView?
339
+    private weak var aiCompanionNotesHeaderView: NSView?
340
+    private weak var aiCompanionNotesTitleLabel: NSTextField?
338 341
     private weak var aiCompanionNotesTextView: NSTextView?
339 342
     private weak var aiCompanionNotesCopyButton: NSButton?
340 343
     private weak var aiCompanionNotesCloseButton: NSButton?
@@ -3525,9 +3528,9 @@ private extension ViewController {
3525 3528
     @MainActor
3526 3529
     private func aiCompanionPresentNotesWindow(meetingTitle: String, initialText: String) {
3527 3530
         guard let hostWindow = view.window else { return }
3528
-        let hostIsDarkMode = hostWindow.effectiveAppearance.bestMatch(from: [.darkAqua, .aqua]) == .darkAqua
3531
+        let hostIsDarkMode = darkModeEnabled
3529 3532
         let panelAppearanceName: NSAppearance.Name = hostIsDarkMode ? .darkAqua : .aqua
3530
-        let outerBackgroundColor: NSColor = hostIsDarkMode ? .windowBackgroundColor : NSColor(calibratedWhite: 0.96, alpha: 1.0)
3533
+        let outerBackgroundColor: NSColor = hostIsDarkMode ? .windowBackgroundColor : NSColor(calibratedWhite: 0.98, alpha: 1.0)
3531 3534
         let headerBackgroundColor: NSColor = hostIsDarkMode ? .controlBackgroundColor : NSColor(calibratedWhite: 0.93, alpha: 1.0)
3532 3535
 
3533 3536
         if let panel = aiCompanionNotesPanel, let textView = aiCompanionNotesTextView {
@@ -3535,6 +3538,9 @@ private extension ViewController {
3535 3538
             panel.appearance = NSAppearance(named: panelAppearanceName)
3536 3539
             panel.backgroundColor = outerBackgroundColor
3537 3540
             textView.string = initialText
3541
+            aiCompanionNotesRootView?.layer?.backgroundColor = outerBackgroundColor.cgColor
3542
+            aiCompanionNotesHeaderView?.layer?.backgroundColor = headerBackgroundColor.cgColor
3543
+            aiCompanionNotesTitleLabel?.textColor = hostIsDarkMode ? .labelColor : .black
3538 3544
             if hostWindow.attachedSheet !== panel {
3539 3545
                 hostWindow.beginSheet(panel, completionHandler: nil)
3540 3546
             }
@@ -3572,7 +3578,8 @@ private extension ViewController {
3572 3578
         header.layer?.backgroundColor = headerBackgroundColor.cgColor
3573 3579
         header.layer?.cornerRadius = 10
3574 3580
 
3575
-        let titleLabel = textLabel("Meeting Notes", font: NSFont.systemFont(ofSize: 15, weight: .semibold), color: .labelColor)
3581
+        let headingColor: NSColor = hostIsDarkMode ? .labelColor : .black
3582
+        let titleLabel = textLabel("Meeting Notes", font: NSFont.systemFont(ofSize: 15, weight: .semibold), color: headingColor)
3576 3583
         titleLabel.translatesAutoresizingMaskIntoConstraints = false
3577 3584
         let subtitleLabel = textLabel(meetingTitle, font: NSFont.systemFont(ofSize: 12, weight: .regular), color: .secondaryLabelColor)
3578 3585
         subtitleLabel.translatesAutoresizingMaskIntoConstraints = false
@@ -3644,6 +3651,9 @@ private extension ViewController {
3644 3651
         NSApp.activate(ignoringOtherApps: true)
3645 3652
 
3646 3653
         aiCompanionNotesPanel = panel
3654
+        aiCompanionNotesRootView = root
3655
+        aiCompanionNotesHeaderView = header
3656
+        aiCompanionNotesTitleLabel = titleLabel
3647 3657
         aiCompanionNotesTextView = textView
3648 3658
         aiCompanionNotesCopyButton = copyButton
3649 3659
         aiCompanionNotesCloseButton = closeButton
@@ -6607,6 +6617,9 @@ extension ViewController: NSWindowDelegate {
6607 6617
         guard let closingWindow = notification.object as? NSWindow else { return }
6608 6618
         if closingWindow === aiCompanionNotesPanel {
6609 6619
             aiCompanionNotesPanel = nil
6620
+            aiCompanionNotesRootView = nil
6621
+            aiCompanionNotesHeaderView = nil
6622
+            aiCompanionNotesTitleLabel = nil
6610 6623
             aiCompanionNotesTextView = nil
6611 6624
             aiCompanionNotesCopyButton = nil
6612 6625
             aiCompanionNotesCloseButton = nil