SetupView.swift (4774B)
1 // 2 // SetupView.swift 3 // damus 4 // 5 // Created by William Casarin on 2022-05-18. 6 // 7 8 import SwiftUI 9 10 11 struct SetupView: View { 12 @StateObject var navigationCoordinator: NavigationCoordinator = NavigationCoordinator() 13 14 var body: some View { 15 NavigationStack(path: $navigationCoordinator.path) { 16 ZStack { 17 VStack(alignment: .center) { 18 Spacer() 19 20 Image("logo-nobg") 21 .resizable() 22 .shadow(color: DamusColors.purple, radius: 2) 23 .frame(width: 56, height: 56, alignment: .center) 24 .padding(.top, 20.0) 25 26 Text("Welcome to Damus", comment: "Welcome text shown on the first screen when user is not logged in.") 27 .font(.title) 28 .fontWeight(.heavy) 29 .foregroundStyle(DamusLogoGradient.gradient) 30 31 Text("The go-to iOS Nostr client", comment: "Quick description of what Damus is") 32 .foregroundColor(DamusColors.mediumGrey) 33 .padding(.top, 10) 34 35 WhatIsNostr() 36 .padding() 37 38 WhyWeNeedNostr() 39 .padding() 40 41 Spacer() 42 43 Button(action: { 44 navigationCoordinator.push(route: Route.Login) 45 }) { 46 HStack { 47 Text("Let's get started!", comment: "Button to continue to login page.") 48 .fontWeight(.semibold) 49 } 50 .frame(minWidth: 300, maxWidth: .infinity, maxHeight: 12, alignment: .center) 51 } 52 .buttonStyle(GradientButtonStyle()) 53 .padding() 54 } 55 } 56 .background(DamusBackground(maxHeight: 300), alignment: .top) 57 .navigationDestination(for: Route.self) { route in 58 route.view(navigationCoordinator: navigationCoordinator, damusState: DamusState.empty) 59 } 60 } 61 .navigationBarTitleDisplayMode(.inline) 62 .navigationViewStyle(StackNavigationViewStyle()) 63 } 64 } 65 66 struct LearnAboutNostrLink: View { 67 @Environment(\.openURL) var openURL 68 var body: some View { 69 HStack { 70 Button(action: { 71 openURL(URL(string: "https://nostr.com")!) 72 }, label: { 73 Text("Learn more about Nostr", comment: "Button that opens up a webpage where the user can learn more about Nostr.") 74 .foregroundColor(.accentColor) 75 }) 76 77 Image(systemName: "arrow.up.right") 78 .font(.footnote) 79 .foregroundColor(.accentColor) 80 } 81 } 82 } 83 84 struct WhatIsNostr: View { 85 var body: some View { 86 HStack(alignment: .top) { 87 Image("nostr-logo") 88 VStack(alignment: .leading) { 89 Text("What is Nostr?", comment: "Heading text for section describing what is Nostr.") 90 .fontWeight(.bold) 91 .padding(.vertical, 10) 92 93 Text("Nostr is a protocol, designed for simplicity, that aims to create a censorship-resistant global social network", comment: "Description about what is Nostr.") 94 .foregroundColor(DamusColors.mediumGrey) 95 96 LearnAboutNostrLink() 97 .padding(.top, 10) 98 } 99 Spacer() 100 } 101 } 102 } 103 104 struct WhyWeNeedNostr: View { 105 var body: some View { 106 HStack(alignment: .top) { 107 Image("lightbulb") 108 VStack(alignment: .leading) { 109 Text("Why we need Nostr?", comment: "Heading text for section describing why Nostr is needed.") 110 .fontWeight(.bold) 111 .padding(.vertical, 10) 112 113 Text("Social media has developed into a key way information flows around the world. Unfortunately, our current social media systems are broken", comment: "Description about why Nostr is needed.") 114 .foregroundColor(DamusColors.mediumGrey) 115 } 116 Spacer() 117 } 118 } 119 } 120 121 struct SetupView_Previews: PreviewProvider { 122 static var previews: some View { 123 Group { 124 SetupView() 125 .previewDevice(PreviewDevice(rawValue: "iPhone SE (3rd generation)")) 126 SetupView() 127 .previewDevice(PreviewDevice(rawValue: "iPhone 13 Pro Max")) 128 } 129 } 130 } 131