Skip to content

Commit

Permalink
Merge pull request #56 from aapis/feature/remove-neuronalfire-ux-pass
Browse files Browse the repository at this point in the history
UI/UX pass, remove NeuronalFire
  • Loading branch information
aapis authored Sep 6, 2024
2 parents 83fdc2d + be0e95f commit dfd6136
Show file tree
Hide file tree
Showing 16 changed files with 422 additions and 1,170 deletions.
12 changes: 2 additions & 10 deletions KlockWork-iOS/KlockWork-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
538A53502C6FEA6600711639 /* CoreDataTaxonomyTerms.swift in Sources */ = {isa = PBXBuildFile; fileRef = 538A534F2C6FEA6600711639 /* CoreDataTaxonomyTerms.swift */; };
538A53522C6FF1C400711639 /* TermDetail.swift in Sources */ = {isa = PBXBuildFile; fileRef = 538A53512C6FF1C200711639 /* TermDetail.swift */; };
538A53562C7026B500711639 /* CoreDataTaxonomyTermDefinitions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 538A53552C7026B500711639 /* CoreDataTaxonomyTermDefinitions.swift */; };
538A53612C72766F00711639 /* GlasgowComaScaleCalculator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 538A53602C72766900711639 /* GlasgowComaScaleCalculator.swift */; };
53911FC52C19E87300B77DAB /* ActivityWeight.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53911FC42C19E87300B77DAB /* ActivityWeight.swift */; };
539134EA2C0269B600B48494 /* PageConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 539134E92C0269B600B48494 /* PageConfiguration.swift */; };
539134EC2C02883000B48494 /* PersonDetail.swift in Sources */ = {isa = PBXBuildFile; fileRef = 539134EB2C02883000B48494 /* PersonDetail.swift */; };
Expand All @@ -62,7 +61,6 @@
53B2C3692C1F7D65003507CE /* DefaultObjects.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53B2C3682C1F7D59003507CE /* DefaultObjects.swift */; };
53B2C36B2C22708D003507CE /* PageMode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53B2C36A2C22708A003507CE /* PageMode.swift */; };
53B72B5C2C77DDE900324E15 /* DefinitionDetail.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53B72B5B2C77DDE600324E15 /* DefinitionDetail.swift */; };
53B72B5E2C78193100324E15 /* PrimaryAssessmentGuide.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53B72B5D2C78192A00324E15 /* PrimaryAssessmentGuide.swift */; };
53C059B82C33BCAE0066111C /* RecordFilter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53C059B72C33BCAA0066111C /* RecordFilter.swift */; };
53D4CB572BFE930100AFEDEA /* KlockWork_iOSApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53D4CB562BFE930100AFEDEA /* KlockWork_iOSApp.swift */; };
53D4CB642BFE930300AFEDEA /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 53D4CB632BFE930300AFEDEA /* Preview Assets.xcassets */; };
Expand Down Expand Up @@ -163,7 +161,6 @@
538A534F2C6FEA6600711639 /* CoreDataTaxonomyTerms.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = CoreDataTaxonomyTerms.swift; path = ../../DLPrototype/DLPrototype/Models/CoreData/CoreDataTaxonomyTerms.swift; sourceTree = "<group>"; };
538A53512C6FF1C200711639 /* TermDetail.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TermDetail.swift; sourceTree = "<group>"; };
538A53552C7026B500711639 /* CoreDataTaxonomyTermDefinitions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = CoreDataTaxonomyTermDefinitions.swift; path = ../../DLPrototype/DLPrototype/Models/CoreData/CoreDataTaxonomyTermDefinitions.swift; sourceTree = "<group>"; };
538A53602C72766900711639 /* GlasgowComaScaleCalculator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GlasgowComaScaleCalculator.swift; sourceTree = "<group>"; };
53911FC42C19E87300B77DAB /* ActivityWeight.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ActivityWeight.swift; path = ../../DLPrototype/DLPrototype/Enums/ActivityWeight.swift; sourceTree = "<group>"; };
539134E92C0269B600B48494 /* PageConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PageConfiguration.swift; sourceTree = "<group>"; };
539134EB2C02883000B48494 /* PersonDetail.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PersonDetail.swift; sourceTree = "<group>"; };
Expand All @@ -183,7 +180,6 @@
53B2C3682C1F7D59003507CE /* DefaultObjects.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DefaultObjects.swift; sourceTree = "<group>"; };
53B2C36A2C22708A003507CE /* PageMode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PageMode.swift; sourceTree = "<group>"; };
53B72B5B2C77DDE600324E15 /* DefinitionDetail.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DefinitionDetail.swift; sourceTree = "<group>"; };
53B72B5D2C78192A00324E15 /* PrimaryAssessmentGuide.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrimaryAssessmentGuide.swift; sourceTree = "<group>"; };
53C059B72C33BCAA0066111C /* RecordFilter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecordFilter.swift; sourceTree = "<group>"; };
53D4CB532BFE930100AFEDEA /* KlockWork-iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "KlockWork-iOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
53D4CB562BFE930100AFEDEA /* KlockWork_iOSApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KlockWork_iOSApp.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -339,8 +335,6 @@
538A535F2C72765F00711639 /* Explore */ = {
isa = PBXGroup;
children = (
53B72B5D2C78192A00324E15 /* PrimaryAssessmentGuide.swift */,
538A53602C72766900711639 /* GlasgowComaScaleCalculator.swift */,
53D4CB6C2BFE93B000AFEDEA /* Explore.swift */,
);
path = Explore;
Expand Down Expand Up @@ -641,7 +635,6 @@
538A10332C31C7D70028B785 /* RowAddButton.swift in Sources */,
539134EA2C0269B600B48494 /* PageConfiguration.swift in Sources */,
53F926292BFEA00E00948076 /* Project.swift in Sources */,
53B72B5E2C78193100324E15 /* PrimaryAssessmentGuide.swift in Sources */,
53F9262A2BFEA00E00948076 /* Job.swift in Sources */,
53E50C112C0E60A800A85FDC /* Month.swift in Sources */,
53F9262B2BFEA00E00948076 /* EKEvent.swift in Sources */,
Expand Down Expand Up @@ -675,7 +668,6 @@
53F9260C2BFE9BF300948076 /* CoreDataPlan.swift in Sources */,
53F9260D2BFE9BF300948076 /* CoreDataProjectConfiguration.swift in Sources */,
5324416F2C067F5D00659F14 /* Assessment.swift in Sources */,
538A53612C72766F00711639 /* GlasgowComaScaleCalculator.swift in Sources */,
53E6974E2C23ABB0005A7375 /* ProjectSelector.swift in Sources */,
53B2C3692C1F7D65003507CE /* DefaultObjects.swift in Sources */,
5324416D2C06485800659F14 /* ActivityCalendar.swift in Sources */,
Expand Down Expand Up @@ -869,7 +861,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = "KlockWork-iOS/KlockWork_iOS.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 20;
CURRENT_PROJECT_VERSION = 21;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"KlockWork-iOS/Preview Content\"";
DEVELOPMENT_TEAM = 6DT7L2N5X6;
Expand Down Expand Up @@ -912,7 +904,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = "KlockWork-iOS/KlockWork_iOS.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 20;
CURRENT_PROJECT_VERSION = 21;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"KlockWork-iOS/Preview Content\"";
DEVELOPMENT_TEAM = 6DT7L2N5X6;
Expand Down
13 changes: 6 additions & 7 deletions KlockWork-iOS/KlockWork-iOS/Entities/Detail/NoteDetail.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ struct NoteDetail: View {
.blendMode(.softLight)

ZStack {
VStack {
VStack(alignment: .leading, spacing: 0) {
Editor(job: $job, title: $title)
HStack {
HStack(alignment: .top, spacing: 0) {
TextEditor(text: $content)
.focused($contentFieldFocused)
.padding()
.foregroundStyle(contentFieldFocused ? .white : .gray)
.padding(8)
.foregroundStyle(.white)
Spacer()
}
Spacer()
Expand Down Expand Up @@ -78,7 +78,7 @@ struct NoteDetail: View {
TextField("Title", text: $title)
.focused($titleFieldFocused)
.padding(.leading)
.foregroundStyle(titleFieldFocused ? .white : .gray)
.foregroundStyle(.white)
Spacer()
Menu {
// A little bit of info about the current job (title and JID)
Expand Down Expand Up @@ -144,11 +144,10 @@ struct NoteDetail: View {
.frame(maxHeight: 20)
}
.padding(14)
.tint(self.job != nil ? self.job!.backgroundColor.isBright() ? Theme.base : self.state.theme.tint : .white)
.foregroundStyle(self.job != nil ? self.job!.backgroundColor.isBright() ? Theme.cPurple : self.state.theme.tint : .white)
.background(self.job != nil ? self.job!.backgroundColor : .red)
}
}
.frame(height: 50)
}
.background(Theme.textBackground)
.border(width: 1, edges: [.bottom], color: Theme.rowColour)
Expand Down
30 changes: 22 additions & 8 deletions KlockWork-iOS/KlockWork-iOS/Entities/Detail/TaskDetail.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ struct TaskDetail: View {
@State private var content: String = ""
@State private var created: Date = Date()
@State private var due: Date = DateHelper.endOfDay() ?? Date()
@State private var dueTomorrow: Date = DateHelper.endOfTomorrow() ?? Date()
@State private var lastUpdate: Date = Date()
@State public var job: Job?
@State private var company: Company?
Expand Down Expand Up @@ -53,20 +54,29 @@ struct TaskDetail: View {

self.actionOnSave()
} label: {
Text("Reopen")
HStack {
Image(systemName: "plus")
.foregroundStyle(self.state.theme.tint)
Text("Reopen")
}
}
.listRowBackground(Theme.textBackground)
}

Button {
var dc = DateComponents()
dc.day = +1
self.due = Calendar.autoupdatingCurrent.date(byAdding: dc, to: self.due) ?? DateHelper.endOfDay() ?? Date()
if let newDate = DateHelper.endOfTomorrow(self.due) {
self.due = newDate
}
self.actionOnSave()
} label: {
Text("+1 Due")
HStack {
Image(systemName: "calendar.badge.clock")
.foregroundStyle(self.state.theme.tint)
Text("Due tomorrow")
}
}
.listRowBackground(Theme.textBackground)

if self.task != nil {
Button {
CoreDataTasks(moc: self.state.moc).create(
Expand All @@ -77,7 +87,11 @@ struct TaskDetail: View {
)
dismiss()
} label: {
Text("Duplicate")
HStack {
Image(systemName: "doc.on.doc")
.foregroundStyle(self.state.theme.tint)
Text("Duplicate")
}
}
.listRowBackground(Theme.textBackground)
}
Expand Down
88 changes: 71 additions & 17 deletions KlockWork-iOS/KlockWork-iOS/Entities/Filter/RecordFilter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,53 @@ import SwiftUI

struct RecordsGroupedByDate: Identifiable {
var id: UUID = UUID()
var date: Date
var date: String
var records: [LogRecord]
}

struct GroupedRecordDateRow: View {
public let date: Date
public let date: String

var body: some View {
HStack(alignment: .center, spacing: 5) {
Image(systemName: "calendar")
Text(date.formatted(date: .abbreviated, time: .omitted))
Text(date)
Spacer()
}
.padding(8)
}
}

struct RecordFilter: View {
typealias Button = Tabs.Content.Individual.SingleRecord
typealias Record = Tabs.Content.Individual.SingleRecord

@EnvironmentObject private var state: AppState
public var job: Job?
public var page: PageConfiguration.AppPage = .create
@FetchRequest private var records: FetchedResults<LogRecord>
@State private var groupedRecords: [RecordsGroupedByDate] = []
@State private var searchText: String = ""

var body: some View {
VStack(alignment: .leading, spacing: 0) {
ScrollView(showsIndicators: false) {
ForEach(groupedRecords) { group in
VStack(alignment: .leading, spacing: 1) {
GroupedRecordDateRow(date: group.date)
ZStack(alignment: .bottomLeading) {
ScrollView(showsIndicators: false) {
ForEach(groupedRecords) { group in
VStack(alignment: .leading, spacing: 1) {
GroupedRecordDateRow(date: group.date)

ForEach(group.records) { record in
Button(record: record)
ForEach(group.records) { record in
Record(record: record)
}
}
}
}
LinearGradient(colors: [.black, .clear], startPoint: .bottom, endPoint: .top)
.frame(height: 50)
.opacity(0.1)
}

QueryField(prompt: "Search for keywords or phrases", onSubmit: self.actionOnSubmit, action: .search, text: $searchText)
}
.onAppear(perform: self.actionOnAppear)
.navigationTitle("Records")
Expand All @@ -69,19 +79,63 @@ extension RecordFilter {
private func actionOnAppear() -> Void {
self.groupedRecords = []
if self.records.count > 0 {
let sortedRecords = Array(self.records)
.sliced(by: [.year, .month, .day], for: \.timestamp!)
.sorted(by: {$0.key > $1.key})
let grouped = Dictionary(grouping: sortedRecords, by: {$0.key})
// @TODO: implement similar sorting to Upcoming/Overdue tabs
let grouped = Dictionary(grouping: self.records, by: {$0.timestamp!.formatted(date: .abbreviated, time: .omitted)})
let sorted = Array(grouped)
.sorted(by: {
let df = DateFormatter()
df.dateStyle = .medium
df.timeStyle = .none

if let d1 = df.date(from: $0.key) {
if let d2 = df.date(from: $1.key) {
return d1 < d2
}
}
return false
})

for group in grouped {
for group in sorted {
self.groupedRecords.append(
RecordsGroupedByDate(date: group.key, records: group.value.first?.value ?? [])
RecordsGroupedByDate(date: group.key, records: group.value.sorted(by: {$0.timestamp! < $1.timestamp!}))
)
}
}
}

/// Plaintext search onsubmit handler
/// - Returns: Void
private func actionOnSubmit() -> Void {
self.groupedRecords = []
if self.records.count > 0 {
let grouped = Dictionary(grouping: self.records, by: {$0.timestamp!.formatted(date: .abbreviated, time: .omitted)})
let sorted = Array(grouped)
.sorted(by: {
let df = DateFormatter()
df.dateStyle = .medium
df.timeStyle = .none

if let d1 = df.date(from: $0.key) {
if let d2 = df.date(from: $1.key) {
return d1 < d2
}
}
return false
})

for group in sorted {
if self.searchText.isEmpty {
self.groupedRecords.append(
RecordsGroupedByDate(date: group.key, records: group.value.sorted(by: {$0.timestamp! < $1.timestamp!}))
)
} else {
let matchingRecords = group.value.filter({$0.message?.contains(self.searchText.lowercased()) ?? false})
self.groupedRecords.append(
RecordsGroupedByDate(date: group.key, records: matchingRecords.sorted(by: {$0.timestamp! < $1.timestamp!}))
)
}
}
}
}
}

/// Thank you https://stackoverflow.com/a/64496966
Expand Down
Loading

0 comments on commit dfd6136

Please sign in to comment.