feat: Add service_name
for article list
All checks were successful
release-tag / release-image (push) Successful in 2m23s
All checks were successful
release-tag / release-image (push) Successful in 2m23s
This commit is contained in:
parent
db5e9d9fc4
commit
9bf294e124
@ -21,6 +21,7 @@ export function MediaView({ media }: Readonly<{ media?: MediaData }>) {
|
|||||||
display: "flex",
|
display: "flex",
|
||||||
flexGrow: 1,
|
flexGrow: 1,
|
||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
|
margin: "0 auto",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{media?.media_type === 1 && (
|
{media?.media_type === 1 && (
|
||||||
|
@ -18,7 +18,7 @@ export const ArticleList = observer(() => {
|
|||||||
|
|
||||||
const { dataGridProps } = useDataGrid({
|
const { dataGridProps } = useDataGrid({
|
||||||
resource: "article",
|
resource: "article",
|
||||||
...META_LANGUAGE(language)
|
...META_LANGUAGE(language),
|
||||||
});
|
});
|
||||||
|
|
||||||
const columns = React.useMemo<GridColDef[]>(
|
const columns = React.useMemo<GridColDef[]>(
|
||||||
@ -33,7 +33,7 @@ export const ArticleList = observer(() => {
|
|||||||
headerAlign: "left",
|
headerAlign: "left",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: "heading",
|
field: "service_name",
|
||||||
headerName: "Заголовок",
|
headerName: "Заголовок",
|
||||||
type: "string",
|
type: "string",
|
||||||
minWidth: 300,
|
minWidth: 300,
|
||||||
@ -43,6 +43,16 @@ export const ArticleList = observer(() => {
|
|||||||
flex: 1,
|
flex: 1,
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
|
// field: "service_name",
|
||||||
|
// headerName: "Сервисное название (тест)",
|
||||||
|
// type: "string",
|
||||||
|
// minWidth: 300,
|
||||||
|
// display: "flex",
|
||||||
|
// align: "left",
|
||||||
|
// headerAlign: "left",
|
||||||
|
// flex: 1,
|
||||||
|
// },
|
||||||
|
// {
|
||||||
// field: 'body',
|
// field: 'body',
|
||||||
// headerName: 'Контент',
|
// headerName: 'Контент',
|
||||||
// type: 'string',
|
// type: 'string',
|
||||||
@ -66,10 +76,7 @@ export const ArticleList = observer(() => {
|
|||||||
<>
|
<>
|
||||||
<EditButton hideText recordItemId={row.id} />
|
<EditButton hideText recordItemId={row.id} />
|
||||||
<ShowButton hideText recordItemId={row.id} />
|
<ShowButton hideText recordItemId={row.id} />
|
||||||
<DeleteButton
|
<DeleteButton hideText recordItemId={row.id} />
|
||||||
hideText
|
|
||||||
recordItemId={row.id}
|
|
||||||
/>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -1,88 +1,107 @@
|
|||||||
import {type GridColDef} from '@mui/x-data-grid'
|
import { type GridColDef } from "@mui/x-data-grid";
|
||||||
import {CustomDataGrid} from '../../components/CustomDataGrid'
|
import { CustomDataGrid } from "../../components/CustomDataGrid";
|
||||||
import {DeleteButton, EditButton, List, ShowButton, useDataGrid} from '@refinedev/mui'
|
import {
|
||||||
import React from 'react'
|
DeleteButton,
|
||||||
import {MEDIA_TYPES} from '../../lib/constants'
|
EditButton,
|
||||||
import { observer } from "mobx-react-lite"
|
List,
|
||||||
|
ShowButton,
|
||||||
|
useDataGrid,
|
||||||
|
} from "@refinedev/mui";
|
||||||
|
import React from "react";
|
||||||
|
import { MEDIA_TYPES } from "../../lib/constants";
|
||||||
|
import { observer } from "mobx-react-lite";
|
||||||
|
|
||||||
import {localeText} from '../../locales/ru/localeText'
|
import { localeText } from "../../locales/ru/localeText";
|
||||||
import { languageStore, META_LANGUAGE } from '@stores'
|
import { languageStore, META_LANGUAGE } from "@stores";
|
||||||
|
|
||||||
export const MediaList = observer(() => {
|
export const MediaList = observer(() => {
|
||||||
const { language } = languageStore;
|
const { language } = languageStore;
|
||||||
const {dataGridProps} = useDataGrid({
|
const { dataGridProps } = useDataGrid({
|
||||||
...META_LANGUAGE(language)
|
...META_LANGUAGE(language),
|
||||||
})
|
});
|
||||||
|
|
||||||
const columns = React.useMemo<GridColDef[]>(
|
const columns = React.useMemo<GridColDef[]>(
|
||||||
() => [
|
() => [
|
||||||
{
|
{
|
||||||
field: 'id',
|
field: "id",
|
||||||
headerName: 'ID',
|
headerName: "ID",
|
||||||
type: 'number',
|
type: "number",
|
||||||
minWidth: 350,
|
minWidth: 350,
|
||||||
display: 'flex',
|
display: "flex",
|
||||||
align: 'left',
|
align: "left",
|
||||||
headerAlign: 'left',
|
headerAlign: "left",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'filename',
|
field: "filename",
|
||||||
headerName: 'Название файла',
|
headerName: "Название файла",
|
||||||
type: 'string',
|
type: "string",
|
||||||
minWidth: 250,
|
minWidth: 250,
|
||||||
display: 'flex',
|
display: "flex",
|
||||||
align: 'left',
|
align: "left",
|
||||||
headerAlign: 'left',
|
headerAlign: "left",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'media_name',
|
field: "media_name",
|
||||||
headerName: 'Название',
|
headerName: "Название",
|
||||||
type: 'string',
|
type: "string",
|
||||||
minWidth: 150,
|
minWidth: 150,
|
||||||
display: 'flex',
|
flex: 1,
|
||||||
align: 'left',
|
display: "flex",
|
||||||
headerAlign: 'left',
|
align: "left",
|
||||||
|
headerAlign: "left",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'media_type',
|
field: "media_type",
|
||||||
headerName: 'Тип',
|
headerName: "Тип",
|
||||||
type: 'string',
|
type: "string",
|
||||||
display: 'flex',
|
display: "flex",
|
||||||
align: 'left',
|
align: "left",
|
||||||
headerAlign: 'left',
|
headerAlign: "left",
|
||||||
flex: 1,
|
flex: 1,
|
||||||
renderCell: (params) => {
|
renderCell: (params) => {
|
||||||
const value = params.row.media_type
|
const value = params.row.media_type;
|
||||||
return MEDIA_TYPES.find((type) => type.value === value)?.label || value
|
return (
|
||||||
|
MEDIA_TYPES.find((type) => type.value === value)?.label || value
|
||||||
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'actions',
|
field: "actions",
|
||||||
headerName: 'Действия',
|
headerName: "Действия",
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
display: 'flex',
|
display: "flex",
|
||||||
align: 'right',
|
align: "right",
|
||||||
headerAlign: 'center',
|
headerAlign: "center",
|
||||||
sortable: false,
|
sortable: false,
|
||||||
filterable: false,
|
filterable: false,
|
||||||
disableColumnMenu: true,
|
disableColumnMenu: true,
|
||||||
renderCell: function render({row}) {
|
renderCell: function render({ row }) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<EditButton hideText recordItemId={row.id} />
|
<EditButton hideText recordItemId={row.id} />
|
||||||
<ShowButton hideText recordItemId={row.id} />
|
<ShowButton hideText recordItemId={row.id} />
|
||||||
<DeleteButton hideText confirmTitle="Вы уверены?" recordItemId={row.id} />
|
<DeleteButton
|
||||||
|
hideText
|
||||||
|
confirmTitle="Вы уверены?"
|
||||||
|
recordItemId={row.id}
|
||||||
|
/>
|
||||||
</>
|
</>
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[],
|
[]
|
||||||
)
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<List>
|
<List>
|
||||||
<CustomDataGrid {...dataGridProps} columns={columns} localeText={localeText} getRowId={(row: any) => row.id} languageEnabled/>
|
<CustomDataGrid
|
||||||
|
{...dataGridProps}
|
||||||
|
columns={columns}
|
||||||
|
localeText={localeText}
|
||||||
|
getRowId={(row: any) => row.id}
|
||||||
|
languageEnabled
|
||||||
|
/>
|
||||||
</List>
|
</List>
|
||||||
)
|
);
|
||||||
});
|
});
|
||||||
|
@ -60,6 +60,7 @@ export const RouteList = observer(() => {
|
|||||||
minWidth: 150,
|
minWidth: 150,
|
||||||
display: "flex",
|
display: "flex",
|
||||||
align: "left",
|
align: "left",
|
||||||
|
flex: 1,
|
||||||
headerAlign: "left",
|
headerAlign: "left",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -68,6 +69,7 @@ export const RouteList = observer(() => {
|
|||||||
type: "string",
|
type: "string",
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
display: "flex",
|
display: "flex",
|
||||||
|
|
||||||
align: "left",
|
align: "left",
|
||||||
headerAlign: "left",
|
headerAlign: "left",
|
||||||
},
|
},
|
||||||
|
@ -782,21 +782,9 @@ export const SightEdit = observer(() => {
|
|||||||
bgcolor: "#806c59",
|
bgcolor: "#806c59",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Box
|
{leftArticleData?.media && (
|
||||||
sx={{
|
<MediaView media={leftArticleData.media} />
|
||||||
mb: 2,
|
)}
|
||||||
margin: "0 auto 40px auto",
|
|
||||||
display: "flex",
|
|
||||||
flexDirection: "column",
|
|
||||||
maxHeight: "300px",
|
|
||||||
|
|
||||||
gap: 2,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{leftArticleData?.media && (
|
|
||||||
<MediaView media={leftArticleData.media} />
|
|
||||||
)}
|
|
||||||
</Box>
|
|
||||||
|
|
||||||
{/* Заголовок статьи */}
|
{/* Заголовок статьи */}
|
||||||
<Typography
|
<Typography
|
||||||
@ -1093,7 +1081,8 @@ export const SightEdit = observer(() => {
|
|||||||
width: "30%",
|
width: "30%",
|
||||||
|
|
||||||
top: "178px",
|
top: "178px",
|
||||||
minHeight: "600px",
|
maxHeight: "600px",
|
||||||
|
overflowY: "auto",
|
||||||
right: 50,
|
right: 50,
|
||||||
zIndex: 1000,
|
zIndex: 1000,
|
||||||
borderRadius: 2,
|
borderRadius: 2,
|
||||||
@ -1246,14 +1235,56 @@ export const SightEdit = observer(() => {
|
|||||||
{creatingArticleHeading}
|
{creatingArticleHeading}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
||||||
<Typography
|
<Box
|
||||||
variant="body1"
|
sx={{
|
||||||
gutterBottom
|
mt: -6,
|
||||||
px={2}
|
p: 2,
|
||||||
sx={{ color: "text.primary" }}
|
"& img": {
|
||||||
|
maxWidth: "100%",
|
||||||
|
height: "auto",
|
||||||
|
borderRadius: 1,
|
||||||
|
},
|
||||||
|
"& h1, & h2, & h3, & h4, & h5, & h6": {
|
||||||
|
color: "primary.main",
|
||||||
|
mt: 2,
|
||||||
|
mb: 1,
|
||||||
|
},
|
||||||
|
"& p": {
|
||||||
|
mb: 2,
|
||||||
|
color: (theme) =>
|
||||||
|
theme.palette.mode === "dark"
|
||||||
|
? "grey.300"
|
||||||
|
: "grey.800",
|
||||||
|
},
|
||||||
|
"& a": {
|
||||||
|
color: "primary.main",
|
||||||
|
textDecoration: "none",
|
||||||
|
"&:hover": {
|
||||||
|
textDecoration: "underline",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"& blockquote": {
|
||||||
|
borderLeft: "4px solid",
|
||||||
|
borderColor: "primary.main",
|
||||||
|
pl: 2,
|
||||||
|
my: 2,
|
||||||
|
color: "text.secondary",
|
||||||
|
},
|
||||||
|
"& code": {
|
||||||
|
bgcolor: (theme) =>
|
||||||
|
theme.palette.mode === "dark"
|
||||||
|
? "grey.900"
|
||||||
|
: "grey.100",
|
||||||
|
p: 0.5,
|
||||||
|
borderRadius: 0.5,
|
||||||
|
color: "primary.main",
|
||||||
|
},
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{creatingArticleBody}
|
<ReactMarkdown rehypePlugins={[rehypeRaw]}>
|
||||||
</Typography>
|
{creatingArticleBody}
|
||||||
|
</ReactMarkdown>
|
||||||
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
<Box sx={{ mt: "auto" }}>
|
<Box sx={{ mt: "auto" }}>
|
||||||
|
Loading…
Reference in New Issue
Block a user