Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions TaskManager.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
EED772152B7BC0C6007BDA4A /* AddTaskView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EED772142B7BC0C6007BDA4A /* AddTaskView.swift */; };
EED772172B7BC0C8007BDA4A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EED772162B7BC0C8007BDA4A /* Assets.xcassets */; };
EED7721A2B7BC0C8007BDA4A /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EED772192B7BC0C8007BDA4A /* Preview Assets.xcassets */; };
EEFAD1912CD3A7F900018043 /* AllTasksView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEFAD1902CD3A7F900018043 /* AllTasksView.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -33,6 +34,7 @@
EED772142B7BC0C6007BDA4A /* AddTaskView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddTaskView.swift; sourceTree = "<group>"; };
EED772162B7BC0C8007BDA4A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
EED772192B7BC0C8007BDA4A /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
EEFAD1902CD3A7F900018043 /* AllTasksView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AllTasksView.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -52,6 +54,7 @@
EE59B6B32C342680003D59DF /* AboutPageView.swift */,
EED772142B7BC0C6007BDA4A /* AddTaskView.swift */,
EEA7106D2C908CA000785086 /* HomeView.swift */,
EEFAD1902CD3A7F900018043 /* AllTasksView.swift */,
);
path = Views;
sourceTree = "<group>";
Expand Down Expand Up @@ -185,6 +188,7 @@
EEA7106E2C908CA000785086 /* HomeView.swift in Sources */,
EE59B6B42C342680003D59DF /* AboutPageView.swift in Sources */,
EE3AE1712CC69970001A80C1 /* Router.swift in Sources */,
EEFAD1912CD3A7F900018043 /* AllTasksView.swift in Sources */,
EE00D2BC2C6F8D65004FF048 /* TaskViewModel.swift in Sources */,
EE019E182C9460C600A8B764 /* TaskModel.swift in Sources */,
EED772152B7BC0C6007BDA4A /* AddTaskView.swift in Sources */,
Expand Down
1 change: 1 addition & 0 deletions TaskManager/Router.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ final class Router: ObservableObject {
public enum Destination: Codable, Hashable {
case addTask
case aboutPage
case allTasks
}

@Published var navPath = NavigationPath()
Expand Down
3 changes: 3 additions & 0 deletions TaskManager/TaskManagerApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ struct TaskManagerApp: App {
AddTaskView(viewModel: TaskViewModel(router: router))
case .aboutPage:
AboutPageView(viewModel: TaskViewModel(router: router))

case .allTasks:
AllTasksView(viewModel: TaskViewModel(router: router))
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions TaskManager/ViewModel/TaskViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ class TaskViewModel: ObservableObject {
isTaskComplete.toggle()
}

// Routing
func navigateToViewAllTasks() {
router.navigate(to: .allTasks)
}

func navigateToAboutPage() {
router.navigate(to: .aboutPage)
}

Expand Down
14 changes: 12 additions & 2 deletions TaskManager/Views/AboutPageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ struct AboutPageView: View {
.modifier(TextStyles.bulletPointStyle())
.multilineTextAlignment(.center)

Text("\u{2022} **Organised Categories**: Categorise tasks for effortless " +
"organisation and quick access.")
Text("""
\u{2022} **Organised Categories**: Categorise tasks \
for effortless organisation and quick access.
""")
.modifier(TextStyles.bulletPointStyle())
.multilineTextAlignment(.center)

Expand Down Expand Up @@ -79,8 +81,16 @@ struct AboutPageView: View {
.baselineOffset(-5)
}
.padding(12.0)
.background(Color.cPink)
.cornerRadius(Spacing.medium)
}
.padding(.horizontal, 20.0)
.padding(.bottom, 20.0)

}
.padding(10.0)
.background(Color("Rose"))

}
}

Expand Down
1 change: 1 addition & 0 deletions TaskManager/Views/AddTaskView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ struct AddTaskView: View {
Spacer()
}
.padding(.horizontal, Spacing.spacious)
Spacer()
}
.background(Color("Rose"))
}
Expand Down
106 changes: 106 additions & 0 deletions TaskManager/Views/AllTasksView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
//
// AllTasksView.swift
// TaskManager
//
// Created by Isabella Sulisufi on 31/10/2024.
//

import SwiftUI

struct AllTasksView: View {
@ObservedObject var viewModel: TaskViewModel

var body: some View {
ScrollView {
VStack {
// if !task.isComplete {
TaskCardView(viewModel: viewModel, title: "Task 1",
category: .school, description: "This is a task", dueDate: Date())
// }
Spacer()
}
}
.padding(10.0)
.background(Color("Cream"))
}

}

struct TaskCardView: View {
@ObservedObject var viewModel: TaskViewModel
let title: String
let category: Category
let description: String?
let dueDate: Date
// var isComplete: Bool

var body: some View {
HStack {
VStack(alignment: .leading) {
HStack {
Text(title)
.font(.custom("Gill Sans", size: Spacing.medium))
.foregroundColor(Color("DarkPurple"))
.padding(.bottom, 4)
Spacer()
Text(category.rawValue)
.font(.custom("Gill Sans", size: Spacing.small))
.foregroundColor(Color("DarkPurple"))
.padding(.horizontal, 16)
.padding(.vertical, 8)
.background(Color("CPink"))
.cornerRadius(25)
}
.padding(.trailing, Spacing.small)

Text(description ?? "")
.font(.custom("Gill Sans", size: Spacing.standard))
.foregroundColor(Color("DarkPurple"))
.padding(.bottom, 6.0)

Text(dueDate.formatted(date: .abbreviated, time: .omitted))
.font(.custom("Gill Sans", size: 13))
.foregroundColor(Color("DarkPurple"))
.padding(.bottom, Spacing.small)

HStack {
// complete button
Button {
viewModel.navigateAddTask()
} label: {
Image(systemName: "checkmark.circle")
.font(.system(size: Spacing.medium, weight: .bold))
.foregroundColor(Color("CPink"))
Text("Complete?")
.font(.custom("Gill Sans", size: Spacing.standard))
.foregroundColor(Color("DarkPurple"))
}
Spacer()

// update button
Button {
viewModel.navigateAddTask()
} label: {
Image(systemName: "pencil.circle")
.font(.system(size: Spacing.medium, weight: .bold))
.foregroundColor(Color("CPink"))
Text("Update?")
.font(.custom("Gill Sans", size: Spacing.standard))
.foregroundColor(Color("DarkPurple"))
}
}
.padding([.bottom, .trailing], Spacing.standard)

}
.padding(.leading, Spacing.standard)
Spacer()

}
.padding(.top, 10.0)
.background(Color("Cream"))
.overlay(
RoundedRectangle(cornerRadius: Spacing.small)
.stroke(Color("Purple3"), lineWidth: 1)
)
}
}
4 changes: 2 additions & 2 deletions TaskManager/Views/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ struct HomeView: View {
HStack {
// View All Tasks Button
Button("View All Tasks") {
viewModel.navigateToViewAllTasks()
router.navigate(to: .allTasks)
}
.font(Font.custom("NotoSansOriya", size: Spacing.medium))
.foregroundColor(Color.cPink)
Expand Down Expand Up @@ -138,10 +138,10 @@ struct HomeView: View {
}
Spacer()
}
Spacer()
}
.padding(15)
.background(Color("Rose"))
Spacer()
}
}

Expand Down
Loading