perf: use OptimizedImage in admin pages

This commit is contained in:
Kirill
2026-05-15 13:30:27 +05:00
parent 9c238bd542
commit 50eb427f5c
2 changed files with 28 additions and 18 deletions
@@ -40,6 +40,7 @@ import { getErrorMessage } from '@/shared/lib/get-error-message'
import { invalidateQueryKeys } from '@/shared/lib/invalidate-query-keys'
import { useEditDialogState } from '@/shared/lib/use-edit-dialog-state'
import { EntityRowActions } from '@/shared/ui/EntityRowActions'
import { OptimizedImage } from '@/shared/ui/OptimizedImage'
type FormState = {
title: string
@@ -416,11 +417,12 @@ export function AdminProductsPage() {
}}
title={url}
>
<Box
component="img"
<OptimizedImage
src={url}
alt="Фото товара"
sx={{ width: '100%', height: '100%', objectFit: 'cover', display: 'block' }}
widths={[80, 160]}
sizes="80px"
sx={{ width: '100%', height: '100%', objectFit: 'cover' }}
/>
<Button
size="small"
@@ -533,12 +535,15 @@ export function AdminProductsPage() {
/>
}
label={
<Box
component="img"
<Box sx={{ width: '100%', maxHeight: 100, borderRadius: 1, overflow: 'hidden' }}>
<OptimizedImage
src={item.url}
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>
}
/>
)
+11 -6
View File
@@ -46,6 +46,7 @@ import { getErrorMessage } from '@/shared/lib/get-error-message'
import { invalidateQueryKeys } from '@/shared/lib/invalidate-query-keys'
import { useEditDialogState } from '@/shared/lib/use-edit-dialog-state'
import { EntityRowActions } from '@/shared/ui/EntityRowActions'
import { OptimizedImage } from '@/shared/ui/OptimizedImage'
const UNSPECIFIED_CATEGORY_SLUG = 'ne-ukazano'
@@ -569,11 +570,12 @@ export function AdminPage() {
}}
title={url}
>
<Box
component="img"
<OptimizedImage
src={url}
alt="Фото товара"
sx={{ width: '100%', height: '100%', objectFit: 'cover', display: 'block' }}
widths={[80, 160]}
sizes="80px"
sx={{ width: '100%', height: '100%', objectFit: 'cover' }}
/>
<Button
size="small"
@@ -686,12 +688,15 @@ export function AdminPage() {
/>
}
label={
<Box
component="img"
<Box sx={{ width: '100%', maxHeight: 100, borderRadius: 1, overflow: 'hidden' }}>
<OptimizedImage
src={item.url}
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>
}
/>
)