IceCubesApp/IceCubesApp/App/Tabs/Settings/InstanceInfoView.swift

46 lines
1.2 KiB
Swift
Raw Normal View History

2022-12-29 13:07:58 +00:00
import DesignSystem
2023-01-17 10:36:01 +00:00
import Models
2022-12-29 13:07:58 +00:00
import NukeUI
2023-01-17 10:36:01 +00:00
import SwiftUI
2022-12-29 13:07:58 +00:00
struct InstanceInfoView: View {
@EnvironmentObject private var theme: Theme
2023-01-17 10:36:01 +00:00
2022-12-29 13:07:58 +00:00
let instance: Instance
2023-01-17 10:36:01 +00:00
2022-12-29 13:07:58 +00:00
var body: some View {
2023-01-06 16:14:34 +00:00
Form {
2023-01-07 17:12:56 +00:00
InstanceInfoSection(instance: instance)
2022-12-29 13:07:58 +00:00
}
2023-01-06 16:14:34 +00:00
.navigationTitle("Instance Info")
.scrollContentBackground(.hidden)
.background(theme.secondaryBackgroundColor)
2022-12-29 13:07:58 +00:00
}
}
2023-01-07 17:12:56 +00:00
public struct InstanceInfoSection: View {
@EnvironmentObject private var theme: Theme
2023-01-17 10:36:01 +00:00
2023-01-07 17:12:56 +00:00
let instance: Instance
2023-01-17 10:36:01 +00:00
2023-01-07 17:12:56 +00:00
public var body: some View {
Section("Instance info") {
LabeledContent("Name", value: instance.title)
Text(instance.shortDescription)
LabeledContent("Email", value: instance.email)
LabeledContent("Version", value: instance.version)
LabeledContent("Users", value: "\(instance.stats.userCount)")
LabeledContent("Posts", value: "\(instance.stats.statusCount)")
LabeledContent("Domains", value: "\(instance.stats.domainCount)")
}
.listRowBackground(theme.primaryBackgroundColor)
2023-01-17 10:36:01 +00:00
2023-01-07 17:12:56 +00:00
Section("Instance rules") {
ForEach(instance.rules) { rule in
Text(rule.text)
}
}
.listRowBackground(theme.primaryBackgroundColor)
}
}