diff --git a/DLPrototype.xcodeproj/project.pbxproj b/DLPrototype.xcodeproj/project.pbxproj index 3397daf4..19a4b295 100644 --- a/DLPrototype.xcodeproj/project.pbxproj +++ b/DLPrototype.xcodeproj/project.pbxproj @@ -957,7 +957,7 @@ "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 75; + CURRENT_PROJECT_VERSION = 76; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = "\"DLPrototype/Preview Content\""; DEVELOPMENT_TEAM = 6DT7L2N5X6; @@ -988,7 +988,7 @@ "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 75; + CURRENT_PROJECT_VERSION = 76; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = "\"DLPrototype/Preview Content\""; DEVELOPMENT_TEAM = 6DT7L2N5X6; diff --git a/DLPrototype/CoreData/Data.xcdatamodeld/Note.xcdatamodel/contents b/DLPrototype/CoreData/Data.xcdatamodeld/Note.xcdatamodel/contents index 3d3718b1..9f0bc524 100644 --- a/DLPrototype/CoreData/Data.xcdatamodeld/Note.xcdatamodel/contents +++ b/DLPrototype/CoreData/Data.xcdatamodeld/Note.xcdatamodel/contents @@ -12,6 +12,7 @@ + @@ -40,6 +41,7 @@ + diff --git a/DLPrototype/Views/Notes/NoteCreate.swift b/DLPrototype/Views/Notes/NoteCreate.swift index 378435cf..53b61183 100644 --- a/DLPrototype/Views/Notes/NoteCreate.swift +++ b/DLPrototype/Views/Notes/NoteCreate.swift @@ -85,7 +85,8 @@ struct NoteCreate: View { note.body = content note.postedDate = Date() note.id = UUID() - note.job = selectedJob + note.job = selectedJob // TODO: DEPRECATED + note.mJob = selectedJob note.alive = true let version = NoteVersion(context: moc) diff --git a/DLPrototype/Views/Notes/NoteRow.swift b/DLPrototype/Views/Notes/NoteRow.swift index 187ddf07..9d75f822 100644 --- a/DLPrototype/Views/Notes/NoteRow.swift +++ b/DLPrototype/Views/Notes/NoteRow.swift @@ -28,8 +28,8 @@ struct NoteRow: View { Group { HStack(spacing: 0) { ZStack(alignment: .leading) { - if note.job != nil { - Color.fromStored(note.job!.project!.colour ?? Theme.rowColourAsDouble) + if note.mJob != nil { + Color.fromStored(note.mJob!.project!.colour ?? Theme.rowColourAsDouble) } else { Theme.rowColour } @@ -42,13 +42,13 @@ struct NoteRow: View { @ViewBuilder private func nNote(_ note: Note) -> some View { Group { ZStack(alignment: .leading) { - if note.job != nil { - Color.fromStored(note.job!.colour ?? Theme.rowColourAsDouble) + if note.mJob != nil { + Color.fromStored(note.mJob!.colour ?? Theme.rowColourAsDouble) } else { Theme.rowColour } - FancyTextLink(text: note.title!, destination: AnyView(NoteView(note: note)), fgColour: (note.job != nil ? (Color.fromStored(note.job!.colour ?? Theme.rowColourAsDouble).isBright() ? Color.black : Color.white) : Color.white)) + FancyTextLink(text: note.title!, destination: AnyView(NoteView(note: note)), fgColour: (note.mJob != nil ? (Color.fromStored(note.mJob!.colour ?? Theme.rowColourAsDouble).isBright() ? Color.black : Color.white) : Color.white)) } } } @@ -56,8 +56,8 @@ struct NoteRow: View { @ViewBuilder private func nStar(_ note: Note) -> some View { Group { ZStack { - if note.job != nil { - Color.fromStored(note.job!.colour ?? Theme.rowColourAsDouble) + if note.mJob != nil { + Color.fromStored(note.mJob!.colour ?? Theme.rowColourAsDouble) } else { Theme.rowColour } @@ -65,7 +65,7 @@ struct NoteRow: View { if note.starred { Image(systemName: "star.fill") .padding() - .foregroundColor(note.job != nil ? (Color.fromStored(note.job!.colour ?? Theme.rowColourAsDouble).isBright() ? Color.black : Color.white) : Color.white) + .foregroundColor(note.mJob != nil ? (Color.fromStored(note.mJob!.colour ?? Theme.rowColourAsDouble).isBright() ? Color.black : Color.white) : Color.white) } } } @@ -75,15 +75,15 @@ struct NoteRow: View { @ViewBuilder private func nVersions(_ note: Note) -> some View { Group { ZStack { - if note.job != nil { - Color.fromStored(note.job!.colour ?? Theme.rowColourAsDouble) + if note.mJob != nil { + Color.fromStored(note.mJob!.colour ?? Theme.rowColourAsDouble) } else { Theme.rowColour } Text("\(note.versions!.count)") .padding() - .foregroundColor(note.job != nil ? (Color.fromStored(note.job!.colour ?? Theme.rowColourAsDouble).isBright() ? Color.black : Color.white) : Color.white) + .foregroundColor(note.mJob != nil ? (Color.fromStored(note.mJob!.colour ?? Theme.rowColourAsDouble).isBright() ? Color.black : Color.white) : Color.white) } } .frame(width: 100) diff --git a/DLPrototype/Views/Notes/NoteView.swift b/DLPrototype/Views/Notes/NoteView.swift index b56127da..fa1ef170 100644 --- a/DLPrototype/Views/Notes/NoteView.swift +++ b/DLPrototype/Views/Notes/NoteView.swift @@ -43,10 +43,6 @@ struct NoteView: View { CoreDataNoteVersions(moc: moc).by(id: note.id!) } -// private var currentVersion: NoteVersion { -// versions.last! -// } - var body: some View { VStack { if isShowingEditor { @@ -197,6 +193,7 @@ struct NoteView: View { note.lastUpdate = Date() lastUpdate = note.lastUpdate note.job = selectedJob // TODO: REMOVE + note.mJob = selectedJob note.alive = true CoreDataNoteVersions(moc: moc).from(note) @@ -226,7 +223,7 @@ struct NoteView: View { private func createBindings(note: Note) -> Void { title = note.title! content = note.body! - selectedJob = note.job ?? nil + selectedJob = note.mJob ?? nil lastUpdate = note.lastUpdate ?? nil isShowingEditor = true noteVersions = CoreDataNoteVersions(moc: moc).by(id: note.id!) diff --git a/DLPrototype/Views/Projects/ProjectRow.swift b/DLPrototype/Views/Projects/ProjectRow.swift index c2611328..28d57e6a 100644 --- a/DLPrototype/Views/Projects/ProjectRow.swift +++ b/DLPrototype/Views/Projects/ProjectRow.swift @@ -60,6 +60,6 @@ struct ProjectRow: View { (project.alive ? Theme.rowStatusGreen : Color.red.opacity(0.2)) } } - .frame(width: 100) + .frame(width: 5) } } diff --git a/DLPrototype/Views/Projects/ProjectView.swift b/DLPrototype/Views/Projects/ProjectView.swift index 2c89f328..f2ac2f89 100644 --- a/DLPrototype/Views/Projects/ProjectView.swift +++ b/DLPrototype/Views/Projects/ProjectView.swift @@ -14,6 +14,7 @@ struct ProjectView: View { @State private var name: String = "" @State private var colour: String = "" + @State private var colourChanged: Bool = false @State private var created: Date? @State private var lastUpdate: Date? @State private var alive: Bool = true @@ -339,6 +340,7 @@ struct ProjectView: View { let rndColour = Color.randomStorable() colour = Color.fromStored(rndColour).description.debugDescription project.colour = rndColour + colourChanged = true PersistenceController.shared.save() updater.update() @@ -367,7 +369,11 @@ struct ProjectView: View { project.jobs = [] project.alive = alive project.lastUpdate = Date() - project.colour = Color.randomStorable() + + if colourChanged { + project.colour = Color.randomStorable() + } + lastUpdate = project.lastUpdate! saveSelectedJobs() diff --git a/DLPrototype/Views/Projects/ProjectsDashboard.swift b/DLPrototype/Views/Projects/ProjectsDashboard.swift index 0cea699e..88f6a61d 100644 --- a/DLPrototype/Views/Projects/ProjectsDashboard.swift +++ b/DLPrototype/Views/Projects/ProjectsDashboard.swift @@ -77,15 +77,6 @@ struct ProjectsDashboard: View { } } .frame(width: 100) - - Group { - ZStack(alignment: .leading) { - Theme.headerColour - Text("Alive") - .padding() - } - } - .frame(width: 100) } } .frame(height: 46) diff --git a/DLPrototype/Views/Today/LogTable/LogTableDetails.swift b/DLPrototype/Views/Today/LogTable/LogTableDetails.swift index fbb9b311..14f1367e 100644 --- a/DLPrototype/Views/Today/LogTable/LogTableDetails.swift +++ b/DLPrototype/Views/Today/LogTable/LogTableDetails.swift @@ -209,7 +209,7 @@ struct LogTableDetails: View { StatisticWithView( key: note.title!, value: note.id!.debugDescription, - colour: Color.fromStored(note.job?.colour ?? Theme.rowColourAsDouble), + colour: Color.fromStored(note.mJob?.colour ?? Theme.rowColourAsDouble), group: .notes, view: AnyView( NavigationLink {