From fd9eb47b85ef40db467f4ba1bb2f57a7a8f248e5 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Tue, 17 Jun 2025 01:38:38 +0200 Subject: [PATCH] add docs --- VibeTunnel/Core/Utilities/NetworkUtility.swift | 6 +++++- .../Core/Utilities/WindowCenteringHelper.swift | 6 +++++- VibeTunnel/Presentation/Views/MenuBarView.swift | 6 +++++- .../Presentation/Views/ServerConsoleView.swift | 6 +++++- .../Views/Settings/SettingsTab.swift | 5 ++++- .../Presentation/Views/SettingsView.swift | 6 +++++- VibeTunnel/Presentation/Views/WelcomeView.swift | 17 +++++++++++++---- 7 files changed, 42 insertions(+), 10 deletions(-) diff --git a/VibeTunnel/Core/Utilities/NetworkUtility.swift b/VibeTunnel/Core/Utilities/NetworkUtility.swift index 537e5fd9..97d494f8 100644 --- a/VibeTunnel/Core/Utilities/NetworkUtility.swift +++ b/VibeTunnel/Core/Utilities/NetworkUtility.swift @@ -1,7 +1,11 @@ import Foundation import Network -/// Utility for network-related operations +/// Utility for network-related operations. +/// +/// Provides helper functions for network interface discovery and IP address resolution. +/// Primarily used to determine the local machine's network addresses for display +/// in the dashboard settings. enum NetworkUtility { /// Get the primary IPv4 address of the local machine static func getLocalIPAddress() -> String? { diff --git a/VibeTunnel/Core/Utilities/WindowCenteringHelper.swift b/VibeTunnel/Core/Utilities/WindowCenteringHelper.swift index b28431f9..68ecdb68 100644 --- a/VibeTunnel/Core/Utilities/WindowCenteringHelper.swift +++ b/VibeTunnel/Core/Utilities/WindowCenteringHelper.swift @@ -1,6 +1,10 @@ import AppKit -/// Helper class for consistent window centering across the application +/// Helper class for consistent window centering across the application. +/// +/// Provides utility methods for positioning windows on screen, including +/// centering on the active display and moving windows off-screen when needed. +/// Used throughout VibeTunnel to ensure consistent window placement behavior. enum WindowCenteringHelper { /// Centers a window on the active screen (where the mouse cursor is located) /// - Parameter window: The NSWindow to center diff --git a/VibeTunnel/Presentation/Views/MenuBarView.swift b/VibeTunnel/Presentation/Views/MenuBarView.swift index 8ddf6934..9f67a654 100644 --- a/VibeTunnel/Presentation/Views/MenuBarView.swift +++ b/VibeTunnel/Presentation/Views/MenuBarView.swift @@ -1,6 +1,10 @@ import SwiftUI -/// Main menu bar view displaying session status and app controls +/// Main menu bar view displaying session status and app controls. +/// +/// Appears in the macOS menu bar and provides quick access to VibeTunnel's +/// key features including server status, dashboard access, session monitoring, +/// and application preferences. Updates in real-time to reflect server state. struct MenuBarView: View { @Environment(SessionMonitor.self) var sessionMonitor diff --git a/VibeTunnel/Presentation/Views/ServerConsoleView.swift b/VibeTunnel/Presentation/Views/ServerConsoleView.swift index b8c704a1..56b67136 100644 --- a/VibeTunnel/Presentation/Views/ServerConsoleView.swift +++ b/VibeTunnel/Presentation/Views/ServerConsoleView.swift @@ -1,7 +1,11 @@ import Observation import SwiftUI -/// View for displaying server console logs +/// View for displaying server console logs. +/// +/// Provides a real-time console interface for monitoring server output with +/// filtering capabilities, auto-scroll functionality, and color-coded log levels. +/// Supports both Rust and Hummingbird server implementations. struct ServerConsoleView: View { @State private var viewModel = ServerConsoleViewModel() @State private var autoScroll = true diff --git a/VibeTunnel/Presentation/Views/Settings/SettingsTab.swift b/VibeTunnel/Presentation/Views/Settings/SettingsTab.swift index c2ebb103..37b4a656 100644 --- a/VibeTunnel/Presentation/Views/Settings/SettingsTab.swift +++ b/VibeTunnel/Presentation/Views/Settings/SettingsTab.swift @@ -1,6 +1,9 @@ import Foundation -/// Represents the available tabs in the Settings window +/// Represents the available tabs in the Settings window. +/// +/// Each tab corresponds to a different configuration area of VibeTunnel, +/// with associated display names and SF Symbol icons for the tab bar. enum SettingsTab: String, CaseIterable { case general case dashboard diff --git a/VibeTunnel/Presentation/Views/SettingsView.swift b/VibeTunnel/Presentation/Views/SettingsView.swift index 6c5c016a..ae804f39 100644 --- a/VibeTunnel/Presentation/Views/SettingsView.swift +++ b/VibeTunnel/Presentation/Views/SettingsView.swift @@ -1,6 +1,10 @@ import SwiftUI -/// Main settings window with tabbed interface +/// Main settings window with tabbed interface. +/// +/// Provides a macOS-style preferences window with multiple tabs for different +/// configuration aspects of VibeTunnel. Dynamically adjusts window size based +/// on the selected tab and conditionally shows debug settings when enabled. struct SettingsView: View { @State private var selectedTab: SettingsTab = .general @State private var contentSize: CGSize = .zero diff --git a/VibeTunnel/Presentation/Views/WelcomeView.swift b/VibeTunnel/Presentation/Views/WelcomeView.swift index c372b3de..d9bfe8f8 100644 --- a/VibeTunnel/Presentation/Views/WelcomeView.swift +++ b/VibeTunnel/Presentation/Views/WelcomeView.swift @@ -1,5 +1,10 @@ import SwiftUI +/// Welcome onboarding view for first-time users. +/// +/// Presents a multi-page onboarding experience that introduces VibeTunnel's features, +/// guides through CLI installation, and explains dashboard security best practices. +/// The view tracks completion state to ensure it's only shown once. struct WelcomeView: View { @State private var currentPage = 0 @Environment(\.dismiss) @@ -101,7 +106,8 @@ struct WelcomeView: View { // MARK: - Welcome Page -struct WelcomePageView: View { +/// First page of the welcome flow introducing VibeTunnel. +private struct WelcomePageView: View { var body: some View { VStack(spacing: 40) { Spacer() @@ -141,7 +147,8 @@ struct WelcomePageView: View { // MARK: - VT Command Page -struct VTCommandPageView: View { +/// Second page explaining the VT command-line tool and installation. +private struct VTCommandPageView: View { var cliInstaller: CLIInstaller var body: some View { @@ -225,7 +232,8 @@ struct VTCommandPageView: View { // MARK: - Protect Dashboard Page -struct ProtectDashboardPageView: View { +/// Third page explaining dashboard security and access protection. +private struct ProtectDashboardPageView: View { @State private var password = "" @State private var confirmPassword = "" @State private var showError = false @@ -352,7 +360,8 @@ struct ProtectDashboardPageView: View { // MARK: - Access Dashboard Page -struct AccessDashboardPageView: View { +/// Fourth page showing how to access the dashboard and ngrok integration. +private struct AccessDashboardPageView: View { @AppStorage("ngrokEnabled") private var ngrokEnabled = false @AppStorage("serverPort")