mirror of
https://github.com/nimbold/Firelink.git
synced 2026-07-26 12:08:27 +00:00
chore: organize settings sections
This commit is contained in:
@@ -3,13 +3,23 @@ import SwiftUI
|
||||
|
||||
private enum SettingsSection: String, CaseIterable, Hashable {
|
||||
case downloads = "Downloads"
|
||||
case network = "Network"
|
||||
case locations = "Locations"
|
||||
case network = "Network"
|
||||
case siteLogins = "Site Logins"
|
||||
case power = "Power"
|
||||
case engine = "Engine"
|
||||
case about = "About"
|
||||
|
||||
static let orderedCases: [SettingsSection] = [
|
||||
.downloads,
|
||||
.locations,
|
||||
.network,
|
||||
.siteLogins,
|
||||
.power,
|
||||
.engine,
|
||||
.about
|
||||
]
|
||||
|
||||
var symbolName: String {
|
||||
switch self {
|
||||
case .downloads: "arrow.down.circle"
|
||||
@@ -24,7 +34,7 @@ private enum SettingsSection: String, CaseIterable, Hashable {
|
||||
|
||||
var groupTitle: String {
|
||||
switch self {
|
||||
case .about:
|
||||
case .engine, .about:
|
||||
"App"
|
||||
default:
|
||||
"Preferences"
|
||||
@@ -64,14 +74,14 @@ struct SettingsView: View {
|
||||
private var settingsSidebar: some View {
|
||||
List(selection: $selection) {
|
||||
Section("Preferences") {
|
||||
ForEach(SettingsSection.allCases.filter { $0.groupTitle == "Preferences" }, id: \.self) { section in
|
||||
ForEach(SettingsSection.orderedCases.filter { $0.groupTitle == "Preferences" }, id: \.self) { section in
|
||||
Label(section.rawValue, systemImage: section.symbolName)
|
||||
.tag(section)
|
||||
}
|
||||
}
|
||||
|
||||
Section("App") {
|
||||
ForEach(SettingsSection.allCases.filter { $0.groupTitle == "App" }, id: \.self) { section in
|
||||
ForEach(SettingsSection.orderedCases.filter { $0.groupTitle == "App" }, id: \.self) { section in
|
||||
Label(section.rawValue, systemImage: section.symbolName)
|
||||
.tag(section)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user