diff --git a/nirvana-ios/Views/HomeView/UserMenu/UserMenu.swift b/nirvana-ios/Views/HomeView/UserMenu/UserMenu.swift index 208ca1d..9f7c5bb 100644 --- a/nirvana-ios/Views/HomeView/UserMenu/UserMenu.swift +++ b/nirvana-ios/Views/HomeView/UserMenu/UserMenu.swift @@ -8,15 +8,9 @@ import SwiftUI struct UserMenuView: View { - @Environment(\.dismiss) var dismiss var body: some View { - Button("Press to dismiss") { - dismiss() - } - .font(.title) - .padding() - .background(Color.black) + Text("different menu options") } } diff --git a/nirvana-ios/Views/Templates/HeaderView.swift b/nirvana-ios/Views/Templates/HeaderView.swift index 5f15efd..ccf4b48 100644 --- a/nirvana-ios/Views/Templates/HeaderView.swift +++ b/nirvana-ios/Views/Templates/HeaderView.swift @@ -13,35 +13,49 @@ struct HeaderView: View { @State var showingMenu: Bool = false var body: some View { - HStack(alignment:.center) { - Image("undraw_handcrafts_leaf") - .resizable() - .frame(width: 20.0, height: 32.132) - .padding(.leading, 20) - - Spacer() - - if self.authStore.sessionState == SessionState.isAuthenticated { - RemoteImage(url: self.authStore.user?.profilePictureUrl?.absoluteString ?? "https://avatars.githubusercontent.com/u/41487836") - .background(NirvanaColor.teal) - .aspectRatio(contentMode: .fill) - .frame(width: 40, height: 40) - .clipShape(Circle()) - .padding(5) - .sheet(isPresented: $showingMenu) { - UserMenuView() - } + if authStore.sessionState == SessionState.isLoggedOut { + HStack { + Image("undraw_handcrafts_leaf") + .resizable() + .frame(width: 20.0, height: 32.132) + .padding() + + Spacer() } - } - .frame(maxWidth: .infinity) -// .background(Color(self.averageColor)) // color based on user's profilepicture dominant color - .background(NirvanaColor.solidBlue) - .cornerRadius(100) - .padding(.horizontal) - .shadow(radius: 10) - .onAppear{ - // set background color based on profile picture tint - if authStore.sessionState == SessionState.isAuthenticated { + } else { + HStack(alignment:.center) { + Image("undraw_handcrafts_leaf") + .resizable() + .frame(width: 20.0, height: 32.132) + .padding(.leading, 20) + + Spacer() + + Menu { + Button("Log out") { + print("log out button clicked") + self.authStore.logOut() + } + Button("Friends") { + print("manage friends page") + } + } label: { + RemoteImage(url: self.authStore.user?.profilePictureUrl?.absoluteString ?? "https://avatars.githubusercontent.com/u/41487836") + .background(NirvanaColor.teal) + .aspectRatio(contentMode: .fill) + .frame(width: 40, height: 40) + .clipShape(Circle()) + .padding(5) + } + } + .frame(maxWidth: .infinity) + // .background(Color(self.averageColor)) // color based on user's profilepicture dominant color + .background(NirvanaColor.solidBlue) + .cornerRadius(100) + .padding(.horizontal) + .shadow(radius: 10) + .onAppear{ + // set background color based on profile picture tint if let userPicUrl = authStore.user?.profilePictureUrl { if let avgColor = NirvanaImage.getAverageColor(url: userPicUrl.absoluteString) { self.averageColor = avgColor