From 59cf8056bd1db41da05abefcc93dd19f5df0b40f Mon Sep 17 00:00:00 2001 From: William Casarin Date: Wed, 23 Aug 2023 09:52:28 -0700 Subject: [PATCH] sidemenu: split out profile section We will be adding to this and it is getting messy --- damus/Views/SideMenuView.swift | 43 +++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/damus/Views/SideMenuView.swift b/damus/Views/SideMenuView.swift index 0851c566..38a0717d 100644 --- a/damus/Views/SideMenuView.swift +++ b/damus/Views/SideMenuView.swift @@ -81,32 +81,37 @@ struct SideMenuView: View { } } + var TopProfile: some View { + let profile = damus_state.profiles.lookup(id: damus_state.pubkey) + return HStack { + ProfilePicView(pubkey: damus_state.pubkey, size: 60, highlight: .none, profiles: damus_state.profiles, disable_animation: damus_state.settings.disable_animation) + + VStack(alignment: .leading) { + if let display_name = profile?.display_name { + Text(display_name) + .foregroundColor(textColor()) + .font(.title) + .lineLimit(1) + } + if let name = profile?.name { + Text("@" + name) + .foregroundColor(DamusColors.mediumGrey) + .font(.body) + .lineLimit(1) + } + } + } + } + var MainSidemenu: some View { VStack(alignment: .leading, spacing: 0) { - let profile = damus_state.profiles.lookup(id: damus_state.pubkey) let followers = FollowersModel(damus_state: damus_state, target: damus_state.pubkey) let profile_model = ProfileModel(pubkey: damus_state.pubkey, damus: damus_state) NavigationLink(value: Route.Profile(profile: profile_model, followers: followers), label: { - HStack { - ProfilePicView(pubkey: damus_state.pubkey, size: 60, highlight: .none, profiles: damus_state.profiles, disable_animation: damus_state.settings.disable_animation) - VStack(alignment: .leading) { - if let display_name = profile?.display_name { - Text(display_name) - .foregroundColor(textColor()) - .font(.title) - .lineLimit(1) - } - if let name = profile?.name { - Text("@" + name) - .foregroundColor(DamusColors.mediumGrey) - .font(.body) - .lineLimit(1) - } - } - } - .padding(.bottom, verticalSpacing) + TopProfile + .padding(.bottom, verticalSpacing) }) Divider()