another.im-ios/Monal/another.im/Views/Enter/WelcomeScreen.swift
2024-12-02 16:50:23 +01:00

80 lines
2.8 KiB
Swift

import SwiftUI
struct WelcomeScreen: View {
@EnvironmentObject var wrapper: WrapperXMPP
@Environment(\.router) var router
var body: some View {
ZStack {
// background
Color.Material.Background.light
.ignoresSafeArea()
if wrapper.accountsAvailability == .allDisabled {
VStack {
HStack {
Spacer()
Image(systemName: "gear")
.foregroundColor(.Material.Elements.active)
.tappablePadding(.symmetric(10)) {
router.showScreen(.push) { _ in
EmptyView()
// SettingsScreen()
// .environment(\.settingsParent, .welcome)
// .navigationBarHidden(true)
}
}
}
.padding()
Spacer()
}
}
// content
VStack(spacing: 32) {
// icon
Image.aimlogo
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 120, height: 120)
// texts
VStack(spacing: 10) {
Text(L10n.Global.name)
.font(.head1r)
.foregroundColor(.Material.Text.main)
.fixedSize(horizontal: true, vertical: false)
Text(L10n.Start.subtitle)
.font(.body2)
.foregroundColor(.Material.Text.sub)
.fixedSize(horizontal: false, vertical: true)
.multilineTextAlignment(.center)
}
// buttons
VStack(spacing: 16) {
Button {
router.showScreen(.push) { _ in
LoginScreen()
.navigationBarBackButtonHidden(true)
}
} label: {
Text(L10n.Start.Btn.login)
}
.buttonStyle(SecondaryButtonStyle())
Button {
router.showScreen(.push) { _ in
RegistrationScreen()
.navigationBarBackButtonHidden(true)
}
} label: {
Text(L10n.Start.Btn.register)
}
.buttonStyle(PrimaryButtonStyle())
}
}
.padding(.horizontal, 32)
}
}
}