Skip to content

Commit

Permalink
Complete about view. (#18)
Browse files Browse the repository at this point in the history
Co-authored-by: marikletko <kirill.letko@innowise-group.com>
  • Loading branch information
marikletko and marikletko committed Aug 7, 2020
1 parent b3f965f commit 17dcb44
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 1 deletion.
4 changes: 4 additions & 0 deletions BsuirScheduleApp.xcodeproj/project.pbxproj
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -39,6 +40,7 @@

/* Begin PBXFileReference section */
04187F0B2438A4A20099855E /* SearchBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchBar.swift; sourceTree = "<group>"; };
04F0F8B924D7354B00A1C74F /* AboutView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutView.swift; sourceTree = "<group>"; };
E616B43F24AE12F200A46E67 /* PairView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PairView.swift; sourceTree = "<group>"; };
E616B44124AE158400A46E67 /* ScheduleGridView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScheduleGridView.swift; sourceTree = "<group>"; };
E64D431923758CFE00FA117C /* ContentStateView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentStateView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -152,6 +154,7 @@
E6964823233F7D72007EF2CB /* RootView.swift */,
E6964821233F7C45007EF2CB /* AllGroupsView.swift */,
E69648272340CA53007EF2CB /* AllLecturersView.swift */,
04F0F8B924D7354B00A1C74F /* AboutView.swift */,
);
path = Views;
sourceTree = "<group>";
Expand Down Expand Up @@ -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 */,
Expand Down
83 changes: 83 additions & 0 deletions 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)
}
}
}
15 changes: 14 additions & 1 deletion BsuirScheduleApp/Views/RootView.swift
Expand Up @@ -14,6 +14,7 @@ import os.log
enum CurrentTab: CaseIterable {
case groups
case lecturers
case about
}

struct RootView: View {
Expand All @@ -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 {
Expand All @@ -49,6 +51,8 @@ struct RootView: View {
allGroups
case .lecturers:
allLecturers
case .about:
about
}

SchedulePlaceholder()
Expand All @@ -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) {
Expand All @@ -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))
Expand Down Expand Up @@ -100,6 +112,8 @@ private extension CurrentTab {
Label("Группы", systemImage: "person.2")
case .lecturers:
Label("Преподаватели", systemImage: "person.crop.rectangle")
case .about:
Label("О приложении", systemImage: "wrench")
}
}
}
Expand Down Expand Up @@ -133,4 +147,3 @@ private extension URLRequest {
return components.joined(separator: " ")
}
}

0 comments on commit 17dcb44

Please sign in to comment.