Skip to content

Conversation

Copy link

Copilot AI commented Dec 1, 2025

  • Add formatExactDuration function to compute exact duration string (hours, minutes, seconds)
  • Modify FormattedDuration component to add data-rh attribute with exact duration
  • Update Layout's hint renderer to handle duration format
  • Test the changes with TypeScript check
  • Address code review feedback
  • Run CodeQL check (no security alerts)
  • Clean rebase on master (removed package-lock.json changes)

Summary

This PR implements the feature request to show exact playtime when hovering over the approximate playtime display.

Changes Made:

  1. src/common/format/datetime.ts: Added formatExactDuration() function that formats duration in seconds as "Xh Ym Zs" format (e.g., "1h 23m 45s")
  2. src/renderer/basics/FormattedDuration.tsx: Wrapped the formatted message in a <span> with data-rh attribute containing the duration in seconds
  3. src/renderer/App/Layout/index.tsx: Updated the react-hint renderer to handle the new duration format type

How it works:

  • The approximate playtime text (e.g., "an hour") now shows a tooltip on hover with the exact playtime (e.g., "1h 23m 45s")
  • Uses the existing react-hint tooltip system already used for date/time tooltips in the app
  • Handles edge cases like negative input values gracefully

Rebased cleanly on master - only 2 commits with the feature implementation, no package-lock.json changes.

Original prompt

This section details on the original issue you should resolve

<issue_title>Feature request: show exact playtime when hovering approximate playtime</issue_title>
<issue_description># Context

The "play time" feature is useful for me to estimate the time to finish my own games. While a session play time would be ideal, at least the total play time allows me to subtract the previous total play time before playing today from the new total play time after playing today to deduce my play session time, so I know how long it takes to play a given chapter.

Issue

However, the current time display is approximative: at first I see minutes, but when I reach an hour, it just says "an hour"

Image

This is okay for casual usage, but I need an exact number of minutes. Hovering on the number shows nothing.

Suggestion

When hovering on the approximate duration, show the exact duration (at least down 1 minute, if not seconds), similarly to how hovering the commit's readable last time on GitHub shows UTC time, except with a duration.

Image</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits December 1, 2025 11:33
Co-authored-by: leafo <15198+leafo@users.noreply.github.com>
Co-authored-by: leafo <15198+leafo@users.noreply.github.com>
…nt title attribute

Co-authored-by: leafo <15198+leafo@users.noreply.github.com>
Copilot AI changed the title [WIP] Add exact playtime display on hover for duration Show exact playtime when hovering approximate playtime Dec 1, 2025
Copilot AI requested a review from leafo December 1, 2025 11:39
@leafo leafo marked this pull request as ready for review December 2, 2025 21:57
@leafo
Copy link
Member

leafo commented Dec 2, 2025

@copilot please rebase on master to fix conflicts, don't check in any changes to package-lock.json

Copy link
Author

Copilot AI commented Dec 2, 2025

@copilot please rebase on master to fix conflicts, don't check in any changes to package-lock.json

Rebased on master in commit a3755b5. The package-lock.json changes have been removed - only the 3 source files with the feature implementation remain.

Copilot AI requested a review from leafo December 2, 2025 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: show exact playtime when hovering approximate playtime

2 participants