Refactor initial table

dev
Platon Yasev 3 years ago
parent cc8959c835
commit fd65bd7d88

@ -3,6 +3,7 @@ import { Table } from "../Table";
import { usePointSelection } from "../../../stores/usePointSelection";
import { useClickedPointConfig } from "../../../stores/useClickedPointConfig";
import { useInitialTableData } from "./useInitialTableData";
import { columns } from "./columns";
export const InitialTable = () => {
const { selection, include, exclude } = usePointSelection();
@ -52,6 +53,7 @@ export const InitialTable = () => {
page={page}
pageSize={pageSize}
isClickedPointLoading={isClickedPointLoading}
columns={columns}
/>
);
};

@ -0,0 +1,57 @@
export const columns = [
{
title: "Id",
dataIndex: "location_id",
key: "location_id",
width: 50,
ellipsis: true,
},
{
title: "Адрес",
dataIndex: "address",
key: "address",
width: 200,
},
{
title: "Район",
dataIndex: "rayon",
key: "rayon",
width: "120px",
ellipsis: true,
},
{
title: "Округ",
dataIndex: "okrug",
key: "okrug",
width: "120px",
ellipsis: true,
},
{
title: "Название",
dataIndex: "name",
key: "name",
width: "120px",
ellipsis: true,
},
{
title: "Категория",
dataIndex: "category",
key: "category",
width: "120px",
ellipsis: true,
},
{
title: "Статус",
dataIndex: "status",
key: "status",
width: "120px",
ellipsis: true,
},
{
title: "Прогнозный трафик",
dataIndex: "prediction_current",
key: "prediction_current",
width: "120px",
ellipsis: true,
},
];

@ -6,64 +6,6 @@ import { useMap } from "react-map-gl";
import { useClickedPointConfig } from "../../stores/useClickedPointConfig";
import scrollIntoView from "scroll-into-view-if-needed";
const columns = [
{
title: "Id",
dataIndex: "location_id",
key: "location_id",
width: 50,
ellipsis: true,
},
{
title: "Адрес",
dataIndex: "address",
key: "address",
width: 200,
},
{
title: "Район",
dataIndex: "rayon",
key: "rayon",
width: "120px",
ellipsis: true,
},
{
title: "Округ",
dataIndex: "okrug",
key: "okrug",
width: "120px",
ellipsis: true,
},
{
title: "Название",
dataIndex: "name",
key: "name",
width: "120px",
ellipsis: true,
},
{
title: "Категория",
dataIndex: "category",
key: "category",
width: "120px",
ellipsis: true,
},
{
title: "Статус",
dataIndex: "status",
key: "status",
width: "120px",
ellipsis: true,
},
{
title: "Прогнозный трафик",
dataIndex: "prediction_current",
key: "prediction_current",
width: "120px",
ellipsis: true,
},
];
export const Table = React.memo(
({
height = 200,
@ -73,6 +15,7 @@ export const Table = React.memo(
isClickedPointLoading,
page,
onPageChange,
columns,
}) => {
const { clickedPointConfig } = useClickedPointConfig();
const { map } = useMap();

Loading…
Cancel
Save