[#515] Add top websites and window titles#522
Conversation
casaout
left a comment
There was a problem hiding this comment.
great start, thank you!
I now mostly reviewed UI; and will review the code once we've settled on the design
|
|
||
| <!-- Website and window title details --> | ||
| <div v-if="topItemsAvailable"> | ||
| <div class="mb-2 mt-8"> |
There was a problem hiding this comment.
i don't think we'll need another title
also in terms of what is displayed, it's very similar to "top apps" and "top activities pursued" anyways
this will also help to reduce the window size
| v-if="topWebsites.length" | ||
| class="top-item-card rounded border border-gray-200 bg-gray-100 px-4 py-3 text-gray-800 dark:border-transparent dark:bg-neutral-800 dark:text-slate-200" | ||
| > | ||
| <h2 class="primary-blue font-bold leading-4">Top websites</h2> |
| renderCompactTime(website.totalDurationMs) | ||
| }}</span> | ||
| <span class="top-item-percentage">{{ | ||
| getTopItemPercentage(website, topWebsites) |
There was a problem hiding this comment.
I think we should try to align the design slightly more to the existing design; few suggestions:
- the numbering can be simplified (no rounded border); or maybe even removed as it'll be intuitive which one is the highest one?
- the fonts should be the same as for the other insight boxes
- in the dark mode, i think the light background of the chart is a bit too strong
- i think we don't need to display the percentages (as the timeline chart will imply this anyways), and to have more space for the window title)
- it can be made a bit more compact, to reduce the overall height of the insights
Great that you're using the activity colors; that's awesome!!
There was a problem hiding this comment.
It already looks better, thank you. However, to me still looks a bit like it's in light mode (with the bright colors)...
- I wonder if it'd work better if the barchart was the actual category color
- the font was white (in dark mode) and dark (as is in light mode)? (then it'd look much more similar to the activities timeline (which also helps to clarify the colors)
- And the "white" part could be white in light mode; and a very dark shade (i.e. the background color); so the white font would easily be readable
Also, can we vertically make it slightly more compact, such as by removing some of the top/bottom padding between the text and the barchart?
There was a problem hiding this comment.
It already looks better, thank you. However, to me still looks a bit like it's in light mode (with the bright colors)...
- I wonder if it'd work better if the barchart was the actual category color
- the font was white (in dark mode) and dark (as is in light mode)? (then it'd look much more similar to the activities timeline (which also helps to clarify the colors)
- And the "white" part could be white in light mode; and a very dark shade (i.e. the background color); so the white font would easily be readable
Also, can we vertically make it slightly more compact, such as by removing some of the top/bottom padding between the text and the barchart?
What do you think of this?
There was a problem hiding this comment.
that's great, thanks! Do we need the broders at all? and how dos it look in light mode? thanks!
| <span class="top-item-time">{{ | ||
| renderCompactTime(website.totalDurationMs) | ||
| }}</span> | ||
| <span class="top-item-percentage">{{ |
There was a problem hiding this comment.
once we finalize on the design of these "charts", i think we can uniformly use the same design (and CSS) for all 4 boxes: top apps/activities & websites
| return await getWindowActivitySessionsByKey((activity) => activity[prop], date); | ||
| } | ||
|
|
||
| function getDomainFromUrl(url: string | null): string | null { |
There was a problem hiding this comment.
guiding from your screenshot, i think just having the domain is not sufficient to know what a person was doing; e.g. on github it could be specification, code review, browsing, etc
is it possible to show slightly more (i.e. the core part of the displayed window title)?
There was a problem hiding this comment.
thanks for the updates, however,w ithout in-code documentation, it is very difficult to understand what exactly is done.
I suggest to make an example and describe the supsteps
| } | ||
|
|
||
| if (processName) { | ||
| const suffixes = [` - ${processName}`, ` — ${processName}`, ` | ${processName}`]; |
|
|
||
| if (processName) { | ||
| const suffixes = [` - ${processName}`, ` — ${processName}`, ` | ${processName}`]; | ||
| const matchingSuffix = suffixes.find((suffix) => title.endsWith(suffix)); |
casaout
left a comment
There was a problem hiding this comment.
thanks for the updates! To understand the "algorithm" for loading the actual datasets, extracting window titles, I think it'd be beneficial to add more documentation and rationale. otherwise, it's difficult to review the code, and also later maintain it. Thanks!
| </div> | ||
| </div> | ||
|
|
||
| <div v-if="topItemsAvailable" class="tile-grid mt-8"> |
|
|
||
| type WindowActivitySessionKeySelector = (activity: WindowActivityEntity) => string | null; | ||
|
|
||
| const BROWSER_PROCESS_NAMES = [ |
There was a problem hiding this comment.
what do we need this list for? (please add a quick comment to remember this later)
also, i wonder if we could reuse the list from https://github.com/HASEL-UZH/PA.WindowsActivityTracker/blob/main/typescript/src/mappings/browsers.ts and then compare the process name instead of app name? (and also extend it with the list from there)
There was a problem hiding this comment.
The tracker doesn't export the list a sa runtime import and it's being used to recognise the browser process names for title cleanup. So, for now, I've mirred the tracker browser mapping instead.
| map.set(key, entry); | ||
| } | ||
|
|
||
| function addSessionWithActiveMinuteSplits( |
There was a problem hiding this comment.
can you briefly explain (and document) the goal and logic of this method?
| async function getWindowActivitySessionsByType(prop: "processName" | "activity", date: Date): Promise<ActivitySessions[]> { | ||
| const windowActivityToday = await getWindowActivities(date) | ||
| const activeMinutesSet = await getActiveMinutesSet(date) | ||
| async function getWindowActivitySessionsByKey( |
There was a problem hiding this comment.
can you please explain this method a bit; and also what changed from the existing one?
what is a sessionkey?
| return await getWindowActivitySessionsByKey((activity) => activity[prop], date); | ||
| } | ||
|
|
||
| function getDomainFromUrl(url: string | null): string | null { |
There was a problem hiding this comment.
thanks for the updates, however,w ithout in-code documentation, it is very difficult to understand what exactly is done.
I suggest to make an example and describe the supsteps
Add in-line comments and doc strings to RetrospectionService





Add Top Websites and Window Titles to Retrospection (Closes #515)
Description
Adds two new Retrospection detail cards that summarize where participants spent the most time during the selected day: top websites and top window titles. The cards use compact horizontal bars, durations, and relative percentages to make the details easy to scan alongside the existing Retrospection timeline and insights.
Changes Made
Top websitescard showing the top 3 website domains for the selected dayTop window titlescard showing the top 3 non-browsing window titles for the selected dayWorkRelatedBrowsingactivity and grouped by domain, without showing the browser app nameOther,Unknown, andIdleentries are filtered out before selecting the top 3Implementation Details
processNameoractivity. This allows website domains to be extracted from URLs and window titles to be cleaned before aggregation.getTopWebsiteSessionsonly considersWorkRelatedBrowsingentries, extracts the hostname from each URL, groups active time by domain, filters irrelevant values, sorts by total duration, and returns the top 3.getTopWindowTitleSessionsexcludes browsing categories (WorkRelatedBrowsing,WorkUnrelatedBrowsing, andSocialMedia), strips matching app suffixes from window titles, groups active time by cleaned title, filters irrelevant values, sorts by total duration, and returns the top 3.Screenshots
Closes #515