|
|
|
|
@ -4,17 +4,17 @@ import {
|
|
|
|
|
APPROVE_COLOR,
|
|
|
|
|
CANCELLED_COLOR,
|
|
|
|
|
OTHER_POSTAMATES_COLOR,
|
|
|
|
|
PENDING_COLOR,
|
|
|
|
|
PENDING_COLOR, PVZ_COLOR,
|
|
|
|
|
} from "./Layers/layers-config";
|
|
|
|
|
import {Logo} from "../icons/Logo.jsx";
|
|
|
|
|
import {usePostamatesAndPvzGroups} from "../api.js";
|
|
|
|
|
import {useOtherGroups, usePostamatesAndPvzGroups} from "../api.js";
|
|
|
|
|
import {Collapse, Image} from "antd";
|
|
|
|
|
import React from "react";
|
|
|
|
|
|
|
|
|
|
const LegendPointItem = ({color, imageSrc, name}) => {
|
|
|
|
|
return (
|
|
|
|
|
<div className="flex gap-2 items-center">
|
|
|
|
|
{imageSrc && <Image src={imageSrc} width={12} height={12} preview={false}/>}
|
|
|
|
|
{imageSrc && <Image src={imageSrc} width={12} height={12} className='flex items-center' preview={false}/>}
|
|
|
|
|
{color && !imageSrc && (
|
|
|
|
|
<span
|
|
|
|
|
className="rounded-xl w-3 h-3 inline-block"
|
|
|
|
|
@ -50,7 +50,7 @@ const LegendColorRampItem = ({colors, name}) => {
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const LegendGroupItem = ({item}) => {
|
|
|
|
|
const LegendGroupItem = ({item, color}) => {
|
|
|
|
|
return (
|
|
|
|
|
<Collapse
|
|
|
|
|
bordered={false}
|
|
|
|
|
@ -62,16 +62,14 @@ const LegendGroupItem = ({item}) => {
|
|
|
|
|
>
|
|
|
|
|
<Collapse.Panel
|
|
|
|
|
key={"opened"}
|
|
|
|
|
header={<LegendPointItem name={item.name} imageSrc={item.image} color={OTHER_POSTAMATES_COLOR}/>}
|
|
|
|
|
showArrow={false}
|
|
|
|
|
header={<LegendPointItem name={item.name} imageSrc={item.image} color={color}/>}
|
|
|
|
|
>
|
|
|
|
|
<div className="ml-3 my-1">
|
|
|
|
|
{item.groups && item.groups?.map((groupItem) => {
|
|
|
|
|
return (
|
|
|
|
|
<div className="my-1">
|
|
|
|
|
<div key={groupItem.id} className="my-1">
|
|
|
|
|
<LegendPointItem
|
|
|
|
|
key={groupItem.id}
|
|
|
|
|
color={OTHER_POSTAMATES_COLOR}
|
|
|
|
|
color={color}
|
|
|
|
|
imageSrc={groupItem.image}
|
|
|
|
|
name={groupItem.name}
|
|
|
|
|
/>
|
|
|
|
|
@ -88,6 +86,7 @@ const LegendGroupItem = ({item}) => {
|
|
|
|
|
export function Legend() {
|
|
|
|
|
const {mode} = useMode();
|
|
|
|
|
const {data: postamatesAndPvzGroups} = usePostamatesAndPvzGroups();
|
|
|
|
|
const {data: otherGroups} = useOtherGroups();
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div
|
|
|
|
|
@ -130,7 +129,12 @@ export function Legend() {
|
|
|
|
|
|
|
|
|
|
<div className="space-y-1">
|
|
|
|
|
{postamatesAndPvzGroups && postamatesAndPvzGroups?.map((item) => {
|
|
|
|
|
return <LegendGroupItem key={item.id} item={item}/>
|
|
|
|
|
return <LegendGroupItem key={item.id} item={item} color={PVZ_COLOR}/>
|
|
|
|
|
})}
|
|
|
|
|
</div>
|
|
|
|
|
<div className="space-y-1">
|
|
|
|
|
{otherGroups && otherGroups?.map((item) => {
|
|
|
|
|
return <LegendGroupItem key={item.id} item={item} color={OTHER_POSTAMATES_COLOR}/>
|
|
|
|
|
})}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|