mirror of
https://github.com/Mueller-Patrick/DHBW-Service-App.git
synced 2024-11-22 09:23:57 +00:00
Merge branch 'ui-refactor'
This commit is contained in:
commit
5e177eedd5
|
@ -81,49 +81,11 @@ struct HomeView: View {
|
||||||
HStack {
|
HStack {
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
VStack {
|
// Todays lectures block
|
||||||
Text("today".localized(tableName: "HomeView"))
|
UpcomingLecturesBlock(eventsList: todaysEvents, titleKey: "today")
|
||||||
.font(.title)
|
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
|
||||||
VStack {
|
|
||||||
if(!todaysEvents.isEmpty){
|
|
||||||
ForEach(todaysEvents, id: \.self) { exam in
|
|
||||||
Text(exam.value(forKey: "summary") as! String)
|
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Text("noLectures".localized(tableName: "HomeView"))
|
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.padding()
|
|
||||||
.background(
|
|
||||||
RoundedRectangle(cornerRadius: 10)
|
|
||||||
.fill(Color.gray)
|
|
||||||
)
|
|
||||||
|
|
||||||
VStack {
|
// Tomorrows lectures block
|
||||||
Text("tomorrow".localized(tableName: "HomeView"))
|
UpcomingLecturesBlock(eventsList: tomorrowsEvents, titleKey: "tomorrow")
|
||||||
.font(.title)
|
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
|
||||||
VStack {
|
|
||||||
if(!tomorrowsEvents.isEmpty){
|
|
||||||
ForEach(tomorrowsEvents, id: \.self) { exam in
|
|
||||||
Text(exam.value(forKey: "summary") as! String)
|
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Text("noLectures".localized(tableName: "HomeView"))
|
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.padding()
|
|
||||||
.background(
|
|
||||||
RoundedRectangle(cornerRadius: 10)
|
|
||||||
.fill(Color.gray)
|
|
||||||
)
|
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
|
@ -132,31 +94,7 @@ struct HomeView: View {
|
||||||
HStack {
|
HStack {
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
VStack {
|
UpcomingExamsBlock(examsList: upcomingExams, titleKey: "upcomingExams")
|
||||||
Text("upcomingExams".localized(tableName: "HomeView"))
|
|
||||||
.font(.title)
|
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
|
||||||
VStack {
|
|
||||||
if(!upcomingExams.isEmpty){
|
|
||||||
ForEach(upcomingExams, id: \.self) { exam in
|
|
||||||
Text(exam.value(forKey: "summary") as! String)
|
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Text("noExams".localized(tableName: "HomeView"))
|
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.padding()
|
|
||||||
.background(
|
|
||||||
RoundedRectangle(cornerRadius: 10)
|
|
||||||
.fill(Color.gray)
|
|
||||||
)
|
|
||||||
.overlay(
|
|
||||||
RoundedRectangle(cornerRadius: 10)
|
|
||||||
.stroke(Color.red, lineWidth: 4)
|
|
||||||
)
|
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
|
@ -283,6 +221,68 @@ extension HomeView{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct UpcomingLecturesBlock: View {
|
||||||
|
let eventsList: [NSManagedObject]
|
||||||
|
let titleKey: String
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
VStack {
|
||||||
|
Text(titleKey.localized(tableName: "HomeView"))
|
||||||
|
.font(.title)
|
||||||
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
|
VStack {
|
||||||
|
if(!eventsList.isEmpty){
|
||||||
|
ForEach(eventsList, id: \.self) { exam in
|
||||||
|
Text(exam.value(forKey: "summary") as! String)
|
||||||
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Text("noLectures".localized(tableName: "HomeView"))
|
||||||
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.padding()
|
||||||
|
.background(
|
||||||
|
RoundedRectangle(cornerRadius: 10)
|
||||||
|
.fill(Color.gray)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct UpcomingExamsBlock: View {
|
||||||
|
let examsList: [NSManagedObject]
|
||||||
|
let titleKey: String
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
VStack {
|
||||||
|
Text(titleKey.localized(tableName: "HomeView"))
|
||||||
|
.font(.title)
|
||||||
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
|
VStack {
|
||||||
|
if(!examsList.isEmpty){
|
||||||
|
ForEach(examsList, id: \.self) { exam in
|
||||||
|
Text(exam.value(forKey: "summary") as! String)
|
||||||
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Text("noExams".localized(tableName: "HomeView"))
|
||||||
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.padding()
|
||||||
|
.background(
|
||||||
|
RoundedRectangle(cornerRadius: 10)
|
||||||
|
.fill(Color.gray)
|
||||||
|
)
|
||||||
|
.overlay(
|
||||||
|
RoundedRectangle(cornerRadius: 10)
|
||||||
|
.stroke(Color.red, lineWidth: 4)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct HomeView_Previews: PreviewProvider {
|
struct HomeView_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
HomeView()
|
HomeView()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user