diff --git a/src/ui/osx/TogglDesktop/Common/Utils/ProjectTitleFactory.swift b/src/ui/osx/TogglDesktop/Common/Utils/ProjectTitleFactory.swift index 3ffb43e781..87d3d00f35 100644 --- a/src/ui/osx/TogglDesktop/Common/Utils/ProjectTitleFactory.swift +++ b/src/ui/osx/TogglDesktop/Common/Utils/ProjectTitleFactory.swift @@ -30,8 +30,8 @@ class ProjectTitleFactory: NSObject { @objc func title(withProject project: String, - task: String?, - client: String?, + task: String? = nil, + client: String? = nil, projectColor: NSColor, clientColor: NSColor? = nil) -> NSAttributedString { diff --git a/src/ui/osx/TogglDesktop/Features/Timeline/Views/TimelineTimeEntryCell.swift b/src/ui/osx/TogglDesktop/Features/Timeline/Views/TimelineTimeEntryCell.swift index b2d5be2391..cbba167384 100644 --- a/src/ui/osx/TogglDesktop/Features/Timeline/Views/TimelineTimeEntryCell.swift +++ b/src/ui/osx/TogglDesktop/Features/Timeline/Views/TimelineTimeEntryCell.swift @@ -53,8 +53,6 @@ final class TimelineTimeEntryCell: TimelineBaseCell { // MARK: OUTLET @IBOutlet weak var titleLbl: NSTextField! - @IBOutlet weak var projectStackView: NSStackView! - @IBOutlet weak var dotColorBox: DotImageView! @IBOutlet weak var projectLbl: ProjectTextField! @IBOutlet weak var clientNameLbl: NSTextField! @IBOutlet weak var billableImageView: NSImageView! @@ -125,7 +123,7 @@ final class TimelineTimeEntryCell: TimelineBaseCell { // Prepare controls need to check var components: [NSView] = [titleLbl] - if !projectStackView.isHidden { components.append(projectStackView) } + if !projectLbl.isHidden { components.append(projectLbl) } if !clientNameLbl.isHidden { components.append(clientNameLbl) } components.append(iconStackView) @@ -163,19 +161,12 @@ final class TimelineTimeEntryCell: TimelineBaseCell { // Projects if let project = item.projectLabel, !project.isEmpty { - projectStackView.isHidden = false - if let color = ConvertHexColor.hexCode(toNSColor: item.projectColor) { - dotColorBox.isHidden = false - dotColorBox.fill(with: color) - projectLbl.textColor = color - } else { - dotColorBox.isHidden = true - projectLbl.textColor = NSColor.labelColor - } - projectLbl.stringValue = project + projectLbl.isHidden = false projectLbl.toolTip = project + projectLbl.attributedStringValue = projectTitle(from: item) + } else { - projectStackView.isHidden = true + projectLbl.isHidden = true } // Client @@ -210,6 +201,18 @@ extension TimelineTimeEntryCell { backgroundBox?.isHidden = isHidden innerBackgroundBox.isHidden = isHidden } + + private func projectTitle(from timeEntry: TimeEntryViewItem) -> NSAttributedString { + let projectTitle = NSMutableAttributedString( + attributedString: ProjectTitleFactory().title( + withProject: timeEntry.projectLabel, + task: timeEntry.taskLabel, + projectColor: ConvertHexColor.hexCode(toNSColor: timeEntry.projectColor) + ) + ) + projectTitle.setAlignment(.left, range: NSRange(location: 0, length: projectTitle.length)) + return projectTitle + } } // MARK: TimelineTimeEntryMenuDelegate diff --git a/src/ui/osx/TogglDesktop/Features/Timeline/Views/TimelineTimeEntryCell.xib b/src/ui/osx/TogglDesktop/Features/Timeline/Views/TimelineTimeEntryCell.xib index 4be422e0a0..6482ed7374 100644 --- a/src/ui/osx/TogglDesktop/Features/Timeline/Views/TimelineTimeEntryCell.xib +++ b/src/ui/osx/TogglDesktop/Features/Timeline/Views/TimelineTimeEntryCell.xib @@ -1,8 +1,8 @@ - + - + @@ -31,56 +31,35 @@ - + - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + - - + + - + @@ -99,12 +78,12 @@ - + - + - + @@ -204,14 +183,12 @@ - - @@ -220,7 +197,6 @@ -