|
|
|
@ -5,21 +5,60 @@ struct SavedGamesView: View {
|
|
|
|
|
private var vm = SavedGamesVM()
|
|
|
|
|
|
|
|
|
|
var body: some View {
|
|
|
|
|
TabView {
|
|
|
|
|
/* VStack {
|
|
|
|
|
Section("savedGames.section.unfinished") {
|
|
|
|
|
ScoreboardView(results: self.$vm.results, "scoreboard.table.column.players") {
|
|
|
|
|
result in
|
|
|
|
|
let n1 = if result.player1 != nil {
|
|
|
|
|
Text(result.player1!)
|
|
|
|
|
} else {
|
|
|
|
|
Text(LocalizedStringKey(result.player1Type.baseTranslationKey))
|
|
|
|
|
}
|
|
|
|
|
let n2 = if result.player2 != nil {
|
|
|
|
|
Text(result.player2!)
|
|
|
|
|
} else {
|
|
|
|
|
Text(LocalizedStringKey(result.player2Type.baseTranslationKey))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return LocalizedStringKey("\(n1) savedGames.section.unfinished.entry \(n2)")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} */
|
|
|
|
|
|
|
|
|
|
VStack {
|
|
|
|
|
// TODO: use the same collection view with headers instead? Or use collapsible sections?
|
|
|
|
|
//Section("savedGames.section.unfinished") {
|
|
|
|
|
// ScoreboardView("scoreboard.table.column.players") { result in
|
|
|
|
|
// "\(result.player1) savedGames.section.unfinished.entry \(result.player2)"
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
Section("savedGames.section.finished") {
|
|
|
|
|
ScoreboardView(results: self.$vm.results, "scoreboard.table.column.players") { result in
|
|
|
|
|
"\(result.player1) savedGames.section.finished.entry \(result.player2)"
|
|
|
|
|
ScoreboardView(results: self.$vm.results, "scoreboard.table.column.players") {
|
|
|
|
|
result in
|
|
|
|
|
let n1 = if result.player1 != nil {
|
|
|
|
|
Text(result.player1!)
|
|
|
|
|
} else {
|
|
|
|
|
Text(LocalizedStringKey(result.player1Type.baseTranslationKey))
|
|
|
|
|
}
|
|
|
|
|
let n2 = if result.player2 != nil {
|
|
|
|
|
Text(result.player2!)
|
|
|
|
|
} else {
|
|
|
|
|
Text(LocalizedStringKey(result.player2Type.baseTranslationKey))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return LocalizedStringKey("\(n1) savedGames.section.finished.entry \(n2)")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}.onAppear {
|
|
|
|
|
vm.loadData()
|
|
|
|
|
}
|
|
|
|
|
#if os(macOS)
|
|
|
|
|
.tabViewStyle(.automatic)
|
|
|
|
|
#else
|
|
|
|
|
.tabViewStyle(.page)
|
|
|
|
|
#endif
|
|
|
|
|
// VStack {
|
|
|
|
|
// // TODO: use the same collection view with headers instead? Or use collapsible sections?
|
|
|
|
|
// //Section("savedGames.section.") {
|
|
|
|
|
// // ScoreboardView("scoreboard.table.column.players") { result in
|
|
|
|
|
// // "\(result.player1) savedGames.section.unfinished.entry \(result.player2)"
|
|
|
|
|
// // }
|
|
|
|
|
// //}
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
init() {
|
|
|
|
|