@@ -78,9 +78,6 @@ struct ChatTabBar: View {
7878 var selectedTabId : String
7979 }
8080
81- @State var isHoveringCreateButton = false
82- @State var isHoveringMenuButton = false
83-
8481 var body : some View {
8582 WithViewStore (
8683 store,
@@ -120,77 +117,45 @@ struct ChatTabBar: View {
120117
121118 @ViewBuilder
122119 var createButton : some View {
123- HStack ( spacing: 0 ) {
124- Button ( action: {
125- store. send ( . createNewTapButtonClicked( kind: nil ) )
126- } ) {
127- Image ( systemName: " plus " )
128- . foregroundColor ( . secondary)
129- . padding ( . leading, 8 )
130- . padding ( . trailing, 4 )
131- . frame ( maxHeight: . infinity)
132- }
133- . buttonStyle ( . plain)
134- . background {
135- if isHoveringCreateButton {
136- RoundedRectangle ( cornerRadius: 2 )
137- . fill ( Color ( nsColor: . controlTextColor) . opacity ( 0.1 ) )
138- }
139- }
140- . onHover { isHoveringCreateButton = $0 }
141-
142- Menu {
143- WithViewStore ( store, observe: { $0. chatTapGroup. tabCollection } ) { viewStore in
144- ForEach ( 0 ..< viewStore. state. endIndex, id: \. self) { index in
145- switch viewStore. state [ index] {
146- case let . kind( kind) :
147- Button ( action: {
148- store. send ( . createNewTapButtonClicked( kind: kind) )
149- } ) {
150- Text ( kind. title)
151- }
152- case let . folder( title, list) :
153- Menu {
154- ForEach ( 0 ..< list. endIndex, id: \. self) { index in
155- Button ( action: {
156- store
157- . send (
158- . createNewTapButtonClicked(
159- kind: list [ index]
160- )
120+ Menu {
121+ WithViewStore ( store, observe: { $0. chatTapGroup. tabCollection } ) { viewStore in
122+ ForEach ( 0 ..< viewStore. state. endIndex, id: \. self) { index in
123+ switch viewStore. state [ index] {
124+ case let . kind( kind) :
125+ Button ( action: {
126+ store. send ( . createNewTapButtonClicked( kind: kind) )
127+ } ) {
128+ Text ( kind. title)
129+ }
130+ case let . folder( title, list) :
131+ Menu {
132+ ForEach ( 0 ..< list. endIndex, id: \. self) { index in
133+ Button ( action: {
134+ store
135+ . send (
136+ . createNewTapButtonClicked(
137+ kind: list [ index]
161138 )
162- } ) {
163- Text ( list [ index ] . title )
164- }
139+ )
140+ } ) {
141+ Text ( list [ index ] . title )
165142 }
166- } label: {
167- Text ( title)
168143 }
144+ } label: {
145+ Text ( title)
169146 }
170147 }
171148 }
172- } label: {
173- // SwiftUI Menu in macOS is...
174- Button ( " " , action: { } )
175- }
176- . menuStyle ( . borderlessButton)
177- . menuIndicator ( . hidden)
178- . frame ( maxHeight: . infinity)
179- . fixedSize ( horizontal: true , vertical: false )
180- . overlay {
181- Image ( systemName: " chevron.down " )
182- . resizable ( )
183- . frame ( width: 7 , height: 4 )
184- . foregroundColor ( . secondary)
185- }
186- . background {
187- if isHoveringMenuButton {
188- RoundedRectangle ( cornerRadius: 2 )
189- . fill ( Color ( nsColor: . controlTextColor) . opacity ( 0.1 ) )
190- }
191149 }
192- . onHover { isHoveringMenuButton = $0 }
150+ } label: {
151+ Image ( systemName: " plus " )
152+ } primaryAction: {
153+ store. send ( . createNewTapButtonClicked( kind: nil ) )
193154 }
155+ . foregroundColor ( . secondary)
156+ . menuStyle ( . borderedButton)
157+ . padding ( . horizontal, 4 )
158+ . fixedSize ( horizontal: true , vertical: false )
194159 . onHover { isHovering in
195160 if isHovering {
196161 store. send ( . createNewTapButtonHovered)
0 commit comments