Skip to content

Commit 117d8fd

Browse files
feat: show when workspace apps are loading (#163)
Also switches all the stock ProgressViews to our new CircularProgressView https://github.com/user-attachments/assets/7d800856-5dc3-4ae2-8193-41debbf676bd https://github.com/user-attachments/assets/c6a953b4-c14f-437c-8e02-2c21348386e7
1 parent 2adace3 commit 117d8fd

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

Coder-Desktop/Coder-Desktop/Views/FileSync/FilePicker.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ struct FilePicker: View {
2323
VStack(spacing: 0) {
2424
if model.rootIsLoading {
2525
Spacer()
26-
ProgressView()
27-
.controlSize(.large)
26+
CircularProgressView(value: nil)
2827
Spacer()
2928
} else if let loadError = model.error {
3029
Text("\(loadError.description)")
@@ -125,7 +124,8 @@ struct FilePickerEntry: View {
125124
Label {
126125
Text(entry.name)
127126
ZStack {
128-
ProgressView().controlSize(.small).opacity(entry.isLoading && entry.error == nil ? 1 : 0)
127+
CircularProgressView(value: nil, strokeWidth: 2, diameter: 10)
128+
.opacity(entry.isLoading && entry.error == nil ? 1 : 0)
129129
Image(systemName: "exclamationmark.triangle.fill")
130130
.opacity(entry.error != nil ? 1 : 0)
131131
}

Coder-Desktop/Coder-Desktop/Views/FileSync/FileSyncSessionModal.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ struct FileSyncSessionModal<VPN: VPNService, FS: FileSyncDaemon>: View {
6868
Text(msg).foregroundStyle(.secondary)
6969
}
7070
if loading {
71-
ProgressView().controlSize(.small)
71+
CircularProgressView(value: nil, strokeWidth: 3, diameter: 15)
7272
}
7373
Button("Cancel", action: { dismiss() }).keyboardShortcut(.cancelAction)
7474
Button(existingSession == nil ? "Add" : "Save") { Task { await submit() }}

Coder-Desktop/Coder-Desktop/Views/VPN/VPNMenuItem.swift

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ struct MenuItemView: View {
7272

7373
@State private var apps: [WorkspaceApp] = []
7474

75+
@State private var loadingApps: Bool = true
76+
7577
var hasApps: Bool { !apps.isEmpty }
7678

7779
private var itemName: AttributedString {
@@ -129,9 +131,13 @@ struct MenuItemView: View {
129131
MenuItemIcons(item: item, wsURL: wsURL)
130132
}
131133
if isExpanded {
132-
if hasApps {
134+
switch (loadingApps, hasApps) {
135+
case (true, _):
136+
CircularProgressView(value: nil, strokeWidth: 3, diameter: 15)
137+
.padding(.top, 5)
138+
case (false, true):
133139
MenuItemCollapsibleView(apps: apps)
134-
} else {
140+
case (false, false):
135141
HStack {
136142
Text(item.status == .off ? "Workspace is offline." : "No apps available.")
137143
.font(.body)
@@ -146,6 +152,7 @@ struct MenuItemView: View {
146152
}
147153

148154
func loadApps() async {
155+
defer { loadingApps = false }
149156
// If this menu item is an agent, and the user is logged in
150157
if case let .agent(agent) = item,
151158
let client = state.client,

Coder-Desktop/Coder-Desktop/Views/VPN/WorkspaceAppIcon.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ struct WorkspaceAppIcon: View {
1919
) { $0 }
2020
placeholder: {
2121
if app.icon != nil {
22-
ProgressView().controlSize(.small)
22+
CircularProgressView(value: nil, strokeWidth: 2, diameter: 10)
2323
} else {
2424
Image(systemName: "questionmark").frame(
2525
width: Theme.Size.appIconWidth,

0 commit comments

Comments
 (0)