feat(torrents): pin played torrents to the top

Pin torrents (via the pin toggle or automatically on play/stream) so
they stick to the top of the list regardless of the active sort, and
persist the pins to localStorage. The pin sits before the title,
revealing on row hover on desktop and always shown on touch or when
pinned.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
nerandClaude Fable 5 committed 2026-08-06 22:38:57 +03:00
1 parent c144181881
commit 06f142510b
4 files changed
+98 -12

No files matched your search

+5
View File
@@ -32,6 +32,11 @@ export const getMagnetHash = (link: string) => {
return hash?.toUpperCase();
};
// Stable identity for a torrent that survives the lazy empty -> fetched magnet transition:
// Toloka has a permanent download URL, the rest always carry a magnet infohash.
export const torrentKey = (torrent: Torrent) =>
torrent.download || getMagnetHash(torrent.magnet) || torrent.hash || torrent.id;
export const formatBytes = (bytes?: number) => {
if (bytes == null || !isFinite(bytes)) return '';