mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-09 20:29:36 +02:00
unhide image on error on libraryheader
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import { closeAllModals, openModal } from '@mantine/modals';
|
import { closeAllModals, openModal } from '@mantine/modals';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import { forwardRef, ReactNode, Ref, useCallback, useState } from 'react';
|
import { forwardRef, ReactNode, Ref, useCallback } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Link } from 'react-router';
|
import { Link } from 'react-router';
|
||||||
|
|
||||||
@@ -64,13 +64,8 @@ export const LibraryHeader = forwardRef(
|
|||||||
ref: Ref<HTMLDivElement>,
|
ref: Ref<HTMLDivElement>,
|
||||||
) => {
|
) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [isImageError, setIsImageError] = useState<boolean | null>(false);
|
|
||||||
const { blurExplicitImages } = useGeneralSettings();
|
const { blurExplicitImages } = useGeneralSettings();
|
||||||
|
|
||||||
const onImageError = () => {
|
|
||||||
setIsImageError(true);
|
|
||||||
};
|
|
||||||
|
|
||||||
const itemTypeString = (): string => {
|
const itemTypeString = (): string => {
|
||||||
switch (item.type) {
|
switch (item.type) {
|
||||||
case LibraryItem.ALBUM:
|
case LibraryItem.ALBUM:
|
||||||
@@ -161,21 +156,18 @@ export const LibraryHeader = forwardRef(
|
|||||||
style={{ cursor: 'pointer' }}
|
style={{ cursor: 'pointer' }}
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
>
|
>
|
||||||
{!isImageError && (
|
<ItemImage
|
||||||
<ItemImage
|
className={styles.image}
|
||||||
className={styles.image}
|
containerClassName={styles.image}
|
||||||
containerClassName={styles.image}
|
enableDebounce={false}
|
||||||
enableDebounce={false}
|
enableViewport={false}
|
||||||
enableViewport={false}
|
explicitStatus={item.explicitStatus ?? null}
|
||||||
explicitStatus={item.explicitStatus ?? null}
|
fetchPriority="high"
|
||||||
fetchPriority="high"
|
id={item.imageId}
|
||||||
id={item.imageId}
|
itemType={item.type as LibraryItem}
|
||||||
itemType={item.type as LibraryItem}
|
src={imageUrl || ''}
|
||||||
onError={onImageError}
|
type="header"
|
||||||
src={imageUrl || ''}
|
/>
|
||||||
type="header"
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
{title && (
|
{title && (
|
||||||
<div className={styles.metadataSection}>
|
<div className={styles.metadataSection}>
|
||||||
|
|||||||
Reference in New Issue
Block a user