mirror of
https://github.com/NinjaCheetah/RIT-Dining.git
synced 2025-10-19 06:36:18 -04:00
Reworked the detail view for locations to use the screen space more effectively and show the day's visiting chefs and daily specials, as well as the hours for the entire week. The visiting chef screen has also been massively reworked to show all visiting chefs under what location they're in, with their times for the day and an indicator marking their status (one of: "Here Now", "Arriving Later", "Ariving Soon", "Leaving Soon", and "Left For Today"). These markers are also used in location's detail view. There's also an arrow in the top right that switches the visiting chef screen from today's visiting chefs to tomorrow's, so you can scout out what you might want to get tomorrow. Locations are also now sorted alphabetically on the main menu, to make finding the location you're looking for easier.
33 lines
957 B
Swift
33 lines
957 B
Swift
//
|
|
// SharedComponents.swift
|
|
// RIT Dining
|
|
//
|
|
// Created by Campbell on 9/8/25.
|
|
//
|
|
|
|
import Foundation
|
|
import SafariServices
|
|
import SwiftUI
|
|
|
|
// Gross disgusting UIKit code :(
|
|
// There isn't a direct way to use integrated Safari from SwiftUI, except maybe in iOS 26? I'm not targeting that though so I must fall
|
|
// back on UIKit stuff.
|
|
struct SafariView: UIViewControllerRepresentable {
|
|
let url: URL
|
|
|
|
func makeUIViewController(context: Context) -> SFSafariViewController {
|
|
SFSafariViewController(url: url)
|
|
}
|
|
|
|
func updateUIViewController(_ uiViewController: SFSafariViewController, context: Context) {}
|
|
}
|
|
|
|
func getAPIFriendlyDateString(date: Date) -> String {
|
|
let formatter = DateFormatter()
|
|
formatter.calendar = Calendar(identifier: .iso8601)
|
|
formatter.locale = Locale(identifier: "en_US_POSIX")
|
|
formatter.timeZone = TimeZone.current
|
|
formatter.dateFormat = "yyyy-MM-dd"
|
|
return formatter.string(from: date)
|
|
}
|