@@ -16,28 +16,32 @@ struct Agents<VPN: VPNService>: View {
1616 if vpn. state == . connected {
1717 let items = vpn. menuState. sorted
1818 let visibleItems = viewAll ? items [ ... ] : items. prefix ( defaultVisibleRows)
19- ForEach ( visibleItems, id: \. id) { agent in
20- MenuItemView (
21- item: agent,
22- baseAccessURL: state. baseAccessURL!,
23- expandedItem: $expandedItem,
24- userInteracted: $hasToggledExpansion
25- )
26- . padding ( . horizontal, Theme . Size. trayMargin)
27- } . onChange ( of: visibleItems) {
28- // If no workspaces are online, we should expand the first one to come online
29- if visibleItems. filter ( { $0. status != . off } ) . isEmpty {
30- hasToggledExpansion = false
31- return
19+ ScrollView ( showsIndicators: false ) {
20+ ForEach ( visibleItems, id: \. id) { agent in
21+ MenuItemView (
22+ item: agent,
23+ baseAccessURL: state. baseAccessURL!,
24+ expandedItem: $expandedItem,
25+ userInteracted: $hasToggledExpansion
26+ )
27+ . padding ( . horizontal, Theme . Size. trayMargin)
28+ } . onChange ( of: visibleItems) {
29+ // If no workspaces are online, we should expand the first one to come online
30+ if visibleItems. filter ( { $0. status != . off } ) . isEmpty {
31+ hasToggledExpansion = false
32+ return
33+ }
34+ if hasToggledExpansion {
35+ return
36+ }
37+ withAnimation ( . snappy( duration: Theme . Animation. collapsibleDuration) ) {
38+ expandedItem = visibleItems. first? . id
39+ }
40+ hasToggledExpansion = true
3241 }
33- if hasToggledExpansion {
34- return
35- }
36- withAnimation ( . snappy( duration: Theme . Animation. collapsibleDuration) ) {
37- expandedItem = visibleItems. first? . id
38- }
39- hasToggledExpansion = true
4042 }
43+ . scrollBounceBehavior ( . basedOnSize)
44+ . frame ( maxHeight: 400 )
4145 if items. count == 0 {
4246 Text ( " No workspaces! " )
4347 . font ( . body)
0 commit comments