This commit is contained in:
Vladimir Dubovik
2025-02-19 12:43:52 +03:00
parent 9f717d83df
commit bb268cc6ad
31 changed files with 335 additions and 95 deletions

View File

@ -2,7 +2,7 @@
// CreatedClassView.swift
// Schedule ICTIS
//
// Created by G412 on 23.12.2024.
// Created by Mironov Egor on 23.12.2024.
//
import SwiftUI
@ -12,7 +12,7 @@ struct CreatedClassView: View {
var provider = ClassProvider.shared
var body: some View {
let existingCopy = try? provider.viewContext.existingObject(with: _class.objectID)
if let check = existingCopy {
if existingCopy != nil {
HStack(spacing: 10) {
VStack {
Text(getTimeString(_class.starttime))
@ -20,6 +20,7 @@ struct CreatedClassView: View {
Text(getTimeString(_class.endtime))
.font(.custom("Montserrat-Regular", size: 15))
}
.frame(width: 48)
.padding(.top, 7)
.padding(.bottom, 7)
.padding(.leading, 10)
@ -30,7 +31,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-Regular", size: 18))
.font(.custom("Montserrat-Medium", size: 15))
.padding(.top, 7)
.padding(.bottom, 7)
Spacer()

View File

@ -18,7 +18,7 @@ struct AuditoryFieldView: View {
.padding(.leading, 12)
.padding(.trailing, 14)
TextField(labelForField, text: $text)
.font(.custom("Montserrat-Regular", size: 18))
.font(.custom("Montserrat-Meduim", size: 17))
.disableAutocorrection(true)
.submitLabel(.done)
.focused($isFocused)

View File

@ -14,7 +14,7 @@ struct CommentFieldView: View {
var body: some View {
HStack {
TextField("Комментарий", text: $textForComment)
.font(.custom("Montserrat-Regular", size: 18))
.font(.custom("Montserrat-Medium", size: 17))
.submitLabel(.done)
.multilineTextAlignment(.leading)
.focused($isFocused)

View File

@ -18,7 +18,7 @@ struct ProfessorFieldView: View {
.padding(.leading, 12)
.padding(.trailing, 7)
TextField(labelForField, text: $text)
.font(.custom("Montserrat-Regular", size: 18))
.font(.custom("Montserrat-Meduim", size: 17))
.disableAutocorrection(true)
.submitLabel(.done)
.focused($isFocused)

View File

@ -23,7 +23,7 @@ struct StartEndTimeFieldView: View {
if !isTimeSelected || isIncorrectDate {
Text(text)
.font(.custom("Montserrat-Regular", size: 17))
.font(.custom("Montserrat-Meduim", size: 17))
.foregroundColor(.gray.opacity(0.5))
}
else {

View File

@ -19,7 +19,7 @@ struct SubjectFieldView: View {
.padding(.leading, 12)
.padding(.trailing, 9)
TextField(labelForField, text: $text)
.font(.custom("Montserrat-Regular", size: 18))
.font(.custom("Montserrat-Meduim", size: 17))
.disableAutocorrection(true)
.submitLabel(.done)
.focused($isFocused)
@ -33,10 +33,10 @@ struct SubjectFieldView: View {
Group {
if isShowingSubjectFieldRed {
Text("Поле должно быть заполнено!")
.font(.custom("Montserrat-Regular", size: 18))
.font(.custom("Montserrat-Meduim", size: 17))
.foregroundColor(.red)
.frame(width: 290)
.padding(.leading, -42)
.padding(.leading, -38)
}
}
}

View File

@ -2,7 +2,7 @@
// FirstLaunchScheduleView.swift
// Schedule ICTIS
//
// Created by G412 on 06.12.2024.
// Created by Mironov Egor on 06.12.2024.
//
import SwiftUI

View File

@ -1,25 +0,0 @@
//
// LoadingView.swift
// Schedule ICTIS
//
// Created by G412 on 11.12.2024.
//
import SwiftUI
struct LoadingView: View {
@Binding var isLoading: Bool
var body: some View {
ZStack {
Color("background")
.ignoresSafeArea()
ProgressView()
.progressViewStyle(CircularProgressViewStyle(tint: .secondary))
.scaleEffect(1)
}
}
}
#Preview {
LoadingView(isLoading: .constant(true))
}

View File

@ -24,27 +24,25 @@ struct MainView: View {
}
CurrentDateView()
if vm.isLoading {
LoadingView(isLoading: $vm.isLoading)
LoadingScheduleView()
}
else {
ScheduleView(vm: vm, isScrolling: $isScrolling)
.onTapGesture {
isFocusedSearchBar = false
}
}
}
.alert(isPresented: $vm.isShowingAlertForIncorrectGroup, error: vm.errorInNetwork) { error in
Button("ОК") {
print("This alert")
vm.isShowingAlertForIncorrectGroup = false
vm.errorInNetwork = nil
}
} message: { error in
Text(error.failureReason)
}
.background(Color("background"))
.onTapGesture {
isFocusedSearchBar = false
}
.onAppear {
vm.group = UserDefaults.standard.string(forKey: "group") ?? "notSeted"
if vm.group != "notSeted" {
}
}
}
@ViewBuilder
@ -53,14 +51,14 @@ struct MainView: View {
HStack {
VStack (alignment: .leading, spacing: 0) {
Text(vm.selectedDay.format("EEEE"))
.font(.custom("Montserrat-SemiBold", size: 40))
.font(.custom("Montserrat-SemiBold", size: 30))
.foregroundStyle(.black)
HStack (spacing: 5) {
Text(vm.selectedDay.format("dd"))
.font(.custom("Montserrat-Bold", size: 20))
.font(.custom("Montserrat-Bold", size: 17))
.foregroundStyle(Color("grayForDate"))
Text(vm.selectedDay.format("MMMM"))
.font(.custom("Montserrat-Bold", size: 20))
.font(.custom("Montserrat-Bold", size: 17))
.foregroundStyle(Color("grayForDate"))
Spacer()
Button(action: {
@ -70,7 +68,7 @@ struct MainView: View {
}) {
HStack(spacing: 2) {
Text(isShowingMonthSlider ? "Свернуть" : "Развернуть")
.font(.custom("Montserrat-Light", size: 16))
.font(.custom("Montserrat-Regular", size: 15))
.foregroundStyle(Color.blue)
Image(isShowingMonthSlider ? "arrowup" : "arrowdown")
.resizable()

View File

@ -2,7 +2,7 @@
// NoScheduleView.swift
// Schedule ICTIS
//
// Created by G412 on 12.12.2024.
// Created by Mironov Egor on 12.12.2024.
//
import SwiftUI
@ -11,9 +11,9 @@ struct NoScheduleView: View {
var body: some View {
VStack {
ScrollView (showsIndicators: false) {
Text("Пока расписания нет")
.padding(.top, 20)
.font(.custom("Montserrat-Regular", size: 15))
Text("Пока что расписания нет😪")
.padding(.top, 100)
.font(.custom("Montserrat-SemiBold", size: 17))
}
}
}

View File

@ -17,7 +17,7 @@ struct ScheduleView: View {
var provider = ClassProvider.shared
var body: some View {
if vm.isLoading {
LoadingView(isLoading: $vm.isLoading)
LoadingScheduleView()
}
else {
if vm.errorInNetwork != .invalidResponse {
@ -33,12 +33,13 @@ struct ScheduleView: View {
HStack(spacing: 10) {
VStack {
Text(convertTimeString(vm.classes[1][lessonIndex])[0])
.font(.custom("Montserrat-Medium", size: 15))
.font(.custom("Montserrat-Regular", size: 15))
.padding(.bottom, 1)
Text(convertTimeString(vm.classes[1][lessonIndex])[1])
.font(.custom("Montserrat-Medium", size: 15))
.font(.custom("Montserrat-Regular", size: 15))
.padding(.top, 1)
}
.frame(width: 48)
.padding(.top, 7)
.padding(.bottom, 7)
.padding(.leading, 10)
@ -49,7 +50,7 @@ struct ScheduleView: View {
.padding(.bottom, 7)
.foregroundColor(getColorForClass(lesson))
Text(lesson)
.font(.custom("Montserrat-Regular", size: 17))
.font(.custom("Montserrat-Medium", size: 15))
.lineSpacing(3)
.padding(.top, 9)
.padding(.bottom, 9)

View File

@ -28,8 +28,8 @@ struct SearchBarView: View {
.onSubmit {
self.isFocused = false
if (!text.isEmpty) {
print(vm.errorInNetwork)
vm.fetchWeekSchedule(group: text)
vm.group = text
}
self.text = ""
}
@ -53,7 +53,7 @@ struct SearchBarView: View {
RoundedRectangle(cornerRadius: 10)
.fill(.white)
)
if (!vm.isFirstStartOffApp && !isFocused) {
if !isFocused {
Button {
isShowingSheet = true
} label: {

View File

@ -76,11 +76,11 @@ struct CreateEditClassView: View {
.padding(.trailing, 5)
Text("Дата")
.foregroundColor(Color("grayForFields").opacity(0.5))
.font(.custom("Montserrat-Regular", size: 18))
.font(.custom("Montserrat-Meduim", size: 17))
Spacer()
Text("\(vm._class.day, formatter: dateFormatter)")
.foregroundColor(.black)
.font(.custom("Montserrat-Medium", size: 18))
.font(.custom("Montserrat-Medium", size: 17))
.padding(.trailing, 20)
}
.frame(height: 40)

View File

@ -18,7 +18,7 @@ struct MonthTabView: View {
HStack (spacing: 34) {
ForEach(MockData.daysOfWeek.indices, id: \.self) { index in
Text(MockData.daysOfWeek[index])
.font(.custom("Montserrat-SemiBold", size: 15))
.font(.custom("Montserrat-SemiBold", size: 14))
.foregroundColor(MockData.daysOfWeek[index] == "Вс" ? Color(.red) : Color("customGray2"))
.padding(.top, 13)
.foregroundColor(.gray)

View File

@ -16,7 +16,7 @@ struct WeekViewForMonth: View {
ForEach(week) { day in
VStack {
Text(day.date.format("dd"))
.font(.custom("Montserrat-Medium", size: 15))
.font(.custom("Montserrat-SemiBold", size: 14))
.foregroundStyle(getForegroundColor(day: day))
}
.frame(width: 30, height: 30, alignment: .center)

View File

@ -18,12 +18,12 @@ struct WeekViewForWeek: View {
ForEach(week) { day in
VStack (spacing: 1) {
Text(day.date.format("E"))
.font(.custom("Montserrat-Medium", size: 16))
.font(.custom("Montserrat-SemiBold", size: 14))
.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-Medium", size: 15))
.font(.custom("Montserrat-Semibold", size: 14))
.foregroundStyle(isSameDate(day.date, vm.selectedDay) ? .white : .black)
.padding(.bottom, 13)
}