cmux/Sources/Panels/PanelContentView.swift
Lawrence Chen cef1513ceb Fix notification ring not appearing on terminal panes
TerminalPanelView and PanelContentView held notificationStore as a
plain `let` property. Since it's a reference type (class), SwiftUI's
structural diffing saw no change when notifications were added and
skipped re-evaluating the view body. Changed to @ObservedObject var
so the views properly subscribe to the store's @Published changes.

Closes #126
2026-02-20 02:41:52 -08:00

45 lines
1.5 KiB
Swift

import SwiftUI
import Foundation
/// View that renders the appropriate panel view based on panel type
struct PanelContentView: View {
let panel: any Panel
let isFocused: Bool
let isSelectedInPane: Bool
let isVisibleInUI: Bool
let portalPriority: Int
let isSplit: Bool
let appearance: PanelAppearance
@ObservedObject var notificationStore: TerminalNotificationStore
let onFocus: () -> Void
let onRequestPanelFocus: () -> Void
let onTriggerFlash: () -> Void
var body: some View {
switch panel.panelType {
case .terminal:
if let terminalPanel = panel as? TerminalPanel {
TerminalPanelView(
panel: terminalPanel,
isFocused: isFocused,
isVisibleInUI: isVisibleInUI,
portalPriority: portalPriority,
isSplit: isSplit,
appearance: appearance,
notificationStore: notificationStore,
onFocus: onFocus,
onTriggerFlash: onTriggerFlash
)
}
case .browser:
if let browserPanel = panel as? BrowserPanel {
BrowserPanelView(
panel: browserPanel,
isFocused: isFocused,
isVisibleInUI: isVisibleInUI,
onRequestPanelFocus: onRequestPanelFocus
)
}
}
}
}