|
|
|
@ -5,23 +5,27 @@ import {
|
|
|
|
CANCELLED_COLOR,
|
|
|
|
CANCELLED_COLOR,
|
|
|
|
OTHER_POSTAMATES_COLOR,
|
|
|
|
OTHER_POSTAMATES_COLOR,
|
|
|
|
PENDING_COLOR,
|
|
|
|
PENDING_COLOR,
|
|
|
|
PVZ_COLOR,
|
|
|
|
|
|
|
|
} from "./Layers/layers-config";
|
|
|
|
} from "./Layers/layers-config";
|
|
|
|
import {Logo} from "../icons/Logo.jsx";
|
|
|
|
import {Logo} from "../icons/Logo.jsx";
|
|
|
|
|
|
|
|
import {usePostamatesAndPvzGroups} from "../api.js";
|
|
|
|
|
|
|
|
import {Collapse, Image} from "antd";
|
|
|
|
|
|
|
|
import React from "react";
|
|
|
|
|
|
|
|
|
|
|
|
const LegendPointItem = ({ color, name }) => {
|
|
|
|
const LegendPointItem = ({color, imageSrc, name}) => {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div className="flex gap-2 items-center">
|
|
|
|
<div className="flex gap-2 items-center">
|
|
|
|
{color ? (
|
|
|
|
{imageSrc && <Image src={imageSrc} width={12} height={12} preview={false}/>}
|
|
|
|
|
|
|
|
{color && !imageSrc && (
|
|
|
|
<span
|
|
|
|
<span
|
|
|
|
className="rounded-xl w-3 h-3 inline-block"
|
|
|
|
className="rounded-xl w-3 h-3 inline-block"
|
|
|
|
style={{backgroundColor: color}}
|
|
|
|
style={{backgroundColor: color}}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
) : (
|
|
|
|
)}
|
|
|
|
|
|
|
|
{!imageSrc && !color && (
|
|
|
|
<Logo width={12} height={12} fill="#E63941"/>
|
|
|
|
<Logo width={12} height={12} fill="#E63941"/>
|
|
|
|
)}
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
|
|
<span>{name}</span>
|
|
|
|
<span className='text-xs text-grey'>{name}</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
@ -46,11 +50,48 @@ const LegendColorRampItem = ({ colors, name }) => {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const LegendGroupItem = ({item}) => {
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
|
|
<Collapse
|
|
|
|
|
|
|
|
bordered={false}
|
|
|
|
|
|
|
|
expandIcon={null}
|
|
|
|
|
|
|
|
style={{
|
|
|
|
|
|
|
|
background: 'none',
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
className="legend_group"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<Collapse.Panel
|
|
|
|
|
|
|
|
key={"opened"}
|
|
|
|
|
|
|
|
header={<LegendPointItem name={item.name} imageSrc={item.image} color={OTHER_POSTAMATES_COLOR}/>}
|
|
|
|
|
|
|
|
showArrow={false}
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<div className="ml-3 my-1">
|
|
|
|
|
|
|
|
{item.groups && item.groups?.map((groupItem) => {
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
|
|
<div className="my-1">
|
|
|
|
|
|
|
|
<LegendPointItem
|
|
|
|
|
|
|
|
key={groupItem.id}
|
|
|
|
|
|
|
|
color={OTHER_POSTAMATES_COLOR}
|
|
|
|
|
|
|
|
imageSrc={groupItem.image}
|
|
|
|
|
|
|
|
name={groupItem.name}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
})}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</Collapse.Panel>
|
|
|
|
|
|
|
|
</Collapse>
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export function Legend() {
|
|
|
|
export function Legend() {
|
|
|
|
const {mode} = useMode();
|
|
|
|
const {mode} = useMode();
|
|
|
|
|
|
|
|
const {data: postamatesAndPvzGroups} = usePostamatesAndPvzGroups();
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div className="absolute bottom-[20px] left-[20px] text-xs text-grey z-10 bg-white-background rounded-xl p-3 space-y-3">
|
|
|
|
<div
|
|
|
|
|
|
|
|
className="absolute bottom-[20px] left-[20px] text-xs text-grey z-10 bg-white-background rounded-xl p-3 space-y-3">
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<div className="space-y-1">
|
|
|
|
<div className="space-y-1">
|
|
|
|
{mode === MODES.PENDING && (
|
|
|
|
{mode === MODES.PENDING && (
|
|
|
|
@ -88,11 +129,9 @@ export function Legend() {
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div className="space-y-1">
|
|
|
|
<div className="space-y-1">
|
|
|
|
<LegendPointItem name="ПВЗ" color={PVZ_COLOR} />
|
|
|
|
{postamatesAndPvzGroups && postamatesAndPvzGroups?.map((item) => {
|
|
|
|
<LegendPointItem
|
|
|
|
return <LegendGroupItem key={item.id} item={item}/>
|
|
|
|
name="Постаматы прочих сетей"
|
|
|
|
})}
|
|
|
|
color={OTHER_POSTAMATES_COLOR}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|