import { useEffect, useMemo, useState } from "react"; import { Clock3, CopyCheck, FileAudio, Search, Trash2, } from "lucide-react"; import { Button } from "../components/Button"; import { Input } from "../components/Input"; import { clearLibraryHistory, listLibraryHistory, type LibraryTrackRecord, } from "../helpers/libraryIndex"; import styles from "./history.module.css"; import { MobileNav } from "../components/MobileNav"; export default function HistoryPage() { const [records, setRecords] = useState([]); const [filter, setFilter] = useState(""); useEffect(() => { listLibraryHistory().then(setRecords).catch(() => setRecords([])); }, []); const visible = useMemo(() => { const query = filter.trim().toLowerCase(); if (!query) return records; return records.filter((record) => [record.title, record.artist, record.album || "", record.isrc || ""] .some((value) => value.toLowerCase().includes(query)), ); }, [records, filter]); async function clearHistory() { await clearLibraryHistory(); setRecords([]); } return (
Library History
LOCAL LIBRARY

History & Dedup Index

Tracks SpotiRip has repaired or saved on this device, including ISRC identities used for duplicate detection.

setFilter(event.target.value)} placeholder="Filter history" />
{records.length}Indexed tracks
{records.filter((record) => record.isrc).length}ISRC identified
{new Set(records.map((record) => record.artist)).size}Artists
TrackAlbumISRCSaved
{visible.map((record) => (
{record.artworkUrl ? : }
{record.title}{record.artist}
{record.album || "—"} {record.isrc || "artist/title key"}
{new Date(record.addedAt).toLocaleString()}
))} {!visible.length ? (
{records.length ? "No matching history" : "No local history yet"} Repaired files will appear here and become part of smart duplicate detection.
) : null}
); }