This commit is contained in:
Vladimir Dubovik 2025-02-25 15:25:45 +03:00
parent 9c6515a2f5
commit b719ab300d
21 changed files with 305 additions and 74 deletions

View File

@ -16,10 +16,10 @@ struct CreatedClassView: View {
HStack(spacing: 15) { HStack(spacing: 15) {
VStack { VStack {
Text(getTimeString(_class.starttime)) Text(getTimeString(_class.starttime))
.font(.custom("Montserrat-Regular", size: 15)) .font(.custom("Montserrat-Regular", fixedSize: 15))
.padding(.bottom, 1) .padding(.bottom, 1)
Text(getTimeString(_class.endtime)) Text(getTimeString(_class.endtime))
.font(.custom("Montserrat-Regular", size: 15)) .font(.custom("Montserrat-Regular", fixedSize: 15))
.padding(.top, 1) .padding(.top, 1)
} }
.frame(width: 48) .frame(width: 48)
@ -33,7 +33,7 @@ struct CreatedClassView: View {
.padding(.bottom, 7) .padding(.bottom, 7)
.foregroundColor(_class.important ? Color("redForImportant") : onlineOrNot(_class.online)) .foregroundColor(_class.important ? Color("redForImportant") : onlineOrNot(_class.online))
Text(getSubjectName(_class.subject, _class.professor, _class.auditory)) Text(getSubjectName(_class.subject, _class.professor, _class.auditory))
.font(.custom("Montserrat-Medium", size: 15)) .font(.custom("Montserrat-Medium", fixedSize: 15))
.lineSpacing(3) .lineSpacing(3)
.padding(.top, 9) .padding(.top, 9)
.padding(.bottom, 9) .padding(.bottom, 9)

View File

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

View File

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

View File

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

View File

@ -23,13 +23,13 @@ struct StartEndTimeFieldView: View {
if !isTimeSelected || isIncorrectDate { if !isTimeSelected || isIncorrectDate {
Text(text) Text(text)
.font(.custom("Montserrat-Meduim", size: 17)) .font(.custom("Montserrat-Meduim", fixedSize: 17))
.foregroundColor(.gray.opacity(0.5)) .foregroundColor(.gray.opacity(0.5))
} }
else { else {
Text("\(selectedTime, formatter: timeFormatter)") Text("\(selectedTime, formatter: timeFormatter)")
.foregroundColor(isIncorrectDate ? .red : .black) .foregroundColor(isIncorrectDate ? .red : .black)
.font(.custom("Montserrat-Medium", size: 17)) .font(.custom("Montserrat-Medium", fixedSize: 17))
.padding(.trailing, 10) .padding(.trailing, 10)
} }
Spacer() Spacer()

View File

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

View File

@ -13,6 +13,7 @@ struct MainView: View {
@ObservedObject var vm: ScheduleViewModel @ObservedObject var vm: ScheduleViewModel
@FocusState private var isFocusedSearchBar: Bool @FocusState private var isFocusedSearchBar: Bool
@State private var isScrolling: Bool = false @State private var isScrolling: Bool = false
@State private var isShowingVPKLabel = false
var body: some View { var body: some View {
VStack { VStack {
@ -27,7 +28,7 @@ struct MainView: View {
LoadingScheduleView() LoadingScheduleView()
} }
else { else {
ScheduleView(vm: vm, isScrolling: $isScrolling) ScheduleView(vm: vm, isScrolling: $isScrolling, isShowingVPKLabel: $isShowingVPKLabel)
} }
} }
.alert(isPresented: $vm.isShowingAlertForIncorrectGroup, error: vm.errorInNetwork) { error in .alert(isPresented: $vm.isShowingAlertForIncorrectGroup, error: vm.errorInNetwork) { error in
@ -48,14 +49,14 @@ struct MainView: View {
HStack { HStack {
VStack (alignment: .leading, spacing: 0) { VStack (alignment: .leading, spacing: 0) {
Text(vm.selectedDay.format("EEEE")) Text(vm.selectedDay.format("EEEE"))
.font(.custom("Montserrat-SemiBold", size: 30)) .font(.custom("Montserrat-SemiBold", fixedSize: 30))
.foregroundStyle(.black) .foregroundStyle(.black)
HStack (spacing: 5) { HStack (spacing: 5) {
Text(vm.selectedDay.format("dd")) Text(vm.selectedDay.format("dd"))
.font(.custom("Montserrat-Bold", size: 17)) .font(.custom("Montserrat-Bold", fixedSize: 17))
.foregroundStyle(Color("grayForDate")) .foregroundStyle(Color("grayForDate"))
Text(vm.selectedDay.format("MMMM")) Text(vm.selectedDay.format("MMMM"))
.font(.custom("Montserrat-Bold", size: 17)) .font(.custom("Montserrat-Bold", fixedSize: 17))
.foregroundStyle(Color("grayForDate")) .foregroundStyle(Color("grayForDate"))
Spacer() Spacer()
Button(action: { Button(action: {
@ -65,7 +66,7 @@ struct MainView: View {
}) { }) {
HStack(spacing: 2) { HStack(spacing: 2) {
Text(isShowingMonthSlider ? "Свернуть" : "Развернуть") Text(isShowingMonthSlider ? "Свернуть" : "Развернуть")
.font(.custom("Montserrat-Regular", size: 15)) .font(.custom("Montserrat-Regular", fixedSize: 15))
.foregroundStyle(Color.blue) .foregroundStyle(Color.blue)
Image(isShowingMonthSlider ? "arrowup" : "arrowdown") Image(isShowingMonthSlider ? "arrowup" : "arrowdown")
.resizable() .resizable()
@ -80,11 +81,11 @@ struct MainView: View {
Spacer() Spacer()
} }
if (!isShowingMonthSlider) { if (!isShowingMonthSlider) {
WeekTabView(vm: vm) WeekTabView(vm: vm, isShowingVPKLabel: $isShowingVPKLabel)
.transition(.opacity) .transition(.opacity)
} }
else { else {
MonthTabView(vm: vm) MonthTabView(vm: vm, isShowingVPKLabel: $isShowingVPKLabel)
.transition(.opacity) .transition(.opacity)
} }
} }

View File

@ -13,7 +13,7 @@ struct NoScheduleView: View {
ScrollView (showsIndicators: false) { ScrollView (showsIndicators: false) {
Text("Пока что расписания нет😪") Text("Пока что расписания нет😪")
.padding(.top, 100) .padding(.top, 100)
.font(.custom("Montserrat-SemiBold", size: 17)) .font(.custom("Montserrat-SemiBold", fixedSize: 17))
} }
} }
} }

View File

@ -15,6 +15,7 @@ struct ScheduleView: View {
@State private var scrollTimer: Timer? = nil @State private var scrollTimer: Timer? = nil
@State private var isShowingMyPairs = false @State private var isShowingMyPairs = false
@Binding var isScrolling: Bool @Binding var isScrolling: Bool
@Binding var isShowingVPKLabel: Bool
var provider = ClassProvider.shared var provider = ClassProvider.shared
var body: some View { var body: some View {
if vm.isLoading { if vm.isLoading {
@ -27,7 +28,7 @@ struct ScheduleView: View {
VStack (spacing: 30) { VStack (spacing: 30) {
VStack (alignment: .leading, spacing: 20 ) { VStack (alignment: .leading, spacing: 20 ) {
Text("Учебное расписание") Text("Учебное расписание")
.font(.custom("Montserrat-Bold", size: 20)) .font(.custom("Montserrat-Bold", fixedSize: 20))
ForEach(vm.classes.indices, id: \.self) { index in ForEach(vm.classes.indices, id: \.self) { index in
if index != 0 && index != 1 && index == vm.selectedIndex { if index != 0 && index != 1 && index == vm.selectedIndex {
let daySchedule = vm.classes[index] // Это массив строк для дня let daySchedule = vm.classes[index] // Это массив строк для дня
@ -37,10 +38,10 @@ struct ScheduleView: View {
HStack(spacing: 15) { HStack(spacing: 15) {
VStack { VStack {
Text(convertTimeString(vm.classes[1][lessonIndex])[0]) Text(convertTimeString(vm.classes[1][lessonIndex])[0])
.font(.custom("Montserrat-Regular", size: 15)) .font(.custom("Montserrat-Regular", fixedSize: 15))
.padding(.bottom, 1) .padding(.bottom, 1)
Text(convertTimeString(vm.classes[1][lessonIndex])[1]) Text(convertTimeString(vm.classes[1][lessonIndex])[1])
.font(.custom("Montserrat-Regular", size: 15)) .font(.custom("Montserrat-Regular", fixedSize: 15))
.padding(.top, 1) .padding(.top, 1)
} }
.frame(width: 48) .frame(width: 48)
@ -54,7 +55,7 @@ struct ScheduleView: View {
.padding(.bottom, 7) .padding(.bottom, 7)
.foregroundColor(getColorForClass(lesson)) .foregroundColor(getColorForClass(lesson))
Text(lesson) Text(lesson)
.font(.custom("Montserrat-Medium", size: 15)) .font(.custom("Montserrat-Medium", fixedSize: 16))
.lineSpacing(3) .lineSpacing(3)
.padding(.top, 9) .padding(.top, 9)
.padding(.bottom, 9) .padding(.bottom, 9)
@ -72,7 +73,7 @@ struct ScheduleView: View {
if classes.contains(where: { daysAreEqual($0.day, vm.selectedDay) }) { if classes.contains(where: { daysAreEqual($0.day, vm.selectedDay) }) {
VStack(alignment: .leading, spacing: 20) { VStack(alignment: .leading, spacing: 20) {
Text("Мои пары") Text("Мои пары")
.font(.custom("Montserrat-Bold", size: 20)) .font(.custom("Montserrat-Bold", fixedSize: 20))
ForEach(classes) { _class in ForEach(classes) { _class in
if daysAreEqual(_class.day, vm.selectedDay) { if daysAreEqual(_class.day, vm.selectedDay) {
CreatedClassView(_class: _class) CreatedClassView(_class: _class)
@ -85,8 +86,10 @@ struct ScheduleView: View {
} }
if UserDefaults.standard.string(forKey: "vpk") != nil { if UserDefaults.standard.string(forKey: "vpk") != nil {
VStack (alignment: .leading, spacing: 20 ) { VStack (alignment: .leading, spacing: 20 ) {
Text("ВПК") if isShowingVPKLabel {
.font(.custom("Montserrat-Bold", size: 20)) Text("ВПК")
.font(.custom("Montserrat-Bold", fixedSize: 20))
}
ForEach(vm.vpks.indices, id: \.self) { index in ForEach(vm.vpks.indices, id: \.self) { index in
if index != 0 && index != 1 && index == vm.selectedIndex { if index != 0 && index != 1 && index == vm.selectedIndex {
let dayVPK = vm.vpks[index] // Это массив строк для дня let dayVPK = vm.vpks[index] // Это массив строк для дня
@ -96,10 +99,10 @@ struct ScheduleView: View {
HStack(spacing: 15) { HStack(spacing: 15) {
VStack { VStack {
Text(convertTimeString(vm.vpks[1][lessonIndex])[0]) Text(convertTimeString(vm.vpks[1][lessonIndex])[0])
.font(.custom("Montserrat-Regular", size: 15)) .font(.custom("Montserrat-Regular", fixedSize: 15))
.padding(.bottom, 1) .padding(.bottom, 1)
Text(convertTimeString(vm.vpks[1][lessonIndex])[1]) Text(convertTimeString(vm.vpks[1][lessonIndex])[1])
.font(.custom("Montserrat-Regular", size: 15)) .font(.custom("Montserrat-Regular", fixedSize: 15))
.padding(.top, 1) .padding(.top, 1)
} }
.frame(width: 48) .frame(width: 48)
@ -113,7 +116,7 @@ struct ScheduleView: View {
.padding(.bottom, 7) .padding(.bottom, 7)
.foregroundColor(getColorForClass(lesson)) .foregroundColor(getColorForClass(lesson))
Text(lesson) Text(lesson)
.font(.custom("Montserrat-Medium", size: 15)) .font(.custom("Montserrat-Medium", fixedSize: 16))
.lineSpacing(3) .lineSpacing(3)
.padding(.top, 9) .padding(.top, 9)
.padding(.bottom, 9) .padding(.bottom, 9)
@ -123,6 +126,9 @@ struct ScheduleView: View {
.background(Color.white) .background(Color.white)
.cornerRadius(20) .cornerRadius(20)
.shadow(color: .black.opacity(0.25), radius: 4, x: 2, y: 2) .shadow(color: .black.opacity(0.25), radius: 4, x: 2, y: 2)
.onAppear {
isShowingVPKLabel = true
}
} }
} }
} }

View File

@ -31,7 +31,7 @@ struct CreateEditClassView: View {
.padding(.bottom, 10) .padding(.bottom, 10)
HStack { HStack {
Text("Тип") Text("Тип")
.font(.custom("Montserrat-Medium", size: 17)) .font(.custom("Montserrat-Medium", fixedSize: 17))
Spacer() Spacer()
Picker("Тип", selection: $vm._class.online, content: { Picker("Тип", selection: $vm._class.online, content: {
ForEach(MockData.onlineOrOffline, id: \.self) { ForEach(MockData.onlineOrOffline, id: \.self) {
@ -76,11 +76,11 @@ struct CreateEditClassView: View {
.padding(.trailing, 5) .padding(.trailing, 5)
Text("Дата") Text("Дата")
.foregroundColor(Color("grayForFields").opacity(0.5)) .foregroundColor(Color("grayForFields").opacity(0.5))
.font(.custom("Montserrat-Meduim", size: 17)) .font(.custom("Montserrat-Meduim", fixedSize: 17))
Spacer() Spacer()
Text("\(vm._class.day, formatter: dateFormatter)") Text("\(vm._class.day, formatter: dateFormatter)")
.foregroundColor(.black) .foregroundColor(.black)
.font(.custom("Montserrat-Medium", size: 17)) .font(.custom("Montserrat-Medium", fixedSize: 17))
.padding(.trailing, 20) .padding(.trailing, 20)
} }
.frame(height: 40) .frame(height: 40)
@ -128,7 +128,7 @@ struct CreateEditClassView: View {
.frame(height: 40) .frame(height: 40)
.padding(.bottom, 10) .padding(.bottom, 10)
Toggle("Пометить как важную", isOn: $vm._class.important) Toggle("Пометить как важную", isOn: $vm._class.important)
.font(.custom("Montserrat-Medium", size: 17)) .font(.custom("Montserrat-Medium", fixedSize: 17))
.frame(height: 40) .frame(height: 40)
.padding(.horizontal) .padding(.horizontal)
.background( .background(
@ -136,14 +136,14 @@ struct CreateEditClassView: View {
.fill(.white) .fill(.white)
) )
.padding(.bottom, 10) .padding(.bottom, 10)
HStack { HStack {
Text("Напоминанние") Text("Напоминанние")
.font(.custom("Montserrat-Medium", size: 17)) .font(.custom("Montserrat-Medium", fixedSize: 17))
Spacer() Spacer()
Picker("Напоминание", selection: $vm._class.notification, content: { Picker("Напоминание", selection: $vm._class.notification, content: {
ForEach(MockData.notifications, id: \.self) { ForEach(MockData.notifications, id: \.self) {
Text($0) Text($0)
.font(.custom("Montserrat-Medium", fixedSize: 17))
} }
}) })
.accentColor(Color("grayForFields")) .accentColor(Color("grayForFields"))
@ -173,7 +173,7 @@ struct CreateEditClassView: View {
Spacer() Spacer()
Image(systemName: "trash") Image(systemName: "trash")
Text("Удалить занятие") Text("Удалить занятие")
.font(.custom("Montserrat-Medium", size: 17)) .font(.custom("Montserrat-Medium", fixedSize: 17))
Spacer() Spacer()
} }
.frame(height: 40) .frame(height: 40)

View File

@ -13,12 +13,13 @@ struct MonthTabView: View {
@State private var createMonth: Bool = false @State private var createMonth: Bool = false
@State private var currentWeekIndex: Int = 0 @State private var currentWeekIndex: Int = 0
@ObservedObject var vm: ScheduleViewModel @ObservedObject var vm: ScheduleViewModel
@Binding var isShowingVPKLabel: Bool
var body: some View { var body: some View {
VStack { VStack {
HStack (spacing: 34) { HStack (spacing: 34) {
ForEach(MockData.daysOfWeek.indices, id: \.self) { index in ForEach(MockData.daysOfWeek.indices, id: \.self) { index in
Text(MockData.daysOfWeek[index]) Text(MockData.daysOfWeek[index])
.font(.custom("Montserrat-SemiBold", size: 14)) .font(.custom("Montserrat-SemiBold", fixedSize: 15))
.foregroundColor(MockData.daysOfWeek[index] == "Вс" ? Color(.red) : Color("customGray2")) .foregroundColor(MockData.daysOfWeek[index] == "Вс" ? Color(.red) : Color("customGray2"))
.padding(.top, 13) .padding(.top, 13)
.foregroundColor(.gray) .foregroundColor(.gray)
@ -60,7 +61,7 @@ struct MonthTabView: View {
VStack (spacing: 10) { VStack (spacing: 10) {
ForEach(month.indices, id: \.self) { index in ForEach(month.indices, id: \.self) { index in
let week = month[index].week let week = month[index].week
WeekViewForMonth(week: week, vm: vm) WeekViewForMonth(week: week, vm: vm, isShowingVPKLabel: $isShowingVPKLabel)
} }
} }
.background { .background {

View File

@ -12,12 +12,13 @@ struct WeekTabView: View {
@State var weekSlider: [[Date.WeekDay]] = [] @State var weekSlider: [[Date.WeekDay]] = []
@State private var createWeek: Bool = false @State private var createWeek: Bool = false
@ObservedObject var vm: ScheduleViewModel @ObservedObject var vm: ScheduleViewModel
@Binding var isShowingVPKLabel: Bool
var body: some View { var body: some View {
HStack { HStack {
TabView(selection: $currentWeekIndex) { TabView(selection: $currentWeekIndex) {
ForEach(weekSlider.indices, id: \.self) { index in ForEach(weekSlider.indices, id: \.self) { index in
let week = weekSlider[index] 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) .padding(.horizontal, 15)
.tag(index) .tag(index)
} }

View File

@ -10,13 +10,14 @@ import SwiftUI
struct WeekViewForMonth: View { struct WeekViewForMonth: View {
let week: [Date.WeekDay] let week: [Date.WeekDay]
@ObservedObject var vm: ScheduleViewModel @ObservedObject var vm: ScheduleViewModel
@Binding var isShowingVPKLabel: Bool
var body: some View { var body: some View {
HStack(spacing: 23) { HStack(spacing: 23) {
ForEach(week) { day in ForEach(week) { day in
VStack { VStack {
Text(day.date.format("dd")) Text(day.date.format("dd"))
.font(.custom("Montserrat-SemiBold", size: 14)) .font(.custom("Montserrat-SemiBold", fixedSize: 15))
.foregroundStyle(getForegroundColor(day: day)) .foregroundStyle(getForegroundColor(day: day))
} }
.frame(width: 30, height: 30, alignment: .center) .frame(width: 30, height: 30, alignment: .center)
@ -25,6 +26,7 @@ struct WeekViewForMonth: View {
.cornerRadius(15) .cornerRadius(15)
.onTapGesture { .onTapGesture {
handleTap(day: day) handleTap(day: day)
isShowingVPKLabel = false
} }
} }
} }

View File

@ -13,17 +13,18 @@ struct WeekViewForWeek: View {
@Binding var createWeek: Bool @Binding var createWeek: Bool
let week: [Date.WeekDay] let week: [Date.WeekDay]
@ObservedObject var vm: ScheduleViewModel @ObservedObject var vm: ScheduleViewModel
@Binding var isShowingVPKLabel: Bool
var body: some View { var body: some View {
HStack (spacing: 10) { HStack (spacing: 10) {
ForEach(week) { day in ForEach(week) { day in
VStack (spacing: 1) { VStack (spacing: 1) {
Text(day.date.format("E")) 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")) .foregroundColor(day.date.format("E") == "Вс" ? Color(.red) : isSameDate(day.date, vm.selectedDay) ? Color("customGray1") : Color("customGray3"))
.padding(.top, 13) .padding(.top, 13)
.foregroundColor(.gray) .foregroundColor(.gray)
Text(day.date.format("dd")) 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) .foregroundStyle(isSameDate(day.date, vm.selectedDay) ? .white : .black)
.padding(.bottom, 13) .padding(.bottom, 13)
} }
@ -52,6 +53,7 @@ struct WeekViewForWeek: View {
) )
.cornerRadius(15) .cornerRadius(15)
.onTapGesture { .onTapGesture {
isShowingVPKLabel = false
vm.selectedDay = day.date vm.selectedDay = day.date
vm.updateSelectedDayIndex() vm.updateSelectedDayIndex()
} }

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "upDownArrows.svg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,4 @@
<svg width="14" height="18" viewBox="0 0 14 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M1 7L7 1L13 7" stroke="#878787" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M13 11L7 17L1 11" stroke="#878787" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 320 B

View File

@ -0,0 +1,91 @@
//
// GeneralGroupSettings.swift
// Schedule ICTIS
//
// Created by G412 on 25.02.2025.
//
import SwiftUI
struct GeneralGroupSettings: View {
@Binding var selectedTheme: String
@Binding var selectedLanguage: String
var body: some View {
VStack {
HStack {
Text("Тема")
.font(.custom("Montserrat-Medium", fixedSize: 17))
.foregroundColor(.black)
Spacer()
HStack {
Text(selectedTheme)
.font(.custom("Montserrat-Medium", fixedSize: 17))
.foregroundColor(Color("customGray3"))
Image("upDownArrows")
.resizable()
.scaledToFit()
.frame(width: 15, height: 15)
}
.padding(.horizontal)
}
.padding(.horizontal)
.padding(.top, 17)
.padding(.bottom, 7)
.overlay {
HStack {
Spacer()
Picker("", selection: $selectedTheme, content: {
ForEach(MockData.themes, id: \.self) {
Text($0)
}
})
.padding(.trailing, 35)
.blendMode(.destinationOver)
}
.frame(width: UIScreen.main.bounds.width)
}
Rectangle()
.foregroundColor(Color("customGray1"))
.frame(height: 1)
.padding(.horizontal)
HStack {
Text("Язык")
.font(.custom("Montserrat-Medium", fixedSize: 17))
.foregroundColor(.black)
Spacer()
HStack {
Text(selectedLanguage)
.font(.custom("Montserrat-Medium", fixedSize: 17))
.foregroundColor(Color("customGray3"))
Image("upDownArrows")
.resizable()
.scaledToFit()
.frame(width: 15, height: 15)
}
.padding(.horizontal)
}
.padding(.horizontal)
.padding(.top, 7)
.padding(.bottom, 17)
.overlay {
HStack {
Spacer()
Picker("", selection: $selectedLanguage, content: {
ForEach(MockData.languages, id: \.self) {
Text($0)
}
})
.padding(.trailing, 35)
.blendMode(.destinationOver)
}
.frame(width: UIScreen.main.bounds.width)
}
}
.background(Color.white)
.cornerRadius(20)
}
}
#Preview {
GeneralGroupSettings(selectedTheme: .constant("Темная"), selectedLanguage: .constant("Русский"))
}

View File

@ -0,0 +1,54 @@
//
// ScheduleGroupSettings.swift
// Schedule ICTIS
//
// Created by G412 on 25.02.2025.
//
import SwiftUI
struct ScheduleGroupSettings: View {
@AppStorage("group") private var favGroup = ""
@AppStorage("vpk") private var favVPK = ""
@ObservedObject var vm: ScheduleViewModel
var body: some View {
VStack {
NavigationLink(destination: SelectingGroupView(vm: vm)) {
HStack {
Text("Избранное расписание")
.font(.custom("Montserrat-Medium", fixedSize: 17))
.foregroundColor(.black)
Spacer()
Text(favGroup)
.font(.custom("Montserrat-Medium", fixedSize: 17))
.foregroundColor(Color("customGray3"))
Image("arrowRight")
}
.padding(.horizontal)
.padding(.top, 12)
.padding(.bottom, 3)
}
Rectangle()
.foregroundColor(Color("customGray1"))
.frame(height: 1)
.padding(.horizontal)
NavigationLink(destination: SelectingVPKView(vm: vm)) {
HStack {
Text("ВПК")
.font(.custom("Montserrat-Medium", fixedSize: 17))
.foregroundColor(.black)
Spacer()
Text(favVPK)
.font(.custom("Montserrat-Medium", fixedSize: 17))
.foregroundColor(Color("customGray3"))
Image("arrowRight")
}
.padding(.horizontal)
.padding(.top, 3)
.padding(.bottom, 12)
}
}
.background(Color.white)
.cornerRadius(20)
}
}

View File

@ -14,6 +14,7 @@ struct SelectingGroupView: View {
@ObservedObject var vm: ScheduleViewModel @ObservedObject var vm: ScheduleViewModel
@State private var isLoading = false @State private var isLoading = false
@State private var searchTask: DispatchWorkItem? @State private var searchTask: DispatchWorkItem?
@AppStorage("group") private var favGroup = ""
var body: some View { var body: some View {
NavigationView { NavigationView {
VStack { VStack {
@ -31,6 +32,9 @@ struct SelectingGroupView: View {
if !text.isEmpty { if !text.isEmpty {
vm.fetchGroups(group: text) vm.fetchGroups(group: text)
} }
else {
vm.fetchGroups(group: "кт")
}
} }
searchTask = task searchTask = task
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5, execute: task) DispatchQueue.main.asyncAfter(deadline: .now() + 0.5, execute: task)
@ -93,7 +97,7 @@ struct SelectingGroupView: View {
HStack { HStack {
Text(item.name) Text(item.name)
.foregroundColor(.black) .foregroundColor(.black)
.font(.custom("Montserrat-SemiBold", size: 15)) .font(.custom("Montserrat-SemiBold", fixedSize: 15))
Spacer() Spacer()
} }
.padding(.horizontal, 10) .padding(.horizontal, 10)
@ -112,6 +116,27 @@ struct SelectingGroupView: View {
} }
} }
} }
if !isFocused {
if favGroup != "" {
Button {
UserDefaults.standard.removeObject(forKey: "group")
dismiss()
} label: {
HStack {
Spacer()
Image(systemName: "trash")
Text("Удалить группу")
.font(.custom("Montserrat-Medium", fixedSize: 17))
Spacer()
}
.frame(height: 40)
.background(Color.white)
.foregroundColor(Color.red)
.cornerRadius(10)
.padding(.bottom, UIScreen.main.bounds.height / 11)
}
}
}
} }
.padding(.horizontal, 10) .padding(.horizontal, 10)
.background(Color("background")) .background(Color("background"))
@ -121,3 +146,8 @@ struct SelectingGroupView: View {
} }
} }
} }
#Preview {
@Previewable @StateObject var vm = ScheduleViewModel()
SelectingGroupView(vm: vm)
}

View File

@ -14,6 +14,7 @@ struct SelectingVPKView: View {
@ObservedObject var vm: ScheduleViewModel @ObservedObject var vm: ScheduleViewModel
@State private var isLoading = false @State private var isLoading = false
@State private var searchTask: DispatchWorkItem? @State private var searchTask: DispatchWorkItem?
@AppStorage("vpk") private var favVPK = ""
var body: some View { var body: some View {
NavigationView { NavigationView {
VStack { VStack {
@ -31,6 +32,9 @@ struct SelectingVPKView: View {
if !text.isEmpty { if !text.isEmpty {
vm.fetchGroups(group: text) vm.fetchGroups(group: text)
} }
else {
vm.fetchGroups(group: "впк")
}
} }
searchTask = task searchTask = task
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5, execute: task) DispatchQueue.main.asyncAfter(deadline: .now() + 0.5, execute: task)
@ -93,7 +97,7 @@ struct SelectingVPKView: View {
HStack { HStack {
Text(item.name) Text(item.name)
.foregroundColor(.black) .foregroundColor(.black)
.font(.custom("Montserrat-SemiBold", size: 15)) .font(.custom("Montserrat-SemiBold", fixedSize: 15))
Spacer() Spacer()
} }
.padding(.horizontal, 10) .padding(.horizontal, 10)
@ -112,6 +116,27 @@ struct SelectingVPKView: View {
} }
} }
} }
if !isFocused {
if favVPK != "" {
Button {
UserDefaults.standard.removeObject(forKey: "vpk")
dismiss()
} label: {
HStack {
Spacer()
Image(systemName: "trash")
Text("Удалить ВПК")
.font(.custom("Montserrat-Medium", fixedSize: 17))
Spacer()
}
.frame(height: 40)
.background(Color.white)
.foregroundColor(Color.red)
.cornerRadius(10)
.padding(.bottom, UIScreen.main.bounds.height / 11)
}
}
}
} }
.padding(.horizontal, 10) .padding(.horizontal, 10)
.background(Color("background")) .background(Color("background"))
@ -121,3 +146,8 @@ struct SelectingVPKView: View {
} }
} }
} }
#Preview {
@Previewable @StateObject var vm = ScheduleViewModel()
SelectingVPKView(vm: vm)
}

View File

@ -1,8 +1,8 @@
// //
// SettingsView.swift // SettingsView2.swift
// Schedule ICTIS // Schedule ICTIS
// //
// Created by Mironov Egor on 30.01.2025. // Created by G412 on 25.02.2025.
// //
import SwiftUI import SwiftUI
@ -11,42 +11,30 @@ struct SettingsView: View {
@ObservedObject var vm: ScheduleViewModel @ObservedObject var vm: ScheduleViewModel
@State private var selectedTheme = "Светлая" @State private var selectedTheme = "Светлая"
@State private var selectedLanguage = "Русский" @State private var selectedLanguage = "Русский"
@AppStorage("group") private var favGroup = ""
@AppStorage("vpk") private var favVPK = ""
var body: some View { var body: some View {
NavigationView { NavigationView {
VStack { VStack {
List { ScrollView (.vertical, showsIndicators: false) {
Section("Общие") { VStack (alignment: .leading) {
Picker("Тема", selection: $selectedTheme, content: { Text("Общие")
ForEach(MockData.themes, id: \.self) { .font(.custom("Montserrat-Medium", fixedSize: 18))
Text($0) .foregroundColor(Color("customGray3"))
} .padding(.horizontal)
}) GeneralGroupSettings(selectedTheme: $selectedTheme, selectedLanguage: $selectedLanguage)
Picker("Язык", selection: $selectedLanguage, content: {
ForEach(MockData.languages, id: \.self) {
Text($0)
}
})
} }
Section("Расписание") { .padding(.top, 20)
NavigationLink(destination: SelectingGroupView(vm: vm)) { VStack (alignment: .leading) {
LabeledContent { Text("Расписание")
Text(favGroup) .font(.custom("Montserrat-Medium", fixedSize: 18))
} label: { .foregroundColor(Color("customGray3"))
Text("Избранное расписание") .padding(.horizontal)
} ScheduleGroupSettings(vm: vm)
}
NavigationLink(destination: SelectingVPKView(vm: vm)) {
LabeledContent {
Text(favVPK)
} label: {
Text("Избранное ВПК")
}
}
} }
.padding(.top, 20)
} }
.padding(.horizontal)
} }
.background(Color("background"))
.navigationTitle("Настройки") .navigationTitle("Настройки")
} }
} }