perf: use OptimizedImage in admin pages
This commit is contained in:
@@ -40,6 +40,7 @@ import { getErrorMessage } from '@/shared/lib/get-error-message'
|
|||||||
import { invalidateQueryKeys } from '@/shared/lib/invalidate-query-keys'
|
import { invalidateQueryKeys } from '@/shared/lib/invalidate-query-keys'
|
||||||
import { useEditDialogState } from '@/shared/lib/use-edit-dialog-state'
|
import { useEditDialogState } from '@/shared/lib/use-edit-dialog-state'
|
||||||
import { EntityRowActions } from '@/shared/ui/EntityRowActions'
|
import { EntityRowActions } from '@/shared/ui/EntityRowActions'
|
||||||
|
import { OptimizedImage } from '@/shared/ui/OptimizedImage'
|
||||||
|
|
||||||
type FormState = {
|
type FormState = {
|
||||||
title: string
|
title: string
|
||||||
@@ -416,11 +417,12 @@ export function AdminProductsPage() {
|
|||||||
}}
|
}}
|
||||||
title={url}
|
title={url}
|
||||||
>
|
>
|
||||||
<Box
|
<OptimizedImage
|
||||||
component="img"
|
|
||||||
src={url}
|
src={url}
|
||||||
alt="Фото товара"
|
alt="Фото товара"
|
||||||
sx={{ width: '100%', height: '100%', objectFit: 'cover', display: 'block' }}
|
widths={[80, 160]}
|
||||||
|
sizes="80px"
|
||||||
|
sx={{ width: '100%', height: '100%', objectFit: 'cover' }}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
size="small"
|
size="small"
|
||||||
@@ -533,12 +535,15 @@ export function AdminProductsPage() {
|
|||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
label={
|
label={
|
||||||
<Box
|
<Box sx={{ width: '100%', maxHeight: 100, borderRadius: 1, overflow: 'hidden' }}>
|
||||||
component="img"
|
<OptimizedImage
|
||||||
src={item.url}
|
src={item.url}
|
||||||
alt=""
|
alt=""
|
||||||
sx={{ width: '100%', maxHeight: 100, objectFit: 'cover', borderRadius: 1, display: 'block' }}
|
widths={[120, 240]}
|
||||||
/>
|
sizes="120px"
|
||||||
|
sx={{ width: '100%', height: '100%', objectFit: 'cover' }}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ import { getErrorMessage } from '@/shared/lib/get-error-message'
|
|||||||
import { invalidateQueryKeys } from '@/shared/lib/invalidate-query-keys'
|
import { invalidateQueryKeys } from '@/shared/lib/invalidate-query-keys'
|
||||||
import { useEditDialogState } from '@/shared/lib/use-edit-dialog-state'
|
import { useEditDialogState } from '@/shared/lib/use-edit-dialog-state'
|
||||||
import { EntityRowActions } from '@/shared/ui/EntityRowActions'
|
import { EntityRowActions } from '@/shared/ui/EntityRowActions'
|
||||||
|
import { OptimizedImage } from '@/shared/ui/OptimizedImage'
|
||||||
|
|
||||||
const UNSPECIFIED_CATEGORY_SLUG = 'ne-ukazano'
|
const UNSPECIFIED_CATEGORY_SLUG = 'ne-ukazano'
|
||||||
|
|
||||||
@@ -569,11 +570,12 @@ export function AdminPage() {
|
|||||||
}}
|
}}
|
||||||
title={url}
|
title={url}
|
||||||
>
|
>
|
||||||
<Box
|
<OptimizedImage
|
||||||
component="img"
|
|
||||||
src={url}
|
src={url}
|
||||||
alt="Фото товара"
|
alt="Фото товара"
|
||||||
sx={{ width: '100%', height: '100%', objectFit: 'cover', display: 'block' }}
|
widths={[80, 160]}
|
||||||
|
sizes="80px"
|
||||||
|
sx={{ width: '100%', height: '100%', objectFit: 'cover' }}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
size="small"
|
size="small"
|
||||||
@@ -686,12 +688,15 @@ export function AdminPage() {
|
|||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
label={
|
label={
|
||||||
<Box
|
<Box sx={{ width: '100%', maxHeight: 100, borderRadius: 1, overflow: 'hidden' }}>
|
||||||
component="img"
|
<OptimizedImage
|
||||||
src={item.url}
|
src={item.url}
|
||||||
alt=""
|
alt=""
|
||||||
sx={{ width: '100%', maxHeight: 100, objectFit: 'cover', borderRadius: 1, display: 'block' }}
|
widths={[120, 240]}
|
||||||
/>
|
sizes="120px"
|
||||||
|
sx={{ width: '100%', height: '100%', objectFit: 'cover' }}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user