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-19 18:14:08 +01:00
|
|
|
.navigationTitle("instance.info.navigation-title")
|
2023-01-06 17:14:34 +01:00
|
|
|
.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 {
|
2023-01-19 18:14:08 +01:00
|
|
|
Section("instance.info.section.info") {
|
|
|
|
LabeledContent("instance.info.name", value: instance.title)
|
2023-01-07 18:12:56 +01:00
|
|
|
Text(instance.shortDescription)
|
2023-01-19 18:14:08 +01:00
|
|
|
LabeledContent("instance.info.email", value: instance.email)
|
|
|
|
LabeledContent("instance.info.version", value: instance.version)
|
|
|
|
LabeledContent("instance.info.users", value: "\(instance.stats.userCount)")
|
|
|
|
LabeledContent("instance.info.posts", value: "\(instance.stats.statusCount)")
|
|
|
|
LabeledContent("instance.info.domains", value: "\(instance.stats.domainCount)")
|
2023-01-07 18:12:56 +01:00
|
|
|
}
|
|
|
|
.listRowBackground(theme.primaryBackgroundColor)
|
2023-01-17 11:36:01 +01:00
|
|
|
|
2023-01-18 19:10:45 +01:00
|
|
|
if let rules = instance.rules {
|
2023-01-19 18:14:08 +01:00
|
|
|
Section("instance.info.section.rules") {
|
2023-01-18 19:10:45 +01:00
|
|
|
ForEach(rules) { rule in
|
|
|
|
Text(rule.text)
|
|
|
|
}
|
2023-01-07 18:12:56 +01:00
|
|
|
}
|
2023-01-18 19:10:45 +01:00
|
|
|
.listRowBackground(theme.primaryBackgroundColor)
|
2023-01-07 18:12:56 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|