Pretty tabs

main
Mathieu GROUSSEAU 4 days ago
parent 5d8cefb39d
commit a48051a332

@ -37,6 +37,7 @@
F08534D32E0951BD0002A3A0 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F08534D22E0951BD0002A3A0 /* Images.xcassets */; };
F08534D52E0A857D0002A3A0 /* Persistance.swift in Sources */ = {isa = PBXBuildFile; fileRef = F08534D42E0A857D0002A3A0 /* Persistance.swift */; };
F08534D72E0A88240002A3A0 /* String.swift in Sources */ = {isa = PBXBuildFile; fileRef = F08534D62E0A88240002A3A0 /* String.swift */; };
F08534D92E0BBF740002A3A0 /* NavigationLazyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F08534D82E0BBF740002A3A0 /* NavigationLazyView.swift */; };
F0F59E4F2DD4996F00BE32D6 /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = F0F59E4E2DD4996F00BE32D6 /* Localizable.xcstrings */; };
F0F59E512DD49C2800BE32D6 /* Colors.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F0F59E502DD49C2800BE32D6 /* Colors.xcassets */; };
F0F59E532DDDC35100BE32D6 /* NewGameView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0F59E522DDDC35100BE32D6 /* NewGameView.swift */; };
@ -108,6 +109,7 @@
F08534D22E0951BD0002A3A0 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
F08534D42E0A857D0002A3A0 /* Persistance.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Persistance.swift; sourceTree = "<group>"; };
F08534D62E0A88240002A3A0 /* String.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = String.swift; sourceTree = "<group>"; };
F08534D82E0BBF740002A3A0 /* NavigationLazyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationLazyView.swift; sourceTree = "<group>"; };
F0F59E412DD492B400BE32D6 /* C4Persistance.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = C4Persistance.xcframework; path = ../precompiled/xcframeworks/C4Persistance.xcframework; sourceTree = "<group>"; };
F0F59E422DD492B400BE32D6 /* C4Players.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = C4Players.xcframework; path = ../precompiled/xcframeworks/C4Players.xcframework; sourceTree = "<group>"; };
F0F59E432DD492B400BE32D6 /* C4.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = C4.xcframework; path = ../precompiled/xcframeworks/C4.xcframework; sourceTree = "<group>"; };
@ -270,6 +272,7 @@
F0F59E582DE6EB2A00BE32D6 /* PlayerVSPage.swift */,
F0F59E5A2DE6F68800BE32D6 /* ScoreboardView.swift */,
F05DA2142E02D1850094A4A8 /* UIUtilities.swift */,
F08534D82E0BBF740002A3A0 /* NavigationLazyView.swift */,
);
path = View;
sourceTree = "<group>";
@ -427,6 +430,7 @@
F0143C2B2DF018F20086CAAA /* GameScene.swift in Sources */,
F0F59E572DE6D6E600BE32D6 /* SavedGamesView.swift in Sources */,
F05DA2172E082F5B0094A4A8 /* Owner.swift in Sources */,
F08534D92E0BBF740002A3A0 /* NavigationLazyView.swift in Sources */,
F08534D52E0A857D0002A3A0 /* Persistance.swift in Sources */,
F0143C342DF987490086CAAA /* PlayerType.swift in Sources */,
F0F59E552DDDED1D00BE32D6 /* IngameView.swift in Sources */,

@ -680,6 +680,22 @@
}
}
},
"savedGames.section.unfinished.badge %lld" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "%lld"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "%lld"
}
}
}
},
"savedGames.title" : {
"localizations" : {
"en" : {

@ -6,62 +6,46 @@ struct SavedGamesView: View {
@Binding
var currentGame: IngameVM?
var body: some View {
TabView {
VStack {
Section("savedGames.section.unfinished") {
ScoreboardView(results: self.$vm.unfinished, currentGame: $currentGame, "scoreboard.table.column.players") {
result in
let n1 = if result.player1Name != nil {
Text(result.player1Name!)
} else {
Text(LocalizedStringKey(result.player1Type.baseTranslationKey))
}
let n2 = if result.player2Name != nil {
Text(result.player2Name!)
} else {
Text(LocalizedStringKey(result.player2Type.baseTranslationKey))
}
return LocalizedStringKey("\(n1) savedGames.section.unfinished.entry \(n2)")
}
ScoreboardView(results: self.$vm.unfinished, currentGame: $currentGame, "scoreboard.table.column.players") {
result in
let n1 = if result.player1Name != nil {
Text(result.player1Name!)
} else {
Text(LocalizedStringKey(result.player1Type.baseTranslationKey))
}
}
let n2 = if result.player2Name != nil {
Text(result.player2Name!)
} else {
Text(LocalizedStringKey(result.player2Type.baseTranslationKey))
}
return LocalizedStringKey("\(n1) savedGames.section.unfinished.entry \(n2)")
}.tabItem {
Label("savedGames.section.unfinished", systemImage: "play.rectangle")
}.badge("savedGames.section.unfinished.badge \(self.vm.unfinished.count)")
VStack {
Section("savedGames.section.finished") {
ScoreboardView(results: self.$vm.finished, currentGame: $currentGame, "scoreboard.table.column.players") {
result in
let n1 = if result.player1Name != nil {
Text(result.player1Name!)
} else {
Text(LocalizedStringKey(result.player1Type.baseTranslationKey))
}
let n2 = if result.player2Name != nil {
Text(result.player2Name!)
} else {
Text(LocalizedStringKey(result.player2Type.baseTranslationKey))
}
return LocalizedStringKey("\(n1) savedGames.section.finished.entry \(n2)")
}
ScoreboardView(results: self.$vm.finished, currentGame: $currentGame, "scoreboard.table.column.players") {
result in
let n1 = if result.player1Name != nil {
Text(result.player1Name!)
} else {
Text(LocalizedStringKey(result.player1Type.baseTranslationKey))
}
let n2 = if result.player2Name != nil {
Text(result.player2Name!)
} else {
Text(LocalizedStringKey(result.player2Type.baseTranslationKey))
}
return LocalizedStringKey("\(n1) savedGames.section.finished.entry \(n2)")
}.tabItem {
Label("savedGames.section.finished", systemImage: "rosette")
}
}
#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)"
// // }
// //}
// }
}
}

Loading…
Cancel
Save