handle 0 images/assets

This commit is contained in:
Mary Hipp 2023-10-04 10:02:21 -04:00 committed by psychedelicious
parent 16f48a816f
commit eadbe6abf7
2 changed files with 6 additions and 6 deletions

View File

@ -77,12 +77,12 @@ const GalleryBoard = ({
const { data: imagesTotal } = useGetBoardImagesTotalQuery(board.board_id); const { data: imagesTotal } = useGetBoardImagesTotalQuery(board.board_id);
const { data: assetsTotal } = useGetBoardAssetsTotalQuery(board.board_id); const { data: assetsTotal } = useGetBoardAssetsTotalQuery(board.board_id);
const tooltip = useMemo(() => { const tooltip = useMemo(() => {
if (!imagesTotal?.total || !assetsTotal?.total) { if (imagesTotal?.total === undefined || assetsTotal?.total === undefined) {
return undefined; return undefined;
} }
return `${imagesTotal.total} image${imagesTotal.total > 1 ? 's' : ''}, ${ return `${imagesTotal.total} image${imagesTotal.total === 1 ? '' : 's'}, ${
assetsTotal.total assetsTotal.total
} asset${assetsTotal.total > 1 ? 's' : ''}`; } asset${assetsTotal.total === 1 ? '' : 's'}`;
}, [assetsTotal, imagesTotal]); }, [assetsTotal, imagesTotal]);
const { currentData: coverImage } = useGetImageDTOQuery( const { currentData: coverImage } = useGetImageDTOQuery(

View File

@ -48,12 +48,12 @@ const NoBoardBoard = memo(({ isSelected }: Props) => {
const { data: imagesTotal } = useGetBoardImagesTotalQuery('none'); const { data: imagesTotal } = useGetBoardImagesTotalQuery('none');
const { data: assetsTotal } = useGetBoardAssetsTotalQuery('none'); const { data: assetsTotal } = useGetBoardAssetsTotalQuery('none');
const tooltip = useMemo(() => { const tooltip = useMemo(() => {
if (!imagesTotal?.total || !assetsTotal?.total) { if (imagesTotal?.total === undefined || assetsTotal?.total === undefined) {
return undefined; return undefined;
} }
return `${imagesTotal.total} image${imagesTotal.total > 1 ? 's' : ''}, ${ return `${imagesTotal.total} image${imagesTotal.total === 1 ? '' : 's'}, ${
assetsTotal.total assetsTotal.total
} asset${assetsTotal.total > 1 ? 's' : ''}`; } asset${assetsTotal.total === 1 ? '' : 's'}`;
}, [assetsTotal, imagesTotal]); }, [assetsTotal, imagesTotal]);
const handleMouseOver = useCallback(() => { const handleMouseOver = useCallback(() => {