Update CatalogGiftView

This commit is contained in:
Bill 2021-10-16 01:58:12 -04:00
parent f65947c8f6
commit c08e60ba2d

View File

@ -54,8 +54,11 @@ export const CatalogGiftView: FC<{}> = props =>
if(giftData.colors && giftData.colors.length > 0) newColors.push({ id: colorId, color: `#${giftData.colors[0].toString(16)}` }); if(giftData.colors && giftData.colors.length > 0) newColors.push({ id: colorId, color: `#${giftData.colors[0].toString(16)}` });
} }
setSelectedColorId(newColors[0].id); if(newColors.length)
setColors(newColors); {
setSelectedColorId(newColors[0].id);
setColors(newColors);
}
}, [ giftConfiguration ]); }, [ giftConfiguration ]);
const close = useCallback(() => const close = useCallback(() =>
@ -68,7 +71,8 @@ export const CatalogGiftView: FC<{}> = props =>
setMessage(''); setMessage('');
setSelectedBoxIndex(0); setSelectedBoxIndex(0);
setSelectedRibbonIndex(0); setSelectedRibbonIndex(0);
setSelectedColorId(colors[0].id);
if(colors.length) setSelectedColorId(colors[0].id);
}, [ colors ]); }, [ colors ]);
const onCatalogEvent = useCallback((event: CatalogEvent) => const onCatalogEvent = useCallback((event: CatalogEvent) =>