Commit
This commit is contained in:
parent
9c6515a2f5
commit
b719ab300d
@ -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()
|
||||
}
|
||||
|
21
Schedule ICTIS/Preview Content/Assets.xcassets/upDownArrows.imageset/Contents.json
vendored
Normal file
21
Schedule ICTIS/Preview Content/Assets.xcassets/upDownArrows.imageset/Contents.json
vendored
Normal 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
|
||||
}
|
||||
}
|
4
Schedule ICTIS/Preview Content/Assets.xcassets/upDownArrows.imageset/upDownArrows.svg
vendored
Normal file
4
Schedule ICTIS/Preview Content/Assets.xcassets/upDownArrows.imageset/upDownArrows.svg
vendored
Normal 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 |
91
Schedule ICTIS/Settings/GeneralGroupSettings.swift
Normal file
91
Schedule ICTIS/Settings/GeneralGroupSettings.swift
Normal 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("Русский"))
|
||||
}
|
54
Schedule ICTIS/Settings/ScheduleGroupSettings.swift
Normal file
54
Schedule ICTIS/Settings/ScheduleGroupSettings.swift
Normal 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)
|
||||
}
|
||||
}
|
@ -14,6 +14,7 @@ struct SelectingGroupView: View {
|
||||
@ObservedObject var vm: ScheduleViewModel
|
||||
@State private var isLoading = false
|
||||
@State private var searchTask: DispatchWorkItem?
|
||||
@AppStorage("group") private var favGroup = ""
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
VStack {
|
||||
@ -31,6 +32,9 @@ struct SelectingGroupView: View {
|
||||
if !text.isEmpty {
|
||||
vm.fetchGroups(group: text)
|
||||
}
|
||||
else {
|
||||
vm.fetchGroups(group: "кт")
|
||||
}
|
||||
}
|
||||
searchTask = task
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5, execute: task)
|
||||
@ -93,7 +97,7 @@ struct SelectingGroupView: View {
|
||||
HStack {
|
||||
Text(item.name)
|
||||
.foregroundColor(.black)
|
||||
.font(.custom("Montserrat-SemiBold", size: 15))
|
||||
.font(.custom("Montserrat-SemiBold", fixedSize: 15))
|
||||
Spacer()
|
||||
}
|
||||
.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)
|
||||
.background(Color("background"))
|
||||
@ -121,3 +146,8 @@ struct SelectingGroupView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
@Previewable @StateObject var vm = ScheduleViewModel()
|
||||
SelectingGroupView(vm: vm)
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ struct SelectingVPKView: View {
|
||||
@ObservedObject var vm: ScheduleViewModel
|
||||
@State private var isLoading = false
|
||||
@State private var searchTask: DispatchWorkItem?
|
||||
@AppStorage("vpk") private var favVPK = ""
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
VStack {
|
||||
@ -31,6 +32,9 @@ struct SelectingVPKView: View {
|
||||
if !text.isEmpty {
|
||||
vm.fetchGroups(group: text)
|
||||
}
|
||||
else {
|
||||
vm.fetchGroups(group: "впк")
|
||||
}
|
||||
}
|
||||
searchTask = task
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5, execute: task)
|
||||
@ -93,7 +97,7 @@ struct SelectingVPKView: View {
|
||||
HStack {
|
||||
Text(item.name)
|
||||
.foregroundColor(.black)
|
||||
.font(.custom("Montserrat-SemiBold", size: 15))
|
||||
.font(.custom("Montserrat-SemiBold", fixedSize: 15))
|
||||
Spacer()
|
||||
}
|
||||
.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)
|
||||
.background(Color("background"))
|
||||
@ -121,3 +146,8 @@ struct SelectingVPKView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
@Previewable @StateObject var vm = ScheduleViewModel()
|
||||
SelectingVPKView(vm: vm)
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
//
|
||||
// SettingsView.swift
|
||||
// SettingsView2.swift
|
||||
// Schedule ICTIS
|
||||
//
|
||||
// Created by Mironov Egor on 30.01.2025.
|
||||
// Created by G412 on 25.02.2025.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
@ -11,42 +11,30 @@ struct SettingsView: View {
|
||||
@ObservedObject var vm: ScheduleViewModel
|
||||
@State private var selectedTheme = "Светлая"
|
||||
@State private var selectedLanguage = "Русский"
|
||||
@AppStorage("group") private var favGroup = ""
|
||||
@AppStorage("vpk") private var favVPK = ""
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
VStack {
|
||||
List {
|
||||
Section("Общие") {
|
||||
Picker("Тема", selection: $selectedTheme, content: {
|
||||
ForEach(MockData.themes, id: \.self) {
|
||||
Text($0)
|
||||
}
|
||||
})
|
||||
Picker("Язык", selection: $selectedLanguage, content: {
|
||||
ForEach(MockData.languages, id: \.self) {
|
||||
Text($0)
|
||||
}
|
||||
})
|
||||
ScrollView (.vertical, showsIndicators: false) {
|
||||
VStack (alignment: .leading) {
|
||||
Text("Общие")
|
||||
.font(.custom("Montserrat-Medium", fixedSize: 18))
|
||||
.foregroundColor(Color("customGray3"))
|
||||
.padding(.horizontal)
|
||||
GeneralGroupSettings(selectedTheme: $selectedTheme, selectedLanguage: $selectedLanguage)
|
||||
}
|
||||
Section("Расписание") {
|
||||
NavigationLink(destination: SelectingGroupView(vm: vm)) {
|
||||
LabeledContent {
|
||||
Text(favGroup)
|
||||
} label: {
|
||||
Text("Избранное расписание")
|
||||
}
|
||||
}
|
||||
NavigationLink(destination: SelectingVPKView(vm: vm)) {
|
||||
LabeledContent {
|
||||
Text(favVPK)
|
||||
} label: {
|
||||
Text("Избранное ВПК")
|
||||
}
|
||||
}
|
||||
.padding(.top, 20)
|
||||
VStack (alignment: .leading) {
|
||||
Text("Расписание")
|
||||
.font(.custom("Montserrat-Medium", fixedSize: 18))
|
||||
.foregroundColor(Color("customGray3"))
|
||||
.padding(.horizontal)
|
||||
ScheduleGroupSettings(vm: vm)
|
||||
}
|
||||
.padding(.top, 20)
|
||||
}
|
||||
.padding(.horizontal)
|
||||
}
|
||||
.background(Color("background"))
|
||||
.navigationTitle("Настройки")
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user