@@ -10,36 +10,95 @@ import SwiftUI
1010
1111struct ProfileView : View {
1212 @ObservedObject private var viewModel = ProfileViewVM ( )
13-
13+ @Environment ( \. dismiss) var dismiss
14+
1415 var body : some View {
15- return VStack {
16- HStack {
17- AsyncImage ( url: URL ( string: " https://picsum.photos/200/300 " ) ) { image in
18- image. resizable ( )
19- . aspectRatio ( contentMode: . fill)
20- } placeholder: {
21- ProgressView ( )
22- }
23- . frame ( width: 150 , height: 150 , alignment: . center)
24- . cornerRadius ( 75 )
25- VStack {
26- Text ( viewModel. user? . displayName ?? " testste " )
27- . multilineTextAlignment ( . leading)
28- HStack {
29- Image ( systemName: " star.fill " )
30- . resizable ( )
31- . frame ( width: 25 , height: 25 )
32- Text ( " 0 " )
33- . font ( . title)
34- Spacer ( )
16+ return NavigationView {
17+ VStack {
18+ HStack {
19+ profileImage
20+ VStack ( alignment: . leading) {
21+ Text ( viewModel. user? . displayName ?? " " )
22+ . font ( . system( size: 20 , weight: . semibold) )
23+ HStack {
24+ Image ( systemName: " star.fill " )
25+ . resizable ( )
26+ . frame ( width: 25 , height: 25 )
27+ Text ( " 0 " )
28+ . font ( . title)
29+ }
3530 }
36-
31+ Spacer ( )
32+ }
33+ HStack {
34+ profileButton
35+ Spacer ( )
36+ logOutButton
3737 }
38+ Divider ( )
39+ . padding ( )
3840 Spacer ( )
3941 }
40- Spacer ( )
42+ . padding ( 20 )
43+ . navigationBarItems ( leading: backButton)
44+ . navigationBarTitleDisplayMode ( . inline)
45+ . navigationTitle ( " My Profile " )
46+ }
47+
48+ }
49+
50+ private var profileImage : some View {
51+ AsyncImage ( url: URL ( string: " https://picsum.photos/200/300 " ) ) { image in
52+ image. resizable ( )
53+ . aspectRatio ( contentMode: . fill)
54+ } placeholder: {
55+ ProgressView ( )
56+ }
57+ . frame ( width: 150 , height: 150 , alignment: . center)
58+ . cornerRadius ( 75 )
59+ }
60+
61+ private var profileButton : some View {
62+ Button {
63+ // move to profile webpage
64+ } label: {
65+ HStack {
66+ Image ( systemName: " tray.and.arrow.up.fill " )
67+ Text ( " OSM Profile " )
68+ }
69+ . foregroundColor ( . white)
70+ . font ( . system( size: 16 , weight: . semibold) )
71+ . frame ( width: 180 , height: 50 )
72+ . background ( . black)
73+ . cornerRadius ( 5 )
74+ }
75+ }
76+
77+ private var logOutButton : some View {
78+ Button {
79+ //LOGOUT
80+ } label: {
81+ Text ( " LOGOUT " )
82+ . foregroundColor ( . black)
83+ . font ( . system( size: 16 , weight: . semibold) )
84+ . frame ( width: /*@START_MENU_TOKEN@*/100 /*@END_MENU_TOKEN@*/, height: 50 )
85+ . cornerRadius ( 15 )
86+ . overlay {
87+ RoundedRectangle ( cornerRadius: 5 )
88+ . stroke ( Color . black)
89+ }
90+ }
91+ }
92+
93+ private var backButton : some View {
94+ Button {
95+ dismiss ( )
96+ } label: {
97+ Image ( systemName: " arrow.left " )
98+ . font ( . system( size: 24 , weight: . semibold) )
99+ . foregroundColor ( . black)
100+ . cornerRadius ( 15 )
41101 }
42- . padding ( 20 )
43102 }
44103}
45104
0 commit comments