Skip to content

Commit

Permalink
Merge pull request #53 from aapis/feature/ui-pass-4
Browse files Browse the repository at this point in the history
UX pass
  • Loading branch information
aapis authored Sep 1, 2024
2 parents e5f8412 + 968d70c commit c3e7736
Show file tree
Hide file tree
Showing 24 changed files with 261 additions and 182 deletions.
8 changes: 6 additions & 2 deletions KlockWork-iOS/KlockWork-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
53274B3C2C13C7E6008387BF /* AssessmentFactor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53274B3B2C13C7E6008387BF /* AssessmentFactor.swift */; };
536B32B22C1A03BB00E01517 /* AppState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 536B32B12C1A038E00E01517 /* AppState.swift */; };
536E4F692C0D77A600FDC1F4 /* ActionType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 536E4F682C0D77A600FDC1F4 /* ActionType.swift */; };
53733D512C851CF500212DD6 /* Logo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53733D502C851CF200212DD6 /* Logo.swift */; };
537582C72BFFB37900CB528C /* Data.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 537582C52BFFB37900CB528C /* Data.xcdatamodeld */; };
537582CC2BFFD70D00CB528C /* RecordDetail.swift in Sources */ = {isa = PBXBuildFile; fileRef = 537582CB2BFFD70D00CB528C /* RecordDetail.swift */; };
537582CE2BFFEB7500CB528C /* EdgeBorder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 537582CD2BFFEB7500CB528C /* EdgeBorder.swift */; };
Expand Down Expand Up @@ -144,6 +145,7 @@
53274B3B2C13C7E6008387BF /* AssessmentFactor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AssessmentFactor.swift; sourceTree = "<group>"; };
536B32B12C1A038E00E01517 /* AppState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppState.swift; sourceTree = "<group>"; };
536E4F682C0D77A600FDC1F4 /* ActionType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionType.swift; sourceTree = "<group>"; };
53733D502C851CF200212DD6 /* Logo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Logo.swift; sourceTree = "<group>"; };
537582C62BFFB37900CB528C /* Note.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Note.xcdatamodel; sourceTree = "<group>"; };
537582CB2BFFD70D00CB528C /* RecordDetail.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecordDetail.swift; sourceTree = "<group>"; };
537582CD2BFFEB7500CB528C /* EdgeBorder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = EdgeBorder.swift; path = ../../DLPrototype/DLPrototype/Views/Shared/EdgeBorder.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -309,6 +311,7 @@
537582D32C00338E00CB528C /* SharedViews */ = {
isa = PBXGroup;
children = (
53733D502C851CF200212DD6 /* Logo.swift */,
538A10322C31C7CC0028B785 /* RowAddButton.swift */,
530C8D1F2C1BE87600ED3AD1 /* Error */,
53E33F842C1B8D2D001191ED /* LargeDateIndicator.swift */,
Expand Down Expand Up @@ -682,6 +685,7 @@
537582D52C0033B800CB528C /* Tabs.swift in Sources */,
538A10312C30FB600028B785 /* ViewMode.swift in Sources */,
53F926042BFE9B2400948076 /* PersistenceController.swift in Sources */,
53733D512C851CF500212DD6 /* Logo.swift in Sources */,
539134F02C02C44000B48494 /* Swipe.swift in Sources */,
53D4CBCA2BFE955000AFEDEA /* SaveSource.swift in Sources */,
53D4CBC52BFE94C900AFEDEA /* DateHelper.swift in Sources */,
Expand Down Expand Up @@ -861,7 +865,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = "KlockWork-iOS/KlockWork_iOS.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 18;
CURRENT_PROJECT_VERSION = 20;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"KlockWork-iOS/Preview Content\"";
DEVELOPMENT_TEAM = 6DT7L2N5X6;
Expand Down Expand Up @@ -904,7 +908,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = "KlockWork-iOS/KlockWork_iOS.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 18;
CURRENT_PROJECT_VERSION = 20;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"KlockWork-iOS/Preview Content\"";
DEVELOPMENT_TEAM = 6DT7L2N5X6;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct GroupedRecordDateRow: View {

struct RecordFilter: View {
typealias Button = Tabs.Content.Individual.SingleRecord
public let job: Job
public var job: Job?
public var page: PageConfiguration.AppPage = .create
@FetchRequest private var records: FetchedResults<LogRecord>
@State private var groupedRecords: [RecordsGroupedByDate] = []
Expand Down Expand Up @@ -57,9 +57,9 @@ struct RecordFilter: View {
.scrollDismissesKeyboard(.immediately)
}

init(job: Job) {
init(job: Job?) {
self.job = job
_records = CoreDataRecords.fetch(job: self.job)
_records = CoreDataRecords.fetch(job: self.job!)
}
}

Expand Down
1 change: 1 addition & 0 deletions KlockWork-iOS/KlockWork-iOS/Libraries/AppState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class AppState: ObservableObject {
@Published var theme: AppTheme = AppTheme()
@Published var today: TodayPage = TodayPage()
@Published var job: Job?
@Published var plan: Plan?

init() {
self.activities.state = self
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class Assessment {
}

if self.isToday {
return .yellow
return .yellow // leave this .yellow so we don't need to pass in state.theme.tint
} else if self.isSelected {
return .blue
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct Legend: View {
Image(systemName: "gear")
}
}
.foregroundStyle(self.state.activities.statuses.isEmpty ? .gray : .yellow)
.foregroundStyle(self.state.activities.statuses.isEmpty ? .gray : self.state.theme.tint)
.help("Modify assessment factors")
.disabled(self.state.activities.statuses.isEmpty)
}
Expand All @@ -47,7 +47,7 @@ struct Legend: View {
ForEach(self.state.activities.statuses.sorted(by: {$0.defaultValue < $1.defaultValue})) { status in
Row(status: status)
}
RowBasic(colour: .yellow, label: "Today")
RowBasic(colour: self.state.theme.tint, label: "Today")
RowBasic(colour: .blue, label: "Selected")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct OverviewWidget: View {
GridRow(alignment: .top) {
HStack {
Text("Assessment")
.foregroundStyle(.yellow)
.foregroundStyle(self.state.theme.tint)
Spacer()

NavigationLink {
Expand All @@ -34,7 +34,7 @@ struct OverviewWidget: View {
Image(systemName: "gear")
}
}
.foregroundStyle(.yellow)
.foregroundStyle(self.state.theme.tint)
.help("Modify assessment factors")
}
.padding([.leading, .trailing])
Expand Down
6 changes: 5 additions & 1 deletion KlockWork-iOS/KlockWork-iOS/Main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ struct Main: View {
TabView {
Planning(inSheet: false)
.tabItem {
Image(systemName: "hexagon")
if self.state.plan != nil {
Image(systemName: "circle.hexagongrid.fill")
} else {
Image(systemName: "hexagon")
}
Text("Planning")
}
Today(inSheet: false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ struct FlashcardActivity: View {
}

struct Actions: View {
@EnvironmentObject private var state: AppState
@Binding public var isAnswerCardShowing: Bool
@Binding public var definitions: [TaxonomyTermDefinitions]
@Binding public var current: TaxonomyTerm?
Expand Down Expand Up @@ -144,7 +145,7 @@ struct FlashcardActivity: View {
.mask(Circle().frame(width: 50, height: 50))
}
.frame(height: 90)
.border(width: 1, edges: [.top], color: .yellow)
.border(width: 1, edges: [.top], color: self.state.theme.tint)
}
}

Expand Down
28 changes: 20 additions & 8 deletions KlockWork-iOS/KlockWork-iOS/Pages/Explore/Explore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ struct Explore: View {
typealias EntityTypePair = PageConfiguration.EntityTypePair

@EnvironmentObject private var state: AppState
private let fgColour: Color = .yellow
private var columns: [GridItem] {
Array(repeating: .init(.flexible()), count: 2)
}
Expand Down Expand Up @@ -41,15 +40,28 @@ struct Explore: View {

struct Header: View {
@EnvironmentObject private var state: AppState
@State public var date: Date = Date()

var body: some View {
HStack(alignment: .center, spacing: 8) {
Text("Explore")
.font(.largeTitle)
.fontWeight(.bold)
.padding([.leading, .top, .bottom])
Spacer()
CreateEntitiesButton(isViewModeSelectorVisible: false)
HStack(alignment: .center, spacing: 0) {
ZStack(alignment: .bottom) {
LinearGradient(gradient: Gradient(colors: [Theme.base, .clear]), startPoint: .bottom, endPoint: .top)
.opacity(0.1)
.blendMode(.softLight)
.frame(height: 45)

HStack(spacing: 8) {
Text("Explore").font(.title2).padding([.leading, .trailing], 10).bold()
Spacer()
CreateEntitiesButton(isViewModeSelectorVisible: false, isDateSelectorVisible: true)
}
}
}
.onAppear(perform: {
date = self.state.date
})
.onChange(of: date) {
self.state.date = date
}
}
}
Expand Down
55 changes: 29 additions & 26 deletions KlockWork-iOS/KlockWork-iOS/Pages/Find.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,41 +95,44 @@ struct Find: View {

extension Find {
struct Header: View {
@EnvironmentObject private var state: AppState
@State public var date: Date = Date()
@Binding public var text: String
@Binding public var recentSearchTerms: [String]
@State private var isPresented: Bool = false
public var onSubmit: () -> Void

var body: some View {
HStack(alignment: .center, spacing: 0) {
if text.isEmpty {
Text("Find")
.font(.largeTitle)
.fontWeight(.bold)
.padding([.leading, .top, .bottom])
} else {
if text.count < 10 {
Text("Find: \(text.prefix(10))")
.font(.largeTitle)
.fontWeight(.bold)
.padding([.leading, .top, .bottom])
} else {
Text("Find: \(text.prefix(10))...")
.font(.largeTitle)
.fontWeight(.bold)
.padding([.leading, .top, .bottom])
ZStack(alignment: .bottom) {
LinearGradient(gradient: Gradient(colors: [Theme.base, .clear]), startPoint: .bottom, endPoint: .top)
.opacity(0.1)
.blendMode(.softLight)
.frame(height: 45)

HStack(spacing: 8) {
HStack {
if text.isEmpty {
Text("Find")
} else {
if text.count < 10 {
Text("Find: \(text.prefix(10))")
} else {
Text("Find: \(text.prefix(10))...")
}
}
}
.font(.title2).padding([.leading, .trailing], 10).bold()
Spacer()
CreateEntitiesButton(isViewModeSelectorVisible: false, isDateSelectorVisible: true)
}
}

Spacer()
CreateEntitiesButton(isViewModeSelectorVisible: false)
// @TODO: move to CreateEntitiesButton
// NavigationLink {
// AppSettings()
// } label: {
// Image(systemName: "gearshape")
// .font(.title)
// }
}
.onAppear(perform: {
date = self.state.date
})
.onChange(of: date) {
self.state.date = date
}
}
}
Expand Down
33 changes: 15 additions & 18 deletions KlockWork-iOS/KlockWork-iOS/Pages/Planning.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ struct Planning: View {
@State private var text: String = ""
@State private var job: Job? = nil
@State private var selected: PlanType = .daily
@State private var path = NavigationPath()
private let page: PageConfiguration.AppPage = .planning

var body: some View {
NavigationStack {
NavigationStack(path: $path) {
VStack(alignment: .leading, spacing: 0) {
Header(page: self.page)
Divider().background(.white).frame(height: 1)
Expand All @@ -45,26 +46,22 @@ extension Planning {
@EnvironmentObject private var state: AppState
@State private var date: Date = Date()
public let page: PageConfiguration.AppPage


var body: some View {
HStack(alignment: .center, spacing: 8) {
Text("Planning")
.font(.largeTitle)
.fontWeight(.bold)
.padding([.leading, .top, .bottom])
.overlay {
DatePicker(
"Date picker",
selection: $date,
displayedComponents: [.date]
)
.labelsHidden()
.contentShape(Rectangle())
.opacity(0.011)
HStack(alignment: .center, spacing: 0) {
ZStack(alignment: .bottom) {
LinearGradient(gradient: Gradient(colors: [Theme.base, .clear]), startPoint: .bottom, endPoint: .top)
.opacity(0.2)
.blendMode(.softLight)
.frame(height: 45)

HStack(spacing: 8) {
Text("Planning").font(.title2).padding([.leading, .trailing], 10).bold()
Spacer()
CreateEntitiesButton(isViewModeSelectorVisible: false, isDateSelectorVisible: true)
}
Image(systemName: "chevron.right")
Spacer()
CreateEntitiesButton(isViewModeSelectorVisible: false)
}
}
.onAppear(perform: {
date = self.state.date
Expand Down
Loading

0 comments on commit c3e7736

Please sign in to comment.