Initial project setup - Phases 1-3 complete

This commit is contained in:
Trey t
2026-04-06 11:28:40 -05:00
commit c77e506db5
293 changed files with 14233 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
import SwiftUI
struct EmptyStateView: View {
let icon: String
let title: String
let subtitle: String
var actionTitle: String?
var action: (() -> Void)?
var body: some View {
VStack(spacing: 16) {
Image(systemName: icon)
.font(.system(size: 48))
.foregroundStyle(.secondary)
Text(title)
.font(.headline)
.foregroundStyle(.secondary)
Text(subtitle)
.font(.subheadline)
.foregroundStyle(.tertiary)
.multilineTextAlignment(.center)
if let actionTitle, let action {
Button(action: action) {
Text(actionTitle)
.frame(maxWidth: .infinity)
}
.buttonStyle(.borderedProminent)
.padding(.horizontal, 40)
.padding(.top, 8)
}
}
.padding()
}
}

View File

@@ -0,0 +1,34 @@
import SwiftUI
struct FilterChip: Identifiable {
let id = UUID()
let label: String
var isSelected: Bool = false
}
struct FilterChipsView: View {
@Binding var chips: [FilterChip]
var body: some View {
ScrollView(.horizontal, showsIndicators: false) {
HStack(spacing: 8) {
ForEach($chips) { $chip in
Button {
chip.isSelected.toggle()
} label: {
Text(chip.label)
.font(.caption.weight(.medium))
.padding(.horizontal, 12)
.padding(.vertical, 6)
.background(
chip.isSelected ? Color.accentColor : Color(.systemGray5),
in: Capsule()
)
.foregroundStyle(chip.isSelected ? .white : .primary)
}
}
}
.padding(.horizontal)
}
}
}

View File

@@ -0,0 +1,18 @@
import SwiftUI
struct KeyValueRow: View {
let key: String
let value: String
var body: some View {
VStack(alignment: .leading, spacing: 2) {
Text(key)
.font(.caption)
.foregroundStyle(.secondary)
Text(value)
.font(.subheadline)
.textSelection(.enabled)
}
.frame(maxWidth: .infinity, alignment: .leading)
}
}

View File

@@ -0,0 +1,27 @@
import SwiftUI
struct MethodBadge: View {
let method: String
var color: Color {
switch method.uppercased() {
case "GET": .green
case "POST": .blue
case "PUT": .orange
case "PATCH": .purple
case "DELETE": .red
case "HEAD": .gray
case "OPTIONS": .teal
default: .secondary
}
}
var body: some View {
Text(method.uppercased())
.font(.caption2.weight(.bold))
.foregroundStyle(color)
.padding(.horizontal, 6)
.padding(.vertical, 2)
.background(color.opacity(0.12), in: RoundedRectangle(cornerRadius: 4))
}
}

View File

@@ -0,0 +1,45 @@
import SwiftUI
struct StatusBadge: View {
let statusCode: Int?
var color: Color {
guard let code = statusCode else { return .secondary }
switch code {
case 200..<300: return .green
case 300..<400: return .blue
case 400..<500: return .yellow
case 500..<600: return .red
default: return .secondary
}
}
var text: String {
guard let code = statusCode else { return "..." }
switch code {
case 200: return "200 OK"
case 201: return "201 Created"
case 204: return "204 No Content"
case 301: return "301 Moved"
case 302: return "302 Found"
case 304: return "304 Not Modified"
case 400: return "400 Bad Request"
case 401: return "401 Unauthorized"
case 403: return "403 Forbidden"
case 404: return "404 Not Found"
case 500: return "500 Server Error"
case 502: return "502 Bad Gateway"
case 503: return "503 Unavailable"
default: return "\(code)"
}
}
var body: some View {
Text(text)
.font(.caption2.weight(.medium))
.foregroundStyle(color)
.padding(.horizontal, 6)
.padding(.vertical, 2)
.background(color.opacity(0.12), in: RoundedRectangle(cornerRadius: 4))
}
}

View File

@@ -0,0 +1,20 @@
import SwiftUI
struct ToggleHeaderView: View {
let title: String
let description: String
@Binding var isEnabled: Bool
var body: some View {
VStack(alignment: .leading, spacing: 8) {
Toggle(title, isOn: $isEnabled)
.font(.headline)
Text(description)
.font(.subheadline)
.foregroundStyle(.secondary)
}
.padding()
.background(Color(.systemBackground))
}
}