Mercurial > public > geoquiz
diff GeoQuiz/ProfileModalView.swift @ 20:e281791e0494
finish implementation
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Sun, 23 Oct 2022 11:48:39 +0100 |
parents | f140bb277c96 |
children | b145c408f791 |
line wrap: on
line diff
--- a/GeoQuiz/ProfileModalView.swift Sun Oct 23 00:11:38 2022 +0100 +++ b/GeoQuiz/ProfileModalView.swift Sun Oct 23 11:48:39 2022 +0100 @@ -11,7 +11,7 @@ @ObservedObject var userController: UserController @ObservedObject var storeKitController: StoreKitController - @State var showingEditModalView = false + @State private var showingEditModalView = false @FetchRequest(sortDescriptors: [ SortDescriptor(\.date, order: .reverse), @@ -31,13 +31,36 @@ ) VStack(spacing: 20) { - ForEach(playedGames.prefix(8)) { playedGame in - RecentGame(game: playedGame) + HStack { + Text("Latest games") + .foregroundColor(.secondary) + + Spacer() + + NavigationLink { + PlayedGamesList(playedGames: playedGames) + } label: { + Text("Show all") + } + .disabled(playedGames.isEmpty) + } + + if playedGames.isEmpty { + Spacer() + LatestGamesPlaceholder() + } else { + ForEach(playedGames.prefix(8)) { playedGame in + RecentGame(game: playedGame) + .padding() + .background(Color(.secondarySystemGroupedBackground)) + .cornerRadius(20) + } } } } .padding() } + .frame(maxWidth: .infinity) .navigationTitle("Profile") .navigationBarTitleDisplayMode(.inline) .background(Color(.systemGroupedBackground))