Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/446 gridlines #559

Merged
merged 8 commits into from
Aug 25, 2024
43 changes: 39 additions & 4 deletions app-ios/Sources/TimetableFeature/TimetableListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ struct TimetableGridView: View {
let rooms = RoomType.allCases.filter {$0 != RoomType.roomIj}

ScrollView([.horizontal, .vertical]) {
Grid {
Grid(alignment: .leading, horizontalSpacing: 4, verticalSpacing: 2) {
GridRow {
Color.clear
.gridCellUnsizedAxes([.horizontal, .vertical])
Expand All @@ -128,18 +128,19 @@ struct TimetableGridView: View {
let room = column.toRoom()
Text(room.name.currentLangTitle).foregroundStyle(room.roomTheme.primaryColor)
.frame(width: 192)

}
}
DashedDivider(axis: .horizontal)
ForEach(store.timetableItems, id: \.self) { timeBlock in
GridRow {
VStack {
Text(timeBlock.startsTimeString).foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor)
Spacer()

}.frame(height: 153)

ForEach(rooms, id: \.self) { room in

if let cell = timeBlock.getCellForRoom(room: room, onTap: { item in
store.send(.view(.timetableItemTapped(item)))}) {
cell
Expand All @@ -152,8 +153,9 @@ struct TimetableGridView: View {
}
}
}
DashedDivider(axis: .horizontal)
}
}
}.fixedSize(horizontal: false, vertical: true)
.padding(.trailing)

bottomTabBarPadding
Expand Down Expand Up @@ -192,6 +194,39 @@ struct TimeGroupMiniList: View {
}
}

struct DashedDivider: View {
public var axis: Axis
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this property is 'let' more than better👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should change here too🙏


var body: some View {
let shape = LineShape(axis: axis)
.stroke(style: .init(dash: [2]))
.foregroundStyle(AssetColors.Outline.outlineVariant.swiftUIColor)
if axis == .horizontal {
shape.frame(height: 1)
} else {
shape.frame(width: 1).padding(0)
}
//shape
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this comment🤔?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

}
}

struct LineShape: Shape {
public var axis: Axis
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this property is 'let' more than better👍


func path(in rect: CGRect) -> Path {
var path = Path()
path.move(to: CGPoint(x: 0, y: 0))

if axis == .horizontal {
path.addLine(to: CGPoint(x: rect.width, y: 0))
} else {
path.addLine(to: CGPoint(x: 0, y: rect.height))
}

return path
}
}

fileprivate var bottomTabBarPadding: some View {
// bottom floating tabbar padding
Color.clear.padding(.bottom, 60)
Expand Down
Loading