feature/host-inspect-cli
swift 86 lines 2.84 KB
Raw
1 import SwiftUI
2
3 @main
4 struct ControlKitRunnerApp: App {
5 var body: some Scene {
6 WindowGroup {
7 ControlKitShowcaseView()
8 }
9 }
10 }
11
12 private struct ControlKitShowcaseView: View {
13 var body: some View {
14 ScrollView {
15 VStack(alignment: .leading, spacing: 12) {
16 HStack(spacing: 10) {
17 logo
18 VStack(alignment: .leading, spacing: 2) {
19 Text("ControlKit")
20 .font(.headline)
21 Text("watchOS")
22 .font(.caption2)
23 .foregroundStyle(.secondary)
24 }
25 }
26
27 statusCard
28 informationCard
29 }
30 .padding(12)
31 }
32 .background(Color.controlKitGreen.ignoresSafeArea())
33 .foregroundStyle(Color.controlKitCream)
34 }
35
36 private var logo: some View {
37 Text("XC\nRS")
38 .font(.system(size: 14, weight: .black, design: .rounded))
39 .multilineTextAlignment(.center)
40 .lineSpacing(-3)
41 .foregroundStyle(Color.controlKitGreen)
42 .frame(width: 40, height: 40)
43 .background(Color.controlKitCream, in: RoundedRectangle(cornerRadius: 10))
44 }
45
46 private var statusCard: some View {
47 VStack(alignment: .leading, spacing: 6) {
48 Label("Runner online", systemImage: "checkmark.circle.fill")
49 .font(.footnote)
50 .foregroundStyle(.green)
51 Text("Ready for ControlKit automation requests.")
52 .font(.caption2)
53 .foregroundStyle(Color.controlKitCream.opacity(0.78))
54 }
55 .padding(12)
56 .frame(maxWidth: .infinity, alignment: .leading)
57 .background(.white.opacity(0.1), in: RoundedRectangle(cornerRadius: 14))
58 }
59
60 private var informationCard: some View {
61 VStack(alignment: .leading, spacing: 8) {
62 infoRow(title: "Project", value: "XCRSControlKit")
63 infoRow(title: "Creator", value: "smbCloud")
64 infoRow(title: "Purpose", value: "Companion automation runner")
65 }
66 .padding(12)
67 .frame(maxWidth: .infinity, alignment: .leading)
68 .background(.white.opacity(0.08), in: RoundedRectangle(cornerRadius: 14))
69 }
70
71 private func infoRow(title: String, value: String) -> some View {
72 VStack(alignment: .leading, spacing: 1) {
73 Text(title)
74 .font(.caption2)
75 .foregroundStyle(Color.controlKitCream.opacity(0.62))
76 Text(value)
77 .font(.caption)
78 .fontWeight(.semibold)
79 }
80 }
81 }
82
83 private extension Color {
84 static let controlKitGreen = Color(red: 0.106, green: 0.263, blue: 0.196)
85 static let controlKitCream = Color(red: 0.961, green: 0.953, blue: 0.925)
86 }