// // ContentView.swift // RIT Dining // // Created by Campbell on 8/31/25. // import SwiftUI struct LocationList: View { let diningLocations: [DiningLocation] // I forgot this before and was really confused why all of the times were in UTC. private let display: DateFormatter = { let display = DateFormatter() display.timeZone = TimeZone(identifier: "America/New_York") display.dateStyle = .none display.timeStyle = .short return display }() var body: some View { ForEach(diningLocations, id: \.self) { location in NavigationLink(destination: DetailView(location: location)) { VStack(alignment: .leading) { Text(location.name) switch location.open { case .open: Text("Open") .foregroundStyle(.green) case .closed: Text("Closed") .foregroundStyle(.red) case .openingSoon: Text("Opening Soon") .foregroundStyle(.orange) case .closingSoon: Text("Closing Soon") .foregroundStyle(.orange) } if let times = location.diningTimes, !times.isEmpty { ForEach(times, id: \.self) { time in Text("\(display.string(from: time.openTime)) - \(display.string(from: time.closeTime))") .foregroundStyle(.secondary) } } else { Text("Not Open Today") .foregroundStyle(.secondary) } } } } } } struct ContentView: View { @State private var isLoading = true @State private var rotationDegrees: Double = 0 @State private var diningLocations: [DiningLocation] = [] @State private var lastRefreshed: Date? @State private var searchText: String = "" @State private var openLocationsOnly: Bool = false private var animation: Animation { .linear .speed(0.1) .repeatForever(autoreverses: false) } // Asynchronously fetch the data for all of the locations and parse their data to display it. private func getDiningData() { var newDiningLocations: [DiningLocation] = [] getAllDiningInfo(date: nil) { result in DispatchQueue.global().async { switch result { case .success(let locations): for i in 0..