feat: add gamepad navigation and music library improvements
Continuous Integration / build_web (push) Failing after 0s
Continuous Integration / build (macos-latest) (push) Skipped
Continuous Integration / build (ubuntu-22.04) (push) Skipped
Continuous Integration / build (windows-11-arm) (push) Skipped
Continuous Integration / build (windows-latest) (push) Skipped
Continuous Integration / nightly_release (push) Skipped
Continuous Integration / build_web (push) Failing after 0s
Continuous Integration / build (macos-latest) (push) Skipped
Continuous Integration / build (ubuntu-22.04) (push) Skipped
Continuous Integration / build (windows-11-arm) (push) Skipped
Continuous Integration / build (windows-latest) (push) Skipped
Continuous Integration / nightly_release (push) Skipped
- add TV/gamepad spatial navigation, focus ring and back/select controls - cache artwork persistently and add music cover placeholders - add compact songs list, shuffle-all queue and library error recovery - polish remote control layout and optimistic seek timeline
This commit is contained in:
1 parent
04ab9f767b
commit
5f5803c9f8
24 files changed
+1199
-245
No files matched your search
@@ -0,0 +1,50 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { getCachedImageUrl } from "@/utils/cache/imageCache";
|
||||
|
||||
type CachedImageProps = React.ImgHTMLAttributes<HTMLImageElement> & {
|
||||
src?: string | null;
|
||||
fallback?: React.ReactNode;
|
||||
};
|
||||
|
||||
/**
|
||||
* Drop-in `<img>` that resolves Jellyfin artwork through the persistent
|
||||
* Cache API. If the request cannot be read (CORS/offline), it falls back to
|
||||
* the original URL so the browser can still render it.
|
||||
*/
|
||||
const CachedImage = ({
|
||||
src,
|
||||
fallback = null,
|
||||
onError,
|
||||
...props
|
||||
}: CachedImageProps) => {
|
||||
const [cachedSrc, setCachedSrc] = useState<string | null>(null);
|
||||
const [failed, setFailed] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
let active = true;
|
||||
setCachedSrc(null);
|
||||
setFailed(false);
|
||||
if (!src) return;
|
||||
void getCachedImageUrl(src).then((url) => {
|
||||
if (active && url) setCachedSrc(url);
|
||||
});
|
||||
return () => {
|
||||
active = false;
|
||||
};
|
||||
}, [src]);
|
||||
|
||||
if (!src || failed) return <>{fallback}</>;
|
||||
|
||||
return (
|
||||
<img
|
||||
{...props}
|
||||
src={cachedSrc ?? src}
|
||||
onError={(event) => {
|
||||
setFailed(true);
|
||||
onError?.(event);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default CachedImage;
|
||||
Reference in new issue
Block a user