Skip to content

Commit

Permalink
bugfix: date selector stops working in b90
Browse files Browse the repository at this point in the history
  • Loading branch information
aapis committed Apr 26, 2023
1 parent 6204074 commit c639e53
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions DLPrototype.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 90;
CURRENT_PROJECT_VERSION = 91;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"DLPrototype/Preview Content\"";
DEVELOPMENT_TEAM = 6DT7L2N5X6;
Expand Down Expand Up @@ -1113,7 +1113,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 90;
CURRENT_PROJECT_VERSION = 91;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"DLPrototype/Preview Content\"";
DEVELOPMENT_TEAM = 6DT7L2N5X6;
Expand Down
2 changes: 1 addition & 1 deletion DLPrototype/Views/Shared/Fancy/FancyButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct FancyButton: View {
public var showLabel: Bool? = true
public var showIcon: Bool? = true
public var fgColour: Color?
public var size: ButtonSize = .large
public var size: ButtonSize = .medium

@State private var padding: CGFloat = 10

Expand Down
9 changes: 6 additions & 3 deletions DLPrototype/Views/Today/LogTable/LogTable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import SwiftUI
struct LogTable: View, Identifiable {
public var id = UUID()
@Binding public var job: String
public var date: Date
public var defaultSelectedDate: Date?

@State private var records: [LogRecord] = []
@State private var recordsAsString: String = ""
Expand Down Expand Up @@ -251,7 +251,10 @@ struct LogTable: View, Identifiable {
}

private func loadRecordsBySelectedDate() -> Void {
selectedDate = date
if defaultSelectedDate != nil {
selectedDate = defaultSelectedDate!
}

records = LogRecords(moc: moc).forDate(selectedDate)

// TODO: move this func to LogRecords model
Expand Down Expand Up @@ -325,7 +328,7 @@ struct LogTablePreview: PreviewProvider {
@State static public var d: Date = Date()

static var previews: some View {
LogTable(job: $sj, date: d)
LogTable(job: $sj, defaultSelectedDate: d)
.environment(\.managedObjectContext, PersistenceController.preview.container.viewContext)
.frame(width: 700)
}
Expand Down
4 changes: 2 additions & 2 deletions DLPrototype/Views/Today/Today.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import SwiftUI
import Combine

struct Today: View {
public var defaultSelectedDate: Date? = Date()
public var defaultSelectedDate: Date?

@State private var text: String = ""
@State private var jobId: String = ""
Expand Down Expand Up @@ -82,7 +82,7 @@ struct Today: View {

// MARK: Table view
var table: some View {
LogTable(job: $jobId, date: defaultSelectedDate!)
LogTable(job: $jobId, defaultSelectedDate: defaultSelectedDate)
.id(updater.ids["today.table"])
.environmentObject(updater)
}
Expand Down

0 comments on commit c639e53

Please sign in to comment.