IceCubesApp/IceCubesApp/App/Tabs/Settings/DisplaySettingsView.swift

73 lines
2.2 KiB
Swift
Raw Normal View History

2023-01-06 16:14:34 +00:00
import DesignSystem
2023-01-17 10:36:01 +00:00
import Models
2023-01-06 16:14:34 +00:00
import Status
2023-01-17 10:36:01 +00:00
import SwiftUI
2023-01-06 16:14:34 +00:00
struct DisplaySettingsView: View {
@EnvironmentObject private var theme: Theme
2023-01-17 10:36:01 +00:00
2023-01-06 16:14:34 +00:00
@State private var isThemeSelectorPresented = false
2023-01-17 10:36:01 +00:00
2023-01-06 16:14:34 +00:00
var body: some View {
Form {
Section("Theme") {
themeSelectorButton
ColorPicker("Tint color", selection: $theme.tintColor)
ColorPicker("Background color", selection: $theme.primaryBackgroundColor)
ColorPicker("Secondary Background color", selection: $theme.secondaryBackgroundColor)
}
.listRowBackground(theme.primaryBackgroundColor)
2023-01-17 10:36:01 +00:00
2023-01-06 16:14:34 +00:00
Section("Display") {
Picker("Avatar position", selection: $theme.avatarPosition) {
ForEach(Theme.AvatarPosition.allCases, id: \.rawValue) { position in
Text(position.description).tag(position)
}
}
Picker("Avatar shape", selection: $theme.avatarShape) {
ForEach(Theme.AvatarShape.allCases, id: \.rawValue) { shape in
Text(shape.description).tag(shape)
}
}
Picker("Status actions buttons", selection: $theme.statusActionsDisplay) {
ForEach(Theme.StatusActionsDisplay.allCases, id: \.rawValue) { buttonStyle in
Text(buttonStyle.description).tag(buttonStyle)
}
}
2023-01-17 10:36:01 +00:00
2023-01-07 16:44:25 +00:00
Picker("Status media style", selection: $theme.statusDisplayStyle) {
ForEach(Theme.StatusDisplayStyle.allCases, id: \.rawValue) { buttonStyle in
Text(buttonStyle.description).tag(buttonStyle)
}
}
2023-01-06 16:14:34 +00:00
}
.listRowBackground(theme.primaryBackgroundColor)
2023-01-17 10:36:01 +00:00
2023-01-06 16:14:34 +00:00
Section {
Button {
theme.selectedSet = .iceCubeDark
theme.avatarShape = .rounded
theme.avatarPosition = .top
theme.statusActionsDisplay = .full
} label: {
Text("Restore default")
}
}
.listRowBackground(theme.primaryBackgroundColor)
}
.navigationTitle("Display Settings")
.scrollContentBackground(.hidden)
.background(theme.secondaryBackgroundColor)
}
2023-01-17 10:36:01 +00:00
2023-01-06 16:14:34 +00:00
private var themeSelectorButton: some View {
NavigationLink(destination: ThemePreviewView()) {
HStack {
Text("Theme")
Spacer()
Text(theme.selectedSet.rawValue)
}
}
}
}