initial commit: Proximity iOS app proposal, full Swift code scaffold, reference backend, testing docs, generated Xcode project
This commit is contained in:
67
Proximity/Views/ConnectionsView.swift
Normal file
67
Proximity/Views/ConnectionsView.swift
Normal file
@@ -0,0 +1,67 @@
|
||||
import SwiftUI
|
||||
|
||||
/// The list of revealed, mutually-consented connections.
|
||||
///
|
||||
/// This list is the *proof* of the product's thesis: every connection here
|
||||
/// began as a real-world encounter. There is no way to add someone you've
|
||||
/// never been near.
|
||||
struct ConnectionsView: View {
|
||||
@EnvironmentObject private var chatViewModel: ChatViewModel
|
||||
// In production, sourced from GraphStore via a ConnectionsViewModel.
|
||||
private let connections: [Connection] = []
|
||||
|
||||
var body: some View {
|
||||
NavigationStack {
|
||||
Group {
|
||||
if connections.isEmpty {
|
||||
emptyState
|
||||
} else {
|
||||
List(connections) { connection in
|
||||
NavigationLink(value: connection) {
|
||||
ConnectionRow(connection: connection)
|
||||
}
|
||||
}
|
||||
.navigationDestination(for: Connection.self) { connection in
|
||||
ChatView(connection: connection)
|
||||
.environmentObject(chatViewModel)
|
||||
}
|
||||
}
|
||||
}
|
||||
.navigationTitle("Connections")
|
||||
}
|
||||
}
|
||||
|
||||
private var emptyState: some View {
|
||||
VStack(spacing: 12) {
|
||||
Image(systemName: "person.2")
|
||||
.font(.system(size: 48))
|
||||
.foregroundColor(.secondary)
|
||||
Text("No connections yet")
|
||||
.font(.headline)
|
||||
Text("Connections only form when you're physically near someone —\nand you both choose to reveal. Go be present.")
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundColor(.secondary)
|
||||
.padding(.horizontal)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct ConnectionRow: View {
|
||||
let connection: Connection
|
||||
|
||||
var body: some View {
|
||||
HStack {
|
||||
Circle()
|
||||
.fill(Color.green.opacity(0.2))
|
||||
.frame(width: 40, height: 40)
|
||||
.overlay(Text(String(connection.displayName.prefix(1))))
|
||||
VStack(alignment: .leading) {
|
||||
Text(connection.displayName)
|
||||
.font(.headline)
|
||||
Text("Met \(connection.createdAt, format: .dateTime.month().day())")
|
||||
.font(.caption)
|
||||
.foregroundColor(.secondary)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user