Added details of the type of bike available; fixed a bug where the application would not load the bikes; added a shortcut to the settings app in the event of location refusal.
58 lines
1.4 KiB
Swift
58 lines
1.4 KiB
Swift
//
|
|
// StationComponent.swift
|
|
// velibtracker
|
|
//
|
|
// Created by Louis Gallet on 02/09/2023.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
import SwiftUI
|
|
|
|
struct StationComponent: View {
|
|
|
|
let station: VelibStation
|
|
|
|
var body: some View {
|
|
VStack(alignment: .leading, spacing: 8) {
|
|
Text(station.name)
|
|
.font(.title)
|
|
.foregroundColor(.primary)
|
|
|
|
HStack {
|
|
Text("Capacité: \(station.capacity)")
|
|
.font(.subheadline)
|
|
.foregroundColor(.secondary)
|
|
|
|
Spacer()
|
|
|
|
VStack {
|
|
Text("Disponibles: \(station.numbikesavailable)")
|
|
.font(.subheadline)
|
|
.foregroundColor(.secondary)
|
|
Text("Electriques: \(station.ebike)")
|
|
.font(.subheadline)
|
|
.foregroundColor(.blue)
|
|
Text("Mécaniques: \(station.mechanical)")
|
|
.font(.subheadline)
|
|
.foregroundColor(.green)
|
|
}
|
|
|
|
}
|
|
}
|
|
.padding()
|
|
.background(Color.white)
|
|
.cornerRadius(10)
|
|
.shadow(radius: 5)
|
|
.padding(.horizontal, 16)
|
|
.padding(.vertical, 8)
|
|
}
|
|
}
|
|
|
|
|
|
struct StationComponent_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
StationComponent(station: test[1])
|
|
}
|
|
}
|