fix(F-04): include crop/color fields in item queries and use dominantColor in GearImage

getAllItems and getItemById were not selecting dominantColor, cropZoom,
cropX, cropY from the database. GearImage was ignoring the dominantColor
prop. Now the fields flow end-to-end from DB to UI background fill.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
makiolajandClaude Opus 4.6 committed 2026-04-12 22:34:19 +02:00
1 parent 581872b534
commit e3124e49c9
2 files changed
+28 -15

No files matched your search

+20 -15
View File
@@ -12,7 +12,7 @@ interface GearImageProps {
export function GearImage({
src,
alt,
dominantColor: _dominantColor,
dominantColor,
cropZoom,
cropX,
cropY,
@@ -20,6 +20,7 @@ export function GearImage({
cover = false,
}: GearImageProps) {
const hasCrop = cropZoom != null && cropZoom > 1;
const bgStyle = dominantColor ? { backgroundColor: dominantColor } : undefined;
if (cover) {
return (
@@ -33,24 +34,28 @@ export function GearImage({
if (hasCrop) {
return (
<img
src={src}
alt={alt}
className={`w-full h-full object-cover ${className}`}
style={{
transform: `scale(${cropZoom}) translate(${cropX ?? 0}%, ${cropY ?? 0}%)`,
transformOrigin: "center center",
}}
/>
<div className="w-full h-full overflow-hidden" style={bgStyle}>
<img
src={src}
alt={alt}
className={`w-full h-full object-cover ${className}`}
style={{
transform: `scale(${cropZoom}) translate(${cropX ?? 0}%, ${cropY ?? 0}%)`,
transformOrigin: "center center",
}}
/>
</div>
);
}
return (
<img
src={src}
alt={alt}
className={`w-full h-full object-contain ${className}`}
/>
<div className="w-full h-full flex items-center justify-center" style={bgStyle}>
<img
src={src}
alt={alt}
className={`w-full h-full object-contain ${className}`}
/>
</div>
);
}