mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-23 00:11:28 -07:00
style: format stats library files
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
import { useState, useMemo } from 'react';
|
||||
import { useMediaLibrary } from '../../hooks/useMediaLibrary';
|
||||
import { formatDuration, formatNumber } from '../../lib/formatters';
|
||||
import { groupMediaLibraryItems, summarizeMediaLibraryGroups } from '../../lib/media-library-grouping';
|
||||
import {
|
||||
groupMediaLibraryItems,
|
||||
summarizeMediaLibraryGroups,
|
||||
} from '../../lib/media-library-grouping';
|
||||
import { CoverImage } from './CoverImage';
|
||||
import { MediaCard } from './MediaCard';
|
||||
import { MediaDetailView } from './MediaDetailView';
|
||||
|
||||
@@ -114,9 +114,7 @@ test('CoverImage renders explicit remote artwork when src is provided', () => {
|
||||
});
|
||||
|
||||
test('MediaCard uses the proxied cover endpoint instead of metadata artwork urls', () => {
|
||||
const markup = renderToStaticMarkup(
|
||||
<MediaCard item={youtubeEpisodeA} onClick={() => {}} />,
|
||||
);
|
||||
const markup = renderToStaticMarkup(<MediaCard item={youtubeEpisodeA} onClick={() => {}} />);
|
||||
|
||||
assert.match(markup, /src="http:\/\/127\.0\.0\.1:6969\/api\/stats\/media\/1\/cover"/);
|
||||
assert.doesNotMatch(markup, /https:\/\/i\.ytimg\.com\/vi\/yt-1\/hqdefault\.jpg/);
|
||||
|
||||
@@ -49,14 +49,12 @@ export function groupMediaLibraryItems(items: MediaLibraryItem[]): MediaLibraryG
|
||||
const uploaderId = item.uploaderId?.trim() || null;
|
||||
const videoTitle = item.videoTitle?.trim() || null;
|
||||
const key = channelId || `video:${item.videoId}`;
|
||||
const title =
|
||||
channelName || uploaderId || videoTitle || item.canonicalTitle;
|
||||
const subtitle =
|
||||
channelId
|
||||
? channelId
|
||||
: videoTitle && videoTitle !== item.canonicalTitle
|
||||
? videoTitle
|
||||
: null;
|
||||
const title = channelName || uploaderId || videoTitle || item.canonicalTitle;
|
||||
const subtitle = channelId
|
||||
? channelId
|
||||
: videoTitle && videoTitle !== item.canonicalTitle
|
||||
? videoTitle
|
||||
: null;
|
||||
const existing = groups.get(key);
|
||||
if (existing) {
|
||||
existing.items.push(item);
|
||||
|
||||
Reference in New Issue
Block a user