diff GeoQuiz/ProfileModalView.swift @ 21:b145c408f791

refactor code
author Dennis C. M. <dennis@denniscm.com>
date Tue, 25 Oct 2022 15:30:01 +0200
parents e281791e0494
children 56add5561261
line wrap: on
line diff
--- a/GeoQuiz/ProfileModalView.swift	Sun Oct 23 11:48:39 2022 +0100
+++ b/GeoQuiz/ProfileModalView.swift	Tue Oct 25 15:30:01 2022 +0200
@@ -30,25 +30,25 @@
                         isShowing: $showingEditModalView
                     )
                     
-                    VStack(spacing: 20) {
-                        HStack {
-                            Text("Latest games")
-                                .foregroundColor(.secondary)
-                            
-                            Spacer()
+                    if !playedGames.isEmpty {
+                        VStack(spacing: 20) {
+                            HStack {
+                                Text("Latest games")
+                                    .foregroundColor(.secondary)
+                                
+                                Spacer()
+                                
+                                NavigationLink {
+                                    PlayedGamesList()
+                                } label: {
+                                    HStack {
+                                        Text("Show all")
+                                        Image(systemName: "chevron.right")
+                                    }
+                                }
+                                .disabled(playedGames.isEmpty)
+                            }
                             
-                            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()
@@ -75,8 +75,14 @@
             }
             
             .sheet(isPresented: $showingEditModalView) {
-                ProfileEditModalView(user: userController)
+                ProfileEditModalView(userController: userController)
             }
+            
+            #if DEBUG
+            .onAppear {
+                
+            }
+            #endif
         }
     }
 }