@@ -16,14 +16,6 @@ public struct WidgetFeature: ReducerProtocol {
1616 var frame : CGRect = . zero
1717 }
1818
19- public struct Windows : Equatable {
20- public var widgetWindowState = WindowState ( )
21- public var chatWindowState = WindowState ( )
22- public var suggestionPanelWindowState = WindowState ( )
23- public var sharedPanelWindowState = WindowState ( )
24- public var tabWindowState = WindowState ( )
25- }
26-
2719 public enum WindowCanBecomeKey : Equatable {
2820 case sharedPanel
2921 case chatPanel
@@ -33,8 +25,8 @@ public struct WidgetFeature: ReducerProtocol {
3325 var focusingDocumentURL : URL ?
3426 public var colorScheme : ColorScheme = . light
3527
36- public var toast = Toast . State ( )
37-
28+ var toastPanel = ToastPanel . State ( )
29+
3830 // MARK: Panels
3931
4032 public var panelState = PanelFeature . State ( )
@@ -123,7 +115,7 @@ public struct WidgetFeature: ReducerProtocol {
123115 case updateWindowOpacityFinished
124116 case updateKeyWindow( WindowCanBecomeKey )
125117
126- case toast ( Toast . Action )
118+ case toastPanel ( ToastPanel . Action )
127119 case panel( PanelFeature . Action )
128120 case chatPanel( ChatPanelFeature . Action )
129121 case circularWidget( CircularWidgetFeature . Action )
@@ -147,10 +139,10 @@ public struct WidgetFeature: ReducerProtocol {
147139 public init ( ) { }
148140
149141 public var body : some ReducerProtocol < State , Action > {
150- Scope ( state: \. toast , action: / Action. toast ) {
151- Toast ( )
142+ Scope ( state: \. toastPanel , action: / Action. toastPanel ) {
143+ ToastPanel ( )
152144 }
153-
145+
154146 Scope ( state: \. _circularWidgetState, action: / Action. circularWidget) {
155147 CircularWidgetFeature ( )
156148 }
@@ -236,7 +228,7 @@ public struct WidgetFeature: ReducerProtocol {
236228 case . startup:
237229 return . merge(
238230 . run { send in
239- await send ( . toast ( . start) )
231+ await send ( . toastPanel ( . start) )
240232 await send ( . observeActiveApplicationChange)
241233 await send ( . observeCompletionPanelChange)
242234 await send ( . observeFullscreenChange)
@@ -490,6 +482,7 @@ public struct WidgetFeature: ReducerProtocol {
490482 } ( )
491483
492484 state. colorScheme = scheme
485+ state. toastPanel. colorScheme = scheme
493486 state. panelState. sharedPanelState. colorScheme = scheme
494487 state. panelState. suggestionPanelState. colorScheme = scheme
495488 state. chatPanelState. colorScheme = scheme
@@ -514,6 +507,10 @@ public struct WidgetFeature: ReducerProtocol {
514507 state. panelState. suggestionPanelState. isPanelOutOfFrame = true
515508 }
516509
510+ state. toastPanel. alignTopToAnchor = widgetLocation
511+ . defaultPanelLocation
512+ . alignPanelTop
513+
517514 let isChatPanelDetached = state. chatPanelState. chatPanelInASeparateWindow
518515
519516 return . run { _ in
@@ -523,8 +520,8 @@ public struct WidgetFeature: ReducerProtocol {
523520 display: false ,
524521 animate: animated
525522 )
526- windows. tabWindow . setFrame (
527- widgetLocation. tabFrame ,
523+ windows. toastWindow . setFrame (
524+ widgetLocation. defaultPanelLocation . frame ,
528525 display: false ,
529526 animate: animated
530527 )
@@ -582,7 +579,7 @@ public struct WidgetFeature: ReducerProtocol {
582579 windows. sharedPanelWindow. alphaValue = noFocus ? 0 : 1
583580 windows. suggestionPanelWindow. alphaValue = noFocus ? 0 : 1
584581 windows. widgetWindow. alphaValue = noFocus ? 0 : 1
585- windows. tabWindow . alphaValue = 0
582+ windows. toastWindow . alphaValue = noFocus ? 0 : 1
586583
587584 if isChatPanelDetached {
588585 windows. chatPanelWindow. alphaValue = hasChat ? 1 : 0
@@ -604,7 +601,7 @@ public struct WidgetFeature: ReducerProtocol {
604601 windows. sharedPanelWindow. alphaValue = noFocus ? 0 : 1
605602 windows. suggestionPanelWindow. alphaValue = noFocus ? 0 : 1
606603 windows. widgetWindow. alphaValue = noFocus ? 0 : 1
607- windows. tabWindow . alphaValue = 0
604+ windows. toastWindow . alphaValue = noFocus ? 0 : 1
608605 if isChatPanelDetached {
609606 windows. chatPanelWindow. alphaValue = hasChat ? 1 : 0
610607 } else {
@@ -615,7 +612,7 @@ public struct WidgetFeature: ReducerProtocol {
615612 windows. sharedPanelWindow. alphaValue = 0
616613 windows. suggestionPanelWindow. alphaValue = 0
617614 windows. widgetWindow. alphaValue = 0
618- windows. tabWindow . alphaValue = 0
615+ windows. toastWindow . alphaValue = 0
619616 if !isChatPanelDetached {
620617 windows. chatPanelWindow. alphaValue = 0
621618 }
@@ -639,8 +636,8 @@ public struct WidgetFeature: ReducerProtocol {
639636 await windows. sharedPanelWindow. makeKeyAndOrderFront ( nil )
640637 }
641638 }
642-
643- case . toast :
639+
640+ case . toastPanel :
644641 return . none
645642
646643 case . circularWidget:
0 commit comments