fix /media
route
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import {Stack, Typography} from '@mui/material'
|
||||
import {useShow} from '@refinedev/core'
|
||||
import {Show, TextFieldComponent as TextField} from '@refinedev/mui'
|
||||
import {MEDIA_TYPES} from '../../lib/constants'
|
||||
|
||||
export const MediaShow = () => {
|
||||
const {query} = useShow({})
|
||||
@ -10,8 +11,12 @@ export const MediaShow = () => {
|
||||
|
||||
const fields = [
|
||||
{label: 'Название', data: 'filename'},
|
||||
{label: 'Тип', data: 'media_type'},
|
||||
{label: 'ID', data: 'id'},
|
||||
{
|
||||
label: 'Тип',
|
||||
data: 'media_type',
|
||||
render: (value: number) => MEDIA_TYPES.find((type) => type.value === value)?.label || value,
|
||||
},
|
||||
// {label: 'ID', data: 'id'},
|
||||
]
|
||||
|
||||
return (
|
||||
@ -19,12 +24,12 @@ export const MediaShow = () => {
|
||||
<Stack gap={4}>
|
||||
{record && <img src={`https://wn.krbl.ru/media/${record?.id}/download`} alt={record?.filename} style={{maxWidth: '100%', height: '40vh', objectFit: 'contain', borderRadius: 8}} />}
|
||||
|
||||
{fields.map(({label, data}) => (
|
||||
{fields.map(({label, data, render}) => (
|
||||
<Stack key={data} gap={1}>
|
||||
<Typography variant="body1" fontWeight="bold">
|
||||
{label}
|
||||
</Typography>
|
||||
<TextField value={record?.[data]} />
|
||||
<TextField value={render ? render(record?.[data]) : record?.[data]} />
|
||||
</Stack>
|
||||
))}
|
||||
</Stack>
|
||||
|
Reference in New Issue
Block a user