updated the icon picker ui to look cleaner

updated logic for previews hostsmanager
This commit is contained in:
neon443 committed 2025-08-22 14:03:10 +01:00
1 parent 3e45de2d32
commit 2030c48ab3
3 files changed
+16 -16

No files matched your search

+7 -6
View File
@@ -32,6 +32,13 @@ class HostsManager: ObservableObject, @unchecked Sendable {
}
init(previews: Bool = false) {
if previews {
self.hosts = [Host.debug, Host.blank]
self.themes = [Theme.defaultTheme]
self.snippets = [Snippet(name: "kys", content: "ls\npwd\n")]
self.history = [History(host: Host.debug, count: 3)]
return
}
loadSettings()
loadHosts()
exportHosts()
@@ -39,12 +46,6 @@ class HostsManager: ObservableObject, @unchecked Sendable {
loadFonts()
loadSnippets()
loadHistory()
if previews {
self.hosts = [Host.debug, Host.blank]
self.themes = [Theme.defaultTheme]
self.snippets = [Snippet(name: "kys", content: "ls\npwd\n")]
self.history = [History(host: Host.debug, count: 3)]
}
}
func setAppIcon() {
+1 -1
View File
@@ -74,7 +74,7 @@ enum AppIcon: Codable, CaseIterable, Equatable, CustomStringConvertible {
case .beta:
return "Beta"
case .betaBlueprint:
return "Beta Blueprint"
return "Blueprint"
}
}
}
+8 -9
View File
@@ -57,25 +57,24 @@ struct SettingsView: View {
HStack {
ForEach(AppIcon.allCases, id: \.self) { icon in
let isSelected = hostsManager.settings.appIcon == icon
ZStack {
ZStack(alignment: .top) {
RoundedRectangle(cornerRadius: 21.5)
.foregroundStyle(.gray.opacity(0.5))
.opacity(isSelected ? 1 : 0)
VStack(alignment: .center) {
VStack(spacing: 0) {
icon.image
.resizable().scaledToFit()
.frame(maxWidth: 85)
.clipShape(RoundedRectangle(cornerRadius: 16.5))
.padding(5)
Spacer()
Text(icon.description).tag(icon)
.font(.callout)
.padding(5)
.font(.caption)
.padding(.bottom, 5)
// Spacer()
.padding(.horizontal, 5)
.border(.red)
.multilineTextAlignment(.center)
}
}
.frame(maxWidth: 85)
.frame(maxWidth: 85, maxHeight: 110)
.onTapGesture {
withAnimation {
hostsManager.settings.appIcon = icon
@@ -97,7 +96,7 @@ struct SettingsView: View {
#Preview {
SettingsView(
hostsManager: HostsManager(),
hostsManager: HostsManager(previews: true),
keyManager: KeyManager()
)
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.