diff --git a/BsuirScheduleApp.xcodeproj/project.pbxproj b/BsuirScheduleApp.xcodeproj/project.pbxproj index bc4d9362..b81c421d 100644 --- a/BsuirScheduleApp.xcodeproj/project.pbxproj +++ b/BsuirScheduleApp.xcodeproj/project.pbxproj @@ -9,6 +9,7 @@ /* Begin PBXBuildFile section */ 04187F0C2438A4A20099855E /* SearchBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04187F0B2438A4A20099855E /* SearchBar.swift */; }; 04C0743424520BBC00362531 /* URLImage in Frameworks */ = {isa = PBXBuildFile; productRef = 04C0743324520BBC00362531 /* URLImage */; }; + 04F0F8BA24D7354B00A1C74F /* AboutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F0F8B924D7354B00A1C74F /* AboutView.swift */; }; E616B44024AE12F200A46E67 /* PairView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E616B43F24AE12F200A46E67 /* PairView.swift */; }; E616B44224AE158400A46E67 /* ScheduleGridView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E616B44124AE158400A46E67 /* ScheduleGridView.swift */; }; E64D431A23758CFE00FA117C /* ContentStateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E64D431923758CFE00FA117C /* ContentStateView.swift */; }; @@ -39,6 +40,7 @@ /* Begin PBXFileReference section */ 04187F0B2438A4A20099855E /* SearchBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchBar.swift; sourceTree = ""; }; + 04F0F8B924D7354B00A1C74F /* AboutView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutView.swift; sourceTree = ""; }; E616B43F24AE12F200A46E67 /* PairView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PairView.swift; sourceTree = ""; }; E616B44124AE158400A46E67 /* ScheduleGridView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScheduleGridView.swift; sourceTree = ""; }; E64D431923758CFE00FA117C /* ContentStateView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentStateView.swift; sourceTree = ""; }; @@ -152,6 +154,7 @@ E6964823233F7D72007EF2CB /* RootView.swift */, E6964821233F7C45007EF2CB /* AllGroupsView.swift */, E69648272340CA53007EF2CB /* AllLecturersView.swift */, + 04F0F8B924D7354B00A1C74F /* AboutView.swift */, ); path = Views; sourceTree = ""; @@ -298,6 +301,7 @@ E68610C52471C2BC001BF527 /* DismissingKeyboardOnSwipe.swift in Sources */, E6964822233F7C45007EF2CB /* AllGroupsView.swift in Sources */, E6A6A88324142F2C0024D738 /* CombineHelpers.swift in Sources */, + 04F0F8BA24D7354B00A1C74F /* AboutView.swift in Sources */, E66C1D8F24C2704D008391B6 /* ContinuousSchedule.swift in Sources */, E6F931B622F8B1C10038FC43 /* AppDelegate.swift in Sources */, E6964820233F7BD3007EF2CB /* AppState.swift in Sources */, diff --git a/BsuirScheduleApp/Views/AboutView.swift b/BsuirScheduleApp/Views/AboutView.swift new file mode 100644 index 00000000..8c308b2d --- /dev/null +++ b/BsuirScheduleApp/Views/AboutView.swift @@ -0,0 +1,83 @@ +// +// AboutView.swift +// BsuirScheduleApp +// +// Created by mac on 6/20/20. +// Copyright © 2020 Saute. All rights reserved. +// + +import SwiftUI +import Foundation + +struct AboutView: View { + var body: some View { + VStack { + ScheduleInfoView() + .padding(EdgeInsets(top: 10, leading: 15, bottom: 0, trailing: 15)) + InfoView() + .padding(EdgeInsets(top: 10, leading: 15, bottom: 0, trailing: 15)) + Spacer() + } + .navigationBarTitle("Информация") + } +} + +struct ScheduleInfoView: View { + var body: some View { + VStack(alignment: .leading) { + VStack(alignment: .leading) { + PairTypeView(type: "Лекция", color: .green) + .padding([.leading, .top], 20) + PairTypeView(type: "Лабораторная работа", color: .yellow) + .padding(.leading, 20) + PairTypeView(type: "Практическая работа", color: .red) + .padding(.leading, 20) + } + PairCell(from: "начало", to: "конец", subject: "Предмет", weeks: "неделя", note: "Кабинет - корпус", form: .practice, progress: PairProgress(constant: 0.5)) + .padding(EdgeInsets(top: 10, leading: 10, bottom: 10, trailing: 10)) + .fixedSize(horizontal: false, vertical: true) + .overlay(RoundedRectangle(cornerRadius: 10) + .stroke(Color.gray.opacity(0.2), lineWidth: 1)) + } + } +} + +struct InfoView: View { + var body: some View { + VStack(alignment: .leading, spacing: 10) { + HStack() { + Text("О приложении") + .font(.headline) + .bold() + Spacer() + } + VStack(alignment: .leading, spacing: 5) { + Text("Версия 1.0") + Button(action: { + guard let url = URL(string: "https://github.com/asiliuk/BsuirScheduleApp") else { return } + UIApplication.shared.open(url) + }, label: { + Text("GitHub") + .underline() + .foregroundColor(.black) + }) + } + } + .padding(EdgeInsets(top: 10, leading: 15, bottom: 10, trailing: 15)) + .overlay(RoundedRectangle(cornerRadius: 10) + .stroke(Color.gray.opacity(0.2), lineWidth: 1)) + } +} + +struct PairTypeView: View { + var type: String + var color: Color + + var body: some View { + HStack { + color.frame(width: 30, height: 30) + .clipShape(Circle()) + Text(type) + } + } +} diff --git a/BsuirScheduleApp/Views/RootView.swift b/BsuirScheduleApp/Views/RootView.swift index fb803056..1e570628 100644 --- a/BsuirScheduleApp/Views/RootView.swift +++ b/BsuirScheduleApp/Views/RootView.swift @@ -14,6 +14,7 @@ import os.log enum CurrentTab: CaseIterable { case groups case lecturers + case about } struct RootView: View { @@ -39,6 +40,7 @@ struct RootView: View { TabView(selection: $currentTab) { NavigationView { allGroups }.tab(.groups) NavigationView { allLecturers }.tab(.lecturers) + NavigationView { about }.tab(.about) } case .regular?: NavigationView { @@ -49,6 +51,8 @@ struct RootView: View { allGroups case .lecturers: allLecturers + case .about: + about } SchedulePlaceholder() @@ -64,6 +68,10 @@ struct RootView: View { AllLecturersView(screen: state.allLecturers) } + private var about: some View { + AboutView() + } + private var sidebar: some View { List { NavigationLink(destination: allGroups, tag: .groups, selection: $currentTab) { @@ -73,6 +81,10 @@ struct RootView: View { NavigationLink(destination: allLecturers, tag: .lecturers, selection: $currentTab) { CurrentTab.lecturers.label } + + NavigationLink(destination: about, tag: .about, selection: $currentTab) { + CurrentTab.about.label + } } .listStyle(SidebarListStyle()) .listItemTint(.fixed(.red)) @@ -100,6 +112,8 @@ private extension CurrentTab { Label("Группы", systemImage: "person.2") case .lecturers: Label("Преподаватели", systemImage: "person.crop.rectangle") + case .about: + Label("О приложении", systemImage: "wrench") } } } @@ -133,4 +147,3 @@ private extension URLRequest { return components.joined(separator: " ") } } -