Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: make workspaces list scrollable on overflow#197

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ethanndickson merged 1 commit intomainfromethan/scrollable-workspaces
Jul 24, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 24 additions & 20 deletionsCoder-Desktop/Coder-Desktop/Views/VPN/Agents.swift
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,28 +16,32 @@ struct Agents<VPN: VPNService>: View {
if vpn.state == .connected {
let items = vpn.menuState.sorted
let visibleItems = viewAll ? items[...] : items.prefix(defaultVisibleRows)
ForEach(visibleItems, id: \.id) { agent in
MenuItemView(
item: agent,
baseAccessURL: state.baseAccessURL!,
expandedItem: $expandedItem,
userInteracted: $hasToggledExpansion
)
.padding(.horizontal, Theme.Size.trayMargin)
}.onChange(of: visibleItems) {
// If no workspaces are online, we should expand the first one to come online
if visibleItems.filter({ $0.status != .off }).isEmpty {
hasToggledExpansion = false
return
ScrollView(showsIndicators: false) {
ForEach(visibleItems, id: \.id) { agent in
MenuItemView(
item: agent,
baseAccessURL: state.baseAccessURL!,
expandedItem: $expandedItem,
userInteracted: $hasToggledExpansion
)
.padding(.horizontal, Theme.Size.trayMargin)
}.onChange(of: visibleItems) {
// If no workspaces are online, we should expand the first one to come online
if visibleItems.filter({ $0.status != .off }).isEmpty {
hasToggledExpansion = false
return
}
if hasToggledExpansion {
return
}
withAnimation(.snappy(duration: Theme.Animation.collapsibleDuration)) {
expandedItem = visibleItems.first?.id
}
hasToggledExpansion = true
}
if hasToggledExpansion {
return
}
withAnimation(.snappy(duration: Theme.Animation.collapsibleDuration)) {
expandedItem = visibleItems.first?.id
}
hasToggledExpansion = true
}
.scrollBounceBehavior(.basedOnSize)
.frame(maxHeight: 400)
if items.count == 0 {
Text("No workspaces!")
.font(.body)
Expand Down
31 changes: 16 additions & 15 deletionsCoder-Desktop/Coder-Desktop/Views/VPN/VPNMenuItem.swift
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -138,24 +138,25 @@ struct MenuItemView: View {
MenuItemIcons(item: item, wsURL: wsURL)
}
if isExpanded {
switch (loadingApps, hasApps) {
case (true, _):
CircularProgressView(value: nil, strokeWidth: 3, diameter: 15)
.padding(.top, 5)
case (false, true):
MenuItemCollapsibleView(apps: apps)
case (false, false):
HStack {
Text(item.status == .off ? "Workspace is offline." : "No apps available.")
.font(.body)
.foregroundColor(.secondary)
.padding(.horizontal, Theme.Size.trayInset)
.padding(.top, 7)
Group {
switch (loadingApps, hasApps) {
case (true, _):
CircularProgressView(value: nil, strokeWidth: 3, diameter: 15)
.padding(.top, 5)
case (false, true):
MenuItemCollapsibleView(apps: apps)
case (false, false):
HStack {
Text(item.status == .off ? "Workspace is offline." : "No apps available.")
.font(.body)
.foregroundColor(.secondary)
.padding(.horizontal, Theme.Size.trayInset)
.padding(.top, 7)
}
}
}
}.task { await loadApps() }
Copy link
MemberAuthor

@ethanndicksonethanndicksonJul 7, 2025
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Previously, we were fetching the apps when the menu bar row was rendered (this was before we had a dropdown). Now, we fetch when the dropdown is expanded.

}
}
.task { await loadApps() }
}

func loadApps() async {
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp