Files
movieloop-frontend/src/hooks/use-image-fallback.ts
T
TehRiehlDeal 8d0b7f39ee feat(ui): give the app one visual identity as Movie Loop
Gold is the primary in both themes, Bricolage Grotesque carries the
wordmark, titles and the score, and Movie A / Movie B wear the blue and
magenta of three-strip Technicolor on their posters instead of colouring
whole rows. The loop closes on screen - connectors light, a gold line
draws back to Movie A, the row glows, then the result arrives - in place
of confetti, on every play mode, scaled to the chain's length. Every
page shares one header and hairline lists; copy is sentence case with
one verb per flow, and the Home hero shows a real finished loop.

Also clamps link counts at zero: an opponent who had not moved yet
showed "-1 links".
2026-09-12 22:42:55 -07:00

19 lines
641 B
TypeScript

import { useState } from 'react';
/**
* A src that swaps to a fallback when the image fails to load. TMDB image
* paths are editable on TMDB's side, so a poster that existed when a chain
* was played can 404 later; without this an old game's review, or the Home
* example loop, shows broken-image icons instead of placeholder art.
*/
export function useImageFallback(src: string | null, fallback: string) {
const [failedSrc, setFailedSrc] = useState<string | null>(null);
const resolved = src && failedSrc !== src ? src : fallback;
return {
src: resolved,
onError: () => {
if (src) setFailedSrc(src);
},
};
}