mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-22 15:25:46 +00:00
feat(player-stats): local listening history tab with heatmap and summaries (#849)
* feat(player-stats): local listening history tab with heatmap and summaries Record play sessions in library.sqlite when the library index is enabled, add Rust read APIs and Tauri commands for year/day aggregates, and ship the Player stats UI with session clustering, event-driven live refresh, and a notice when some servers are excluded from indexing. * test(player-stats): split play_session repo and expand test coverage Move the repository into play_session/ (completion, cluster, integration tests), add remap/purge/FK coverage in Rust, and cover ingestion gates plus live-refresh hooks on the frontend per spec v0.3. * docs(release): CHANGELOG and credits for player stats (PR #849) * fix(player-stats): satisfy tsc and clippy CI gates Use InternetRadioStation field names in the radio skip test and replace manual month/day range checks with RangeInclusive::contains.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import type { PlaySessionDayDetail } from '../../api/library';
|
||||
import { formatPlayerStatsListenedSec } from '../../utils/format/formatHumanDuration';
|
||||
|
||||
type Props = {
|
||||
detail: PlaySessionDayDetail;
|
||||
};
|
||||
|
||||
export default function PlayerStatsDayTracks({ detail }: Props) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<ul className="player-stats-day-tracks">
|
||||
{detail.tracks.map(tr => (
|
||||
<li key={`${tr.serverId}:${tr.trackId}:${tr.startedAtMs}`}>
|
||||
<div className="player-stats-day-track-title">{tr.title}</div>
|
||||
<div className="player-stats-day-track-meta">
|
||||
{tr.artist ?? '—'}
|
||||
{' · '}
|
||||
{formatPlayerStatsListenedSec(tr.listenedSec)}
|
||||
{' · '}
|
||||
{tr.completion === 'full'
|
||||
? t('statistics.completionFull')
|
||||
: t('statistics.completionPartial')}
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user