Skip to content

Commit

Permalink
feat(view): 💄 use most tracked project colour for client icon
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesNZL committed May 16, 2023
1 parent 6a701fa commit 60af653
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/TogglTrack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1491,12 +1491,16 @@ internal async ValueTask<List<Result>> RequestViewReports(CancellationToken toke
var client = me.clients?.Find(client => client.id == group.id);
var elapsed = TimeSpan.FromSeconds(group.seconds);
var highestProjectId = group.sub_groups?.MaxBy(subGroup => subGroup.seconds)?.id;
var highestProject = me.projects?.Find(project => project.id == highestProjectId);
return new Result
{
Title = client?.name ?? "No Client",
SubTitle = $"{elapsed.Humanize(maxUnit: Humanizer.Localisation.TimeUnit.Hour)} ({(int)elapsed.TotalHours}:{elapsed.ToString(@"mm\:ss")})",
// TODO: colour based on highest-tracked project
IcoPath = "view.png",
IcoPath = (highestProject?.color is not null)
? new ColourIcon(this._context, highestProject.color, "view.png").GetColourIcon()
: "view.png",
// AutoCompleteText =
Score = (int)group.seconds,
// Action = c =>
Expand Down

0 comments on commit 60af653

Please sign in to comment.