Worked on amending the colors.

This commit is contained in:
Ben Weeks
2023-01-06 22:41:48 +00:00
parent 5733f782d9
commit fba29d4454
4 changed files with 219 additions and 194 deletions

View File

@@ -211,11 +211,16 @@ struct ContentView: View {
} }
var body: some View { var body: some View {
//ZStack { ZStack {
VStack(alignment: .leading, spacing: 0) {
if let damus = self.damus_state { if let damus = self.damus_state {
VStack(alignment: .leading, spacing: 0) {
NavigationView { NavigationView {
SideMenuView(damus_state: damus_state!, isSidebarVisible: $isSideBarOpened)
SideMenuView(damus_state: damus, isSidebarVisible: $isSideBarOpened).zIndex(1)
VStack(alignment: .leading, spacing: 0) {
MainContent(damus: damus) MainContent(damus: damus)
.toolbar { .toolbar {
ToolbarItem(placement: .navigationBarLeading) { ToolbarItem(placement: .navigationBarLeading) {
@@ -258,20 +263,23 @@ struct ContentView: View {
.foregroundColor(.gray) .foregroundColor(.gray)
} }
/*
NavigationLink(destination: ConfigView(state: damus_state!).environmentObject(user_settings)) { NavigationLink(destination: ConfigView(state: damus_state!).environmentObject(user_settings)) {
Label("", systemImage: "gear") Label("", systemImage: "gear")
} }
.buttonStyle(PlainButtonStyle()) .buttonStyle(PlainButtonStyle())
*/
} }
} }
} }
} }
.navigationViewStyle(.stack) }.navigationViewStyle(.stack)
}
TabBar(new_events: $home.new_events, selected: $selected_timeline, action: switch_timeline) TabBar(new_events: $home.new_events, selected: $selected_timeline, action: switch_timeline)
.padding([.bottom], 8) .padding([.bottom], 8)
} }
}
}
.onAppear() { .onAppear() {
self.connect() self.connect()
//KingfisherManager.shared.cache.clearDiskCache() //KingfisherManager.shared.cache.clearDiskCache()
@@ -401,7 +409,9 @@ struct ContentView: View {
.onReceive(timer) { n in .onReceive(timer) { n in
self.damus_state?.pool.connect_to_disconnected() self.damus_state?.pool.connect_to_disconnected()
} }
//}
} }
func switch_timeline(_ timeline: Timeline) { func switch_timeline(_ timeline: Timeline) {
@@ -460,7 +470,6 @@ struct ContentView_Previews: PreviewProvider {
} }
} }
func get_since_time(last_event: NostrEvent?) -> Int64? { func get_since_time(last_event: NostrEvent?) -> Int64? {
if let last_event = last_event { if let last_event = last_event {
return last_event.created_at - 60 * 10 return last_event.created_at - 60 * 10

View File

@@ -137,7 +137,7 @@ struct EventProfileName: View {
.padding([.trailing], 2) .padding([.trailing], 2)
Text("@" + String(display_name ?? Profile.displayName(profile: profile, pubkey: pubkey))) Text("@" + String(display_name ?? Profile.displayName(profile: profile, pubkey: pubkey)))
.foregroundColor(.gray) .foregroundColor(Color("DamusMediumGrey"))
.font(eventviewsize_to_font(size)) .font(eventviewsize_to_font(size))
} else { } else {
Text(String(display_name ?? Profile.displayName(profile: profile, pubkey: pubkey))) Text(String(display_name ?? Profile.displayName(profile: profile, pubkey: pubkey)))

View File

@@ -11,13 +11,20 @@ struct SideMenuView: View {
let damus_state: DamusState let damus_state: DamusState
@Binding var isSidebarVisible: Bool @Binding var isSidebarVisible: Bool
@State var confirm_logout: Bool = false
@StateObject var user_settings = UserSettingsStore()
@Environment(\.colorScheme) var colorScheme
var sideBarWidth = UIScreen.main.bounds.size.width * 0.7 var sideBarWidth = UIScreen.main.bounds.size.width * 0.7
var bgColor: Color =
Color(.init( func fillColor() -> Color {
red: 52 / 255, colorScheme == .light ? Color("DamusWhite") : Color("DamusBlack")
green: 70 / 255, }
blue: 182 / 255,
alpha: 1)) func textColor() -> Color {
colorScheme == .light ? Color("DamusBlack") : Color("DamusWhite")
}
var body: some View { var body: some View {
if isSidebarVisible { if isSidebarVisible {
@@ -25,7 +32,7 @@ struct SideMenuView: View {
GeometryReader { _ in GeometryReader { _ in
EmptyView() EmptyView()
} }
.background(.black.opacity(0.6)) .background(.gray.opacity(0.6))
.opacity(isSidebarVisible ? 1 : 0) .opacity(isSidebarVisible ? 1 : 0)
.animation(.easeInOut.delay(0.2), value: isSidebarVisible) .animation(.easeInOut.delay(0.2), value: isSidebarVisible)
.onTapGesture { .onTapGesture {
@@ -40,7 +47,7 @@ struct SideMenuView: View {
var content: some View { var content: some View {
HStack(alignment: .top) { HStack(alignment: .top) {
ZStack(alignment: .top) { ZStack(alignment: .top) {
Color("DamusBlack") fillColor()
VStack(alignment: .leading, spacing: 20) { VStack(alignment: .leading, spacing: 20) {
let profile = damus_state.profiles.lookup(id: damus_state.pubkey) let profile = damus_state.profiles.lookup(id: damus_state.pubkey)
@@ -50,14 +57,16 @@ struct SideMenuView: View {
} else { } else {
Image(systemName: "person.fill") Image(systemName: "person.fill")
} }
if let display_name = profile?.display_name {
VStack(alignment: .leading) { VStack(alignment: .leading) {
if let display_name = profile?.display_name {
Text(display_name) Text(display_name)
.foregroundColor(Color("DamusWhite")) .foregroundColor(textColor())
.font(.headline) .font(.title)
ProfileName(pubkey: damus_state.pubkey, profile: profile, prefix: "@", damus: damus_state, show_friend_confirmed: false) }
.font(.callout) if let name = profile?.name {
.foregroundColor(.gray) Text("@" + name)
.foregroundColor(Color("DamusMediumGrey"))
.font(.body)
} }
} }
@@ -80,7 +89,7 @@ struct SideMenuView: View {
.foregroundColor(.accentColor) .foregroundColor(.accentColor)
} }
NavigationLink(destination: ConfigView(state: damus_state)) { NavigationLink(destination: ConfigView(state: damus_state).environmentObject(user_settings)) {
Label("App Settings", systemImage: "xserve") Label("App Settings", systemImage: "xserve")
.font(.title2) .font(.title2)
.foregroundColor(.accentColor) .foregroundColor(.accentColor)
@@ -90,20 +99,30 @@ struct SideMenuView: View {
Button(action: { Button(action: {
//ConfigView(state: damus_state) //ConfigView(state: damus_state)
notify(.logout, ()) confirm_logout = true
}, label: { }, label: {
Label("Sign out", systemImage: "exit") Label("Sign out", systemImage: "pip.exit")
.font(.title3) .font(.title3)
.foregroundColor(Color("DamusWhite")) .foregroundColor(textColor())
}) })
} }
.padding(.top, 50) .padding(.top, 50)
.padding(.bottom, 50) .padding(.bottom, 50)
.padding(.horizontal, 20) .padding(.leading, 40)
} }
.frame(width: sideBarWidth) .frame(width: sideBarWidth)
.offset(x: isSidebarVisible ? 0 : -sideBarWidth) .offset(x: isSidebarVisible ? 0 : -sideBarWidth)
.animation(.default, value: isSidebarVisible) .animation(.default, value: isSidebarVisible)
.alert("Logout", isPresented: $confirm_logout) {
Button("Cancel") {
confirm_logout = false
}
Button("Logout") {
notify(.logout, ())
}
} message: {
Text("Make sure your nsec account key is saved before you logout or you will lose access to this account")
}
Spacer() Spacer()
} }

View File

@@ -14,10 +14,7 @@ struct damusApp: App {
WindowGroup { WindowGroup {
MainView() MainView()
} }
} }
} }
struct MainView: View { struct MainView: View {