// // OnboardWindow.swift // // Copyright 2026 Brendan Szymanski // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . // // SPDX-License-Identifier: GPL-3.0-or-later // import LuminateCore import Portico /// The root view for the unauthenticated onboarding window. /// /// Hosts a `NavigationView` rooted at ``IntroPage``, with every later step (server setup, then the /// `.login`-rooted stack: public-user picker, manual sign-in, Quick Connect, forgot password) /// pushed as an ``OnboardDestination``. Owns the single `onboardPath` state and injects it through /// `\.onboardPath` so every pushed page can push further without re-threading a binding down the /// view tree. package struct OnboardWindow: View { @State private var onboardPath: [OnboardDestination] /// Creates the onboarding window. /// /// - Parameter path: The destinations to push above the server-setup carousel at mount. Pass /// `[.login]` when a server URL is already stored so a returning user does not retype it. package init(startingAt path: [OnboardDestination] = []) { _onboardPath = State(wrappedValue: path) } package var body: some View { NavigationView(path: $onboardPath) { IntroPage() .navigationDestination(for: OnboardDestination.self) { destination in switch destination { case .setup: SetupPage() case .login: LoginPage() case .userLogin(let user): UserLoginPage(user) case .manualLogin: ManualLoginPage() case .quickConnect: QuickConnectPage() case .forgotPassword: ForgotPasswordPage() } } } .environment(\.onboardPath, $onboardPath) } }