Skip to content

Commit

Permalink
Merge pull request #305 from aapis/feature/1.13/inspect-meetings-in-u…
Browse files Browse the repository at this point in the history
…niversalheader

Support inspecting events listed in universal header widgets
  • Loading branch information
aapis authored Oct 15, 2024
2 parents 469ea0e + 59bcb5d commit 8efbf4e
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions KWCore/Sources/UI/WidgetLibrary/WidgetLibrary.UI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -381,12 +381,18 @@ extension WidgetLibrary {
let hasPassed = event.startDate >= Date()
Image(systemName: hasPassed ? "arrow.right" : "checkmark")
.padding(.leading, 10)
HStack {
Text("\(event.startTime()) - \(event.endTime()):")
Text(event.title)
}
.foregroundColor(hasPassed ? (self.state.session.job?.backgroundColor ?? .clear).isBright() ? Theme.lightBase : Theme.lightWhite : .gray.opacity(0.8))
Button {
self.state.session.search.inspectingEvent = event
} label: {
HStack {
Text("\(event.startTime()) - \(event.endTime()):")
Text(event.title)
}
.foregroundColor(hasPassed ? (self.state.session.job?.backgroundColor ?? .clear).isBright() ? Theme.lightBase : .white : .gray.opacity(0.8))
.multilineTextAlignment(.leading)
}
.useDefaultHover({_ in})
.buttonStyle(.plain)
}
}
}
Expand All @@ -395,6 +401,13 @@ extension WidgetLibrary {
.foregroundStyle((self.state.session.job?.backgroundColor ?? .clear).isBright() ? Theme.lightBase : Theme.lightWhite)
.onAppear(perform: self.actionOnAppear)
.onChange(of: self.calendar) { self.actionOnChangeCalendar() }
.onChange(of: self.state.session.search.inspectingEvent) {
if let event = self.state.session.search.inspectingEvent {
self.state.setInspector(AnyView(Inspector(event: event)))
} else {
self.state.setInspector()
}
}
.id(self.updater.get("dashboard.header"))
}
}
Expand Down

0 comments on commit 8efbf4e

Please sign in to comment.