Repository Public
1// =============================================================================2// SP BOUCHER | SOFTWARE & RESEARCH3// ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// PROJECT METADATA7// -----------------------------------------------------------------------------8// Project : MacLustr Storage Node9// File : MacLustrStorageNode/Features/Dashboard/StationView.swift10// Description : Station mode: minimal dimmed screen for a device left11// plugged in as a dedicated storage node. The screen is kept12// awake only if the user enabled it and the device is on13// power; brightness is restored on exit.14// Module : MacLustrStorageNode15// Repository : https://git.spboucher.ai/maclustr-storage-ios16// Project Website : https://storage.spboucher.ai17// Created : 2026-12-0118// Last Modified : 2026-12-0119//20// =============================================================================21// AUTHOR & PROFESSIONAL AFFILIATION22// =============================================================================23//24// Author : Simon-Pierre Boucher25// Position : Professor of Finance26// Institution : Université du Québec en Outaouais (UQO)27// Department : Département des sciences administratives28// Organization : SP Boucher29//30// Website : https://spboucher.ai31// Git : https://git.spboucher.ai32//33// =============================================================================34// OFFICIAL CONTACT DIRECTORY35// =============================================================================36//37// General : info@spboucher.ai38// Professional : contact@spboucher.ai39// Direct : simon@spboucher.ai40// Research : research@spboucher.ai41// Development : dev@spboucher.ai42// Support : support@spboucher.ai43// Security/Admin : admin@spboucher.ai44// Notifications : notifications@spboucher.ai45//46// Preferred Contact: admin@spboucher.ai47//48// =============================================================================49// COPYRIGHT & INTELLECTUAL PROPERTY50// =============================================================================51//52// Copyright (c) 202653// Simon-Pierre Boucher54//55// All rights reserved where applicable.56//57// This file is governed by the applicable project license,58// copyright notices, institutional agreements and relevant law.59//60// Unless expressly authorized by the applicable license or61// rights holder, copying, redistribution, sublicensing,62// publication and commercial exploitation are not permitted.63//64// Existing third-party rights and notices remain unaffected.65//66// =============================================================================67// CONFIDENTIALITY & SECURITY68// =============================================================================69//70// Classification : Public71// Distribution : Public repository; use is governed by the project license72// Security Contact : admin@spboucher.ai73//74// Access to this source does not independently grant permission75// to redistribute or disclose confidential materials.76//77// Do not embed credentials, private keys, access tokens,78// certificates or confidential personal information.79//80// =============================================================================81// LICENSE & MAINTENANCE82// =============================================================================83//84// License : None specified (no license file in this repository)85// Maintainer : Simon-Pierre Boucher86// Technical Contact: dev@spboucher.ai87//88// =============================================================================89// END OF SP BOUCHER SOURCE HEADER90// =============================================================================9192import SwiftUI93import UIKit9495struct StationView: View {96 @EnvironmentObject private var node: NodeController97 @State private var previousBrightness: CGFloat = 0.59899 var body: some View {100 let s = node.snapshot, cap = s.capacity101 ZStack {102 Color.black.ignoresSafeArea()103 VStack(alignment: .leading, spacing: 22) {104 HStack(spacing: 8) {105 Circle().fill(s.stateColor).frame(width: 8, height: 8)106 Text(s.stateLabel.uppercased()).font(.caption.weight(.semibold)).tracking(1.4)107 Spacer()108 Text(s.path == .lan ? "LAN" : s.path == .gateway ? "GATEWAY" : "").font(.caption2).tracking(1.2)109 }110 VStack(alignment: .leading, spacing: 4) {111 Text(Format.bytes(cap.used)).font(.system(size: 54, weight: .light).monospacedDigit())112 Text("of \(Format.bytes(cap.quota)) · \(cap.fragments) fragments").font(.footnote)113 }114 HStack(spacing: 28) {115 line("IN", Format.rate(s.rxBps)); line("OUT", Format.rate(s.txBps)); line("TEMP", s.thermalLabel)116 }117 if let why = s.pauseExplanation { Text(why).font(.footnote) }118 if !s.charging { Text("Not on power: the screen will sleep normally.").font(.footnote) }119 else if !node.settings.keepAwakeInStationMode { Text("Keep-awake is off in Settings: the screen will sleep normally.").font(.footnote) }120 Spacer()121 Button("Exit station mode") { node.exitStation() }.font(.footnote.weight(.medium)).buttonStyle(.bordered).tint(.gray)122 }123 .foregroundStyle(Color(white: 0.55))124 .padding(28)125 .frame(maxWidth: 520, alignment: .leading)126 }127 .statusBarHidden(true)128 .persistentSystemOverlays(.hidden)129 .onAppear { previousBrightness = UIScreen.main.brightness; UIScreen.main.brightness = min(previousBrightness, 0.08) }130 .onDisappear { UIScreen.main.brightness = previousBrightness }131 }132133 private func line(_ label: String, _ value: String) -> some View {134 VStack(alignment: .leading, spacing: 3) {135 Text(label).font(.caption2).tracking(1.2).foregroundStyle(Color(white: 0.35))136 Text(value).font(.callout.monospacedDigit())137 }138 }139}140