IceCubesApp/IceCubesApp/App/Tabs/Settings/InstanceInfoView.swift
Thomas Ricouard 7f6419ebae Swiftformat
2023-01-17 11:36:01 +01:00

46 lines
1.2 KiB
Swift

import DesignSystem
import Models
import NukeUI
import SwiftUI
struct InstanceInfoView: View {
@EnvironmentObject private var theme: Theme
let instance: Instance
var body: some View {
Form {
InstanceInfoSection(instance: instance)
}
.navigationTitle("Instance Info")
.scrollContentBackground(.hidden)
.background(theme.secondaryBackgroundColor)
}
}
public struct InstanceInfoSection: View {
@EnvironmentObject private var theme: Theme
let instance: Instance
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)
Section("Instance rules") {
ForEach(instance.rules) { rule in
Text(rule.text)
}
}
.listRowBackground(theme.primaryBackgroundColor)
}
}