fix: pin Connect button to bottom, dynamic protocol badge

- safeAreaInset pins Connect/Continue button to screen bottom,
  eliminating dead space below the form
- UGreenCompatibilityBadge now takes selectedProtocol param:
  green dot + green SMB label when SMB selected,
  grey dot + grey SFTP label when SFTP selected

Co-Authored-By: Kutesir <kutesir@provoc.ug>
Co-Authored-By: Sentry <sentry@provoc.ug>
This commit is contained in:
Robin Kutesa
2026-05-16 19:19:37 +03:00
parent 2b6e2d145d
commit 2bdf41502e
2 changed files with 29 additions and 31 deletions

View File

@@ -1,31 +1,24 @@
import SwiftUI
import UIKit
// Displays the UGreen NAS compatibility indicator.
// If you add an image named "ugreen_logo" to Assets.xcassets it will be used automatically.
// Otherwise a brand-styled text badge is shown.
struct UGreenCompatibilityBadge: View {
private static let ugreenGreen = Color(hex: "#00B388")
private let hasLogo = UIImage(named: "ugreen_logo") != nil
var selectedProtocol: NASProtocol = .smb
private var dotColor: Color {
selectedProtocol == .smb ? Color(hex: "#00B388") : AppTheme.inkQuaternary
}
var body: some View {
HStack(spacing: 8) {
// UGreen logo or fallback wordmark
if hasLogo {
Image("ugreen_logo")
.resizable()
.scaledToFit()
.frame(height: 14)
} else {
HStack(spacing: 4) {
// Brand dot
Circle()
.fill(Self.ugreenGreen)
.frame(width: 6, height: 6)
Text("UGreen NAS")
.font(.system(size: 11, weight: .semibold))
.foregroundStyle(Self.ugreenGreen)
}
// Status dot + UGreen NAS label
HStack(spacing: 4) {
Circle()
.fill(dotColor)
.frame(width: 6, height: 6)
.animation(.spring(response: 0.25, dampingFraction: 0.8), value: selectedProtocol)
Text("UGreen NAS")
.font(.system(size: 11, weight: .semibold))
.foregroundStyle(dotColor)
.animation(.spring(response: 0.25, dampingFraction: 0.8), value: selectedProtocol)
}
// Separator
@@ -33,10 +26,11 @@ struct UGreenCompatibilityBadge: View {
.fill(AppTheme.inkQuaternary)
.frame(width: 0.5, height: 11)
// Protocol hint
Text("SMB · SFTP")
.font(.system(size: 11, weight: .regular))
.foregroundStyle(AppTheme.inkTertiary)
// Active protocol label
Text(selectedProtocol.rawValue)
.font(.system(size: 11, weight: .medium))
.foregroundStyle(selectedProtocol == .smb ? dotColor : AppTheme.inkTertiary)
.contentTransition(.identity)
}
.padding(.horizontal, 12)
.padding(.vertical, 6)