mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Normalize item icons
This commit is contained in:
parent
3e494a14d9
commit
414ae94312
2 changed files with 36 additions and 54 deletions
|
@ -1,3 +1,4 @@
|
|||
import { CollectionType } from '@jellyfin/sdk/lib/generated-client/models/collection-type';
|
||||
import { BaseItemKind } from '@jellyfin/sdk/lib/generated-client/models/base-item-kind';
|
||||
import type { DeviceInfo } from '@jellyfin/sdk/lib/generated-client/models/device-info';
|
||||
import type { SessionInfo } from '@jellyfin/sdk/lib/generated-client/models/session-info';
|
||||
|
@ -75,36 +76,39 @@ export function getDeviceIcon(info: DeviceInfo | SessionInfo) {
|
|||
}
|
||||
}
|
||||
|
||||
export function getLibraryIcon(library: string | null | undefined) {
|
||||
export function getLibraryIcon(library: CollectionType | string | null | undefined) {
|
||||
switch (library) {
|
||||
case 'movies':
|
||||
return 'video_library';
|
||||
case 'music':
|
||||
return 'library_music';
|
||||
case 'photos':
|
||||
return 'photo_library';
|
||||
case 'livetv':
|
||||
case CollectionType.Movies:
|
||||
return 'movie';
|
||||
case CollectionType.Music:
|
||||
return 'music_note';
|
||||
case CollectionType.Homevideos:
|
||||
case CollectionType.Photos:
|
||||
return 'photo';
|
||||
case CollectionType.Livetv:
|
||||
return 'live_tv';
|
||||
case 'tvshows':
|
||||
case CollectionType.Tvshows:
|
||||
return 'tv';
|
||||
case 'trailers':
|
||||
case CollectionType.Trailers:
|
||||
return 'local_movies';
|
||||
case 'homevideos':
|
||||
return 'photo_library';
|
||||
case 'musicvideos':
|
||||
case CollectionType.Musicvideos:
|
||||
return 'music_video';
|
||||
case 'books':
|
||||
return 'library_books';
|
||||
case CollectionType.Books:
|
||||
return 'book';
|
||||
case CollectionType.Boxsets:
|
||||
return 'video_library';
|
||||
case CollectionType.Playlists:
|
||||
return 'library_add';
|
||||
case 'channels':
|
||||
return 'videocam';
|
||||
case 'playlists':
|
||||
return 'view_list';
|
||||
case undefined:
|
||||
return 'quiz';
|
||||
default:
|
||||
return 'folder';
|
||||
}
|
||||
}
|
||||
|
||||
export function getItemTypeIcon(itemType: BaseItemKind | string) {
|
||||
export function getItemTypeIcon(itemType: BaseItemKind | string, defaultIcon?: string) {
|
||||
switch (itemType) {
|
||||
case BaseItemKind.MusicAlbum:
|
||||
return 'album';
|
||||
|
@ -125,15 +129,15 @@ export function getItemTypeIcon(itemType: BaseItemKind | string) {
|
|||
case BaseItemKind.Folder:
|
||||
return 'folder';
|
||||
case BaseItemKind.BoxSet:
|
||||
return 'collections';
|
||||
return 'video_library';
|
||||
case BaseItemKind.Playlist:
|
||||
return 'view_list';
|
||||
return 'library_add';
|
||||
case BaseItemKind.Photo:
|
||||
return 'photo';
|
||||
case BaseItemKind.PhotoAlbum:
|
||||
return 'photo_album';
|
||||
default:
|
||||
return 'folder';
|
||||
return defaultIcon || 'folder';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue