feat(ui): replace loading indicators with Apple-style LoadingSpinner
- Add LoadingSpinner component with small/medium/large sizes using system gray color - Add LoadingPlaceholder for skeleton loading states - Add LoadingSheet for full-screen blocking overlays - Replace ThemedSpinner/ThemedSpinnerCompact across all views - Remove deprecated loading components from AnimatedComponents.swift - Delete LoadingTextGenerator.swift - Fix PhotoImportView layout to fill full width Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
37
SportsTimeTests/Loading/LoadingPlaceholderTests.swift
Normal file
37
SportsTimeTests/Loading/LoadingPlaceholderTests.swift
Normal file
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// LoadingPlaceholderTests.swift
|
||||
// SportsTimeTests
|
||||
//
|
||||
|
||||
import Testing
|
||||
import SwiftUI
|
||||
@testable import SportsTime
|
||||
|
||||
struct LoadingPlaceholderTests {
|
||||
|
||||
@Test func rectangleHasCorrectDimensions() {
|
||||
let rect = LoadingPlaceholder.rectangle(width: 100, height: 20)
|
||||
#expect(rect.width == 100)
|
||||
#expect(rect.height == 20)
|
||||
}
|
||||
|
||||
@Test func circleHasCorrectDiameter() {
|
||||
let circle = LoadingPlaceholder.circle(diameter: 40)
|
||||
#expect(circle.diameter == 40)
|
||||
}
|
||||
|
||||
@Test func capsuleHasCorrectDimensions() {
|
||||
let capsule = LoadingPlaceholder.capsule(width: 80, height: 24)
|
||||
#expect(capsule.width == 80)
|
||||
#expect(capsule.height == 24)
|
||||
}
|
||||
|
||||
@Test func animationCycleDurationIsCorrect() {
|
||||
#expect(LoadingPlaceholder.animationDuration == 1.2)
|
||||
}
|
||||
|
||||
@Test func opacityRangeIsSubtle() {
|
||||
#expect(LoadingPlaceholder.minOpacity == 0.3)
|
||||
#expect(LoadingPlaceholder.maxOpacity == 0.5)
|
||||
}
|
||||
}
|
||||
28
SportsTimeTests/Loading/LoadingSheetTests.swift
Normal file
28
SportsTimeTests/Loading/LoadingSheetTests.swift
Normal file
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// LoadingSheetTests.swift
|
||||
// SportsTimeTests
|
||||
//
|
||||
|
||||
import Testing
|
||||
import SwiftUI
|
||||
@testable import SportsTime
|
||||
|
||||
struct LoadingSheetTests {
|
||||
|
||||
@Test func sheetRequiresLabel() {
|
||||
let sheet = LoadingSheet(label: "Planning trip")
|
||||
#expect(sheet.label == "Planning trip")
|
||||
}
|
||||
|
||||
@Test func sheetCanHaveOptionalDetail() {
|
||||
let withDetail = LoadingSheet(label: "Exporting", detail: "Generating maps...")
|
||||
let withoutDetail = LoadingSheet(label: "Loading")
|
||||
|
||||
#expect(withDetail.detail == "Generating maps...")
|
||||
#expect(withoutDetail.detail == nil)
|
||||
}
|
||||
|
||||
@Test func backgroundOpacityIsCorrect() {
|
||||
#expect(LoadingSheet.backgroundOpacity == 0.5)
|
||||
}
|
||||
}
|
||||
47
SportsTimeTests/Loading/LoadingSpinnerTests.swift
Normal file
47
SportsTimeTests/Loading/LoadingSpinnerTests.swift
Normal file
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// LoadingSpinnerTests.swift
|
||||
// SportsTimeTests
|
||||
//
|
||||
|
||||
import Testing
|
||||
import SwiftUI
|
||||
@testable import SportsTime
|
||||
|
||||
struct LoadingSpinnerTests {
|
||||
|
||||
@Test func smallSizeHasCorrectDimensions() {
|
||||
let config = LoadingSpinner.Size.small
|
||||
#expect(config.diameter == 16)
|
||||
#expect(config.strokeWidth == 2)
|
||||
}
|
||||
|
||||
@Test func mediumSizeHasCorrectDimensions() {
|
||||
let config = LoadingSpinner.Size.medium
|
||||
#expect(config.diameter == 24)
|
||||
#expect(config.strokeWidth == 3)
|
||||
}
|
||||
|
||||
@Test func largeSizeHasCorrectDimensions() {
|
||||
let config = LoadingSpinner.Size.large
|
||||
#expect(config.diameter == 40)
|
||||
#expect(config.strokeWidth == 4)
|
||||
}
|
||||
|
||||
@Test func spinnerCanBeCreatedWithAllSizes() {
|
||||
let small = LoadingSpinner(size: .small)
|
||||
let medium = LoadingSpinner(size: .medium)
|
||||
let large = LoadingSpinner(size: .large)
|
||||
|
||||
#expect(small.size == .small)
|
||||
#expect(medium.size == .medium)
|
||||
#expect(large.size == .large)
|
||||
}
|
||||
|
||||
@Test func spinnerCanHaveOptionalLabel() {
|
||||
let withLabel = LoadingSpinner(size: .medium, label: "Loading...")
|
||||
let withoutLabel = LoadingSpinner(size: .medium)
|
||||
|
||||
#expect(withLabel.label == "Loading...")
|
||||
#expect(withoutLabel.label == nil)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user