6
|
1 //
|
|
2 // ProfileModalView.swift
|
|
3 // GeoQuiz
|
|
4 //
|
|
5 // Created by Dennis Concepción Martín on 25/9/22.
|
|
6 //
|
|
7
|
|
8 import SwiftUI
|
14
|
9 import PhotosUI
|
6
|
10
|
|
11 struct ProfileModalView: View {
|
14
|
12 @ObservedObject var user: User
|
|
13 @ObservedObject var storeKitRC: StoreKitRC
|
|
14
|
|
15 @Environment(\.dismiss) var dismiss
|
|
16
|
|
17 @State private var showingEditModalView = false
|
|
18
|
6
|
19 var body: some View {
|
14
|
20 NavigationView {
|
|
21 Form {
|
|
22 Section {
|
|
23 HStack(spacing: 20) {
|
|
24 UserImage(uiImage: user.data.uiImage)
|
|
25
|
|
26 VStack(alignment: .leading, spacing: 8) {
|
|
27 Text(user.data.username)
|
|
28 .font(.title)
|
|
29 .fontWeight(.semibold)
|
|
30
|
|
31 if storeKitRC.isActive {
|
|
32 Text("Premium user ⭐️")
|
|
33 .foregroundColor(.secondary)
|
|
34 }
|
|
35 }
|
|
36 }
|
|
37 }
|
|
38
|
|
39 Section {
|
|
40 VStack(alignment: .leading) {
|
|
41 Text("Game 1")
|
|
42 Capsule()
|
|
43 .frame(height: 6)
|
|
44 }
|
|
45
|
|
46 VStack(alignment: .leading) {
|
|
47 Text("Game 1")
|
|
48 Capsule()
|
|
49 .frame(height: 6)
|
|
50 }
|
|
51 VStack(alignment: .leading) {
|
|
52 Text("Game 1")
|
|
53 Capsule()
|
|
54 .frame(height: 6)
|
|
55 }
|
|
56 VStack(alignment: .leading) {
|
|
57 Text("Game 1")
|
|
58 Capsule()
|
|
59 .frame(height: 6)
|
|
60 }
|
|
61 } header: {
|
|
62 Text("Progress")
|
|
63 }
|
|
64
|
|
65 Section {
|
|
66 ForEach(1..<10) { _ in
|
|
67 Text("Hello")
|
|
68 }
|
|
69 } header: {
|
|
70 Text("Recent games")
|
|
71 }
|
|
72 }
|
|
73 .navigationTitle("Profile")
|
|
74 .navigationBarTitleDisplayMode(.inline)
|
|
75 .toolbar {
|
|
76 ToolbarItem(placement: .cancellationAction) {
|
|
77 Button {
|
|
78 dismiss()
|
|
79 } label: {
|
|
80 Label("Exit", systemImage: "multiply")
|
|
81 }
|
|
82 }
|
|
83
|
|
84 ToolbarItem(placement: .navigationBarTrailing) {
|
|
85 Button("Edit") {
|
|
86 showingEditModalView = true
|
|
87 }
|
|
88 }
|
|
89 }
|
|
90
|
|
91 .sheet(isPresented: $showingEditModalView) {
|
|
92 ProfileEditModalView(user: user)
|
|
93 }
|
|
94 }
|
6
|
95 }
|
|
96 }
|
|
97
|
|
98 struct ProfileView_Previews: PreviewProvider {
|
|
99 static var previews: some View {
|
14
|
100 ProfileModalView(user: User(), storeKitRC: StoreKitRC())
|
6
|
101 }
|
|
102 }
|