Pretty tabs

main
Mathieu GROUSSEAU 5 days ago
parent 5d8cefb39d
commit a48051a332

@ -37,6 +37,7 @@
F08534D32E0951BD0002A3A0 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F08534D22E0951BD0002A3A0 /* Images.xcassets */; }; F08534D32E0951BD0002A3A0 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F08534D22E0951BD0002A3A0 /* Images.xcassets */; };
F08534D52E0A857D0002A3A0 /* Persistance.swift in Sources */ = {isa = PBXBuildFile; fileRef = F08534D42E0A857D0002A3A0 /* Persistance.swift */; }; F08534D52E0A857D0002A3A0 /* Persistance.swift in Sources */ = {isa = PBXBuildFile; fileRef = F08534D42E0A857D0002A3A0 /* Persistance.swift */; };
F08534D72E0A88240002A3A0 /* String.swift in Sources */ = {isa = PBXBuildFile; fileRef = F08534D62E0A88240002A3A0 /* String.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 */; }; F0F59E4F2DD4996F00BE32D6 /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = F0F59E4E2DD4996F00BE32D6 /* Localizable.xcstrings */; };
F0F59E512DD49C2800BE32D6 /* Colors.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F0F59E502DD49C2800BE32D6 /* Colors.xcassets */; }; F0F59E512DD49C2800BE32D6 /* Colors.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F0F59E502DD49C2800BE32D6 /* Colors.xcassets */; };
F0F59E532DDDC35100BE32D6 /* NewGameView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0F59E522DDDC35100BE32D6 /* NewGameView.swift */; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 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 */, F0F59E582DE6EB2A00BE32D6 /* PlayerVSPage.swift */,
F0F59E5A2DE6F68800BE32D6 /* ScoreboardView.swift */, F0F59E5A2DE6F68800BE32D6 /* ScoreboardView.swift */,
F05DA2142E02D1850094A4A8 /* UIUtilities.swift */, F05DA2142E02D1850094A4A8 /* UIUtilities.swift */,
F08534D82E0BBF740002A3A0 /* NavigationLazyView.swift */,
); );
path = View; path = View;
sourceTree = "<group>"; sourceTree = "<group>";
@ -427,6 +430,7 @@
F0143C2B2DF018F20086CAAA /* GameScene.swift in Sources */, F0143C2B2DF018F20086CAAA /* GameScene.swift in Sources */,
F0F59E572DE6D6E600BE32D6 /* SavedGamesView.swift in Sources */, F0F59E572DE6D6E600BE32D6 /* SavedGamesView.swift in Sources */,
F05DA2172E082F5B0094A4A8 /* Owner.swift in Sources */, F05DA2172E082F5B0094A4A8 /* Owner.swift in Sources */,
F08534D92E0BBF740002A3A0 /* NavigationLazyView.swift in Sources */,
F08534D52E0A857D0002A3A0 /* Persistance.swift in Sources */, F08534D52E0A857D0002A3A0 /* Persistance.swift in Sources */,
F0143C342DF987490086CAAA /* PlayerType.swift in Sources */, F0143C342DF987490086CAAA /* PlayerType.swift in Sources */,
F0F59E552DDDED1D00BE32D6 /* IngameView.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" : { "savedGames.title" : {
"localizations" : { "localizations" : {
"en" : { "en" : {

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