mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-07-30 19:21:32 -07:00
b343f1cf5c
- Flash mined-frame screenshot as in-overlay image toast for OSD card notifications - Batch cover art from stored DB blobs via POST /api/stats/covers (no extra AniList fetches) - Show delete progress toast on stats home and sessions pages - Refresh only affected rollups on session delete instead of full rebuild - Rebuild lifetime summaries with aggregate SQL CTEs instead of per-session loop
42 lines
1.0 KiB
TypeScript
42 lines
1.0 KiB
TypeScript
import { useEffect, useState } from 'react';
|
|
import { getCoverImageSrc, type CoverImageMap } from '../../lib/cover-images';
|
|
|
|
interface CoverThumbnailProps {
|
|
animeId: number | null;
|
|
videoId: number | null;
|
|
title: string;
|
|
coverImages: CoverImageMap;
|
|
}
|
|
|
|
export function CoverThumbnail({ animeId, videoId, title, coverImages }: CoverThumbnailProps) {
|
|
const [failed, setFailed] = useState(false);
|
|
const fallbackChar = title.charAt(0) || '?';
|
|
const fallback = (
|
|
<div className="w-12 h-16 rounded bg-ctp-surface2 flex items-center justify-center text-ctp-overlay2 text-lg font-bold shrink-0">
|
|
{fallbackChar}
|
|
</div>
|
|
);
|
|
|
|
const src =
|
|
animeId != null
|
|
? getCoverImageSrc(coverImages, 'anime', animeId)
|
|
: getCoverImageSrc(coverImages, 'media', videoId);
|
|
|
|
useEffect(() => {
|
|
setFailed(false);
|
|
}, [src]);
|
|
|
|
if (!src || failed) {
|
|
return fallback;
|
|
}
|
|
|
|
return (
|
|
<img
|
|
src={src}
|
|
alt=""
|
|
className="w-12 h-16 rounded object-cover shrink-0 bg-ctp-surface2"
|
|
onError={() => setFailed(true)}
|
|
/>
|
|
);
|
|
}
|