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

46 lines
1.2 KiB
Swift
Raw Normal View History

2022-12-29 14:07:58 +01:00
import DesignSystem
2023-01-17 11:36:01 +01:00
import Models
2022-12-29 14:07:58 +01:00
import NukeUI
2023-01-17 11:36:01 +01:00
import SwiftUI
2022-12-29 14:07:58 +01:00
struct InstanceInfoView: View {
@EnvironmentObject private var theme: Theme
2023-01-17 11:36:01 +01:00
2022-12-29 14:07:58 +01:00
let instance: Instance
2023-01-17 11:36:01 +01:00
2022-12-29 14:07:58 +01:00
var body: some View {
2023-01-06 17:14:34 +01:00
Form {
2023-01-07 18:12:56 +01:00
InstanceInfoSection(instance: instance)
2022-12-29 14:07:58 +01:00
}
2023-01-06 17:14:34 +01:00
.navigationTitle("Instance Info")
.scrollContentBackground(.hidden)
.background(theme.secondaryBackgroundColor)
2022-12-29 14:07:58 +01:00
}
}
2023-01-07 18:12:56 +01:00
public struct InstanceInfoSection: View {
@EnvironmentObject private var theme: Theme
2023-01-17 11:36:01 +01:00
2023-01-07 18:12:56 +01:00
let instance: Instance
2023-01-17 11:36:01 +01:00
2023-01-07 18:12:56 +01: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 11:36:01 +01:00
2023-01-07 18:12:56 +01:00
Section("Instance rules") {
ForEach(instance.rules) { rule in
Text(rule.text)
}
}
.listRowBackground(theme.primaryBackgroundColor)
}
}