mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Remove click action from item details primary image
This commit is contained in:
parent
bfbdffdff5
commit
92ed674e7e
4 changed files with 76 additions and 25 deletions
|
@ -261,7 +261,7 @@ function buildCardsHtmlInternal(items, options) {
|
|||
* @param {string} shape - Shape of the desired image.
|
||||
* @returns {CardImageUrl} Object representing the URL of the card's image.
|
||||
*/
|
||||
function getCardImageUrl(item, apiClient, options, shape) {
|
||||
export function getCardImageUrl(item, apiClient, options, shape) {
|
||||
item = item.ProgramInfo || item;
|
||||
|
||||
const width = options.width;
|
||||
|
@ -1049,7 +1049,7 @@ function buildCard(index, item, apiClient, options) {
|
|||
cardImageContainerOpen += getDefaultText(item, options);
|
||||
}
|
||||
|
||||
const tagName = (layoutManager.tv) && !overlayButtons ? 'button' : 'div';
|
||||
const tagName = layoutManager.tv && !overlayButtons ? 'button' : 'div';
|
||||
|
||||
const nameWithPrefix = (item.SortName || item.Name || '');
|
||||
let prefix = nameWithPrefix.substring(0, Math.min(3, nameWithPrefix.length));
|
||||
|
|
61
src/components/cardbuilder/cardImage.ts
Normal file
61
src/components/cardbuilder/cardImage.ts
Normal file
|
@ -0,0 +1,61 @@
|
|||
import type { BaseItemDto } from '@jellyfin/sdk/lib/generated-client/models/base-item-dto';
|
||||
import type { ApiClient } from 'jellyfin-apiclient';
|
||||
import type { CardOptions } from 'types/cardOptions';
|
||||
import { CardShape } from 'utils/card';
|
||||
|
||||
import { getCardImageUrl } from './cardBuilder';
|
||||
|
||||
/**
|
||||
* Builds an html string for a basic image only card.
|
||||
*/
|
||||
export function buildCardImage(
|
||||
apiClient: ApiClient,
|
||||
item: BaseItemDto,
|
||||
options: CardOptions
|
||||
): string {
|
||||
let shape: CardShape = CardShape.Square;
|
||||
if (item.PrimaryImageAspectRatio) {
|
||||
if (item.PrimaryImageAspectRatio >= 3) {
|
||||
shape = CardShape.Banner;
|
||||
} else if (item.PrimaryImageAspectRatio >= 1.33) {
|
||||
shape = CardShape.Backdrop;
|
||||
} else if (item.PrimaryImageAspectRatio > 0.71) {
|
||||
shape = CardShape.Square;
|
||||
} else {
|
||||
shape = CardShape.Portrait;
|
||||
}
|
||||
}
|
||||
|
||||
const image = getCardImageUrl(
|
||||
item,
|
||||
apiClient,
|
||||
options,
|
||||
shape
|
||||
);
|
||||
|
||||
if (!image) return '';
|
||||
|
||||
const className = ` ${shape}Card`;
|
||||
|
||||
const { blurhash, imgUrl } = image;
|
||||
let blurhashAttrib = '';
|
||||
if (blurhash && blurhash.length > 0) {
|
||||
blurhashAttrib = `data-blurhash="${blurhash}"`;
|
||||
}
|
||||
|
||||
return (
|
||||
`<div class="card ${className}">
|
||||
<div class="cardBox">
|
||||
<div class="cardScalable">
|
||||
<div class="cardPadder cardPadder-${shape}"></div>
|
||||
<div
|
||||
class="cardImageContainer coveredImage cardContent lazy"
|
||||
style="cursor: default;"
|
||||
data-src="${imgUrl}"
|
||||
${blurhashAttrib}
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue