Mercurial > public > geoquiz
view GeoQuiz/ProfileModalView.swift @ 14:136928bae534
add user profile
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Wed, 19 Oct 2022 07:56:33 +0200 |
parents | e09959b4e4a8 |
children | f1967f8cc67b |
line wrap: on
line source
// // ProfileModalView.swift // GeoQuiz // // Created by Dennis Concepción Martín on 25/9/22. // import SwiftUI import PhotosUI struct ProfileModalView: View { @ObservedObject var user: User @ObservedObject var storeKitRC: StoreKitRC @Environment(\.dismiss) var dismiss @State private var showingEditModalView = false var body: some View { NavigationView { Form { Section { HStack(spacing: 20) { UserImage(uiImage: user.data.uiImage) VStack(alignment: .leading, spacing: 8) { Text(user.data.username) .font(.title) .fontWeight(.semibold) if storeKitRC.isActive { Text("Premium user ⭐️") .foregroundColor(.secondary) } } } } Section { VStack(alignment: .leading) { Text("Game 1") Capsule() .frame(height: 6) } VStack(alignment: .leading) { Text("Game 1") Capsule() .frame(height: 6) } VStack(alignment: .leading) { Text("Game 1") Capsule() .frame(height: 6) } VStack(alignment: .leading) { Text("Game 1") Capsule() .frame(height: 6) } } header: { Text("Progress") } Section { ForEach(1..<10) { _ in Text("Hello") } } header: { Text("Recent games") } } .navigationTitle("Profile") .navigationBarTitleDisplayMode(.inline) .toolbar { ToolbarItem(placement: .cancellationAction) { Button { dismiss() } label: { Label("Exit", systemImage: "multiply") } } ToolbarItem(placement: .navigationBarTrailing) { Button("Edit") { showingEditModalView = true } } } .sheet(isPresented: $showingEditModalView) { ProfileEditModalView(user: user) } } } } struct ProfileView_Previews: PreviewProvider { static var previews: some View { ProfileModalView(user: User(), storeKitRC: StoreKitRC()) } }