This commit is contained in:
Vladimir Dubovik 2024-12-09 12:55:01 +03:00
parent 955c7d9066
commit f59d00016b

View File

@ -10,48 +10,55 @@ import SwiftUI
struct ScheduleView: View {
@ObservedObject var vm: ViewModel
var body: some View {
ScrollView(.vertical, showsIndicators: false) {
VStack (spacing: 20) {
ForEach(vm.classes.indices, id: \.self) { index in
if index != 0 && index != 1 && index == vm.selectedIndex {
let daySchedule = vm.classes[index] // Это массив строк для дня
ForEach(daySchedule.indices.dropFirst(), id: \.self) { lessonIndex in
let lesson = daySchedule[lessonIndex] // Это строка с расписанием одной пары
if !lesson.isEmpty {
HStack(spacing: 10) {
VStack {
Text(convertTimeString(vm.classes[1][lessonIndex])[0])
.font(.system(size: 15, weight: .regular))
Text(convertTimeString(vm.classes[1][lessonIndex])[1])
.font(.system(size: 15, weight: .regular))
ZStack (alignment: .top) {
ScrollView(.vertical, showsIndicators: false) {
VStack (spacing: 20) {
ForEach(vm.classes.indices, id: \.self) { index in
if index != 0 && index != 1 && index == vm.selectedIndex {
let daySchedule = vm.classes[index] // Это массив строк для дня
ForEach(daySchedule.indices.dropFirst(), id: \.self) { lessonIndex in
let lesson = daySchedule[lessonIndex] // Это строка с расписанием одной пары
if !lesson.isEmpty {
HStack(spacing: 10) {
VStack {
Text(convertTimeString(vm.classes[1][lessonIndex])[0])
.font(.system(size: 15, weight: .regular))
Text(convertTimeString(vm.classes[1][lessonIndex])[1])
.font(.system(size: 15, weight: .regular))
}
.padding(.top, 7)
.padding(.bottom, 7)
.padding(.leading, 10)
Rectangle()
.frame(width: 2)
.frame(maxHeight: UIScreen.main.bounds.height - 18)
.padding(.top, 7)
.padding(.bottom, 7)
.foregroundColor(onlineOrOffline(lesson) ? Color("greenForOffline") : Color("blueForOnline"))
Text(lesson)
.font(.system(size: 18, weight: .regular))
.padding(.top, 7)
.padding(.bottom, 7)
Spacer()
}
.padding(.top, 7)
.padding(.bottom, 7)
.padding(.leading, 10)
Rectangle()
.frame(width: 2)
.frame(maxHeight: UIScreen.main.bounds.height - 18)
.padding(.top, 7)
.padding(.bottom, 7)
.foregroundColor(onlineOrOffline(lesson) ? Color("greenForOffline") : Color("blueForOnline"))
Text(lesson)
.font(.system(size: 18, weight: .regular))
.padding(.top, 7)
.padding(.bottom, 7)
Spacer()
.frame(maxWidth: UIScreen.main.bounds.width - 40, maxHeight: 230)
.background(Color.white)
.cornerRadius(20)
.shadow(color: .black.opacity(0.25), radius: 4, x: 2, y: 2)
}
.frame(maxWidth: UIScreen.main.bounds.width - 40, maxHeight: 230)
.background(Color.white)
.cornerRadius(20)
.shadow(color: .black.opacity(0.25), radius: 4, x: 4, y: 4)
}
}
}
}
.frame(width: UIScreen.main.bounds.width)
.padding(.bottom, 100)
.padding(.top, 30)
}
VStack {
Rectangle()
.frame(width: UIScreen.main.bounds.width, height: 25)
.foregroundColor(Color("background").opacity(0.9))
}
.frame(width: UIScreen.main.bounds.width)
.padding(.bottom, 100)
.padding(.top, 10)
}
}