2023-12-29 11:17:37 +01:00
|
|
|
//Made by Lumaa
|
|
|
|
|
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct ConnectView: View {
|
|
|
|
@Environment(\.dismiss) private var dismiss
|
|
|
|
|
|
|
|
@State private var sheet: SheetDestination?
|
|
|
|
@State private var logged: Bool = false
|
|
|
|
|
2024-01-06 03:35:06 +01:00
|
|
|
init() {}
|
|
|
|
|
2023-12-29 11:17:37 +01:00
|
|
|
var body: some View {
|
|
|
|
VStack {
|
2024-01-02 14:23:36 +01:00
|
|
|
Image("HeroIcon")
|
|
|
|
.resizable()
|
|
|
|
.aspectRatio(contentMode: .fit)
|
|
|
|
.frame(width: 30)
|
|
|
|
.padding(.bottom)
|
|
|
|
|
2023-12-29 11:17:37 +01:00
|
|
|
Text("login.title")
|
|
|
|
.font(.title.bold())
|
|
|
|
.multilineTextAlignment(.center)
|
|
|
|
|
|
|
|
Spacer()
|
|
|
|
|
|
|
|
VStack(spacing: 30) {
|
|
|
|
Button {
|
|
|
|
sheet = .mastodonLogin(logged: $logged)
|
|
|
|
} label: {
|
|
|
|
mastodon
|
|
|
|
}
|
|
|
|
.buttonStyle(LargeButton())
|
|
|
|
|
2024-01-06 03:35:06 +01:00
|
|
|
// Button {
|
|
|
|
// print("go directly")
|
|
|
|
// } label: {
|
|
|
|
// noAccount
|
|
|
|
// }
|
|
|
|
// .buttonStyle(LargeButton())
|
|
|
|
// .disabled(true)
|
2023-12-29 11:17:37 +01:00
|
|
|
}
|
|
|
|
.padding(.vertical, 100)
|
|
|
|
}
|
|
|
|
.withSheets(sheetDestination: $sheet)
|
|
|
|
.safeAreaPadding()
|
|
|
|
.onChange(of: logged) { _, newValue in
|
|
|
|
if newValue == true {
|
|
|
|
dismiss()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var mastodon: some View {
|
|
|
|
HStack(alignment: .top) {
|
|
|
|
VStack(alignment: .leading) {
|
|
|
|
Text("login.mastodon")
|
|
|
|
Text("login.mastodon.footer")
|
|
|
|
.multilineTextAlignment(.leading)
|
|
|
|
.font(.caption)
|
|
|
|
.foregroundStyle(.gray)
|
|
|
|
}
|
|
|
|
Spacer()
|
|
|
|
Image("MastodonMark")
|
|
|
|
.resizable()
|
|
|
|
.scaledToFit()
|
|
|
|
.frame(width: 30, height: 30)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var noAccount: some View {
|
|
|
|
HStack(alignment: .top) {
|
|
|
|
VStack(alignment: .leading) {
|
|
|
|
Text("login.no-account")
|
|
|
|
Text("login.no-account.footer")
|
|
|
|
.multilineTextAlignment(.leading)
|
|
|
|
.font(.caption)
|
|
|
|
.foregroundStyle(.gray)
|
|
|
|
}
|
|
|
|
Spacer()
|
|
|
|
Image(systemName: "person.crop.circle.dashed")
|
|
|
|
.resizable()
|
|
|
|
.scaledToFit()
|
|
|
|
.frame(width: 30, height: 30)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#Preview {
|
|
|
|
ConnectView()
|
|
|
|
}
|