wip
This commit is contained in:
parent
50d64cf96b
commit
2e9b4f5d19
|
@ -73,4 +73,7 @@
|
|||
"Chats.Create.Main.createChannel" = "Create channel";
|
||||
"Chats.Create.Main.findChannel" = "Find channel";
|
||||
|
||||
// MARK: Settings
|
||||
"Settings.Main.title" = "Settings";
|
||||
"Settings.Section.Accounts.title" = "Accounts";
|
||||
|
||||
|
|
|
@ -5,22 +5,86 @@ struct SettingsScreen: View {
|
|||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
// bg
|
||||
// Background color
|
||||
Color.Material.Background.light
|
||||
.ignoresSafeArea()
|
||||
|
||||
// debug buttons
|
||||
#if DEBUG
|
||||
// clean all data
|
||||
Button {
|
||||
clientsStore.flushAllData()
|
||||
Database.shared.flushAllData()
|
||||
} label: {
|
||||
Text("Clean all (for test)")
|
||||
.font(.title)
|
||||
.foregroundColor(.Material.Elements.active)
|
||||
// Content
|
||||
VStack(spacing: 0) {
|
||||
// Header
|
||||
SharedNavigationBar(
|
||||
centerText: .init(text: L10n.Settings.Main.title)
|
||||
)
|
||||
|
||||
// List
|
||||
List {
|
||||
// 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()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue