Skip to content

Commit 99d4e4d

Browse files
chore: minor ui/ux changes (#186)
These changes were in response to feedback: - Adds tooltips on hover to the copy DNS button, and the open in browser button on the main tray menu. - Includes the download URL in the error message if the client receives an unexpected HTTP code when downloading. ![](https://github.com/user-attachments/assets/69c6cffc-ae04-42b4-ac01-0e0d627d02f7) - Makes the file sync table controls a lil bigger (24px -> 28px): - Before: - ![](https://github.com/user-attachments/assets/01dabe2c-4571-4014-98b1-1d8daf603516) - After: - ![](https://github.com/user-attachments/assets/90192329-62f6-4ed2-a992-0cb9f73957a4)
1 parent 9a7b776 commit 99d4e4d

File tree

4 files changed

+36
-11
lines changed

4 files changed

+36
-11
lines changed

Coder-Desktop/Coder-Desktop/Theme.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ enum Theme {
1111
static let appIconWidth: CGFloat = 17
1212
static let appIconHeight: CGFloat = 17
1313
static let appIconSize: CGSize = .init(width: appIconWidth, height: appIconHeight)
14+
15+
static let tableFooterIconSize: CGFloat = 28
1416
}
1517

1618
enum Animation {

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

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ struct FileSyncConfig<VPN: VPNService, FS: FileSyncDaemon>: View {
4747
}
4848
})
4949
.frame(minWidth: 400, minHeight: 200)
50-
.padding(.bottom, 25)
50+
.padding(.bottom, Theme.Size.tableFooterIconSize)
5151
.overlay(alignment: .bottom) {
5252
tableFooter
5353
}
@@ -121,8 +121,8 @@ struct FileSyncConfig<VPN: VPNService, FS: FileSyncDaemon>: View {
121121
Button {
122122
addingNewSession = true
123123
} label: {
124-
Image(systemName: "plus")
125-
.frame(width: 24, height: 24).help("Create")
124+
FooterIcon(systemName: "plus")
125+
.help("Create")
126126
}.disabled(vpn.menuState.agents.isEmpty)
127127
sessionControls
128128
}
@@ -139,21 +139,25 @@ struct FileSyncConfig<VPN: VPNService, FS: FileSyncDaemon>: View {
139139
Divider()
140140
Button { Task { await delete(session: selectedSession) } }
141141
label: {
142-
Image(systemName: "minus").frame(width: 24, height: 24).help("Terminate")
142+
FooterIcon(systemName: "minus")
143+
.help("Terminate")
143144
}
144145
Divider()
145146
Button { Task { await pauseResume(session: selectedSession) } }
146147
label: {
147148
if selectedSession.status.isResumable {
148-
Image(systemName: "play").frame(width: 24, height: 24).help("Pause")
149+
FooterIcon(systemName: "play")
150+
.help("Resume")
149151
} else {
150-
Image(systemName: "pause").frame(width: 24, height: 24).help("Resume")
152+
FooterIcon(systemName: "pause")
153+
.help("Pause")
151154
}
152155
}
153156
Divider()
154157
Button { Task { await reset(session: selectedSession) } }
155158
label: {
156-
Image(systemName: "arrow.clockwise").frame(width: 24, height: 24).help("Reset")
159+
FooterIcon(systemName: "arrow.clockwise")
160+
.help("Reset")
157161
}
158162
}
159163
}
@@ -199,6 +203,18 @@ struct FileSyncConfig<VPN: VPNService, FS: FileSyncDaemon>: View {
199203
}
200204
}
201205

206+
struct FooterIcon: View {
207+
let systemName: String
208+
209+
var body: some View {
210+
Image(systemName: systemName)
211+
.frame(
212+
width: Theme.Size.tableFooterIconSize,
213+
height: Theme.Size.tableFooterIconSize
214+
)
215+
}
216+
}
217+
202218
#if DEBUG
203219
#Preview {
204220
FileSyncConfig<PreviewVPN, PreviewFileSync>()

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,12 @@ struct MenuItemIcons: View {
235235
MenuItemIconButton(systemName: "doc.on.doc", action: copyToClipboard)
236236
.font(.system(size: 9))
237237
.symbolVariant(.fill)
238+
.help("Copy hostname")
238239
MenuItemIconButton(systemName: "globe", action: { openURL(wsURL) })
239240
.contentShape(Rectangle())
240241
.font(.system(size: 12))
241242
.padding(.trailing, Theme.Size.trayMargin)
243+
.help("Open in browser")
242244
}
243245
}
244246

Coder-Desktop/VPNLib/Download.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,15 @@ func etag(data: Data) -> String {
146146
}
147147

148148
public enum DownloadError: Error {
149-
case unexpectedStatusCode(Int)
149+
case unexpectedStatusCode(Int, url: String)
150150
case invalidResponse
151151
case networkError(any Error, url: String)
152152
case fileOpError(any Error)
153153

154154
public var description: String {
155155
switch self {
156-
case let .unexpectedStatusCode(code):
157-
"Unexpected HTTP status code: \(code)"
156+
case let .unexpectedStatusCode(code, url):
157+
"Unexpected HTTP status code: \(code) - \(url)"
158158
case let .networkError(error, url):
159159
"Network error: \(url) - \(error.localizedDescription)"
160160
case let .fileOpError(error):
@@ -232,7 +232,12 @@ extension DownloadManager: URLSessionDownloadDelegate {
232232
}
233233

234234
guard httpResponse.statusCode == 200 else {
235-
continuation.resume(throwing: DownloadError.unexpectedStatusCode(httpResponse.statusCode))
235+
continuation.resume(
236+
throwing: DownloadError.unexpectedStatusCode(
237+
httpResponse.statusCode,
238+
url: httpResponse.url?.absoluteString ?? "Unknown URL"
239+
)
240+
)
236241
return
237242
}
238243

0 commit comments

Comments
 (0)