This commit is contained in:
fmodf 2024-10-07 14:54:07 +02:00
parent 50d64cf96b
commit 2e9b4f5d19
3 changed files with 100 additions and 12 deletions

View file

@ -73,4 +73,7 @@
"Chats.Create.Main.createChannel" = "Create channel"; "Chats.Create.Main.createChannel" = "Create channel";
"Chats.Create.Main.findChannel" = "Find channel"; "Chats.Create.Main.findChannel" = "Find channel";
// MARK: Settings
"Settings.Main.title" = "Settings";
"Settings.Section.Accounts.title" = "Accounts";

View file

@ -5,22 +5,86 @@ struct SettingsScreen: View {
var body: some View { var body: some View {
ZStack { ZStack {
// bg // Background color
Color.Material.Background.light Color.Material.Background.light
.ignoresSafeArea() .ignoresSafeArea()
// debug buttons // Content
#if DEBUG VStack(spacing: 0) {
// clean all data // Header
Button { SharedNavigationBar(
clientsStore.flushAllData() centerText: .init(text: L10n.Settings.Main.title)
Database.shared.flushAllData() )
} label: {
Text("Clean all (for test)") // List
.font(.title) List {
.foregroundColor(.Material.Elements.active) // Accounts section
SharedSectionTitle(text: L10n.Settings.Section.Accounts.title)
ForEach(clientsStore.clients) { client in
SharedListRow(
iconType: .image(Image(systemName: "person.fill"), .Material.Elements.active),
text: "name",
controlType: .none
)
.onTapGesture {
print("Tapped client: \(client.name)")
}
}
SharedListRow(
iconType: .image(Image(systemName: "person.2.fill"), .Material.Elements.active),
text: L10n.Chats.Create.Main.createGroup,
controlType: .none
)
.onTapGesture {
print("Tapped createGroup")
}
SharedListRow(
iconType: .image(Image(systemName: "person.2.fill"), .Material.Elements.active),
text: L10n.Chats.Create.Main.createGroup,
controlType: .none
)
.onTapGesture {
print("Tapped createGroup")
}
SharedListRow(
iconType: .image(Image(systemName: "person.2.fill"), .Material.Elements.active),
text: L10n.Chats.Create.Main.createGroup,
controlType: .none
)
.onTapGesture {
print("Tapped createGroup")
}
SharedListRow(
iconType: .image(Image(systemName: "person.2.fill"), .Material.Elements.active),
text: L10n.Chats.Create.Main.createGroup,
controlType: .none
)
.onTapGesture {
print("Tapped createGroup")
}
// Dev section
#if DEBUG
SharedSectionTitle(text: "Dev tools")
SharedListRow(
iconType: .image(Image(systemName: "xmark.octagon"), .Material.Elements.active),
text: "Clean all data",
controlType: .none
)
.onTapGesture {
clientsStore.flushAllData()
Database.shared.flushAllData()
}
#endif
} }
#endif .listStyle(.plain)
.environment(\.defaultMinListRowHeight, 10)
Spacer()
}
} }
} }
} }

View file

@ -0,0 +1,21 @@
import SwiftUI
struct SharedSectionTitle: View {
let text: String
var body: some View {
HStack(spacing: 0) {
// Text
Text(text)
.foregroundColor(Color.Material.Text.sub)
.font(.body3)
.padding(.leading, 16)
.padding(.top, 16)
Spacer()
}
.listRowInsets(.zero)
.listRowSeparator(.hidden)
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color.Material.Background.light)
}
}