mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-22 15:25:46 +00:00
refactor(ui): co-locate CachedImage as a shared primitive in src/ui
This commit is contained in:
@@ -10,7 +10,7 @@ import { useAlbumCoverRef } from '../cover/useLibraryCoverRef';
|
|||||||
import { useArtistBanner, useArtistFanart } from '../cover/useArtistFanart';
|
import { useArtistBanner, useArtistFanart } from '../cover/useArtistFanart';
|
||||||
import { useCoverArt } from '../cover/useCoverArt';
|
import { useCoverArt } from '../cover/useCoverArt';
|
||||||
import { useHeroBackdrop } from '../cover/useHeroBackdrop';
|
import { useHeroBackdrop } from '../cover/useHeroBackdrop';
|
||||||
import { useCachedUrl } from './CachedImage';
|
import { useCachedUrl } from '@/ui/CachedImage';
|
||||||
import { usePlayerStore } from '../store/playerStore';
|
import { usePlayerStore } from '../store/playerStore';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useIsMobile } from '../hooks/useIsMobile';
|
import { useIsMobile } from '../hooks/useIsMobile';
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import { useAuthStore } from '../store/authStore';
|
|||||||
import { useLibraryIndexStore } from '../store/libraryIndexStore';
|
import { useLibraryIndexStore } from '../store/libraryIndexStore';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { albumArtistDisplayName } from '../utils/album/deriveAlbumHeaderArtistRefs';
|
import { albumArtistDisplayName } from '../utils/album/deriveAlbumHeaderArtistRefs';
|
||||||
import { FETCH_QUEUE_BIAS_SEARCH_ARTIST_OVER_ALBUM } from './CachedImage';
|
import { FETCH_QUEUE_BIAS_SEARCH_ARTIST_OVER_ALBUM } from '@/ui/CachedImage';
|
||||||
import type { SubsonicSong } from '../api/subsonicTypes';
|
import type { SubsonicSong } from '../api/subsonicTypes';
|
||||||
import { AlbumCoverArtImage } from '../cover/AlbumCoverArtImage';
|
import { AlbumCoverArtImage } from '../cover/AlbumCoverArtImage';
|
||||||
import { ArtistCoverArtImage } from '../cover/ArtistCoverArtImage';
|
import { ArtistCoverArtImage } from '../cover/ArtistCoverArtImage';
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import {
|
|||||||
Moon, Sunrise,
|
Moon, Sunrise,
|
||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
import { usePlayerStore } from '../store/playerStore';
|
import { usePlayerStore } from '../store/playerStore';
|
||||||
import { useCachedUrl } from './CachedImage';
|
import { useCachedUrl } from '@/ui/CachedImage';
|
||||||
import { OpenArtistRefInline } from './OpenArtistRefInline';
|
import { OpenArtistRefInline } from './OpenArtistRefInline';
|
||||||
import { formatTrackTime } from '../utils/format/formatDuration';
|
import { formatTrackTime } from '../utils/format/formatDuration';
|
||||||
import { resolveQueueTrack } from '../utils/library/queueTrackView';
|
import { resolveQueueTrack } from '../utils/library/queueTrackView';
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { X, Search, Disc3, Users, Music, Music2, Clock, ChevronRight } from 'luc
|
|||||||
import { usePlayerStore } from '../store/playerStore';
|
import { usePlayerStore } from '../store/playerStore';
|
||||||
import { useAuthStore } from '../store/authStore';
|
import { useAuthStore } from '../store/authStore';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { FETCH_QUEUE_BIAS_SEARCH_ARTIST_OVER_ALBUM } from './CachedImage';
|
import { FETCH_QUEUE_BIAS_SEARCH_ARTIST_OVER_ALBUM } from '@/ui/CachedImage';
|
||||||
import { AlbumCoverArtImage } from '../cover/AlbumCoverArtImage';
|
import { AlbumCoverArtImage } from '../cover/AlbumCoverArtImage';
|
||||||
import { ArtistCoverArtImage } from '../cover/ArtistCoverArtImage';
|
import { ArtistCoverArtImage } from '../cover/ArtistCoverArtImage';
|
||||||
import { CoverArtImage } from '../cover/CoverArtImage';
|
import { CoverArtImage } from '../cover/CoverArtImage';
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { usePlayerStore } from '../store/playerStore';
|
|||||||
import { useAuthStore } from '../store/authStore';
|
import { useAuthStore } from '../store/authStore';
|
||||||
import { usePlaybackServerId } from '../hooks/usePlaybackServerId';
|
import { usePlaybackServerId } from '../hooks/usePlaybackServerId';
|
||||||
import { fetchBandsintownEvents, type BandsintownEvent } from '../api/bandsintown';
|
import { fetchBandsintownEvents, type BandsintownEvent } from '../api/bandsintown';
|
||||||
import CachedImage from './CachedImage';
|
import CachedImage from '@/ui/CachedImage';
|
||||||
import OverlayScrollArea from '@/ui/OverlayScrollArea';
|
import OverlayScrollArea from '@/ui/OverlayScrollArea';
|
||||||
import { primaryTrackArtistRef } from '../utils/playback/trackArtistRefs';
|
import { primaryTrackArtistRef } from '../utils/playback/trackArtistRefs';
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import { ArtistHeroCover } from '../../cover/artistHero';
|
|||||||
import { useArtistBanner, useArtistFanart } from '../../cover/useArtistFanart';
|
import { useArtistBanner, useArtistFanart } from '../../cover/useArtistFanart';
|
||||||
import { backdropFromConfig } from '../../cover/artistBackdrop';
|
import { backdropFromConfig } from '../../cover/artistBackdrop';
|
||||||
import { usePlaybackCoverArt } from '../../cover/usePlaybackCoverArt';
|
import { usePlaybackCoverArt } from '../../cover/usePlaybackCoverArt';
|
||||||
import { useCachedUrl } from '../CachedImage';
|
import { useCachedUrl } from '@/ui/CachedImage';
|
||||||
import { useCoverLightboxSrc } from '../../cover/lightbox';
|
import { useCoverLightboxSrc } from '../../cover/lightbox';
|
||||||
import type { CoverArtRef } from '../../cover/types';
|
import type { CoverArtRef } from '../../cover/types';
|
||||||
import LastfmIcon from '../LastfmIcon';
|
import LastfmIcon from '../LastfmIcon';
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { usePlayerStore } from '../../store/playerStore';
|
|||||||
import { queueSongStar, queueSongRating } from '../../store/pendingStarSync';
|
import { queueSongStar, queueSongRating } from '../../store/pendingStarSync';
|
||||||
import { useAlbumCoverRef, useArtistCoverRef } from '../../cover/useLibraryCoverRef';
|
import { useAlbumCoverRef, useArtistCoverRef } from '../../cover/useLibraryCoverRef';
|
||||||
import { usePlaybackCoverArt } from '../../hooks/usePlaybackCoverArt';
|
import { usePlaybackCoverArt } from '../../hooks/usePlaybackCoverArt';
|
||||||
import { useCachedUrl } from '../CachedImage';
|
import { useCachedUrl } from '@/ui/CachedImage';
|
||||||
import { useArtistFanart } from '../../cover/useArtistFanart';
|
import { useArtistFanart } from '../../cover/useArtistFanart';
|
||||||
import { backdropFromConfig } from '../../cover/artistBackdrop';
|
import { backdropFromConfig } from '../../cover/artistBackdrop';
|
||||||
import { useThemeStore } from '../../store/themeStore';
|
import { useThemeStore } from '../../store/themeStore';
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { emit } from '@tauri-apps/api/event';
|
import { emit } from '@tauri-apps/api/event';
|
||||||
import CachedImage from '../CachedImage';
|
import CachedImage from '@/ui/CachedImage';
|
||||||
import { OpenArtistRefInline } from '../OpenArtistRefInline';
|
import { OpenArtistRefInline } from '../OpenArtistRefInline';
|
||||||
import type { MiniTrackInfo } from '../../utils/miniPlayerBridge';
|
import type { MiniTrackInfo } from '../../utils/miniPlayerBridge';
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import { ExternalLink } from 'lucide-react';
|
import { ExternalLink } from 'lucide-react';
|
||||||
import type { SubsonicArtistInfo } from '../../api/subsonicTypes';
|
import type { SubsonicArtistInfo } from '../../api/subsonicTypes';
|
||||||
import { isRealArtistImage, sanitizeHtml } from '../../utils/componentHelpers/nowPlayingHelpers';
|
import { isRealArtistImage, sanitizeHtml } from '../../utils/componentHelpers/nowPlayingHelpers';
|
||||||
import CachedImage from '../CachedImage';
|
import CachedImage from '@/ui/CachedImage';
|
||||||
|
|
||||||
export interface ArtistCardTab {
|
export interface ArtistCardTab {
|
||||||
id?: string;
|
id?: string;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { songToTrack } from '../../utils/playback/songToTrack';
|
|||||||
import { activateShareSearchServer } from '../../utils/share/enqueueShareSearchPayload';
|
import { activateShareSearchServer } from '../../utils/share/enqueueShareSearchPayload';
|
||||||
import { sharePayloadTotal, type ShareSearchMatch } from '../../utils/share/shareSearch';
|
import { sharePayloadTotal, type ShareSearchMatch } from '../../utils/share/shareSearch';
|
||||||
import type { ShareSearchPreviewState } from '../../hooks/useShareSearchPreview';
|
import type { ShareSearchPreviewState } from '../../hooks/useShareSearchPreview';
|
||||||
import { FETCH_QUEUE_BIAS_SEARCH_ARTIST_OVER_ALBUM } from '../CachedImage';
|
import { FETCH_QUEUE_BIAS_SEARCH_ARTIST_OVER_ALBUM } from '@/ui/CachedImage';
|
||||||
import { AlbumCoverArtImage } from '../../cover/AlbumCoverArtImage';
|
import { AlbumCoverArtImage } from '../../cover/AlbumCoverArtImage';
|
||||||
import { ArtistCoverArtImage } from '../../cover/ArtistCoverArtImage';
|
import { ArtistCoverArtImage } from '../../cover/ArtistCoverArtImage';
|
||||||
import { COVER_DENSE_SEARCH_CSS_PX } from '../../cover/layoutSizes';
|
import { COVER_DENSE_SEARCH_CSS_PX } from '../../cover/layoutSizes';
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import type { ImgHTMLAttributes } from 'react';
|
import type { ImgHTMLAttributes } from 'react';
|
||||||
import type React from 'react';
|
import type React from 'react';
|
||||||
import { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
import { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
||||||
import { DEFAULT_CACHED_IMAGE_PREPARE_MARGIN } from '../components/CachedImage';
|
import { DEFAULT_CACHED_IMAGE_PREPARE_MARGIN } from '@/ui/CachedImage';
|
||||||
import { resolveIntersectionScrollRoot } from '../utils/ui/resolveIntersectionScrollRoot';
|
import { resolveIntersectionScrollRoot } from '../utils/ui/resolveIntersectionScrollRoot';
|
||||||
import { coverEnsureQueued, coverEnsureReprioritize } from './ensureQueue';
|
import { coverEnsureQueued, coverEnsureReprioritize } from './ensureQueue';
|
||||||
import { coverPrefetchBumpPriority } from './prefetchRegistry';
|
import { coverPrefetchBumpPriority } from './prefetchRegistry';
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React, { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
import React, { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
||||||
import { acquireUrl, getCachedBlob, releaseUrl, subscribeCoverUpgraded } from '../utils/imageCache';
|
import { acquireUrl, getCachedBlob, releaseUrl, subscribeCoverUpgraded } from '@/utils/imageCache';
|
||||||
import { resolveIntersectionScrollRoot } from '../utils/ui/resolveIntersectionScrollRoot';
|
import { resolveIntersectionScrollRoot } from '@/utils/ui/resolveIntersectionScrollRoot';
|
||||||
|
|
||||||
interface CachedImageProps extends React.ImgHTMLAttributes<HTMLImageElement> {
|
interface CachedImageProps extends React.ImgHTMLAttributes<HTMLImageElement> {
|
||||||
src: string;
|
src: string;
|
||||||
Reference in New Issue
Block a user