diff --git a/frontend/src/utils/images.ts b/frontend/src/utils/images.ts index b9c89bd3077..b0dfc8f4544 100644 --- a/frontend/src/utils/images.ts +++ b/frontend/src/utils/images.ts @@ -9,12 +9,7 @@ import { ImageType } from '@jellyfin/sdk/lib/generated-client'; import { useRemote } from '@/composables'; -import { - getShapeFromItemType, - ValidCardShapes, - isPerson, - CardShapes -} from '@/utils/items'; +import { getShapeFromItemType, isPerson, CardShapes } from '@/utils/items'; export interface ImageUrlInfo { url: string | undefined; @@ -108,6 +103,7 @@ export function getParentId(item: BaseItemDto): string | undefined { return item.ParentId; } } + /** * Gets the blurhash string of an image given the item and the image type desired. * @@ -135,6 +131,7 @@ export function getBlurhash( } } } + /** * Returns the aspect ratio that should be use */ @@ -153,7 +150,7 @@ export function getContainerAspectRatioForImageType( * @param shape * @returns */ -export function getDesiredAspect(shape: ValidCardShapes): number { +export function getDesiredAspect(shape: CardShapes): number { let aspectRatio; switch (shape) { @@ -177,6 +174,7 @@ export function getDesiredAspect(shape: ValidCardShapes): number { return aspectRatio; } + /** * Generates the image information for a BaseItemDto or a BasePersonDto according to set priorities. * @@ -208,7 +206,7 @@ export function getImageInfo( ratio = 1, tag }: { - shape?: ValidCardShapes; + shape?: CardShapes; preferThumb?: boolean; preferBanner?: boolean; preferLogo?: boolean; @@ -403,6 +401,7 @@ export function getImageInfo( blurhash: imgType && imgTag ? item.ImageBlurHashes?.[imgType]?.[imgTag] : '' }; } + /** * Generates the logo information for a BaseItemDto or a BasePersonDto according to set priorities. * diff --git a/frontend/src/utils/items.ts b/frontend/src/utils/items.ts index 27fb2738392..69a92272935 100644 --- a/frontend/src/utils/items.ts +++ b/frontend/src/utils/items.ts @@ -55,12 +55,6 @@ export enum CardShapes { Banner = 'banner-card' } -export type ValidCardShapes = - | CardShapes.Portrait - | CardShapes.Thumb - | CardShapes.Square - | CardShapes.Banner; - /** * Determines if the item is a person * @@ -140,7 +134,7 @@ export function getLibraryIcon( */ export function getShapeFromCollectionType( collectionType: string | null | undefined -): ValidCardShapes { +): CardShapes { switch (collectionType?.toLowerCase()) { case 'livetv': case 'musicvideos': { @@ -165,7 +159,7 @@ export function getShapeFromCollectionType( */ export function getShapeFromItemType( itemType: BaseItemKind | null | undefined -): ValidCardShapes { +): CardShapes { if (!itemType) { return CardShapes.Portrait; }