Skip to content

Commit

Permalink
add: DailyDayView
Browse files Browse the repository at this point in the history
  • Loading branch information
s8ngyu committed Nov 17, 2023
1 parent 252a0ba commit ffc1ab3
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 16 deletions.
37 changes: 22 additions & 15 deletions ios/OTL Watch App/Pages/DailyTableView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,30 @@ struct DailyTableView: View {
}
}
}.frame(width: 18)
VStack {
ForEach(0..<33) { number in
if number % 2 == 0 {
HorizontalLine()
.stroke(style: StrokeStyle(lineWidth: 1))
.frame(height: 1)
.foregroundStyle(Color.white.opacity(0.25))
} else {
HorizontalLine()
.stroke(style: StrokeStyle(lineWidth: 1, dash: [2]))
.frame(height: 1)
.foregroundStyle(Color.white.opacity(0.25))
}
if number != 32 {
Spacer()
ZStack(alignment: .top) {
VStack {
ForEach(0..<33) { number in
if number % 2 == 0 {
HorizontalLine()
.stroke(style: StrokeStyle(lineWidth: 1))
.frame(height: 1)
.foregroundStyle(Color.white.opacity(0.25))
} else {
HorizontalLine()
.stroke(style: StrokeStyle(lineWidth: 1, dash: [2]))
.frame(height: 1)
.foregroundStyle(Color.white.opacity(0.25))
}
if number != 32 {
Spacer()
}
}
}
ForEach(self.lectures) { lecture in
DailyDayView(lecture: .constant(lecture))
.frame(height: Double(lecture.classtime.end - lecture.classtime.begin)/30*24+(Double(lecture.classtime.end - lecture.classtime.begin)/30-3)-1)
.offset(y: 51 + Double(lecture.classtime.begin-540)/60*50 + 1)
}
}
}.frame(height: 801)
}
Expand Down
23 changes: 23 additions & 0 deletions ios/OTL Watch App/Subviews/DailyDayView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// DailyDayView.swift
// OTL Watch App
//
// Created by Soongyu Kwon on 11/17/23.
// Copyright © 2023 The Chromium Authors. All rights reserved.
//

import SwiftUI

struct DailyDayView: View {
@Binding var lecture: LectureElement

var body: some View {
ZStack(alignment: .topLeading) {
RoundedRectangle(cornerRadius: 2)
.foregroundStyle(getColourForCourse(course: lecture.course))
Text(lecture.title)
.foregroundStyle(.black)
.padding()
}
}
}
6 changes: 5 additions & 1 deletion ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
8B5DB7BB2B05DE750078CAB9 /* Alamofire in Frameworks */ = {isa = PBXBuildFile; productRef = 8B5DB7BA2B05DE750078CAB9 /* Alamofire */; };
8B5DB7BD2B05E0960078CAB9 /* WeeklyDayView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B5DB7BC2B05E0960078CAB9 /* WeeklyDayView.swift */; };
8B5DB7BF2B05E4230078CAB9 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B5DB7BE2B05E4230078CAB9 /* SettingsView.swift */; };
8B5DB7C32B0742080078CAB9 /* DailyDayView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B5DB7C22B0742080078CAB9 /* DailyDayView.swift */; };
8B643C832A6BC16500BF6DAA /* NextClassAccessory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B643C822A6BC16500BF6DAA /* NextClassAccessory.swift */; };
8B76C8E42A0E834A007E1947 /* TodayClassesWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B76C8E32A0E834A007E1947 /* TodayClassesWidget.swift */; };
8B76C8E62A0E837F007E1947 /* WidgetBase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B76C8E52A0E837F007E1947 /* WidgetBase.swift */; };
Expand Down Expand Up @@ -141,6 +142,7 @@
8B5DB7B82B05DD960078CAB9 /* OTLAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OTLAPI.swift; sourceTree = "<group>"; };
8B5DB7BC2B05E0960078CAB9 /* WeeklyDayView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeeklyDayView.swift; sourceTree = "<group>"; };
8B5DB7BE2B05E4230078CAB9 /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
8B5DB7C22B0742080078CAB9 /* DailyDayView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DailyDayView.swift; sourceTree = "<group>"; };
8B643C822A6BC16500BF6DAA /* NextClassAccessory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NextClassAccessory.swift; sourceTree = "<group>"; };
8B76C8E32A0E834A007E1947 /* TodayClassesWidget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TodayClassesWidget.swift; sourceTree = "<group>"; };
8B76C8E52A0E837F007E1947 /* WidgetBase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WidgetBase.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -241,9 +243,9 @@
8BFB7C592AFC4968007F3E5C /* Pages */,
8B5208372AE539720011417B /* ContentView.swift */,
8BFB7C552AFB67CE007F3E5C /* WatchViewModel.swift */,
8B5DB7B82B05DD960078CAB9 /* OTLAPI.swift */,
8B5208392AE539750011417B /* Assets.xcassets */,
8B52083B2AE539750011417B /* Preview Content */,
8B5DB7B82B05DD960078CAB9 /* OTLAPI.swift */,
);
path = "OTL Watch App";
sourceTree = "<group>";
Expand Down Expand Up @@ -314,6 +316,7 @@
8BE671622AFC5C94006222B1 /* TimelineLabelView.swift */,
8BE671662AFC5F2D006222B1 /* HorizontalLine.swift */,
8B5DB7BC2B05E0960078CAB9 /* WeeklyDayView.swift */,
8B5DB7C22B0742080078CAB9 /* DailyDayView.swift */,
);
path = Subviews;
sourceTree = "<group>";
Expand Down Expand Up @@ -717,6 +720,7 @@
8BE671632AFC5C94006222B1 /* TimelineLabelView.swift in Sources */,
8BFB7C5C2AFC49C9007F3E5C /* ObservableScrollView.swift in Sources */,
8BE671652AFC5D6F006222B1 /* DailyTableView.swift in Sources */,
8B5DB7C32B0742080078CAB9 /* DailyDayView.swift in Sources */,
8B5DB7BD2B05E0960078CAB9 /* WeeklyDayView.swift in Sources */,
8BE671612AFC5BE9006222B1 /* DayLabelView.swift in Sources */,
8B5DB7BF2B05E4230078CAB9 /* SettingsView.swift in Sources */,
Expand Down

0 comments on commit ffc1ab3

Please sign in to comment.