jellyflood/jellyflood tvOS/Views/ConnectToServerView/DualServerConnectView.swift

80 lines
2.4 KiB
Swift

//
// Swiftfin is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2025 Jellyfin & Jellyfin Contributors
//
import Defaults
import SwiftUI
/// Dual-block view for connecting to either Jellyfin or Xtream servers
struct DualServerConnectView: View {
@Default(.accentColor)
private var accentColor
@EnvironmentObject
private var router: SelectUserCoordinator.Router
var body: some View {
SplitLoginWindowView(
leadingTitle: "Jellyfin Server",
trailingTitle: "Xtream Codes Server"
) {
jellyfinBlock
} trailingContentView: {
xtreamBlock
}
.navigationTitle("Add Server")
.padding(.top, 80)
}
@ViewBuilder
private var jellyfinBlock: some View {
VStack(spacing: 30) {
Image(systemName: "server.rack")
.font(.system(size: 100))
.foregroundColor(accentColor)
.padding(.bottom, 10)
Text("Connect to your Jellyfin server for movies, TV shows, and media library")
.font(.callout)
.foregroundColor(.secondary)
.multilineTextAlignment(.center)
.padding(.horizontal, 20)
ListRowButton("Add Jellyfin Server") {
router.route(to: \.connectToServer)
}
.foregroundStyle(accentColor.overlayColor, accentColor)
.padding(.vertical, 20)
}
.frame(maxWidth: .infinity)
}
@ViewBuilder
private var xtreamBlock: some View {
VStack(spacing: 30) {
Image(systemName: "tv")
.font(.system(size: 100))
.foregroundColor(accentColor)
.padding(.bottom, 10)
Text("Connect to your Xtream Codes provider for Live TV channels and EPG")
.font(.callout)
.foregroundColor(.secondary)
.multilineTextAlignment(.center)
.padding(.horizontal, 20)
ListRowButton("Add Xtream Server") {
router.route(to: \.connectToXtream)
}
.foregroundStyle(accentColor.overlayColor, accentColor)
.padding(.vertical, 20)
}
.frame(maxWidth: .infinity)
}
}