history orders image food
This commit is contained in:
@@ -16,11 +16,17 @@ import { HistoryOrderItem } from './types/Types';
|
|||||||
|
|
||||||
const fallbackImage = '/assets/images/food-preview.png';
|
const fallbackImage = '/assets/images/food-preview.png';
|
||||||
|
|
||||||
const getFoodImage = (images: string | null | undefined): string => {
|
const getFoodImage = (images: string[] | string | null | undefined): string => {
|
||||||
if (!images || typeof images !== 'string') {
|
if (!images) {
|
||||||
return fallbackImage;
|
return fallbackImage;
|
||||||
}
|
}
|
||||||
return images;
|
if (Array.isArray(images)) {
|
||||||
|
return images.length > 0 ? images[0] : fallbackImage;
|
||||||
|
}
|
||||||
|
if (typeof images === 'string') {
|
||||||
|
return images;
|
||||||
|
}
|
||||||
|
return fallbackImage;
|
||||||
};
|
};
|
||||||
|
|
||||||
const formatDate = (dateString: string): string => {
|
const formatDate = (dateString: string): string => {
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ export interface HistoryOrderFood {
|
|||||||
stock: number;
|
stock: number;
|
||||||
stockDefault: number;
|
stockDefault: number;
|
||||||
isActive: boolean;
|
isActive: boolean;
|
||||||
images: string | null;
|
images: string[] | null;
|
||||||
inPlaceServe: boolean;
|
inPlaceServe: boolean;
|
||||||
pickupServe: boolean;
|
pickupServe: boolean;
|
||||||
rate: number;
|
rate: number;
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ function PerformantTabRenderer({ children, rowHeight = 100, ...rest }: Props) {
|
|||||||
<ul
|
<ul
|
||||||
{...rest}
|
{...rest}
|
||||||
style={{
|
style={{
|
||||||
height: (rowHeight * (children.length - 1)),
|
height: (rowHeight * children.length),
|
||||||
paddingTop: 16,
|
paddingTop: 16,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user