damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

SetupView.swift (3972B)


      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 social network you control", comment: "Quick description of what Damus is")
     32                         .foregroundColor(DamusColors.neutral6)
     33                         .padding(.top, 10)
     34                     
     35                     Spacer()
     36                     
     37                     Button(action: {
     38                         navigationCoordinator.push(route: Route.CreateAccount)
     39                     }) {
     40                         HStack {
     41                             Text("Create Account", comment: "Button to continue to the create account page.")
     42                                 .fontWeight(.semibold)
     43                         }
     44                         .frame(minWidth: 300, maxWidth: .infinity, maxHeight: 12, alignment: .center)
     45                     }
     46                     .buttonStyle(GradientButtonStyle())
     47                     .padding(.horizontal)
     48                     
     49                     Button(action: {
     50                         navigationCoordinator.push(route: Route.Login)
     51                     }) {
     52                         HStack {
     53                             Text("Sign In", comment: "Button to continue to login page.")
     54                                 .fontWeight(.semibold)
     55                         }
     56                         .frame(minWidth: 300, maxWidth: .infinity, maxHeight: 12, alignment: .center)
     57                     }
     58                     .buttonStyle(GradientButtonStyle())
     59                     .accessibilityIdentifier(AppAccessibilityIdentifiers.sign_in_option_button.rawValue)
     60                     .padding()
     61 
     62                     Button(action: {
     63                         navigationCoordinator.push(route: Route.EULA)
     64                     }, label: {
     65                         HStack {
     66                             Text("By continuing, you agree to our EULA", comment: "Disclaimer to user that they are agreeing to the End User License Agreement if they create an account or sign in.")
     67                                 .font(.subheadline)
     68                                 .foregroundColor(DamusColors.neutral6)
     69 
     70                             Image(systemName: "arrow.forward")
     71                         }
     72                     })
     73                     .padding(.vertical, 5)
     74                     .padding(.bottom)
     75                 }
     76             }
     77             .background(DamusBackground(maxHeight: UIScreen.main.bounds.size.height/2), alignment: .top)
     78             .navigationDestination(for: Route.self) { route in
     79                 route.view(navigationCoordinator: navigationCoordinator, damusState: DamusState.empty)
     80             }
     81         }
     82         .navigationBarTitleDisplayMode(.inline)
     83         .navigationViewStyle(StackNavigationViewStyle())
     84     }
     85 }
     86 
     87 struct SetupView_Previews: PreviewProvider {
     88     static var previews: some View {
     89         Group {
     90             SetupView()
     91                 .previewDevice(PreviewDevice(rawValue: "iPhone SE (3rd generation)"))
     92             SetupView()
     93                 .previewDevice(PreviewDevice(rawValue: "iPhone 13 Pro Max"))
     94         }
     95     }
     96 }
     97