mirror of
https://github.com/neon443/ShhShell.git
synced 2026-03-11 05:19:13 +00:00
updated the icon picker ui to look cleaner
updated logic for previews hostsmanager
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -74,7 +74,7 @@ enum AppIcon: Codable, CaseIterable, Equatable, CustomStringConvertible {
|
||||
case .beta:
|
||||
return "Beta"
|
||||
case .betaBlueprint:
|
||||
return "Beta Blueprint"
|
||||
return "Blueprint"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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