history orders image food

This commit is contained in:
hamid zarghami
2025-12-06 12:24:16 +03:30
parent b46df18025
commit eb9ecfa760
3 changed files with 11 additions and 5 deletions
+9 -3
View File
@@ -16,11 +16,17 @@ import { HistoryOrderItem } from './types/Types';
const fallbackImage = '/assets/images/food-preview.png';
const getFoodImage = (images: string | null | undefined): string => {
if (!images || typeof images !== 'string') {
const getFoodImage = (images: string[] | string | null | undefined): string => {
if (!images) {
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 => {
@@ -117,7 +117,7 @@ export interface HistoryOrderFood {
stock: number;
stockDefault: number;
isActive: boolean;
images: string | null;
images: string[] | null;
inPlaceServe: boolean;
pickupServe: boolean;
rate: number;
+1 -1
View File
@@ -42,7 +42,7 @@ function PerformantTabRenderer({ children, rowHeight = 100, ...rest }: Props) {
<ul
{...rest}
style={{
height: (rowHeight * (children.length - 1)),
height: (rowHeight * children.length),
paddingTop: 16,
}}
>