notification bell shows poster thumbnails instead of icons
This commit is contained in:
@@ -16,7 +16,7 @@ import {
|
|||||||
Tv,
|
Tv,
|
||||||
} from '../../lib/icons'
|
} from '../../lib/icons'
|
||||||
import { isTauri } from '../../lib/tauri'
|
import { isTauri } from '../../lib/tauri'
|
||||||
import { jellyfinClient, getItemsApi } from '../../api/jellyfin'
|
import { jellyfinClient, getItemsApi, getImageUrl, getStoredServerUrl } from '../../api/jellyfin'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The single chrome bar at the top of the in-app shell. Replaces the
|
* The single chrome bar at the top of the in-app shell. Replaces the
|
||||||
@@ -87,7 +87,7 @@ export default function AppHeader({ pinned, onTogglePin }: Props) {
|
|||||||
limit: 10,
|
limit: 10,
|
||||||
recursive: true,
|
recursive: true,
|
||||||
includeItemTypes: ['Movie'],
|
includeItemTypes: ['Movie'],
|
||||||
fields: ['DateCreated', 'PrimaryImageAspectRatio'],
|
fields: ['DateCreated', 'PrimaryImageAspectRatio', 'ImageTags'],
|
||||||
} as any),
|
} as any),
|
||||||
getItemsApi(api!).getItems({
|
getItemsApi(api!).getItems({
|
||||||
userId: auth.userId,
|
userId: auth.userId,
|
||||||
@@ -96,7 +96,7 @@ export default function AppHeader({ pinned, onTogglePin }: Props) {
|
|||||||
limit: 50,
|
limit: 50,
|
||||||
recursive: true,
|
recursive: true,
|
||||||
includeItemTypes: ['Episode'],
|
includeItemTypes: ['Episode'],
|
||||||
fields: ['DateCreated', 'PrimaryImageAspectRatio', 'SeriesName', 'SeriesId', 'ParentIndexNumber', 'IndexNumber'],
|
fields: ['DateCreated', 'PrimaryImageAspectRatio', 'ImageTags', 'SeriesName', 'SeriesId', 'SeriesPrimaryImageTag', 'ParentIndexNumber', 'IndexNumber'],
|
||||||
} as any),
|
} as any),
|
||||||
])
|
])
|
||||||
const movies = (movieRes.data.Items || []) as any[]
|
const movies = (movieRes.data.Items || []) as any[]
|
||||||
@@ -364,6 +364,20 @@ export default function AppHeader({ pinned, onTogglePin }: Props) {
|
|||||||
const epLabel = isEpisode && (season != null || epNum != null)
|
const epLabel = isEpisode && (season != null || epNum != null)
|
||||||
? `S${season ?? '?'}E${epNum ?? '?'}${entry.Name ? ` · ${entry.Name}` : ''}`
|
? `S${season ?? '?'}E${epNum ?? '?'}${entry.Name ? ` · ${entry.Name}` : ''}`
|
||||||
: null
|
: null
|
||||||
|
|
||||||
|
// Poster thumbnail: series poster for episodes, movie poster for movies
|
||||||
|
const serverUrl = getStoredServerUrl()
|
||||||
|
const posterUrl = (() => {
|
||||||
|
if (!serverUrl) return null
|
||||||
|
if (isEpisode && entry.SeriesId && entry.SeriesPrimaryImageTag) {
|
||||||
|
return getImageUrl(serverUrl, entry.SeriesId, 'Primary', 160, entry.SeriesPrimaryImageTag)
|
||||||
|
}
|
||||||
|
if (entry.ImageTags?.Primary) {
|
||||||
|
return getImageUrl(serverUrl, entry.Id, 'Primary', 160, entry.ImageTags.Primary)
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
})()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
key={entry.Id}
|
key={entry.Id}
|
||||||
@@ -373,9 +387,16 @@ export default function AppHeader({ pinned, onTogglePin }: Props) {
|
|||||||
setNotifsOpen(false)
|
setNotifsOpen(false)
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
className={`w-full text-left px-3 py-2.5 text-[11.5px] border-b border-white/5 last:border-0 hover:bg-white/4 transition-colors flex items-start gap-2.5 ${isUnread ? 'bg-white/[0.03]' : ''}`}
|
className={`w-full text-left px-3 py-2.5 text-[11.5px] border-b border-white/5 last:border-0 hover:bg-white/4 transition-colors flex items-start gap-3 ${isUnread ? 'bg-white/[0.03]' : ''}`}
|
||||||
>
|
>
|
||||||
{isEpisode ? (
|
{posterUrl ? (
|
||||||
|
<img
|
||||||
|
src={posterUrl}
|
||||||
|
alt=""
|
||||||
|
className="w-8 aspect-[2/3] rounded object-cover shrink-0 bg-void"
|
||||||
|
loading="lazy"
|
||||||
|
/>
|
||||||
|
) : isEpisode ? (
|
||||||
<Tv size={13} className="text-accent shrink-0 mt-0.5" />
|
<Tv size={13} className="text-accent shrink-0 mt-0.5" />
|
||||||
) : (
|
) : (
|
||||||
<Film size={13} className="text-accent shrink-0 mt-0.5" />
|
<Film size={13} className="text-accent shrink-0 mt-0.5" />
|
||||||
|
|||||||
Reference in New Issue
Block a user