Skip to content

feat: make workspace app icons smaller, neater #152

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 7, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions Coder-Desktop/Coder-Desktop/Theme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ enum Theme {

static let rectCornerRadius: CGFloat = 4

static let appIconWidth: CGFloat = 30
static let appIconHeight: CGFloat = 30
static let appIconWidth: CGFloat = 17
static let appIconHeight: CGFloat = 17
static let appIconSize: CGSize = .init(width: appIconWidth, height: appIconHeight)
}

Expand Down
10 changes: 4 additions & 6 deletions Coder-Desktop/Coder-Desktop/Views/VPN/VPNMenuItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -180,20 +180,18 @@ struct MenuItemView: View {
}

struct MenuItemCollapsibleView: View {
private let defaultVisibleApps = 5
private let defaultVisibleApps = 6
let apps: [WorkspaceApp]

var body: some View {
HStack(spacing: 17) {
HStack(spacing: 16) {
ForEach(apps.prefix(defaultVisibleApps), id: \.id) { app in
WorkspaceAppIcon(app: app)
.frame(width: Theme.Size.appIconWidth, height: Theme.Size.appIconHeight)
}
if apps.count < defaultVisibleApps {
Spacer()
}
Spacer()
}
.padding(.leading, apps.count < defaultVisibleApps ? 14 : 0)
.padding(.leading, 32)
.padding(.bottom, 5)
.padding(.top, 10)
}
Expand Down
13 changes: 5 additions & 8 deletions Coder-Desktop/Coder-Desktop/Views/VPN/WorkspaceAppIcon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ struct WorkspaceAppIcon: View {
) { $0 }
placeholder: {
if app.icon != nil {
ProgressView()
ProgressView().controlSize(.small)
} else {
Text(app.displayName).frame(
Image(systemName: "questionmark").frame(
width: Theme.Size.appIconWidth,
height: Theme.Size.appIconHeight
)
Expand All @@ -30,14 +30,11 @@ struct WorkspaceAppIcon: View {
width: Theme.Size.appIconWidth,
height: Theme.Size.appIconHeight
)
}.padding(4)
}.padding(6)
}
.background(isHovering ? Color.accentColor.opacity(0.8) : .clear)
.clipShape(RoundedRectangle(cornerRadius: 8))
.overlay(
RoundedRectangle(cornerRadius: Theme.Size.rectCornerRadius * 2)
.stroke(.secondary, lineWidth: 1)
.opacity(isHovering && !isPressed ? 0.6 : 0.3)
).onHover { hovering in isHovering = hovering }
.onHover { hovering in isHovering = hovering }
.simultaneousGesture(
DragGesture(minimumDistance: 0)
.onChanged { _ in
Expand Down
Loading