From 80bc179b692632a416288fde50b8fabffe9e0e08 Mon Sep 17 00:00:00 2001 From: maxim Date: Fri, 21 Feb 2025 22:15:16 +0300 Subject: [PATCH] update `show` for `/article` route --- src/App.tsx | 7 +-- src/pages/article/show.tsx | 93 ++++++++++++++++++-------------------- 2 files changed, 47 insertions(+), 53 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 73c6f5d..ef051bc 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -259,9 +259,10 @@ function App() { { - const cleanedTitle = title.autoGeneratedTitle.split('|')[0].trim() - return `${cleanedTitle} — Белые ночи` + handler={() => { + // const cleanedTitle = title.autoGeneratedTitle.split('|')[0].trim() + // return `${cleanedTitle} — Белые ночи` + return 'Белые ночи' }} /> diff --git a/src/pages/article/show.tsx b/src/pages/article/show.tsx index 0737c67..fba0f4a 100644 --- a/src/pages/article/show.tsx +++ b/src/pages/article/show.tsx @@ -1,4 +1,4 @@ -import {Stack, Typography, Box, Grid2 as Grid, Button, MenuItem, Select, FormControl, InputLabel, TextField} from '@mui/material' +import {Stack, Typography, Grid2 as Grid, Button, MenuItem, Select, FormControl, InputLabel, TextField, Card, CardMedia, CardContent, CardActions} from '@mui/material' import {useShow} from '@refinedev/core' import {Show, TextFieldComponent} from '@refinedev/mui' @@ -72,6 +72,7 @@ export const ArticleShow = () => { .then((response) => { setLinkedMedia(response?.data || []) setMediaOrder(mediaOrder + 1) + setSelectedMediaId('') }) .catch(() => { setLinkedMedia([]) @@ -113,7 +114,7 @@ export const ArticleShow = () => { {fields.map(({label, data}) => ( - + {label} @@ -121,65 +122,57 @@ export const ArticleShow = () => { ))} - + Медиа - - + {mediaLoading ? ( - Loading media... + Загрузка медиа... ) : linkedMedia.length > 0 ? ( - linkedMedia.map((mediaItem, index) => ( - - {record && ( - - {mediaItem?.filename} - - )} - - - {mediaFields.map(({label, data}) => ( - - {label}: {mediaItem?.[data]} - - ))} - - - - + linkedMedia.map((mediaItem) => ( + + + + + {mediaFields.map(({label, data}) => ( + + {label}: {mediaItem?.[data]} + + ))} + + + + + + )) ) : ( - Медиа не найдены + Нет привязанных медиа )} - - + {/* sx={{width: '650px'}} */} + + {' '} + Привязать медиа - - - - Медиа - - - - - setMediaOrder(Number(e.target.value))} fullWidth InputLabelProps={{shrink: true}} /> - - - - + + Медиа + + + setMediaOrder(Number(e.target.value))} fullWidth InputLabelProps={{shrink: true}} /> +