Commit
This commit is contained in:
@ -16,10 +16,10 @@ struct CreatedClassView: View {
|
||||
HStack(spacing: 15) {
|
||||
VStack {
|
||||
Text(getTimeString(_class.starttime))
|
||||
.font(.custom("Montserrat-Regular", size: 15))
|
||||
.font(.custom("Montserrat-Regular", fixedSize: 15))
|
||||
.padding(.bottom, 1)
|
||||
Text(getTimeString(_class.endtime))
|
||||
.font(.custom("Montserrat-Regular", size: 15))
|
||||
.font(.custom("Montserrat-Regular", fixedSize: 15))
|
||||
.padding(.top, 1)
|
||||
}
|
||||
.frame(width: 48)
|
||||
@ -33,7 +33,7 @@ struct CreatedClassView: View {
|
||||
.padding(.bottom, 7)
|
||||
.foregroundColor(_class.important ? Color("redForImportant") : onlineOrNot(_class.online))
|
||||
Text(getSubjectName(_class.subject, _class.professor, _class.auditory))
|
||||
.font(.custom("Montserrat-Medium", size: 15))
|
||||
.font(.custom("Montserrat-Medium", fixedSize: 15))
|
||||
.lineSpacing(3)
|
||||
.padding(.top, 9)
|
||||
.padding(.bottom, 9)
|
||||
|
@ -18,7 +18,7 @@ struct AuditoryFieldView: View {
|
||||
.padding(.leading, 12)
|
||||
.padding(.trailing, 14)
|
||||
TextField(labelForField, text: $text)
|
||||
.font(.custom("Montserrat-Meduim", size: 17))
|
||||
.font(.custom("Montserrat-Meduim", fixedSize: 17))
|
||||
.disableAutocorrection(true)
|
||||
.submitLabel(.done)
|
||||
.focused($isFocused)
|
||||
|
@ -14,7 +14,7 @@ struct CommentFieldView: View {
|
||||
var body: some View {
|
||||
HStack {
|
||||
TextField("Комментарий", text: $textForComment)
|
||||
.font(.custom("Montserrat-Medium", size: 17))
|
||||
.font(.custom("Montserrat-Medium", fixedSize: 17))
|
||||
.submitLabel(.done)
|
||||
.multilineTextAlignment(.leading)
|
||||
.focused($isFocused)
|
||||
|
@ -18,7 +18,7 @@ struct ProfessorFieldView: View {
|
||||
.padding(.leading, 12)
|
||||
.padding(.trailing, 7)
|
||||
TextField(labelForField, text: $text)
|
||||
.font(.custom("Montserrat-Meduim", size: 17))
|
||||
.font(.custom("Montserrat-Meduim", fixedSize: 17))
|
||||
.disableAutocorrection(true)
|
||||
.submitLabel(.done)
|
||||
.focused($isFocused)
|
||||
|
@ -23,13 +23,13 @@ struct StartEndTimeFieldView: View {
|
||||
|
||||
if !isTimeSelected || isIncorrectDate {
|
||||
Text(text)
|
||||
.font(.custom("Montserrat-Meduim", size: 17))
|
||||
.font(.custom("Montserrat-Meduim", fixedSize: 17))
|
||||
.foregroundColor(.gray.opacity(0.5))
|
||||
}
|
||||
else {
|
||||
Text("\(selectedTime, formatter: timeFormatter)")
|
||||
.foregroundColor(isIncorrectDate ? .red : .black)
|
||||
.font(.custom("Montserrat-Medium", size: 17))
|
||||
.font(.custom("Montserrat-Medium", fixedSize: 17))
|
||||
.padding(.trailing, 10)
|
||||
}
|
||||
Spacer()
|
||||
|
@ -19,7 +19,7 @@ struct SubjectFieldView: View {
|
||||
.padding(.leading, 12)
|
||||
.padding(.trailing, 9)
|
||||
TextField(labelForField, text: $text)
|
||||
.font(.custom("Montserrat-Meduim", size: 17))
|
||||
.font(.custom("Montserrat-Meduim", fixedSize: 17))
|
||||
.disableAutocorrection(true)
|
||||
.submitLabel(.done)
|
||||
.focused($isFocused)
|
||||
@ -33,7 +33,7 @@ struct SubjectFieldView: View {
|
||||
Group {
|
||||
if isShowingSubjectFieldRed {
|
||||
Text("Поле должно быть заполнено!")
|
||||
.font(.custom("Montserrat-Meduim", size: 17))
|
||||
.font(.custom("Montserrat-Meduim", fixedSize: 17))
|
||||
.foregroundColor(.red)
|
||||
.frame(width: 290)
|
||||
.padding(.leading, -38)
|
||||
|
@ -13,6 +13,7 @@ struct MainView: View {
|
||||
@ObservedObject var vm: ScheduleViewModel
|
||||
@FocusState private var isFocusedSearchBar: Bool
|
||||
@State private var isScrolling: Bool = false
|
||||
@State private var isShowingVPKLabel = false
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
@ -27,7 +28,7 @@ struct MainView: View {
|
||||
LoadingScheduleView()
|
||||
}
|
||||
else {
|
||||
ScheduleView(vm: vm, isScrolling: $isScrolling)
|
||||
ScheduleView(vm: vm, isScrolling: $isScrolling, isShowingVPKLabel: $isShowingVPKLabel)
|
||||
}
|
||||
}
|
||||
.alert(isPresented: $vm.isShowingAlertForIncorrectGroup, error: vm.errorInNetwork) { error in
|
||||
@ -48,14 +49,14 @@ struct MainView: View {
|
||||
HStack {
|
||||
VStack (alignment: .leading, spacing: 0) {
|
||||
Text(vm.selectedDay.format("EEEE"))
|
||||
.font(.custom("Montserrat-SemiBold", size: 30))
|
||||
.font(.custom("Montserrat-SemiBold", fixedSize: 30))
|
||||
.foregroundStyle(.black)
|
||||
HStack (spacing: 5) {
|
||||
Text(vm.selectedDay.format("dd"))
|
||||
.font(.custom("Montserrat-Bold", size: 17))
|
||||
.font(.custom("Montserrat-Bold", fixedSize: 17))
|
||||
.foregroundStyle(Color("grayForDate"))
|
||||
Text(vm.selectedDay.format("MMMM"))
|
||||
.font(.custom("Montserrat-Bold", size: 17))
|
||||
.font(.custom("Montserrat-Bold", fixedSize: 17))
|
||||
.foregroundStyle(Color("grayForDate"))
|
||||
Spacer()
|
||||
Button(action: {
|
||||
@ -65,7 +66,7 @@ struct MainView: View {
|
||||
}) {
|
||||
HStack(spacing: 2) {
|
||||
Text(isShowingMonthSlider ? "Свернуть" : "Развернуть")
|
||||
.font(.custom("Montserrat-Regular", size: 15))
|
||||
.font(.custom("Montserrat-Regular", fixedSize: 15))
|
||||
.foregroundStyle(Color.blue)
|
||||
Image(isShowingMonthSlider ? "arrowup" : "arrowdown")
|
||||
.resizable()
|
||||
@ -80,11 +81,11 @@ struct MainView: View {
|
||||
Spacer()
|
||||
}
|
||||
if (!isShowingMonthSlider) {
|
||||
WeekTabView(vm: vm)
|
||||
WeekTabView(vm: vm, isShowingVPKLabel: $isShowingVPKLabel)
|
||||
.transition(.opacity)
|
||||
}
|
||||
else {
|
||||
MonthTabView(vm: vm)
|
||||
MonthTabView(vm: vm, isShowingVPKLabel: $isShowingVPKLabel)
|
||||
.transition(.opacity)
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ struct NoScheduleView: View {
|
||||
ScrollView (showsIndicators: false) {
|
||||
Text("Пока что расписания нет😪")
|
||||
.padding(.top, 100)
|
||||
.font(.custom("Montserrat-SemiBold", size: 17))
|
||||
.font(.custom("Montserrat-SemiBold", fixedSize: 17))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ struct ScheduleView: View {
|
||||
@State private var scrollTimer: Timer? = nil
|
||||
@State private var isShowingMyPairs = false
|
||||
@Binding var isScrolling: Bool
|
||||
@Binding var isShowingVPKLabel: Bool
|
||||
var provider = ClassProvider.shared
|
||||
var body: some View {
|
||||
if vm.isLoading {
|
||||
@ -27,7 +28,7 @@ struct ScheduleView: View {
|
||||
VStack (spacing: 30) {
|
||||
VStack (alignment: .leading, spacing: 20 ) {
|
||||
Text("Учебное расписание")
|
||||
.font(.custom("Montserrat-Bold", size: 20))
|
||||
.font(.custom("Montserrat-Bold", fixedSize: 20))
|
||||
ForEach(vm.classes.indices, id: \.self) { index in
|
||||
if index != 0 && index != 1 && index == vm.selectedIndex {
|
||||
let daySchedule = vm.classes[index] // Это массив строк для дня
|
||||
@ -37,10 +38,10 @@ struct ScheduleView: View {
|
||||
HStack(spacing: 15) {
|
||||
VStack {
|
||||
Text(convertTimeString(vm.classes[1][lessonIndex])[0])
|
||||
.font(.custom("Montserrat-Regular", size: 15))
|
||||
.font(.custom("Montserrat-Regular", fixedSize: 15))
|
||||
.padding(.bottom, 1)
|
||||
Text(convertTimeString(vm.classes[1][lessonIndex])[1])
|
||||
.font(.custom("Montserrat-Regular", size: 15))
|
||||
.font(.custom("Montserrat-Regular", fixedSize: 15))
|
||||
.padding(.top, 1)
|
||||
}
|
||||
.frame(width: 48)
|
||||
@ -54,7 +55,7 @@ struct ScheduleView: View {
|
||||
.padding(.bottom, 7)
|
||||
.foregroundColor(getColorForClass(lesson))
|
||||
Text(lesson)
|
||||
.font(.custom("Montserrat-Medium", size: 15))
|
||||
.font(.custom("Montserrat-Medium", fixedSize: 16))
|
||||
.lineSpacing(3)
|
||||
.padding(.top, 9)
|
||||
.padding(.bottom, 9)
|
||||
@ -72,7 +73,7 @@ struct ScheduleView: View {
|
||||
if classes.contains(where: { daysAreEqual($0.day, vm.selectedDay) }) {
|
||||
VStack(alignment: .leading, spacing: 20) {
|
||||
Text("Мои пары")
|
||||
.font(.custom("Montserrat-Bold", size: 20))
|
||||
.font(.custom("Montserrat-Bold", fixedSize: 20))
|
||||
ForEach(classes) { _class in
|
||||
if daysAreEqual(_class.day, vm.selectedDay) {
|
||||
CreatedClassView(_class: _class)
|
||||
@ -85,8 +86,10 @@ struct ScheduleView: View {
|
||||
}
|
||||
if UserDefaults.standard.string(forKey: "vpk") != nil {
|
||||
VStack (alignment: .leading, spacing: 20 ) {
|
||||
Text("ВПК")
|
||||
.font(.custom("Montserrat-Bold", size: 20))
|
||||
if isShowingVPKLabel {
|
||||
Text("ВПК")
|
||||
.font(.custom("Montserrat-Bold", fixedSize: 20))
|
||||
}
|
||||
ForEach(vm.vpks.indices, id: \.self) { index in
|
||||
if index != 0 && index != 1 && index == vm.selectedIndex {
|
||||
let dayVPK = vm.vpks[index] // Это массив строк для дня
|
||||
@ -96,10 +99,10 @@ struct ScheduleView: View {
|
||||
HStack(spacing: 15) {
|
||||
VStack {
|
||||
Text(convertTimeString(vm.vpks[1][lessonIndex])[0])
|
||||
.font(.custom("Montserrat-Regular", size: 15))
|
||||
.font(.custom("Montserrat-Regular", fixedSize: 15))
|
||||
.padding(.bottom, 1)
|
||||
Text(convertTimeString(vm.vpks[1][lessonIndex])[1])
|
||||
.font(.custom("Montserrat-Regular", size: 15))
|
||||
.font(.custom("Montserrat-Regular", fixedSize: 15))
|
||||
.padding(.top, 1)
|
||||
}
|
||||
.frame(width: 48)
|
||||
@ -113,7 +116,7 @@ struct ScheduleView: View {
|
||||
.padding(.bottom, 7)
|
||||
.foregroundColor(getColorForClass(lesson))
|
||||
Text(lesson)
|
||||
.font(.custom("Montserrat-Medium", size: 15))
|
||||
.font(.custom("Montserrat-Medium", fixedSize: 16))
|
||||
.lineSpacing(3)
|
||||
.padding(.top, 9)
|
||||
.padding(.bottom, 9)
|
||||
@ -123,6 +126,9 @@ struct ScheduleView: View {
|
||||
.background(Color.white)
|
||||
.cornerRadius(20)
|
||||
.shadow(color: .black.opacity(0.25), radius: 4, x: 2, y: 2)
|
||||
.onAppear {
|
||||
isShowingVPKLabel = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ struct CreateEditClassView: View {
|
||||
.padding(.bottom, 10)
|
||||
HStack {
|
||||
Text("Тип")
|
||||
.font(.custom("Montserrat-Medium", size: 17))
|
||||
.font(.custom("Montserrat-Medium", fixedSize: 17))
|
||||
Spacer()
|
||||
Picker("Тип", selection: $vm._class.online, content: {
|
||||
ForEach(MockData.onlineOrOffline, id: \.self) {
|
||||
@ -76,11 +76,11 @@ struct CreateEditClassView: View {
|
||||
.padding(.trailing, 5)
|
||||
Text("Дата")
|
||||
.foregroundColor(Color("grayForFields").opacity(0.5))
|
||||
.font(.custom("Montserrat-Meduim", size: 17))
|
||||
.font(.custom("Montserrat-Meduim", fixedSize: 17))
|
||||
Spacer()
|
||||
Text("\(vm._class.day, formatter: dateFormatter)")
|
||||
.foregroundColor(.black)
|
||||
.font(.custom("Montserrat-Medium", size: 17))
|
||||
.font(.custom("Montserrat-Medium", fixedSize: 17))
|
||||
.padding(.trailing, 20)
|
||||
}
|
||||
.frame(height: 40)
|
||||
@ -128,7 +128,7 @@ struct CreateEditClassView: View {
|
||||
.frame(height: 40)
|
||||
.padding(.bottom, 10)
|
||||
Toggle("Пометить как важную", isOn: $vm._class.important)
|
||||
.font(.custom("Montserrat-Medium", size: 17))
|
||||
.font(.custom("Montserrat-Medium", fixedSize: 17))
|
||||
.frame(height: 40)
|
||||
.padding(.horizontal)
|
||||
.background(
|
||||
@ -136,14 +136,14 @@ struct CreateEditClassView: View {
|
||||
.fill(.white)
|
||||
)
|
||||
.padding(.bottom, 10)
|
||||
|
||||
HStack {
|
||||
Text("Напоминанние")
|
||||
.font(.custom("Montserrat-Medium", size: 17))
|
||||
.font(.custom("Montserrat-Medium", fixedSize: 17))
|
||||
Spacer()
|
||||
Picker("Напоминание", selection: $vm._class.notification, content: {
|
||||
ForEach(MockData.notifications, id: \.self) {
|
||||
Text($0)
|
||||
.font(.custom("Montserrat-Medium", fixedSize: 17))
|
||||
}
|
||||
})
|
||||
.accentColor(Color("grayForFields"))
|
||||
@ -173,7 +173,7 @@ struct CreateEditClassView: View {
|
||||
Spacer()
|
||||
Image(systemName: "trash")
|
||||
Text("Удалить занятие")
|
||||
.font(.custom("Montserrat-Medium", size: 17))
|
||||
.font(.custom("Montserrat-Medium", fixedSize: 17))
|
||||
Spacer()
|
||||
}
|
||||
.frame(height: 40)
|
||||
|
@ -13,12 +13,13 @@ struct MonthTabView: View {
|
||||
@State private var createMonth: Bool = false
|
||||
@State private var currentWeekIndex: Int = 0
|
||||
@ObservedObject var vm: ScheduleViewModel
|
||||
@Binding var isShowingVPKLabel: Bool
|
||||
var body: some View {
|
||||
VStack {
|
||||
HStack (spacing: 34) {
|
||||
ForEach(MockData.daysOfWeek.indices, id: \.self) { index in
|
||||
Text(MockData.daysOfWeek[index])
|
||||
.font(.custom("Montserrat-SemiBold", size: 14))
|
||||
.font(.custom("Montserrat-SemiBold", fixedSize: 15))
|
||||
.foregroundColor(MockData.daysOfWeek[index] == "Вс" ? Color(.red) : Color("customGray2"))
|
||||
.padding(.top, 13)
|
||||
.foregroundColor(.gray)
|
||||
@ -60,7 +61,7 @@ struct MonthTabView: View {
|
||||
VStack (spacing: 10) {
|
||||
ForEach(month.indices, id: \.self) { index in
|
||||
let week = month[index].week
|
||||
WeekViewForMonth(week: week, vm: vm)
|
||||
WeekViewForMonth(week: week, vm: vm, isShowingVPKLabel: $isShowingVPKLabel)
|
||||
}
|
||||
}
|
||||
.background {
|
||||
|
@ -12,12 +12,13 @@ struct WeekTabView: View {
|
||||
@State var weekSlider: [[Date.WeekDay]] = []
|
||||
@State private var createWeek: Bool = false
|
||||
@ObservedObject var vm: ScheduleViewModel
|
||||
@Binding var isShowingVPKLabel: Bool
|
||||
var body: some View {
|
||||
HStack {
|
||||
TabView(selection: $currentWeekIndex) {
|
||||
ForEach(weekSlider.indices, id: \.self) { index in
|
||||
let week = weekSlider[index]
|
||||
WeekViewForWeek(weekSlider: $weekSlider, currentWeekIndex: $currentWeekIndex, createWeek: $createWeek, week: week, vm: vm)
|
||||
WeekViewForWeek(weekSlider: $weekSlider, currentWeekIndex: $currentWeekIndex, createWeek: $createWeek, week: week, vm: vm, isShowingVPKLabel: $isShowingVPKLabel)
|
||||
.padding(.horizontal, 15)
|
||||
.tag(index)
|
||||
}
|
||||
|
@ -10,13 +10,14 @@ import SwiftUI
|
||||
struct WeekViewForMonth: View {
|
||||
let week: [Date.WeekDay]
|
||||
@ObservedObject var vm: ScheduleViewModel
|
||||
@Binding var isShowingVPKLabel: Bool
|
||||
|
||||
var body: some View {
|
||||
HStack(spacing: 23) {
|
||||
ForEach(week) { day in
|
||||
VStack {
|
||||
Text(day.date.format("dd"))
|
||||
.font(.custom("Montserrat-SemiBold", size: 14))
|
||||
.font(.custom("Montserrat-SemiBold", fixedSize: 15))
|
||||
.foregroundStyle(getForegroundColor(day: day))
|
||||
}
|
||||
.frame(width: 30, height: 30, alignment: .center)
|
||||
@ -25,6 +26,7 @@ struct WeekViewForMonth: View {
|
||||
.cornerRadius(15)
|
||||
.onTapGesture {
|
||||
handleTap(day: day)
|
||||
isShowingVPKLabel = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,17 +13,18 @@ struct WeekViewForWeek: View {
|
||||
@Binding var createWeek: Bool
|
||||
let week: [Date.WeekDay]
|
||||
@ObservedObject var vm: ScheduleViewModel
|
||||
@Binding var isShowingVPKLabel: Bool
|
||||
var body: some View {
|
||||
HStack (spacing: 10) {
|
||||
ForEach(week) { day in
|
||||
VStack (spacing: 1) {
|
||||
Text(day.date.format("E"))
|
||||
.font(.custom("Montserrat-SemiBold", size: 14))
|
||||
.font(.custom("Montserrat-SemiBold", fixedSize: 15))
|
||||
.foregroundColor(day.date.format("E") == "Вс" ? Color(.red) : isSameDate(day.date, vm.selectedDay) ? Color("customGray1") : Color("customGray3"))
|
||||
.padding(.top, 13)
|
||||
.foregroundColor(.gray)
|
||||
Text(day.date.format("dd"))
|
||||
.font(.custom("Montserrat-Semibold", size: 14))
|
||||
.font(.custom("Montserrat-Semibold", fixedSize: 15))
|
||||
.foregroundStyle(isSameDate(day.date, vm.selectedDay) ? .white : .black)
|
||||
.padding(.bottom, 13)
|
||||
}
|
||||
@ -52,6 +53,7 @@ struct WeekViewForWeek: View {
|
||||
)
|
||||
.cornerRadius(15)
|
||||
.onTapGesture {
|
||||
isShowingVPKLabel = false
|
||||
vm.selectedDay = day.date
|
||||
vm.updateSelectedDayIndex()
|
||||
}
|
||||
|
Reference in New Issue
Block a user