Browse Source

Alternate button for calendar.

master
Abhishek Banthia 7 months ago
parent
commit
a0a81e4917
  1. 14
      Clocker/Overall App/Themer.swift
  2. 14
      Clocker/Panel/Upcoming Events/UpcomingEventViewItem.swift

14
Clocker/Overall App/Themer.swift

@ -220,7 +220,19 @@ extension Themer {
}
func removeImage() -> NSImage {
if let symbolImage = symbolImage(for: "xmark") {
if let symbolImage = symbolImage(for: "xmark.circle") {
return symbolImage
}
return fallbackImageProvider(NSImage(named: NSImage.Name("Remove"))!,
NSImage(named: NSImage.Name("WhiteRemove"))!,
NSImage(named: NSImage.Name("Remove Dynamic"))!,
NSImage(named: NSImage.Name("Remove"))!,
NSImage(named: NSImage.Name("WhiteRemove"))!)
}
func removeAlternateImage() -> NSImage {
if let symbolImage = symbolImage(for: "xmark.circle.fill") {
return symbolImage
}

14
Clocker/Panel/Upcoming Events/UpcomingEventViewItem.swift

@ -19,6 +19,7 @@ class UpcomingEventViewItem: NSCollectionViewItem {
private weak var panelDelegate: UpcomingEventPanelDelegate?
override func viewDidLoad() {
zoomButton.setButtonType(.momentaryChange)
zoomButton.target = self
zoomButton.action = #selector(zoomButtonAction(_:))
}
@ -91,7 +92,8 @@ class UpcomingEventViewItem: NSCollectionViewItem {
setAlternateState(NSLocalizedString("See your next Calendar event here.", comment: "Next Event Label for no Calendar access"),
NSLocalizedString("Click here to start.", comment: "Button Title for no Calendar access"),
NSColor.systemBlue,
Themer.shared().removeImage())
Themer.shared().removeImage(),
Themer.shared().removeAlternateImage())
}
func setupEmptyState() {
@ -100,10 +102,15 @@ class UpcomingEventViewItem: NSCollectionViewItem {
setAlternateState(NSLocalizedString("No upcoming events for today!", comment: "Next Event Label with no upcoming event"),
subtitle,
NSColor.systemGreen,
nil)
nil,
nil)
}
private func setAlternateState(_ title: String, _ buttonTitle: String, _ color: NSColor, _ image: NSImage? = nil) {
private func setAlternateState(_ title: String,
_ buttonTitle: String,
_ color: NSColor,
_ image: NSImage?,
_ alternateImage: NSImage?) {
if leadingConstraint.constant != UpcomingEventViewItem.EventLeadingConstraint {
leadingConstraint.animator().constant = UpcomingEventViewItem.EventLeadingConstraint
}
@ -112,6 +119,7 @@ class UpcomingEventViewItem: NSCollectionViewItem {
setCalendarButtonTitle(buttonTitle: buttonTitle, cancellationState: false)
calendarColorView.layer?.backgroundColor = color.cgColor
zoomButton.image = image
zoomButton.alternateImage = alternateImage
}
private func setCalendarButtonTitle(buttonTitle: String, cancellationState: Bool) {

Loading…
Cancel
Save