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) {
|
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()
|
loadSettings()
|
||||||
loadHosts()
|
loadHosts()
|
||||||
exportHosts()
|
exportHosts()
|
||||||
@@ -39,12 +46,6 @@ class HostsManager: ObservableObject, @unchecked Sendable {
|
|||||||
loadFonts()
|
loadFonts()
|
||||||
loadSnippets()
|
loadSnippets()
|
||||||
loadHistory()
|
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() {
|
func setAppIcon() {
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ enum AppIcon: Codable, CaseIterable, Equatable, CustomStringConvertible {
|
|||||||
case .beta:
|
case .beta:
|
||||||
return "Beta"
|
return "Beta"
|
||||||
case .betaBlueprint:
|
case .betaBlueprint:
|
||||||
return "Beta Blueprint"
|
return "Blueprint"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,25 +57,24 @@ struct SettingsView: View {
|
|||||||
HStack {
|
HStack {
|
||||||
ForEach(AppIcon.allCases, id: \.self) { icon in
|
ForEach(AppIcon.allCases, id: \.self) { icon in
|
||||||
let isSelected = hostsManager.settings.appIcon == icon
|
let isSelected = hostsManager.settings.appIcon == icon
|
||||||
ZStack {
|
ZStack(alignment: .top) {
|
||||||
RoundedRectangle(cornerRadius: 21.5)
|
RoundedRectangle(cornerRadius: 21.5)
|
||||||
.foregroundStyle(.gray.opacity(0.5))
|
.foregroundStyle(.gray.opacity(0.5))
|
||||||
.opacity(isSelected ? 1 : 0)
|
.opacity(isSelected ? 1 : 0)
|
||||||
VStack(alignment: .center) {
|
VStack(spacing: 0) {
|
||||||
icon.image
|
icon.image
|
||||||
.resizable().scaledToFit()
|
.resizable().scaledToFit()
|
||||||
.frame(maxWidth: 85)
|
|
||||||
.clipShape(RoundedRectangle(cornerRadius: 16.5))
|
.clipShape(RoundedRectangle(cornerRadius: 16.5))
|
||||||
.padding(5)
|
.padding(5)
|
||||||
Spacer()
|
|
||||||
Text(icon.description).tag(icon)
|
Text(icon.description).tag(icon)
|
||||||
.font(.callout)
|
.font(.caption)
|
||||||
.padding(5)
|
|
||||||
.padding(.bottom, 5)
|
.padding(.bottom, 5)
|
||||||
// Spacer()
|
.padding(.horizontal, 5)
|
||||||
|
.border(.red)
|
||||||
|
.multilineTextAlignment(.center)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.frame(maxWidth: 85)
|
.frame(maxWidth: 85, maxHeight: 110)
|
||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
withAnimation {
|
withAnimation {
|
||||||
hostsManager.settings.appIcon = icon
|
hostsManager.settings.appIcon = icon
|
||||||
@@ -97,7 +96,7 @@ struct SettingsView: View {
|
|||||||
|
|
||||||
#Preview {
|
#Preview {
|
||||||
SettingsView(
|
SettingsView(
|
||||||
hostsManager: HostsManager(),
|
hostsManager: HostsManager(previews: true),
|
||||||
keyManager: KeyManager()
|
keyManager: KeyManager()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user